PDA

View Full Version : How to get items dropped in the inventory to populate weapon list



leozelig
July 17th, 2015, 12:31
I have noticed that several rulesets create a weapon list entry (on the combat/actions tab) when a weapon is dropped into the inventory. I am trying to set this up for my DCCRPG ruleset, but I am having trouble understanding how the code is set up.

I modified the Character Manager for the specific weapon data I am using. What else needs to be set up? I looked at scripts/manager_item and scripts/manager_campaigndata, but it is not clear to me what makes this work.

I have mostly referenced 3.5E for help, but it seems that this feature is similar among the various rulesets. I can post my code, but I am looking for more of a general explanation of what functions make this work and where they live.

Thanks!

Moon Wizard
July 17th, 2015, 19:06
There's a CharManager.addWeaponToDB function used in the 3.5E ruleset. That function accepts a character item DB node that was just added and creates one or more weapon entries.

Take a look at where that is called.

Regards,
JPG

leozelig
July 17th, 2015, 22:33
Ok, thanks again MW...

leozelig
July 18th, 2015, 02:43
Kind of an easy solution...

I had to call the addToWeaponDB function in the onCharItemAdd function (both CharManager). I had a feeling it was something basic like that...


function onCharItemAdd(nodeItem)
DB.setValue(nodeItem, "carried", "number", 1);
addToWeaponDB(nodeItem);
end