Two mistakes in t4modules: Inventory and Equipment Dialogs

If you have a module that you'd like comments on or would like to know how to create your very own module, post here

Moderator: Moderator

Post Reply
Message
Author
galaxys
Posts: 4
Joined: Sat May 19, 2012 3:30 pm

Two mistakes in t4modules: Inventory and Equipment Dialogs

#1 Post by galaxys »

Hope I didn't make it wrong, and you can understand my poor English...

1st: after creating the objects class, you should modify your Game class's "loaded" method to make it load the object class, like this:
Zone:setup{npc_class="mod.class.NPC", grid_class="mod.class.Grid", object_class="mod.class.object",}
If you don't, you will encount an error when clicking on an item in your inventory:
attempt to call function "canUseObject", which is a nil value.

2nd: the "use" functions of consumable items should return a table which contains an element "used", and set it to true. Or the item power will not be consumed, you can use it every turn.
Modify the "use" functions like this:
return {true, used=true}

So... be it an error or not, my mod runs as expected now. If I'm just making a bigger mistake instead of a smaller one, please tell me...

Post Reply