- Joined
- Dec 1, 2010
- Messages
- 346
I have the following trigger:
-
snare Copy 2
-
Events
-
Time - Every 0.10 seconds of game time
-
-
Conditions
-
Actions
-
Unit Group - Pick every unit in (Units of type gaurd) and do (Actions)
-
Loop - Actions
-
Set VariableSet tempUnit = (Picked unit)
-
Set VariableSet tempUnits = (Random (2 - (Load 0 of (Key (Picked unit).) from hashtable.)) units from (Units within 200.00 of (Position of (Picked unit)) matching (((Owner of (Matching unit)) Equal to Player 21 (Coal)) and (((Matching unit) is in tauntedUnits.) Equal to False)).))
-
Hashtable - Save Handle OftempUnit as 0 of (Key (Picked unit).) in hashtable.
-
Unit Group - Pick every unit in tempUnits and do (Actions)
-
Loop - Actions
-
Hashtable - Save ((Load 0 of (Key tempUnitHandle.) from hashtable.) + 1) as 0 of (Key tempUnitHandle.) in hashtable.
-
Unit Group - Add (Picked unit) to tauntedUnits
-
Unit - Order (Picked unit) to Attack tempUnit
-
Floating Text - Create floating text that reads TAUNTED above (Picked unit) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
-
Floating Text - Change (Last created floating text): Disable permanence
-
Floating Text - Change the lifespan of (Last created floating text) to 0.50 seconds
-
-
-
-
-
-
The goal of this trigger is to make it so a unit of type gaurd, can taunt 2 nearby units once they are in his range. At any point in time the gaurd only taunts two units. Since this is for a TD type project it's important for other units to continue using their move script. The current trigger correctly taunts units but it's not limited to two. After some testing i noticed the hashtable value for the gaurd unit is not properly incrementing. I'm still very new to hashtables. And haven't used handles as a variable before, How do i fix this trigger?
[EDIT] I solved it, still looking for a way to update it to also save the units that are taunted to that specific gaurd so that i can decrease the number keeping track of how many units are taunted by that unit when the taunted unit dies.
[EDIT2] entire thing is functioning as intended now, and i'm a retard
-
Gaurd Taunt
-
Events
-
Time - Every 0.10 seconds of game time
-
-
Conditions
-
Actions
-
Unit Group - Pick every unit in (Units of type gaurd) and do (Actions)
-
Loop - Actions
-
Set VariableSet tempUnit = (Picked unit)
-
Set VariableSet tempUnitHandle = (Picked unit)
-
Set VariableSet tempUnits = (Random (2 - (Load 1 of (Key (Picked unit).) from hashtable.)) units from (Units within 200.00 of (Position of (Picked unit)) matching (((Owner of (Matching unit)) Equal to Player 21 (Coal)) and (((Matching unit) is in tauntedUnits.) Equal to False)).))
-
Unit Group - Pick every unit in tempUnits and do (Actions)
-
Loop - Actions
-
Hashtable - Save ((Load 1 of (Key tempUnitHandle.) from hashtable.) + 1) as 1 of (Key tempUnitHandle.) in hashtable.
-
Hashtable - Save Handle Of(Picked unit) as (4 - (Load 1 of (Key tempUnitHandle.) from hashtable.)) of (Key tempUnitHandle.) in hashtable.
-
Unit Group - Add (Picked unit) to tauntedUnits
-
Unit - Order (Picked unit) to Attack tempUnit
-
Floating Text - Create floating text that reads TAUNTED above (Picked unit) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
-
Floating Text - Change (Last created floating text): Disable permanence
-
Floating Text - Change the lifespan of (Last created floating text) to 0.50 seconds
-
-
-
-
-
-
Last edited: