Something odd about additem and getitemcount...

Post » Thu Jun 21, 2012 3:36 am

Just something odd I found.

If I put this is an on animation event (for attack) or for On spell cast on an actor:

attacker.additem(aadpShoutToken, 1)
debug.messagebox(attacker + " Tokens = " + attacker.getitemcount(aadpShoutToken))


It returns 1 as it should.


But if I put this in an onhit event on the actor that gets hit by the above actor (happens 1 second AFTER the above) I get ZERO return:

actor attacker = akAggressor as actor
debug.messagebox(attacker + " Tokens = " + attacker.getitemcount(aadpShoutToken))


Now this is with a token (armor with no slots and checked as not playable) but it still makes no sense why the first would return 1 if such "tokens" were not detectable.
User avatar
Francesca
 
Posts: 3485
Joined: Thu Jun 22, 2006 5:26 pm

Post » Wed Jun 20, 2012 9:29 pm

Are these both part of the same script? If not, did you remember to set the value of aadpShoutToken in the script with the OnHit event?
User avatar
lauren cleaves
 
Posts: 3307
Joined: Tue Aug 15, 2006 8:35 am

Post » Thu Jun 21, 2012 12:32 pm

Are these both part of the same script? If not, did you remember to set the value of aadpShoutToken in the script with the OnHit event?

No, it is a magic effect script on the attacker and a different magic effect script on the one getting hit. Properties value set and check numerous times.
I get "no such item" error using:

getitemcount aadpShoutToken

in the console but I think that is a separate issue.

I switched over to a Faction called aadpShoutFaction (rather than a token ) and the same dam thing is happening. :wallbash:
User avatar
vicki kitterman
 
Posts: 3494
Joined: Mon Aug 07, 2006 11:58 am

Post » Thu Jun 21, 2012 1:51 am

never mind see next post...
User avatar
WYatt REed
 
Posts: 3409
Joined: Mon Jun 18, 2007 3:06 pm

Post » Thu Jun 21, 2012 8:17 am

never mind, it was some kind of dirty save with my test game.

I started up with a fresh savegame from my back ups and it worked as intended now. This game is very picky about the save game, we really need a savegame editor....
User avatar
Hairul Hafis
 
Posts: 3516
Joined: Mon Oct 29, 2007 12:22 am

Post » Wed Jun 20, 2012 8:59 pm

Close requested as problem was solved.
User avatar
Travis
 
Posts: 3456
Joined: Wed Oct 24, 2007 1:57 am


Return to V - Skyrim