- Joined
- Jun 10, 2013
- Messages
- 472
Hey i'm having trouble getting this ability to work and was wondering if any one would be willing to help >
please
The Triggers
https://www.hiveworkshop.com/forums/members/229903-albums8238-picture99025.html
https://www.hiveworkshop.com/forums/members/229903-albums8238-picture99024.html
help of any kind is always appreciated
The Triggers
-
Sacrifice Initialization
-

Events
-


Map initialization
-
-

Conditions
-

Actions
-


-------- THIS SHOULD BE SET UP BY THE USER --------
-


-------- ------------------------------------------------------------------------ --------
-


-------- 1 --------
-


Set Sacrifice_Index = (Sacrifice_Index + 1)
-


-------- ---------- --------
-


Set Sacrifice_Building[Sacrifice_Index] = Tomb
-


Set Sacrifice_BuildingName[Sacrifice_Index] = Tomb
-


Set Sacrifice_Victim[Sacrifice_Index] = Banshee forsaken
-


Set Sacrifice_VictimName[Sacrifice_Index] = Banshee Forsaken
-


Set Sacrifice_NewUnit[Sacrifice_Index] = Dark Ranger
-


Set Sacrifice_Gold[Sacrifice_Index] = 135
-


Set Sacrifice_Lumber[Sacrifice_Index] = 50
-


Set Sacrifice_Food[Sacrifice_Index] = 2
-


Set Sacrifice_Ability_Building[Sacrifice_Index] = Custom sacrifice building
-


Set Sacrifice_Ability_Unit[Sacrifice_Index] = sacrifice unit
-


-------- ------------------------------------------------------------------------ --------
-


-------- ------------------------------------------------------------------------ --------
-


-------- ------------------------------------------------------------------------ --------
-


-------- ------------------------------------------------------------------------ --------
-


-------- ------------------------------------------------------------------------ --------
-


-------- ACTIONS BELOW SHOULD NOT BE TOUCHED --------
-


-------- Note: The action below disables every Sacrifice_NewUnit for all players! --------
-


Player Group - Pick every player in (All players) and do (Actions)
-



Loop - Actions
-




For each (Integer LoopInteger) from 1 to Sacrifice_Index, do (Actions)
-





Loop - Actions
-






Player - Make Sacrifice_NewUnit[LoopInteger] Unavailable for training/construction by (Picked player)
-






-------- ------------------------------------------------------------------------ --------
-
-
-
-
-


-------- ------------------------------------------------------------------------ --------
-


Hashtable - Create a hashtable
-


Set SacrificeHash = (Last created hashtable)
-


-------- ------------------------------------------------------------------------ --------
-


-------- ------------------------------------------------------------------------ --------
-


Set ErrorRace[1] = Human
-


Set ErrorNoFood[1] = Build more Farms to continue unit production.
-


-------- --------- --------
-


Set ErrorRace[2] = Orc
-


Set ErrorNoFood[2] = Build more Burrows to continue unit production.
-


-------- --------- --------
-


Set ErrorRace[3] = Undead
-


Set ErrorNoFood[3] = Summon more Ziggurats to continue unit production.
-


-------- --------- --------
-


Set ErrorRace[4] = Night Elf
-


Set ErrorNoFood[4] = Create more Moon Wells to continue unit production.
-


-------- ------------------------------------------------------------------------ --------
-


-------- ------------------------------------------------------------------------ --------
-
-
-
Sacrifice Order Check
-

Events
-


Unit - A unit Is issued an order targeting an object
-
-

Conditions
-


Or - Any (Conditions) are true
-



Conditions
-




(Issued order) Equal to (Order(sacrifice))
-




(Issued order) Equal to (Order(requestsacrifice))
-
-
-
-

Actions
-


Set u1 = (Triggering unit)
-


Set u2 = (Target unit of issued order)
-


Set order = (Issued order)
-


Set player = (Owner of u1)
-


For each (Integer LoopInteger) from 1 to Sacrifice_Index, do (Actions)
-



