While testing my map I found a really annyoing bug. There are 4 Artefacts in the middle of the map. At the beginning 8 Players try to get one of the 4 Artefacts to gain their power. Now my Problem: If there is more than only one player in the near of the artefact at the same time the Artefact will give more than just one player the power. I tried many things now but I dont get it worked like I want. T_T
I already tried to solve it like you see in the code. But i never saw a protoss explosion !? Maybe the Convert Circle to Region function dont works?
Do you guys have some ideas for a solution?
I also already tried to split them into 4 Triggers and turn the trigger off at the beginning and turn then on at the end of the trigger. This also didnt work! :'(
"If there is more than only one player in the near of the artefact at the same time the Artefact will give more than just one player the power."
with this I assume the problem is that you dont have proper conditions to prevent it from giving "power" to players who shouldnt get it". I suppose you could just use some variable like when the trigger runs "If power = 0, set power = triggering player, else do nothing"
The problem here is that the trigger is started multiple times at the same time. So if you set a Variable in this trigger it is already too late because it has already been started for everyone in the near. This only would work if the trigger would be started only one time.
Its not as easy as you think! Maybe its not as difficult as I think xD
The first time the trigger is run, check the value of some global Boolean variable initialized to False. If the value is True, Skip Remaining Actions immediately. If the value is False, run the trigger and set that Boolean variable's value to True *before* running any Wait() call whatsoever.
This works because Galaxy's execution is serialized, a trigger will complete or reach a Wait() call before another trigger is allowed to run ( otherwise, we would need atomic operations in a multi-threading environment, Galaxy isn't there yet :p ).
Mhh i still dont got it..
Maybe i didnt understand it right :/ Here is what i got now:
I split them into 4 Triggers now
EnterArtefakt1EventsUnit-AnyUnitEntersadistanceof1.5fromArtifactFragment-5[49.48,46.62]
Local Variables
Artefakt = 0 <Integer>
Conditions
(Number of Living units in (Magician units in (Entire map) owned by player (Triggering player) matching Excluded: Missile, Dead, Hidden, with at most Any Amount)) == 0
(Number of Living units in (Tassadar units in (Entire map) owned by player (Triggering player) matching Excluded: Missile, Dead, Hidden, with at most Any Amount)) == 0
((Triggering unit) has Explosion Active) == False
(Unit type of (Triggering unit)) == Inquisitive
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
EnterArtefaktBoolean[1] == True
Then
General - Skip remaining actions
Else
Variable - Set EnterArtefaktBoolean[1] = True
UI - Display (Text((Number of times (Current trigger) has been executed))) for (All players) to Chat area
Variable - Set Artefakt = 1
Unit - Move Artefakt[Artefakt] instantly to (Center of PunkteAway) (No Blend)
Unit - Replace (Triggering unit) with a Magician using Old Unit's Relative vitals
Actor - Attach ItemGravityBombsImpactDeath (Unnamed) to Head on (Last created unit)
Unit Group - Add (Last replaced unit) to AlivePlayers
Unit Selection - Select (Last replaced unit) for player (Triggering player)
Variable - Set ArtefaktPlayer[(Triggeringplayer)] = Artefakt[Artefakt]
Variable - Set ArtefaktPosition[(Triggeringplayer)] = (Position of Artefakt[Artefakt])
Variable - Set EnterArtefaktBoolean[1] = False
There are still up to 7 Units with the power..
EDIT : HAH I GOT IT :D
My last line was fail and i changed the "indexes" of the "EnterArtefaktBoolean" matching the right event. Now i have only 4 Units with the power. Thanks to all helping me
Your trigger seems unreliable to me... There are much simpler ways to do this.
Adding 4 times the same event won't do it 4 times. It will just execute the actions everytime ANY of the action is happening, which in your case is 4 times the same.
A good way would be to turn the trigger off at the beginning, then turn it back on at the end when all the actions are done. However it will force a wait for all actions to finish before allowing another unit to get the artefact power... You'd rather check for "trigger execution count <4" (0 counts as the first execution, so <4 means it was launched less than 5 times) in the conditions of your trigger.
Just in my case my explanations are not clear:
EnterArtefakt1EventsUnit-AnyUnitEntersadistanceof1.5fromArtifactFragment-5[49.48,46.62]
Local Variables
Artefakt = 0 <Integer>
Conditions
AND
(Number of times (Current trigger) has been executed <4)(NumberofLivingunitsin(Magicianunitsin(Entiremap)ownedbyplayer(Triggeringplayer)matchingExcluded:Missile,Dead,Hidden,withatmostAnyAmount))==0(NumberofLivingunitsin(Tassadarunitsin(Entiremap)ownedbyplayer(Triggeringplayer)matchingExcluded:Missile,Dead,Hidden,withatmostAnyAmount))==0((Triggeringunit)hasExplosionActive)==False(Unittypeof(Triggeringunit))==InquisitiveActionsUI-Display(Text((Numberoftimes(Currenttrigger)hasbeenexecuted)))for(Allplayers)toChatareaVariable-SetArtefakt =1Unit-MoveArtefakt[Artefakt]instantlyto(CenterofPunkteAway)(NoBlend)Unit-Replace(Triggeringunit)withaMagicianusingOldUnit'sRelativevitalsActor-AttachItemGravityBombsImpactDeath(Unnamed)toHeadon(Lastcreatedunit)UnitGroup-Add(Lastreplacedunit)toAlivePlayersUnitSelection-Select(Lastreplacedunit)forplayer(Triggeringplayer)Variable-SetArtefaktPlayer[(Triggeringplayer)] =Artefakt[Artefakt]Variable-SetArtefaktPosition[(Triggeringplayer)] =(PositionofArtefakt[Artefakt])
The AND condition I added was not necessary but I personally like it better that way, you don't have to ask yourself anymore if the conditions of a trigger checks for all of them or each one separately: you're sure it checks all. What's pretty useful with the "trigger execution count" condition is that you can do various effects each time the trigger is executed, if you include it in a switch (basically "switch actions depending on number of times current trigger was executed"). In your case, adding it to the execution conditions of your trigger will make sure your trigger cannot be executed more than 4 times by any unit matching all the conditions.
best way to do this is turn it on and off with a boolean global variable.......
create global boolean variable (triggerbusy) = false
events
some event
conditions
triggerbusy = false
actions
set triggerbusy = true
do stuff
set triggerbusy = false
this will prevent multiple instances of the trigger from running at the same time.
You can also determine if if the trigger is running from other trigger or actions using this method which you may or may not need.
very similiar to turning the triggering on and off once it has started as well.
Rollback Post to RevisionRollBack
Skype
KageNinpo = SN
My Libraries
DialogLeaderboard & TeamSort
My Projects
SPACEWAR Tribute
Infinite TD
First thanks for giving me hints.
@ZealNaga
There aren't 4 same Events. I got 4 different Artefacts from the same type, thats why there are 4 Events. This trigger is difficult because i dont want to have the trigger ge started by the same Artefact multiple times but it should be able to start it with seperate Artefacts at the same time. So if I turn the trigger off at the beginning it isnt possible for the other players to get a Artefact. Thats no solution for this situation.
The thing with the "trigger execution count" is a really nice hint. But this trigger can be executed the whole game. If someone gets the power he can unleash it and its again possible to get the artefact. So the number of times the trigger will be executed is more than 4 times.
@SouLCarveRR
Also its no solution to turn the trigger on/off because other Artefacts can be "picked up" at the same moment.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hey guys!
While testing my map I found a really annyoing bug. There are 4 Artefacts in the middle of the map. At the beginning 8 Players try to get one of the 4 Artefacts to gain their power. Now my Problem: If there is more than only one player in the near of the artefact at the same time the Artefact will give more than just one player the power. I tried many things now but I dont get it worked like I want. T_T
Here is my Trigger:
I already tried to solve it like you see in the code. But i never saw a protoss explosion !? Maybe the Convert Circle to Region function dont works?
Do you guys have some ideas for a solution?
I also already tried to split them into 4 Triggers and turn the trigger off at the beginning and turn then on at the end of the trigger. This also didnt work! :'(
Hope to get some answers!
"If there is more than only one player in the near of the artefact at the same time the Artefact will give more than just one player the power."
If it would be so easy^^
The problem here is that the trigger is started multiple times at the same time. So if you set a Variable in this trigger it is already too late because it has already been started for everyone in the near. This only would work if the trigger would be started only one time.
Its not as easy as you think! Maybe its not as difficult as I think xD
The first time the trigger is run, check the value of some global Boolean variable initialized to False. If the value is True, Skip Remaining Actions immediately. If the value is False, run the trigger and set that Boolean variable's value to True *before* running any Wait() call whatsoever.
This works because Galaxy's execution is serialized, a trigger will complete or reach a Wait() call before another trigger is allowed to run ( otherwise, we would need atomic operations in a multi-threading environment, Galaxy isn't there yet :p ).
Mhh i still dont got it..
Maybe i didnt understand it right :/ Here is what i got now:
I split them into 4 Triggers now
There are still up to 7 Units with the power..
EDIT : HAH I GOT IT :D
My last line was fail and i changed the "indexes" of the "EnterArtefaktBoolean" matching the right event. Now i have only 4 Units with the power. Thanks to all helping me
Your trigger seems unreliable to me... There are much simpler ways to do this. Adding 4 times the same event won't do it 4 times. It will just execute the actions everytime ANY of the action is happening, which in your case is 4 times the same.
A good way would be to turn the trigger off at the beginning, then turn it back on at the end when all the actions are done. However it will force a wait for all actions to finish before allowing another unit to get the artefact power... You'd rather check for "trigger execution count <4" (0 counts as the first execution, so <4 means it was launched less than 5 times) in the conditions of your trigger.
Just in my case my explanations are not clear:
The AND condition I added was not necessary but I personally like it better that way, you don't have to ask yourself anymore if the conditions of a trigger checks for all of them or each one separately: you're sure it checks all. What's pretty useful with the "trigger execution count" condition is that you can do various effects each time the trigger is executed, if you include it in a switch (basically "switch actions depending on number of times current trigger was executed"). In your case, adding it to the execution conditions of your trigger will make sure your trigger cannot be executed more than 4 times by any unit matching all the conditions.
best way to do this is turn it on and off with a boolean global variable.......
create global boolean variable (triggerbusy) = false
this will prevent multiple instances of the trigger from running at the same time. You can also determine if if the trigger is running from other trigger or actions using this method which you may or may not need.
very similiar to turning the triggering on and off once it has started as well.
First thanks for giving me hints.
@ZealNaga
There aren't 4 same Events. I got 4 different Artefacts from the same type, thats why there are 4 Events. This trigger is difficult because i dont want to have the trigger ge started by the same Artefact multiple times but it should be able to start it with seperate Artefacts at the same time. So if I turn the trigger off at the beginning it isnt possible for the other players to get a Artefact. Thats no solution for this situation.
The thing with the "trigger execution count" is a really nice hint. But this trigger can be executed the whole game. If someone gets the power he can unleash it and its again possible to get the artefact. So the number of times the trigger will be executed is more than 4 times.
@SouLCarveRR
Also its no solution to turn the trigger on/off because other Artefacts can be "picked up" at the same moment.