| 07-12-2004, 02:19 AM | #1 |
I need help with my trigger that picks the winning hero. There is only 1 hero per person btw. Umm ive got the trigger that puts em in the arena.. which turns this on when its turn off but.. this trigger isnt working lol... Any help plz. Code:
Winner
Events
Unit - A unit Dies
Conditions
((Dying unit) is A Hero) Equal to True
Actions
Wait 2.00 seconds
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in (Units in Hero arena <gen>)) Equal to 1
Then - Actions
-------- If you add a reward add 1 to the second number on the action below... --------
Set RewardChance = (Random integer number between 1 and 2)
Region - Center RewardGetting Area <gen> on ((Owner of (Killing unit)) start location)
Wait 0.01 seconds
Unit - Move (Killing unit) instantly to (Center of RewardGetting Area <gen>)
Game - Display to (All players) for 30.00 seconds the text: ((Name of (Owner of (Killing unit))) + has won the duel!)
-------- Put Rewards Under here... --------
If (RewardChance Equal to 1) then do (Unit - Create 1 Goblin Shredder for (Owner of (Killing unit)) at (Center of RewardGetting Area <gen>) facing (Position of (Triggering unit))) else do (Do nothing)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
RewardChance Equal to 2
Then - Actions
Hero - Modify Strength of (Killing unit): Add 7
Hero - Modify Agility of (Killing unit): Add 7
Hero - Modify Intelligence of (Killing unit): Add 7
Else - Actions
Trigger - Turn off (This trigger)
Else - Actions
Do nothing |
| 07-12-2004, 03:47 AM | #2 |
I would do it a different way that I will detail. I use three triggers, Map Intitialization, Duel Death, and Duel End. I also use three variables; Duelist (a unit array), Winner (a unit), and Integer (an integer). First add this to your map initialization trigger: Code:
Map Initialization
Events
Map initialization
Conditions
Actions
For each (Integer A) from 1 to (Number of players), do (Actions)
Loop - Actions
Trigger - Add to Duel Death <gen> the event (Unit - Duelist[(Integer A)] Dies)This set it so that Duel Death will run whenever a unit in the Duelist array is killed. By default, all slots should be empty in the array. When you start the duel, set each player's hero to Duelist[Player number of (Owner of unit)] and hen the duel's over, set all the Duelist array slots to No unit. The Duel Death trigger should be as follows: Code:
Duel Death
Events
Conditions
Actions
Set Integer = (Integer + 1)
Set Duelist[Player number of (Owner of (Dying unit))] = No unit
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Integer Equal to ((Number of players) - 1)
Then - Actions
Trigger - Run Duel End <gen> (ignoring conditions)
Else - Actions
Do nothingThis trigger will add one to an integer and check to see if the intger is equal to the number of players minus one, as each player has one Her and one should still be alive. If this is true, then it runs Duel End, which gives the reward. Code:
Duel End
Events
Conditions
Actions
For each (Integer A) from 1 to (Number of players), do (Actions)
Loop - Actions
If (Duelist[(Integer A)] Not equal to No unit) then do (Set Duelist[(Integer A)] = Winner) else do (Do nothing)
Special Effect - Create a special effect at (Position of Winner) using Abilities\Spells\Demon\DarkPortal\DarkPortalTarget.mdl
Unit - Move Winner instantly to ((Owner of Winner) start location)
Special Effect - Create a special effect at (Position of Winner) using Abilities\Spells\Items\TomeOfRetraining\TomeOfRetrainingCaster.mdl
Game - Display to (All players) the text: ((Proper name of Winner) + ( the + ((Name of Winner) + has won the duel!)))
Set Integer = (Random integer number between 1 and 2)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Integer Equal to 2
Then - Actions
Hero - Modify Strength of Winner: Add 7
Hero - Modify Intelligence of Winner: Add 7
Hero - Modify Agility of Winner: Add 7
Else - Actions
Unit - Create 1 Goblin Shredder for (Owner of Winner) at (Position of Winner) facing Default building facing degrees
Wait 1.00 seconds
Set Winner = No unit
Set Integer = (Number of players)
For each (Integer A) from 1 to (Number of players), do (Actions)
Loop - Actions
Set Duelist[(Integer A)] = No unitTry this and see if it helps you any. |
| 07-12-2004, 03:56 AM | #3 |
You might want to add a condition that says 'unit type of killing unit equal to hero', for just in case a water elemental or something slays the dieing unit. Having the game try to raise a non-hero's stats (they have none) could glitch the game. You may also need a separate trigger that does something like this... Code:
Events
Every 1.00 seconds of game time
Conditions
Actions
Pick all units in (Units in Hero arena <gen>) and do actions.
If then else
If
Unit type of picked units equal to hero
Then
Add (picked units) to ([color=Sienna]unit group variable[/color])
Else
Do nothingThen when you're counting the number of units in your trigger, you simply count the number of units in your unit group variable. If it equals 1, then... etc... Shimrra's way is probably more bug-free and cleaner though. |
| 07-12-2004, 04:30 AM | #4 |
So if i want to make the duel every 600 seconds what trigger do i have to add using Shimrra's triggers? Well how do i set each players hero as an array number. They are all sent to separate regions in the arena. Thanks for the help.. If i do this i have to make everyone choose a hero at the start before the duel right? Edit: OK here it is a little simpler. I'm not sure how to work the trigger that picks all the heros on the map and shoves them in their corners in the arena. (6 heros, 6 players) I tried what you said but i didn't know how to do it exactly so ill show you my really bad starting trigger. I'm kinda confused... i know i could have shortend that but i already started it like that for some reason ( even though it doesn't work lol) BTW i've put those 3 triggers you said.. i've done them correctly so its just this now. Code:
Send heros 2 arena
Events
Time - Every 600.00 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in (Units in (Playable map area) owned by Player 1 (Red)) and do (If (((Picked unit) is A Hero) Equal to True) then do (Unit - Move (Picked unit) instantly to (Center of Red Hero arena <gen>)) else do (Do nothing))
Unit Group - Pick every unit in (Units in (Playable map area) owned by Player 2 (Blue)) and do (If (((Picked unit) is A Hero) Equal to True) then do (Unit - Move (Picked unit) instantly to (Center of Blue hero arena <gen>)) else do (Do nothing))
Unit Group - Pick every unit in (Units in (Playable map area) owned by Player 3 (Teal)) and do (If (((Picked unit) is A Hero) Equal to True) then do (Unit - Move (Picked unit) instantly to (Center of Teal hero arena <gen>)) else do (Do nothing))
Unit Group - Pick every unit in (Units in (Playable map area) owned by Player 4 (Purple)) and do (If (((Picked unit) is A Hero) Equal to True) then do (Unit - Move (Picked unit) instantly to (Center of Purple hero arena <gen>)) else do (Do nothing))
Unit Group - Pick every unit in (Units in (Playable map area) owned by Player 5 (Yellow)) and do (If (((Picked unit) is A Hero) Equal to True) then do (Unit - Move (Picked unit) instantly to (Center of Yellow hero arena <gen>)) else do (Do nothing))
Unit Group - Pick every unit in (Units in (Playable map area) owned by Player 6 (Orange)) and do (If (((Picked unit) is A Hero) Equal to True) then do (Unit - Move (Picked unit) instantly to (Center of Orange hero arena <gen>)) else do (Do nothing))
Wait 0.01 seconds
Player Group - Pick every player in (All players) and do (Camera - Pan camera for (Picked player) to (Center of Hero arena <gen>) over 2.00 seconds)
Game - Display to (All players) for 10.00 seconds the text: ATTENTION:- It's t...
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Player 6 (Orange) slot status) Equal to Is playing
Then - Actions
Unit Group - Pick every unit in (Units in Orange hero arena <gen>) and do (Set Duelist[(Player number of (Owner of (Picked unit)))] = (Picked unit))
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Player 5 (Yellow) slot status) Equal to Is playing
Then - Actions
Unit Group - Pick every unit in (Units in Yellow hero arena <gen>) and do (Set Duelist[(Player number of (Owner of (Picked unit)))] = (Picked unit))
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Player 4 (Purple) slot status) Equal to Is playing
Then - Actions
Unit Group - Pick every unit in (Units in Purple hero arena <gen>) and do (Set Duelist[(Player number of (Owner of (Picked unit)))] = (Picked unit))
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Player 3 (Teal) slot status) Equal to Is playing
Then - Actions
Unit Group - Pick every unit in (Units in Teal hero arena <gen>) and do (Set Duelist[(Player number of (Owner of (Picked unit)))] = (Picked unit))
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Player 2 (Blue) slot status) Equal to Is playing
Then - Actions
Unit Group - Pick every unit in (Units in Blue hero arena <gen>) and do (Set Duelist[(Player number of (Owner of (Picked unit)))] = (Picked unit))
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Player 1 (Red) slot status) Equal to Is playing
Then - Actions
Unit Group - Pick every unit in (Units in Red Hero arena <gen>) and do (Set Duelist[(Player number of (Owner of (Picked unit)))] = (Picked unit))
Else - Actions
Do nothing |
| 07-12-2004, 10:19 AM | #5 |
I didn't know that specific unit events added with a trigger will dinamically change themselves if the variable changes... Are you sure things work this way, Shimrra? |
| 07-13-2004, 02:41 AM | #6 |
Argh i still need help.. I can't get it working. |
| 07-13-2004, 01:48 PM | #7 | |
Did you set the variables when the duel came? Quote:
If that still doesn't work, then add a condition into the second trigger that says "dying unit is a Hero equal to true" and then male the event "a unit dies". Make the trigger NOT initially enabled and remove the stuff at Map Initialzation. When the duel stats, add in the action "Trigger - Turn On Duel Death". Tell me if this doesn't work. |
| 07-14-2004, 03:27 AM | #8 |
Nope... It didn't work It started the arena so the starting trigger is working. :( I'll show you all my triggers..... This is the starting Trigger.. Code:
Starting Trigger
Events
Time - Every 360.00 seconds of game time
Conditions
Actions
Trigger - Turn on Duel Death <gen>
Unit Group - Pick every unit in (Units in (Playable map area) owned by Player 1 (Red)) and do (If (((Picked unit) is A Hero) Equal to True) then do (Unit - Move (Picked unit) instantly to (Center of Red Hero arena <gen>)) else do (Do nothing))
Unit Group - Pick every unit in (Units in (Playable map area) owned by Player 2 (Blue)) and do (If (((Picked unit) is A Hero) Equal to True) then do (Unit - Move (Picked unit) instantly to (Center of Blue hero arena <gen>)) else do (Do nothing))
Unit Group - Pick every unit in (Units in (Playable map area) owned by Player 3 (Teal)) and do (If (((Picked unit) is A Hero) Equal to True) then do (Unit - Move (Picked unit) instantly to (Center of Teal hero arena <gen>)) else do (Do nothing))
Unit Group - Pick every unit in (Units in (Playable map area) owned by Player 4 (Purple)) and do (If (((Picked unit) is A Hero) Equal to True) then do (Unit - Move (Picked unit) instantly to (Center of Purple hero arena <gen>)) else do (Do nothing))
Unit Group - Pick every unit in (Units in (Playable map area) owned by Player 5 (Yellow)) and do (If (((Picked unit) is A Hero) Equal to True) then do (Unit - Move (Picked unit) instantly to (Center of Yellow hero arena <gen>)) else do (Do nothing))
Unit Group - Pick every unit in (Units in (Playable map area) owned by Player 6 (Orange)) and do (If (((Picked unit) is A Hero) Equal to True) then do (Unit - Move (Picked unit) instantly to (Center of Orange hero arena <gen>)) else do (Do nothing))
Wait 0.01 seconds
Player Group - Pick every player in (All players) and do (Camera - Pan camera for (Picked player) to (Center of Hero arena <gen>) over 2.00 seconds)
Game - Display to (All players) for 10.00 seconds the text: ATTENTION:- It's t...
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Player 6 (Orange) slot status) Equal to Is playing
Then - Actions
Unit Group - Pick every unit in (Units in Orange hero arena <gen>) and do (Set Duelist[6] = (Picked unit))
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Player 5 (Yellow) slot status) Equal to Is playing
Then - Actions
Unit Group - Pick every unit in (Units in Yellow hero arena <gen>) and do (Set Duelist[5] = (Picked unit))
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Player 4 (Purple) slot status) Equal to Is playing
Then - Actions
Unit Group - Pick every unit in (Units in Purple hero arena <gen>) and do (Set Duelist[4] = (Picked unit))
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Player 3 (Teal) slot status) Equal to Is playing
Then - Actions
Unit Group - Pick every unit in (Units in Teal hero arena <gen>) and do (Set Duelist[3] = (Picked unit))
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Player 2 (Blue) slot status) Equal to Is playing
Then - Actions
Unit Group - Pick every unit in (Units in Blue hero arena <gen>) and do (Set Duelist[2] = (Picked unit))
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Player 1 (Red) slot status) Equal to Is playing
Then - Actions
Unit Group - Pick every unit in (Units in Red Hero arena <gen>) and do (Set Duelist[1] = (Picked unit))
Else - Actions
Do nothingYou told me to take out the Initialisation trigger (well thats what i thought, its just disabled) So here is Duel Death (which is now not initially on .. Code:
Duel Death
Events
Unit - A unit Dies
Conditions
((Dying unit) is A Hero) Equal to True
Actions
Set Integer = (Integer + 1)
Set Duelist[(Player number of (Owner of (Dying unit)))] = No unit
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Integer Equal to ((Number of players) - 1)
Then - Actions
Trigger - Run Duel End <gen> (ignoring conditions)
Else - Actions
Do nothingAnd finally here is Duel end (All these triggers are up to date with your last post by the way) Code:
Duel End
Events
Conditions
Actions
For each (Integer A) from 1 to (Number of players), do (Actions)
Loop - Actions
If (Duelist[(Integer A)] Not equal to No unit) then do (Set Duelist[(Integer A)] = Winner) else do (Do nothing)
Special Effect - Create a special effect at (Position of Winner) using Abilities\Spells\Demon\DarkPortal\DarkPortalTarget.mdl
Unit - Move Winner instantly to ((Owner of Winner) start location)
Game - Display to (All players) for 10.00 seconds the text: (((Proper name of Winner) + the ) + ((Name of Winner) + has won the duel!))
Set Integer = (Random integer number between 1 and 2)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Integer Equal to 2
Then - Actions
Game - Display to (All players) the text: ((Name of (Owner of Winner)) + 's hero has been awarded +7 to all attributes!)
Hero - Modify Strength of Winner: Add 7
Hero - Modify Agility of Winner: Add 7
Hero - Modify Intelligence of Winner: Add 7
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Integer Equal to 1
Then - Actions
Game - Display to (All players) the text: ((Name of (Owner of Winner)) + has been rewarded a Goblin Shredder!)
Unit - Create 1 Goblin Shredder for (Owner of Winner) at ((Owner of Winner) start location) facing (Position of (Triggering unit))
Else - Actions
Do nothing
For each (Integer A) from 1 to (Number of players), do (Actions)
Loop - Actions
Set Duelist[(Integer A)] = No unit |
| 07-14-2004, 01:55 PM | #9 |
Oh, I was a little stupid tere, sorry. You still need to set the Heroes to their proper Duelist variables at the duel's start. Sorry. |
| 07-15-2004, 05:25 AM | #10 | |
Quote:
I thought i did... How do i set them? I thought you just wanted me to pick the heros and set them as duelest 1, 2 etc like i did on the starting trigger. |