Loop - Actions
-




If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





If - Conditions
-






Or - Any (Conditions) are true
-







Conditions
-








(Level of Sacrifice_Ability_Building[LoopInteger] for u1) Equal to 1
-








(Level of Sacrifice_Ability_Unit[LoopInteger] for u1) Equal to 1
-
-
-
-





Then - Actions
-






Set int = LoopInteger
-
-





Else - Actions
-
-
-
-


-------- ------------------------------------------------------------------------ --------
-


-------- ------------------------------------------------------------------------ --------
-


-------- CHECKS WHICH ORDER HAS BEEN ISSUED AND CHECKS CONDITIONS --------
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




(Order(stop)) Equal to (Order(requestsacrifice))
-
-



Then - Actions
-




If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





If - Conditions
-






Dark Ranger Not equal to Sacrifice_Victim[int]
-
-





Then - Actions
-






-------- SANCTUM DOES NOT TARGET VILLAGER --------
-






Custom script: if udg_ErrorSound == null then
-






Custom script: set udg_ErrorSound = CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
-






Custom script: endif
-






Set ErrorFound = True
-






Set ErrorMessage = (Must target + (Sacrifice_VictimName[int] + .))
-






Set ErrorPlayer = (Triggering player)
-






-------- ------------------------------------------------------------------------ --------
-
-





Else - Actions
-






Unit - Order u2 to Undead Sacrificial Pit - Sacrifice u1
-
-
-
-



Else - Actions
-




-------- THE ITEs BELOW CHECK ALL CONDITIONS --------
-




-------- a) If correct unit is selected --------
-




If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





If - Conditions
-






Banshee forsaken Equal to Sacrifice_Victim[int]
-






Dark Ranger Not equal to Sacrifice_Building[int]
-
-





Then - Actions
-






-------- VILLAGER DOES NOT TARGET SANCTUM --------
-






Custom script: if udg_ErrorSound == null then
-






Custom script: set udg_ErrorSound = CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
-






Custom script: endif
-






Set ErrorFound = True
-






Set ErrorMessage = (Must target + (Sacrifice_BuildingName[int] + .))
-






Set ErrorPlayer = (Triggering player)
-






-------- ------------------------------------------------------------------------ --------
-
-





Else - Actions
-
-




-------- ------------------------------------------------------------------------ --------
-




-------- b) If player has enough resources --------
-




If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





If - Conditions
-






(player Current gold) Less than Sacrifice_Gold[int]
-
-





Then - Actions
-






-------- NOT ENOUGH GOLD --------
-






Custom script: if udg_ErrorSound == null then
-






Custom script: set udg_ErrorSound = CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
-






Custom script: endif
-






Set ErrorFound = True
-






Set ErrorMessage = Not enough gold.
-






Set ErrorPlayer = (Triggering player)
-






-------- ------------------------------------------------------------------------ --------
-
-





Else - Actions
-






If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-







If - Conditions
-








(player Current lumber) Less than Sacrifice_Lumber[int]
-
-







Then - Actions
-








-------- NOT ENOUGH LUMBER --------
-








Custom script: if udg_ErrorSound == null then
-








Custom script: set udg_ErrorSound = CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
-








Custom script: endif
-








Set ErrorFound = True
-








Set ErrorMessage = Not enough lumber.
-








Set ErrorPlayer = (Triggering player)
-








-------- ------------------------------------------------------------------------ --------
-
-







Else - Actions
-








If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-









If - Conditions
-










((player Food max) - (player Food used)) Less than Sacrifice_Food[int]
-
-









Then - Actions
-










-------- NOT ENOUGH FOOD --------
-










Custom script: if udg_ErrorSound == null then
-










Custom script: set udg_ErrorSound = CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
-










Custom script: endif
-










Set ErrorFound = True
-










For each (Integer LoopInteger) from 1 to 4, do (Actions)
-











Loop - Actions
-












If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-













If - Conditions
-














(Race of player) Equal to ErrorRace[LoopInteger]
-
-













Then - Actions
-














Set ErrorMessage = ErrorNoFood[LoopInteger]
-
-













Else - Actions
-
-
-
-










Set ErrorPlayer = (Triggering player)
-










-------- ------------------------------------------------------------------------ --------
-
-









Else - Actions
-
-
-
-
-
-
-
-


-------- ------------------------------------------------------------------------ --------
-


-------- ------------------------------------------------------------------------ --------
-


-------- CHECKS IF BUILDING IS ALREADY CREATING A UNIT --------
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




Tomb Equal to Sacrifice_Building[int]
-




(Load 1 of (Key (Triggering unit)) from SacrificeHash) Equal to True
-
-



Then - Actions
-




-------- SACRIFICE-BUILDING IS TRAINING A UNIT ALREADY! --------
-




Custom script: if udg_ErrorSound == null then
-




Custom script: set udg_ErrorSound = CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
-




Custom script: endif
-




Set ErrorFound = True
-




Set ErrorMessage = This building is currently occupied.
-




Set ErrorPlayer = (Triggering player)
-




-------- ------------------------------------------------------------------------ --------
-
-



Else - Actions
-




If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





If - Conditions
-






Tomb Equal to Sacrifice_Building[int]
-






(Load 1 of (Key (Target unit of issued order)) from SacrificeHash) Equal to True
-
-





Then - Actions
-






-------- SACRIFICE-BUILDING IS TRAINING A UNIT ALREADY! --------
-






Custom script: if udg_ErrorSound == null then
-






Custom script: set udg_ErrorSound = CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
-






Custom script: endif
-






Set ErrorFound = True
-






Set ErrorMessage = This building is currently occupied.
-






Set ErrorPlayer = (Triggering player)
-






-------- ------------------------------------------------------------------------ --------
-
-





Else - Actions
-
-
-
-


-------- ------------------------------------------------------------------------ --------
-


-------- ------------------------------------------------------------------------ --------
-


-------- IF ERROR AND TRIG.UNIT IS VILLAGER, STOPS THAT UNIT --------
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




ErrorFound Equal to True
-




Banshee forsaken Equal to Sacrifice_Victim[int]
-
-



Then - Actions
-




Unit - Pause u1
-




Unit - Order u1 to Stop
-




Unit - Unpause u1
-
-



Else - Actions
-
-


-------- ------------------------------------------------------------------------ --------
-


-------- ------------------------------------------------------------------------ --------
-


-------- SHOWS ERROR, IF ANY HAS BEEN FOUND --------
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




ErrorFound Equal to True
-
-



Then - Actions
-




Custom script: if GetLocalPlayer() == udg_ErrorPlayer then
-




Custom script: call ClearTextMessages()
-




Custom script: call DisplayTimedTextToPlayer( udg_ErrorPlayer, 0.52, 0.96, 2.00, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n|cffffcc00"+udg_ErrorMessage+"|r" )
-




Custom script: call StartSound(udg_ErrorSound)
-




Custom script: endif
-




Set ErrorFound = False
-
-



Else - Actions
-
-


-------- ------------------------------------------------------------------------ --------
-


-------- ------------------------------------------------------------------------ --------
-


-------- ------------------------------------------------------------------------ --------
-


Set u1 = No unit
-


Set u2 = No unit
-


Set order = (Order(<Empty String>))
-


Custom script: set udg_player = null
-
-
-
Sacrifice Training Check
-

Events
-


Unit - A unit Starts the effect of an ability
-
-

Conditions
-


(Current order of (Triggering unit)) Equal to (Order(sacrifice))
-


(Load 1 of (Key (Target unit of ability being cast)) from SacrificeHash) Equal to False
-
-

Actions
-


Set u1 = (Triggering unit)
-


Set u2 = (Target unit of ability being cast)
-


Set player = (Owner of u1)
-


For each (Integer LoopInteger) from 1 to Sacrifice_Index, do (Actions)
-



Loop - Actions
-




If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





If - Conditions
-






(Level of Sacrifice_Ability_Unit[LoopInteger] for u1) Equal to 1
-
-





Then - Actions
-






Set int = LoopInteger
-
-





Else - Actions
-
-
-
-


-------- ------------------------------------------------------------------------ --------
-


-------- ------------------------------------------------------------------------ --------
-


-------- CHECKS CONDITIONS --------
-


-------- a) If player has enough resources --------
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




