Token vanishing

Post » Fri Oct 08, 2010 3:24 pm

I'm adding a token to dead actors to sort the actors out I don't need for my purposes. Adding the tokens works fine, I tested with printtoconsole. But sometimes the tokens seem to vanish for no reason or the condition that checks for the tokens doesn't trigger for some reason.

First I cast a script effect spell from an activator, it has a huge area, requires no LOS and the script effect always applies:

begin scripteffectstartif getdead == 1  if isactor == 1    if getitemcount PTDeathToken == 0    additem PTDeathToken 1    printtoconsole "Token added" ; added this line for testing and 'Token added' is printed exactly as often as it should be (amount of dead people in cell without token)    endif  endifendifend


That works well, the tokens are added. Five frames after I cast another spell that consists of a powerful area fire damage effect, a scripted effect that pushes actors away that get hit by the spell and a scripted effect that checks for the tokens. The spell requires LOS, has the same area settings as the fire damage effect and the script effect always applies:

begin scripteffectstartif getitemcount PTDeathToken == 0  if getdead == 1    if isactor == 1      if getiscreature == 1      modpcmiscstat 5 1      additem PTDeathToken 1      else      modpcmiscstat 6 1      additem PTDeathToken 1      endif    endif  endifendif


And that script causes problems. The first time dead people are hit by this spell everything works fine. If they have a token nothing happens, if they don't have a token they get one and the misc stat is modified. But when the spell hits them again afterwards they sometimes get another token and the misc stat is also altered again. The weird thing is that it only seems to happen sometimes. But it shouldn't happen at all or not? I can clearly see that the tokens are added so if they get hit by the spell getitemcount == 0 should make it impossible for the script to run. I tried with getitemcount < 1, I tried to use getself and a lot of other stupid things. The first script doesn't have this problem by the way although the conditions are almost exactly the same.

I would appreciate any help.

EDIT: If anyone has a better idea how to check whether the fire damage effect that is part of the spell caused an actor's death I'd like to hear it.
User avatar
m Gardner
 
Posts: 3510
Joined: Sun Jun 03, 2007 8:08 pm

Post » Fri Oct 08, 2010 2:26 pm

I don't know if it will help or not, but maybe try...
1. Switching GetDead and IsActor around
2. Add the IsCreature == 0 for the second part
3. Try switching them around if it doesn't work

They're things which shouldn't affect anything, but just the other day I had a bizzare issue with this piece of code:

If ( Target.GetAV Health >= 10 ); Would never come upElseIf ( Target.GetAV Health < 10 ); Came up every timeEndIf


Which was resolved just by switching them around... No idea WHY that would affect anything, since it shouldn't, but it worked perfectly afterward... So maybe something similar will help you?
User avatar
LADONA
 
Posts: 3290
Joined: Wed Aug 15, 2007 3:52 am

Post » Fri Oct 08, 2010 1:10 am

Weird, but it seems to work after reordering the conditions. Thanks!
User avatar
Alyce Argabright
 
Posts: 3403
Joined: Mon Aug 20, 2007 8:11 pm


Return to IV - Oblivion