HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Why Does This Trigger Overlap Between 10 Players Sometimes?

03-05-2007, 03:41 PM#1
Brash
I have a simple trigger that is used to start a timer with an array size of 10.. (one for each player) for the player that triggers the event of a unit dying and then i have 10 other triggers that are waiting for those timer to finish.

but for some reason they overlap sometimes and another players timer will go off for a different player.. it doesn't happen often.. just once in a while and i dont quite grasp why it isn't solid like i had hoped it would be..

the trigger is simply:
Trigger:
Collapse Events
Unit - A unit Dies
Collapse Conditions
(Owner of (dying unit)) equal to Player 12 (enemy)
Collapse Actions
Set PNumber = (Player number of (Owner of (Killing unit)))
Set Counter[PNumber] = (Counter[PNumber] + 1)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Counter[PNumber] Greater than 0
Collapse Then - Actions
Countdown Timer - Start CTimer[PNumber] as a One-shot timer that will expire in 1.70 seconds
Collapse Else - Actions
Do nothing

Then I have 10 more triggers that are waiting on the event of
Trigger:
Events
Time - CTimer[1] expires
Trigger:
Events
Time - CTimer[2] expires

ect.. all the way til i have 10 of those.. and each will do stuff based on that Counter[] variable and display some text.. anyhow

so when i'm hosting the game it works almost all the time perfectly.. but once in a while someone will kill a unit or several units and then when the timer finally is allowed to expire after no kills have been made within the 1.70 sec time frame.. it will once in a while make a different timer expire as though it were giving credit to the wrong player.

i've tested this a LOT as i host my map a lot. but once in a while I (as host in the player 1 slot) have been given credit for the kills that other players have made.

so lets say player yellow kills a bunch of units player 1 red might be the one to have his timer go off.. i've noticed it mostly with purple and yellow but i think it does happen with other colors.. as if that should matter but it is something i have noticed.

i dont understand.. it's so simple and yet it screws up.

i have no wait states so how is this possible
this map does have a lot of killing going on and lots of unit generation.
03-05-2007, 06:01 PM#2
grim001
This would happen if a unit dies, but there is no "killing unit." "Owner of killing unit" would automatically return 0 (player 1).

Some deaths may not be registered as having a killing unit. So try making the whole trigger within a conditional:

If (Killing unit) not equal to null then...

this may not actually work because I'm not sure if the killing unit is stored in a global which would just contain the last killing unit even if it's not part of the current event, but it's worth a shot
03-05-2007, 06:22 PM#3
Brash
Quote:
Originally Posted by grim001
This would happen if a unit dies, but there is no "killing unit." "Owner of killing unit" would automatically return 0 (player 1).

how can there be no killing unit? the killing unit event is always associated with dying unit because there is no real event call of "a unit kills a unit"

Quote:
Originally Posted by grim001
Some deaths may not be registered as having a killing unit. So try making the whole trigger within a conditional:

If (Killing unit) not equal to null then...

if i did that wouldn't it miss some kills then? it must not miss one because then i'd be fixing it so that it assigns the correct player 100% but it would then sometimes not give any credit for a unit dying and players might not like not getting credit for their efforts still..

Quote:
Originally Posted by grim001
this may not actually work because I'm not sure if the killing unit is stored in a global which would just contain the last killing unit even if it's not part of the current event, but it's worth a shot

well, there is no wait states... i dont see how there can be a problem with it not responding every shot spot on.

Oh yeah, if it helps. there has been times when.. as player 1 (red) i would purposely stop killing anything and walk my hero away from all enemies and just let all the other players to play just to see if it still awards me credit and it sometimes very rarely did.. even when i hadn't killed anything for several minutes... and it's not every match either. i have tried to get it to repeat when i want it to and it seems to be random and rare.. but it does happen.
03-05-2007, 06:57 PM#4
ixmike88
If two of brown's units die within a very short period of time the global variable 'PNumber' may be overwritten in the middle of a trigger. If you're sticking to GUI you could probably use an array to solve this problem.
03-05-2007, 10:20 PM#5
Ammorth
Quote:
Originally Posted by ixmike88
If two of brown's units die within a very short period of time the global variable 'PNumber' may be overwritten in the middle of a trigger. If you're sticking to GUI you could probably use an array to solve this problem.

No, that is not the case. The trigger will run through all of it's actions first before another trigger can run (only 1 action is processed at a time, ever). Even if you have 10 triggers with the same event, each trigger will be processed in order (not sure on the order, but any global variables used between them will not be overwritten) (unless of course, you have a wait).
03-06-2007, 12:08 AM#6
grim001
Quote:
Originally Posted by Brash
how can there be no killing unit? the killing unit event is always associated with dying unit because there is no real event call of "a unit kills a unit"
Some things just "die" and don't get registered as having any killing unit, blame blizzard, it depends on the specific method of death. Certain skills may not award credit properly, and then there's the possibility of any kill that wasn't directly caused by an ability or attack.


Quote:
Originally Posted by Brash
if i did that wouldn't it miss some kills then? it must not miss one because then i'd be fixing it so that it assigns the correct player 100% but it would then sometimes not give any credit for a unit dying and players might not like not getting credit for their efforts still..
It would miss the kills for which there is no killing player. If you want to get around that problem you'd have to trigger all of the offending abilities.

Quote:
Originally Posted by Brash
well, there is no wait states... i dont see how there can be a problem with it not responding every shot spot on.
It's not a wait thing, it's just that if there was no killing unit it might still contain the killing unit from the previous execution of the trigger. I am not 100% sure if that happens though.

Quote:
Originally Posted by Brash
to see if it still awards me credit and it sometimes very rarely did.. even when i hadn't killed anything for several minutes... and it's not every match either. i have tried to get it to repeat when i want it to and it seems to be random and rare.. but it does happen.
Yes, it is probably not that common that something would die without having a killing unit
03-06-2007, 12:16 PM#7
Brash
would it work all the time if i seperated that first trigger into 10 seperate? one for player 1.. player 2.. ect?

or is there a way to guarantee registering the killing unit?