(player Current gold) Less than Sacrifice_Gold[int]
-
-



Then - Actions
-




-------- NOT ENOUGH GOLD --------
-




Custom script: if udg_ErrorSound == null then
-




Custom script: set udg_ErrorSound = CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
-




Custom script: endif
-




Set ErrorFound = True
-




Set ErrorMessage = Not enough gold.
-




Set ErrorPlayer = (Triggering player)
-




-------- ------------------------------------------------------------------------ --------
-
-



Else - Actions
-




If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





If - Conditions
-






(player Current lumber) Less than Sacrifice_Lumber[int]
-
-





Then - Actions
-






-------- NOT ENOUGH LUMBER --------
-






Custom script: if udg_ErrorSound == null then
-






Custom script: set udg_ErrorSound = CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
-






Custom script: endif
-






Set ErrorFound = True
-






Set ErrorMessage = Not enough lumber.
-






Set ErrorPlayer = (Triggering player)
-






-------- ------------------------------------------------------------------------ --------
-
-





Else - Actions
-






If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-







If - Conditions
-








((player Food max) - (player Food used)) Less than Sacrifice_Food[int]
-
-







Then - Actions
-








-------- NOT ENOUGH FOOD --------
-








Custom script: if udg_ErrorSound == null then
-








Custom script: set udg_ErrorSound = CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
-








Custom script: endif
-








Set ErrorFound = True
-








For each (Integer LoopInteger) from 1 to 4, do (Actions)
-









Loop - Actions
-










If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-











If - Conditions
-












(Race of player) Equal to ErrorRace[LoopInteger]
-
-











Then - Actions
-












Set ErrorMessage = ErrorNoFood[LoopInteger]
-
-











Else - Actions
-
-
-
-








Set ErrorPlayer = (Triggering player)
-








-------- ------------------------------------------------------------------------ --------
-
-







Else - Actions
-
-
-
-
-
-


-------- ------------------------------------------------------------------------ --------
-


-------- b) if Building is already creating a unit --------
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




(Load 1 of (Key (Target unit of issued order)) from SacrificeHash) Equal to True
-
-



Then - Actions
-




-------- SACRIFICE-BUILDING IS TRAINING A UNIT ALREADY! --------
-




Custom script: if udg_ErrorSound == null then
-




Custom script: set udg_ErrorSound = CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
-




Custom script: endif
-




Set ErrorFound = True
-




Set ErrorMessage = This building is currently occupied.
-




Set ErrorPlayer = (Triggering player)
-




-------- ------------------------------------------------------------------------ --------
-
-



Else - Actions
-
-


-------- ------------------------------------------------------------------------ --------
-


-------- ------------------------------------------------------------------------ --------
-


-------- SHOWS ERROR, IF ANY HAS BEEN FOUND, ELSE GOES ON --------
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




ErrorFound Equal to True
-
-



Then - Actions
-




Set ErrorFound = False
-




Custom script: if GetLocalPlayer() == udg_ErrorPlayer then
-




Custom script: call ClearTextMessages()
-




