Page 1 of 1
Event on Carrying?
Posted: Thu Dec 08, 2016 10:34 pm
by Knight Captain
Is there a similar Usecode event for when you pick something up and add it to the party's inventory? Similar to the equip/unequip for some items?
Re: Event on Carrying?
Posted: Sat Dec 10, 2016 10:56 am
by Knight Captain
Event == 0x0008 is POLYMORPHED but it's not clear how/when that is triggered.
Re: Event on Carrying?
Posted: Sat Dec 10, 2016 4:13 pm
by marzo
There is no 'on carrying' event, no. The polymorphed event is actually not used by Exult: the original SI did not save polymorph shapes on the save game, but only the polymorph flag, and executed the NPC's usecode with this event when the game was loaded to set the polymorph shape back. Exult just saves the polymorph shape instead.
Re: Event on Carrying?
Posted: Sat Dec 10, 2016 4:37 pm
by marzo
Just something else: the polymorph event also wasn't known about for a long time after Exult had implemented it the way I described. It was only when I dumped all usecode with ucxt and went looking for unimplemented stuff which made me find this, and no one thought it was a good idea to replicate the original's behavior.
Re: Event on Carrying?
Posted: Sun Dec 11, 2016 2:49 pm
by Knight Captain
That would seem to explain why de-polymorphing on death doesn't work.
Re: Event on Carrying?
Posted: Sun Dec 11, 2016 4:52 pm
by marzo
No, it does not.
What does explain that is the completely stupid way that SI implemented polymorph: when an NPC is polymorphed, SI would overwrite the shape data in memory to that of the target shape; when you polymorph back it reloads the original shape data. Thus keeps the shape number, so when loooking for body shape (which was hard-coded in stock), it finds the stock body.
The downsides of this is that (1) the game needed to overwrite shape data when loading the save (thus the polymorph event hack) and (2) every single NPC that used the original shape is also effectively polymorphed.
You can test these by: (1) polymorph an NPC that does not have code for a polymorph event, saving and reloading, to see him revert back to original shape; (2) polymorph an NPC that does have a polymorph event, but polymorph him into a shape which is not used in said polymorph event, then save and reload; (3) polymorph (say) a pikeman and see that every other pikemen will also change shape.
All told, the way Exult handles this is superior in every way, except that it does not currently handle reverting back to the original body shape on death (but this is easily fixed, except I never heard of this until now).
Re: Event on Carrying?
Posted: Sun Dec 11, 2016 5:01 pm
by Knight Captain
It would be easy to test a fix. Start a new game and teleport to the Order Shrine antechamber.
The mod I'm working on sets the shape on the NPC and resets it via per-NPC Usecode but I haven't tested it in a while.
Re: Event on Carrying?
Posted: Sun Dec 11, 2016 5:13 pm
by Knight Captain
The reason I asked the original question was to see if I could create Usecode that would place all money in a specific money bag, perhaps similar to the keyring. It would also be handy for Serpent Teeth and reagents, and perhaps even spell scrolls, potions, etc. Work around the poor item management in other words.
Re: Event on Carrying?
Posted: Sun Dec 11, 2016 5:37 pm
by marzo
The keyring is actually hard-coded; which is why I added the option of using it on the avatar to add all keys to it in BG Keyring.
Re: Event on Carrying?
Posted: Sun Dec 11, 2016 5:59 pm
by Knight Captain
Hmm, an event == DOUBLECLICK on each money type might work.