Hello the problem I'm having is that when i host the game with 2 or more friends in it and every ones picking there class the game lags a little loading the unit and you can hit the button over and over until it closes and have like 5(most any ones been able to spawn lol) of w/e hero or heroes you could click. anyone got a fix for this?
Ok, well that is not nearly as easy as I would have expected, but I believe this will do what you want. When a dialog item is used it will loop through all the units owned by the clicking player and check to see if the heroic flag is checked, if it finds one it breaks out of the trigger, otherwise it will continue on and then create the unit at the end.
Events
Dialog - Any Dialog Item is Clicked by Player Any Player
Local Variables
currentUnit = No Unit <Unit>
Conditions
Actions
Unit Group - For each unit currentUnit in (Any units in (Entire map) owned by player (Triggering player) matching
Excluded: Missile, Dead, Hidden, with at most Any Amount) do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
((Unit type of currentUnit) has Heroic attribute) == true
Then
Trigger - Stop all instances of (Current trigger)
Else
Unit - Create 1 <Unit> for player (Triggering player) at <Point> facing 270.0 degrees (No Options)
Not saying Sir Lyradd has bad code, but would be a lot easier to declare a type Boolean variable (set to false) for each player (maybe called Bool_P1PickedHero). So in your trigger add a condition > click comparisions > find your variable
somthing like
Conditions
if Bool_P1PickedHero == false
do actions
set variable Bool_P1PickedHero = True
Now in your action part of the trigger you would set Bool_P1PickedHero to true, so the next time the the trigger is activated, the actions wont run.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hello the problem I'm having is that when i host the game with 2 or more friends in it and every ones picking there class the game lags a little loading the unit and you can hit the button over and over until it closes and have like 5(most any ones been able to spawn lol) of w/e hero or heroes you could click. anyone got a fix for this?
Just add a condition to the spawning trigger that the player does not already have a hero.
oh wow you are my hero rofl i cant belive i did think of that....
hmm i cant seem to find out how to do this >.< could you link code?
Ok, well that is not nearly as easy as I would have expected, but I believe this will do what you want. When a dialog item is used it will loop through all the units owned by the clicking player and check to see if the heroic flag is checked, if it finds one it breaks out of the trigger, otherwise it will continue on and then create the unit at the end.
Events
Dialog - Any Dialog Item is Clicked by Player Any Player
Local Variables
currentUnit = No Unit <Unit>
Conditions
Actions
Unit Group - For each unit currentUnit in (Any units in (Entire map) owned by player (Triggering player) matching
Excluded: Missile, Dead, Hidden, with at most Any Amount) do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
((Unit type of currentUnit) has Heroic attribute) == true
Then
Trigger - Stop all instances of (Current trigger)
Else
Unit - Create 1 <Unit> for player (Triggering player) at <Point> facing 270.0 degrees (No Options)
Not saying Sir Lyradd has bad code, but would be a lot easier to declare a type Boolean variable (set to false) for each player (maybe called Bool_P1PickedHero). So in your trigger add a condition
> click comparisions> find your variablesomthing like Conditions if Bool_P1PickedHero == false do actions set variable Bool_P1PickedHero = True
Now in your action part of the trigger you would set Bool_P1PickedHero to true, so the next time the the trigger is activated, the actions wont run.