Custom script: call DisplayTimedTextToPlayer( udg_ErrorPlayer, 0.52, 0.96, 2.00, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n|cffffcc00"+udg_ErrorMessage+"|r" )
-




Custom script: call StartSound(udg_ErrorSound)
-




Custom script: endif
-
-



Else - Actions
-




Hashtable - Save Handle Ofu1 as 2 of (Key (Target unit of ability being cast)) in SacrificeHash
-




Unit - Make u1 Invulnerable
-




Unit - Pause u1
-




Unit - Change ownership of u1 to Neutral Passive and Retain color
-




Unit - Hide u1
-




-------- ------------------------------------------------------------------------ --------
-




Player - Make Dark Ranger Available for training/construction by player
-




Unit - Order u2 to train/upgrade to a Sacrifice_NewUnit[int]
-




Player - Make Dark Ranger Unavailable for training/construction by player
-




-------- ------------------------------------------------------------------------ --------
-
-
-


-------- ------------------------------------------------------------------------ --------
-


-------- ------------------------------------------------------------------------ --------
-


-------- ------------------------------------------------------------------------ --------
-


Set u1 = No unit
-


Set u2 = No unit
-


Custom script: set udg_player = null
-
-
-
Sacrifice Production Start
-

Events
-


Unit - A unit Begins an upgrade
-


Unit - A unit Begins training a unit
-
-

Conditions
-

Actions
-


Set u1 = (Triggering unit)
-


For each (Integer LoopInteger) from 1 to Sacrifice_Index, do (Actions)
-



Loop - Actions
-




If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





If - Conditions
-






Tomb Equal to Sacrifice_Building[LoopInteger]
-
-





Then - Actions
-






Hashtable - Save True as 1 of (Key (Triggering unit)) in SacrificeHash
-
-





Else - Actions
-
-
-
-


Set u1 = No unit
-
-
-
Sacrifice Production Cancel
-

Events
-


Unit - A unit Cancels an upgrade
-


Unit - A unit Cancels training a unit
-


Unit - A unit Finishes an upgrade
-
-

Conditions
-

Actions
-


Set u1 = (Triggering unit)
-


For each (Integer LoopInteger) from 1 to Sacrifice_Index, do (Actions)
-



Loop - Actions
-




If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





If - Conditions
-






Tomb Equal to Sacrifice_Building[LoopInteger]
-
-





Then - Actions
-






Hashtable - Save False as 1 of (Key (Triggering unit)) in SacrificeHash
-






If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-







If - Conditions
-








Dark Ranger Equal to Sacrifice_NewUnit[LoopInteger]
-
-







Then - Actions
-








Set player = (Owner of u1)
-








Set u2 = (Load 2 of (Key (Triggering unit)) in SacrificeHash)
-








Unit - Make u2 Vulnerable
-








Unit - Unpause u2
-








Unit - Change ownership of u2 to player and Retain color
-








Unit - Unhide u2
-








Hashtable - Save 0 as 2 of (Key (Triggering unit)) in SacrificeHash
-








Set u2 = No unit
-








Custom script: set udg_player = null
-
-







Else - Actions
-
-
-





Else - Actions
-
-
-
-


Set u1 = No unit
-
-
-
Sacrifice Production Finish
-

Events
-


Unit - A unit Finishes training a unit
-
-

Conditions
-

Actions
-


Set u1 = (Triggering unit)
-


For each (Integer LoopInteger) from 1 to Sacrifice_Index, do (Actions)
-



Loop - Actions
-




If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





If - Conditions
-






Tomb Equal to Sacrifice_Building[LoopInteger]
-
-





Then - Actions
-






Hashtable - Save False as 1 of (Key (Triggering unit)) in SacrificeHash
-






If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-







If - Conditions
-








Dark Ranger Equal to Sacrifice_NewUnit[LoopInteger]
-
-







Then - Actions
-








Set u2 = (Load 2 of (Key (Triggering unit)) in SacrificeHash)
-








Unit - Remove u2 from the game
-








Hashtable - Save 0 as 2 of (Key (Triggering unit)) in SacrificeHash
-








Set u2 = No unit
-
-







Else - Actions
-
-
-





Else - Actions
-
-
-
-


Set u1 = No unit
-
-
https://www.hiveworkshop.com/forums/members/229903-albums8238-picture99025.html
https://www.hiveworkshop.com/forums/members/229903-albums8238-picture99024.html
help of any kind is always appreciated

