Hey guys, trying to remake the enfos map from Warcraft III..and I'm hitting a brick wall here.
I can't seem to get my respawn feature to work when a hero dies.
Here's how I built it :
I have an array of Units :
Heroes = No Unit <Unit[8]>
Which when the unit is selected I set using this (EXAMPLE) :
Unit - Create 1 Unit for player (Triggering player) at (Center of SpawnTeam1) facing 270.0 degrees (No Options)
Variable - Set Heroes[(Owner of (Triggering unit))] = (Last created unit)
So for the respawn feature, I created a trigger DIES that monitors the unit death...but it never seems to fire. Any help is apreciated. Here is that trigger :
**Variable Array REPICKBOOL is true only when the player decides to use the -repick option..I do no want to respawn unit when repick is selected
Dies
Events
Unit - Any Unit dies
Local Variables
Conditions
(Triggering unit) == Heroes[1]
Or
Conditions
(Triggering unit) == Heroes[2]
Or
Conditions
(Triggering unit) == Heroes[3]
Or
Conditions
(Triggering unit) == Heroes[4]
Or
Conditions
(Triggering unit) == Heroes[5]
Or
Conditions
(Triggering unit) == Heroes[6]
Or
Conditions
(Triggering unit) == Heroes[7]
Or
Conditions
(Triggering unit) == Heroes[8]
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
RepickBool[(Owner of (Triggering unit))] == false
Then
General - If (Conditions) then do (Actions) else do (Actions)
If
(Owner of (Triggering unit)) >= 1
And
Conditions
(Owner of (Triggering unit)) <= 4
Then
General - Wait 10.0 Game Time seconds
Unit - Create 1 (Unit type of (Triggering unit)) for player (Owner of (Triggering unit)) at (Center of SpawnTeam1) facing (Position of (Triggering unit)) (No Options)
Camera - Pan the camera for player (Triggering player) to ((Center of SpawnTeam1) facing 270.0 degrees) over 1.0 seconds with Existing Velocity% initial velocity, 10% deceleration, and Do Not use smart panning
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Owner of (Triggering unit)) >= 5
And
Conditions
(Owner of (Triggering unit)) <= 8
Then
General - Wait 10.0 Game Time seconds
Unit - Create 1 (Unit type of (Triggering unit)) for player (Owner of (Triggering unit)) at (Center of SpawnTeam2) facing (Position of (Triggering unit)) (No Options)
Camera - Pan the camera for player (Triggering player) to ((Center of SpawnTeam2) facing 270.0 degrees) over 1.0 seconds with Existing Velocity% initial velocity, 10% deceleration, and Do Not use smart panning
Else
Else
Well, I was able to make it work using something a little bit different. Here's the code in case it helps somebody! (Had to create 2 different triggers)
-------------------------------START OF TRIGGER DIES------------------------------------------------------
Dies
Events
Unit - Any Unit dies
Local Variables
Trigunit = No Unit <Unit>
ThisOwner = 0 <Integer>
ThisUnitType = No Game Link <Game Link - Unit>
Conditions
(Owner of (Triggering unit)) >= 1
And
Conditions
(Owner of (Triggering unit)) <= 8
Actions
Variable - Set ThisOwner = (Owner of (Triggering unit))
Variable - Set Trigunit = (Triggering unit)
Variable - Set ThisUnitType = (Unit type of (Triggering unit))
General - If (Conditions) then do (Actions) else do (Actions)
If
Trigunit == Heroes[ThisOwner]
Then
Variable - Set Owner of Unit = ThisOwner
Variable - Set Unit Type = ThisUnitType
Trigger - Run Respawn (Ignore Conditions, Don't Wait until it finishes)
Else
-------------------------------END OF TRIGGER------------------------------------------------------
-------------------------------START OF TRIGGER RESPAWN------------------------------------------------------
Respawn
Events
Local Variables
ThisOwner = 0 <Integer>
ThisUnitType = No Game Link <Game Link - Unit>
Conditions
(Triggering unit) == Heroes[1]
Or
Conditions
(Triggering unit) == Heroes[2]
Actions
Variable - Set ThisUnitType = Unit Type
Variable - Set ThisOwner = Owner of Unit
General - If (Conditions) then do (Actions) else do (Actions)
If
RepickBool[(Owner of (Triggering unit))] == false
Then
General - If (Conditions) then do (Actions) else do (Actions)
If
(Owner of (Triggering unit)) >= 1
And
Conditions
(Owner of (Triggering unit)) <= 4
Then
UI - Display (Combine ("Team 1 : ", (Name of player (Triggering player)), " has died. 10 seconds before respaw...")) for (All players) to Subtitle area
General - Wait 10.0 Game Time seconds
Unit - Create 1 ThisUnitType for player ThisOwner at (Center of SpawnTeam1) facing Point 001 (No Options)
Variable - Set Heroes[ThisOwner] = (Last created unit)
Camera - Pan the camera for player ThisOwner to ((Center of SpawnTeam1) facing 270.0 degrees) over 1.0 seconds with Existing Velocity% initial velocity, 10% deceleration, and Do Not use smart panning
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Owner of (Triggering unit)) >= 5
And
Conditions
(Owner of (Triggering unit)) <= 8
Then
UI - Display (Combine ("Team 2 : ", (Name of player (Triggering player)), " has died. 10 seconds before respaw...")) for (All players) to Subtitle area
General - Wait 10.0 Game Time seconds
Unit - Create 1 ThisUnitType for player ThisOwner at (Center of SpawnTeam2) facing Point 001 (No Options)
Variable - Set Heroes[ThisOwner] = (Last created unit)
Camera - Pan the camera for player (Triggering player) to ((Center of SpawnTeam2) facing 270.0 degrees) over 1.0 seconds with Existing Velocity% initial velocity, 10% deceleration, and Do Not use smart panning
Else
Else
Variable - Set RepickBool[(Owner of (Triggering unit))] = false
-------------------------------END OF TRIGGER------------------------------------------------------
I did some testing, and apparently your initial problem is due to the fact that information (such as Triggering Unit/Player and so on) get lost for the Trigger after a call to Game - Wait.
You can group your last solution into one trigger if you back up everything important before the Wait call.
The following is working perfectly fine:
UnitDiesEventsUnit-AnyUnitdiesLocalVariablesType=NoGameLink<GameLink-Unit>Player=0<Integer>Point=NoPoint<Point>ConditionsActionsVariable-SetPoint=(Positionof(Triggeringunit))Variable-SetPlayer=(Triggeringplayer)Variable-SetType=(Unittypeof(Triggeringunit))General-Wait2.0GameTimesecondsUnit-Create1TypeforplayerPlayeratPointfacing270.0degrees(NoOptions)UI-Display"BACK FROM THE DEAD"for(Allplayers)toSubtitlearea
p.s: Owner of (Triggering unit) is actually Triggering Player :p
Just as a heads up, you can set the variables directly from the Local Variables section, just double click on their value. I actually suggest you do, just as a good habit, to avoid any problems with the game forgetting what unit was used, since I'm pretty sure it will forget even before a wait if there is enough stuff before it.
Hey guys, trying to remake the enfos map from Warcraft III..and I'm hitting a brick wall here.
I can't seem to get my respawn feature to work when a hero dies.
Here's how I built it :
I have an array of Units :
Heroes = No Unit <Unit[8]>
Which when the unit is selected I set using this (EXAMPLE) :
Unit - Create 1 Unit for player (Triggering player) at (Center of SpawnTeam1) facing 270.0 degrees (No Options)
Variable - Set Heroes[(Owner of (Triggering unit))] = (Last created unit)
So for the respawn feature, I created a trigger DIES that monitors the unit death...but it never seems to fire. Any help is apreciated. Here is that trigger :
**Variable Array REPICKBOOL is true only when the player decides to use the -repick option..I do no want to respawn unit when repick is selected
Dies
Events
Unit - Any Unit dies
Local Variables
Conditions
(Triggering unit) == Heroes[1]
Or
Conditions
(Triggering unit) == Heroes[2]
Or
Conditions
(Triggering unit) == Heroes[3]
Or
Conditions
(Triggering unit) == Heroes[4]
Or
Conditions
(Triggering unit) == Heroes[5]
Or
Conditions
(Triggering unit) == Heroes[6]
Or
Conditions
(Triggering unit) == Heroes[7]
Or
Conditions
(Triggering unit) == Heroes[8]
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
RepickBool[(Owner of (Triggering unit))] == false
Then
General - If (Conditions) then do (Actions) else do (Actions)
If
(Owner of (Triggering unit)) >= 1
And
Conditions
(Owner of (Triggering unit)) <= 4
Then
General - Wait 10.0 Game Time seconds
Unit - Create 1 (Unit type of (Triggering unit)) for player (Owner of (Triggering unit)) at (Center of SpawnTeam1) facing (Position of (Triggering unit)) (No Options)
Camera - Pan the camera for player (Triggering player) to ((Center of SpawnTeam1) facing 270.0 degrees) over 1.0 seconds with Existing Velocity% initial velocity, 10% deceleration, and Do Not use smart panning
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Owner of (Triggering unit)) >= 5
And
Conditions
(Owner of (Triggering unit)) <= 8
Then
General - Wait 10.0 Game Time seconds
Unit - Create 1 (Unit type of (Triggering unit)) for player (Owner of (Triggering unit)) at (Center of SpawnTeam2) facing (Position of (Triggering unit)) (No Options)
Camera - Pan the camera for player (Triggering player) to ((Center of SpawnTeam2) facing 270.0 degrees) over 1.0 seconds with Existing Velocity% initial velocity, 10% deceleration, and Do Not use smart panning
Else
Else
Any help would be AWESOMELY apreciated!
Thank you very much.
Well, I was able to make it work using something a little bit different. Here's the code in case it helps somebody! (Had to create 2 different triggers)
-------------------------------START OF TRIGGER DIES------------------------------------------------------
Dies
Events
Unit - Any Unit dies
Local Variables
Trigunit = No Unit <Unit>
ThisOwner = 0 <Integer>
ThisUnitType = No Game Link <Game Link - Unit>
Conditions
(Owner of (Triggering unit)) >= 1
And
Conditions
(Owner of (Triggering unit)) <= 8
Actions
Variable - Set ThisOwner = (Owner of (Triggering unit))
Variable - Set Trigunit = (Triggering unit)
Variable - Set ThisUnitType = (Unit type of (Triggering unit))
General - If (Conditions) then do (Actions) else do (Actions)
If
Trigunit == Heroes[ThisOwner]
Then
Variable - Set Owner of Unit = ThisOwner
Variable - Set Unit Type = ThisUnitType
Trigger - Run Respawn (Ignore Conditions, Don't Wait until it finishes)
Else
-------------------------------END OF TRIGGER------------------------------------------------------
-------------------------------START OF TRIGGER RESPAWN------------------------------------------------------
Respawn
Events
Local Variables
ThisOwner = 0 <Integer>
ThisUnitType = No Game Link <Game Link - Unit>
Conditions
(Triggering unit) == Heroes[1]
Or
Conditions
(Triggering unit) == Heroes[2]
Actions
Variable - Set ThisUnitType = Unit Type
Variable - Set ThisOwner = Owner of Unit
General - If (Conditions) then do (Actions) else do (Actions)
If
RepickBool[(Owner of (Triggering unit))] == false
Then
General - If (Conditions) then do (Actions) else do (Actions)
If
(Owner of (Triggering unit)) >= 1
And
Conditions
(Owner of (Triggering unit)) <= 4
Then
UI - Display (Combine ("Team 1 : ", (Name of player (Triggering player)), " has died. 10 seconds before respaw...")) for (All players) to Subtitle area
General - Wait 10.0 Game Time seconds
Unit - Create 1 ThisUnitType for player ThisOwner at (Center of SpawnTeam1) facing Point 001 (No Options)
Variable - Set Heroes[ThisOwner] = (Last created unit)
Camera - Pan the camera for player ThisOwner to ((Center of SpawnTeam1) facing 270.0 degrees) over 1.0 seconds with Existing Velocity% initial velocity, 10% deceleration, and Do Not use smart panning
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Owner of (Triggering unit)) >= 5
And
Conditions
(Owner of (Triggering unit)) <= 8
Then
UI - Display (Combine ("Team 2 : ", (Name of player (Triggering player)), " has died. 10 seconds before respaw...")) for (All players) to Subtitle area
General - Wait 10.0 Game Time seconds
Unit - Create 1 ThisUnitType for player ThisOwner at (Center of SpawnTeam2) facing Point 001 (No Options)
Variable - Set Heroes[ThisOwner] = (Last created unit)
Camera - Pan the camera for player (Triggering player) to ((Center of SpawnTeam2) facing 270.0 degrees) over 1.0 seconds with Existing Velocity% initial velocity, 10% deceleration, and Do Not use smart panning
Else
Else
Variable - Set RepickBool[(Owner of (Triggering unit))] = false
-------------------------------END OF TRIGGER------------------------------------------------------
@senatorsfc: Go
I did some testing, and apparently your initial problem is due to the fact that information (such as Triggering Unit/Player and so on) get lost for the Trigger after a call to Game - Wait.
You can group your last solution into one trigger if you back up everything important before the Wait call.
The following is working perfectly fine:
p.s: Owner of (Triggering unit) is actually Triggering Player :p
@Moooyaah: Go
Just as a heads up, you can set the variables directly from the Local Variables section, just double click on their value. I actually suggest you do, just as a good habit, to avoid any problems with the game forgetting what unit was used, since I'm pretty sure it will forget even before a wait if there is enough stuff before it.
Ex:
@7MM3: Go
It doesn't change much in the script and I am way too used to declare first, then initialize :) But hey, thanks anyway !
(and Owner of (Triggering unit) is Triggering Player, damn it ! :D)
@Moooyaah: Go
Thanks for your help Moooyaah ;)
Thanks for explaining why it didn't work..I didn't know the reference to triggering player and such were lost after a Wait command! The more you know!
@senatorsfc: Go
You're using the Or/And statements wrong. Here's how it should work:
Or
Condition 1
Condition 2
Condition 3
Condition 4
Etc.
not:
Condition 1
Or
Condition 2
Or
Condition 3
Or
Etc.
@ProxyTooMuch: Go
Thank you!! This is great...