I'm currently using objsetdata and objgetdata with name mangling as a substitute and that does work, which demonstrates that the statements are being executed.
Code: Select all
(setq WE_fireUnlauncher (lambda nil (block (ammolist launcher shot speed munition lastMunition fireCount maxCount) (setq maxCount (typGetStaticData (itmGetUnid gItem) 'TotalShots)) (if (not maxCount) (setq maxCount 1)) (setq fireCount (itmGetData gItem "fireCount")) (setq ammolist (itmGetData gItem "ammolist")) (setq launcher (typGetStaticData (itmGetUnid gItem) 'VirtualLauncher)) (setq lastMunition (objGetitemData gSource gItem "lastMunition")) (if (or (not fireCount) (gr fireCount maxCount)) (setq fireCount 1) ) ; determine ammo type (if (eq 1 fireCount) (enum ammolist ammo (if (not munition) (if (objHasItem gSource (itmCreate ammo 1)) (setq munition ammo) ) ) ) (setq munition lastMunition) ) (if munition (block nil (setq speed (typGetDataField munition "speed")) (if (if (eq 1 fireCount) (objRemoveItem gSource (itmCreate munition 1)) True) (block nil (setq shot (sysCreateWeaponFire munition gSource aFirePos aFireAngle speed aTargetObj nil aWeaponBonus)) (objIncVel shot (objGetVel gSource)) ) ) ) ;; else don't fire! ) (objsetitemData gSource gItem "fireCount" (add 1 fireCount)) (objsetitemData gSource gItem "lastMunition" munition) true ) ))
The only thing I can think of to explain this is that objsetitemdata silently fails if more than two keys are placed on an item. Whyever this is failing it is doing so silently. This is bad.
I don't have the time to set up a better test case right now since I'm in the middle of a rats nest of interlocking bugs.