I was using the inventory and character stats system made by Remix >> viewtopic.php?f=51&t=47911
and tried to put the character's stats and inventory in some screens.
I made some characters and put them into a list.
Code: Select all
define character.mc_inv = Character("Andreia")
define character.erkan_inv = Character("Erkan")
default mc_inv = CharacterStats('mc_inv', weapon = "", head = "", body = "", boots = "", ATK=0, DEF=0, STR=85, AGI=65, max_HP=100, max_MP=70, bag=Inventory(needle=2,pair_of_scissors=1))
default erkan_inv = CharacterStats('erkan_inv', weapon = "", head = "", body = "", boots = "", ATK=0, DEF=0, STR=105, AGI=90, max_HP=120, max_MP=80, bag=Inventory())
Code: Select all
$ character_list = []
$ character_list.append(mc_inv)
$ character_list.append(erkan_inv)
$ mc_inv.HP = mc_inv.max_HP
$ mc_inv.MP = mc_inv.max_MP
$ erkan_inv.HP = erkan_inv.max_HP
$ erkan_inv.MP = erkan_inv.max_MP
I put a screen with inventory buttons per character.
Code: Select all
screen inventory_button:
$ y = 0.2
for chara in character_list:
textbutton "[chara.name]":
xalign 0.5
yalign y
action [Show("test_show"), SetVariable("now_chara", chara), Hide("inventory_button")]
$ y +=0.05
Code: Select all
screen test_show:
modal True
text "Close your inventory {p}before saving.":
xalign 0.85
yalign 0.3
# i initially thought the error in saving was because i didn't close inventory before saving, that's why i put the text above.
# now i'm not so sure what causes the error.
textbutton "Close inventory":
xalign 0.9
yalign 0.4
action [Hide("test_show"), Hide("item_interact"), Show("inventory_button"), Return()]
$ test_y = 0.25
$ test_x = 0.05
$ their_bag = now_chara.bag
text "{b}[now_chara.name].{/b}":
xanchor 0.0 xpos 0.05 yanchor 0.0 ypos 0.05
text "Money = [now_chara.money]. HP = [now_chara.HP] / [now_chara.max_HP] . MP = [now_chara.MP] / [now_chara.max_MP]. Affection = [now_chara.affection]":
xanchor 0.0 xpos 0.05 yanchor 0.0 ypos 0.1
text "STR = [now_chara.STR]. ATK = [now_chara.ATK]. Weapon : [now_chara.weapon].":
xanchor 0.0 xpos 0.05 yanchor 0.0 ypos 0.15
text "AGI = [now_chara.AGI]. DEF = [now_chara.DEF]. Armor : (Head : [now_chara.head] / Body : [now_chara.body] / Boots : [now_chara.boots].)":
xanchor 0.0 xpos 0.05 yanchor 0.0 ypos 0.2
for item in their_bag.items:
text "[item.title] : [item.amount]":
xanchor 0 yanchor 0 xpos test_x ypos test_y
if now_chara.weapon and (now_chara.weapon==item.title): #indicate the selected weapon
text "Equipped":
xpos 0.35 ypos test_y
textbutton "Info":
xpos 0.5
ypos test_y
action [SetVariable("selected_item", item), Function(renpy.call, label="interact_inventory")]
$ test_y +=0.05
Code: Select all
label interact_inventory:
$ renpy.retain_after_load()
call screen item_interact
return
Code: Select all
screen item_interact:
#modal True
text "[selected_item.title]":
xpos 0.4 ypos 0.6
text "[selected_item.description]":
xpos 0.4 ypos 0.65
if selected_item.ATK >0 and selected_item.amount >0:
if now_chara.weapon == selected_item.title:
textbutton "Unequip":
xpos 0.8
ypos 0.8
action[UnequipItem(selected_item)]
else:
textbutton "Equip":
xpos 0.8
ypos 0.8
action[EquipItem(selected_item)]
elif selected_item.amount >0:
textbutton "Use":
xpos 0.8
ypos 0.8
action[WeUse(selected_item)]
textbutton "Hide info":
xpos 0.6
ypos 0.8
action [Hide("item_interact")]
Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "renpy/common/00action_file.rpy", line 331, in __call__
renpy.load(fn)
TypeError: ('__init__() takes exactly 4 arguments (1 given)', <class 'renpy.game.CallException'>, ())
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "renpy/common/_layout/screen_main_menu.rpym", line 29, in script
$ ui.interact()
File "C:\Users\User\Documents\ART_SL\renpy-6.99.4-sdk\renpy\ast.py", line 785, in execute
renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
File "C:\Users\User\Documents\ART_SL\renpy-6.99.4-sdk\renpy\python.py", line 1448, in py_exec_bytecode
exec bytecode in globals, locals
File "renpy/common/_layout/screen_main_menu.rpym", line 29, in <module>
$ ui.interact()
File "C:\Users\User\Documents\ART_SL\renpy-6.99.4-sdk\renpy\ui.py", line 277, in interact
rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
File "C:\Users\User\Documents\ART_SL\renpy-6.99.4-sdk\renpy\display\core.py", line 2276, in interact
repeat, rv = self.interact_core(preloads=preloads, **kwargs)
File "C:\Users\User\Documents\ART_SL\renpy-6.99.4-sdk\renpy\display\core.py", line 2907, in interact_core
rv = root_widget.event(ev, x, y, 0)
File "C:\Users\User\Documents\ART_SL\renpy-6.99.4-sdk\renpy\display\layout.py", line 877, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "C:\Users\User\Documents\ART_SL\renpy-6.99.4-sdk\renpy\display\layout.py", line 877, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "C:\Users\User\Documents\ART_SL\renpy-6.99.4-sdk\renpy\display\layout.py", line 877, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "C:\Users\User\Documents\ART_SL\renpy-6.99.4-sdk\renpy\display\screen.py", line 625, in event
rv = self.child.event(ev, x, y, st)
File "C:\Users\User\Documents\ART_SL\renpy-6.99.4-sdk\renpy\display\layout.py", line 877, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "C:\Users\User\Documents\ART_SL\renpy-6.99.4-sdk\renpy\display\layout.py", line 188, in event
rv = d.event(ev, x - xo, y - yo, st)
File "C:\Users\User\Documents\ART_SL\renpy-6.99.4-sdk\renpy\display\layout.py", line 877, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "C:\Users\User\Documents\ART_SL\renpy-6.99.4-sdk\renpy\display\layout.py", line 188, in event
rv = d.event(ev, x - xo, y - yo, st)
File "C:\Users\User\Documents\ART_SL\renpy-6.99.4-sdk\renpy\display\behavior.py", line 785, in event
return handle_click(self.clicked)
File "C:\Users\User\Documents\ART_SL\renpy-6.99.4-sdk\renpy\display\behavior.py", line 728, in handle_click
rv = run(action)
File "C:\Users\User\Documents\ART_SL\renpy-6.99.4-sdk\renpy\display\behavior.py", line 290, in run
return var(*args, **kwargs)
File "renpy/common/00action_file.rpy", line 331, in __call__
renpy.load(fn)
File "C:\Users\User\Documents\ART_SL\renpy-6.99.4-sdk\renpy\loadsave.py", line 579, in load
roots, log = loads(location.load(filename))
File "C:\Users\User\Documents\ART_SL\renpy-6.99.4-sdk\renpy\loadsave.py", line 49, in loads
return cPickle.loads(s)
TypeError: ('__init__() takes exactly 4 arguments (1 given)', <class 'renpy.game.CallException'>, ())
Windows-8-6.2.9200
Ren'Py 6.99.4.467
trial of stats & invent 0.0
I attach the whole renpy game folder with the scripts and all below.
I thought of posting a reply on Remix's original thread but I'm afraid I have altered it too much, so I made a new ask. Anyway, I don't claim ownership to the original inventory and stats system...
Thank you in advance!