Thursday, April 19, 2012

Need help and explanation to my Trigger problem. :)

Hey guys, i started messing with the World Editor a few weeks ago. I grasped it fairly quickly and now i'm in the process of creating my map. It's single player (possibly multi in the future) map that lets the player control a team of heroes and defeat bosses in various dungeons.

Now, my problem is, that i have a boss who spawns creeps during his combat sequence. When he is killed, they stop spawning. But if the players party dies and combat is disengaged, they keep spawning anyway and stack up until there are a lot of them when the party comes back for a second try.

I need a trigger that will stop other triggers related to the bosses combat sequence when the players party dies and combat is disengaged.

So far, i have only been able to come up with this, but for some reason, it wont work. :(


Code:
Combat Ends lose
Events
Time - Every 1.00 seconds of game time
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in (Units owned by Player 1 (Red))) Equal to 0
Then - Actions
Game - Display to (All players) the text: Combat ended with; ...
Trigger - Turn off Lava Spawn 1 <gen>
Trigger - Turn off Lava Spawn 2 <gen>
Unit Group - Pick every unit in (Units owned by Neutral Hostile of type Lava Blaze) and do (Unit - Remove (Picked unit) from the game)
Trigger - Turn on Combat Begins <gen>
Trigger - Turn off (This trigger)
Else - Actions
Do nothing

At first, i thought it was because the shops owned by player1 counted as units, so i changed their ownership to Neutral Passive, no effect however. The trigger still does absolutely nothing. Can anyone tell me why it isn't working and direct me to a trigger that will do what i need?

Thanks in advance. |||Buildings are also units, so make sure everthing player red owns = 0

Running a trigger at an interval should be avoided if possible. It's better to activate a trigger at a specific event. Something like this for example:


Code:
RedHeroDie
Events
Unit - A unit owned by Player 1 (Red) Dies
Conditions
Actions
Set UnitDie = (UnitDie + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
UnitDie Equal to 5
Then - Actions
Game - Display to (All players) the text: Combat ended with; ...
Trigger - Turn off Lava Spawn 1 <gen>
Trigger - Turn off Lava Spawn 2 <gen>
Unit Group - Pick every unit in (Units owned by Neutral Hostile of type Lava Blaze) and do (Unit - Remove (Picked unit) from the game)
Trigger - Turn on Combat Begins <gen>
Trigger - Turn off (This trigger)
Else - Actions
Do nothing

I made an Integer variable and called it UnitDie, and used action [Set Variable =]

For the sake of an example I used 5 units that needed to die of red. If you use a summoning ability, make sure to make a condition telling that summoned units don't count for this trigger. If you only want that heroes count, you can do that as well.|||Thanks so much!

I'd never used a variable in world editor before, but now that i see it in action it all seems so simple. I modified the information you gave me to this, my fully functional defeat trigger:


Code:
Combat Ends lose
Events
Unit - A unit owned by Player 1 (Red) Dies
Conditions
((Triggering unit) is A Hero) Equal to True
Actions
Set HeroDies = (HeroDies + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
HeroDies Equal to 5
Then - Actions
Game - Display to (All players) the text: Combat ended with; ...
Trigger - Turn off Lava Spawn 1 <gen>
Trigger - Turn off Lava Spawn 2 <gen>
Unit Group - Pick every unit in (Units owned by Neutral Hostile of type Lava Blaze) and do (Unit - Remove (Picked unit) from the game)
Trigger - Turn on Combat Begins <gen>
Set HeroDies = 0
Trigger - Turn off (This trigger)
Else - Actions
Do nothing



Ok, now here comes the next part.

I have a system that allows my 5 man party of heroes to hire non-hero units as mercenaries to help them fight. Now, i want it so that when the party of 5 heroes die to a boss, the defeat conditions kick in. That works now, but is there something i can add to my trigger to teleport/move the non-hero mercenaries that might remain when my defeat trigger kicks in, back to base?

Thanks again! |||Quote:




That works now, but is there something i can add to my trigger to teleport/move the non-hero mercenaries that might remain when my defeat trigger kicks in, back to base?




If all those hired units are owned by one of the dead hero's owners, then you could just pick all remaining units owned by those players and move them wherever. Or, you could add every hired unit to a group variable when they are first hired, and then simply pick every unit in that group and move them that way.

No comments:

Post a Comment