Hey people
I made following triggers -> issues follow below
1. The trigger does not seem to recognize my Unit Group variable "UG_Footman" (only works when I dont use my varibale)
2. general question: I have no idea about hashtables. How do I save a handle from a location and load it up in another trigger?? My plan is to have a building which spawns units, that are bound to said building and its location (via hashtable) and make the units move back to said building after the attack is over. (+ the location is an array if that matters)
I dont know how to load the saved handle (if it even is the right one) accordingly in the other trigger (higlighted above).
I made following triggers -> issues follow below
-
Spawn
-
Events
- Unit - A unit Finishes construction
-
Conditions
- (Unit-type of (Triggering unit)) Equal to Farm
-
Actions
- Set VariableSet BuildingLoc = (Position of (Triggering unit))
- Set VariableSet RandomReg = (Region centered at BuildingLoc with size (700.00, 700.00))
- Set VariableSet SpawnLoc[0] = (Random point in RandomReg)
- Set VariableSet SpawnLoc[1] = (Random point in RandomReg)
- Set VariableSet SpawnLoc[2] = (Random point in RandomReg)
- Wait 2.00 seconds
- Unit - Create 1 Footman for Player 1 (Red) at SpawnLoc[0] facing Default building facing degrees
- Hashtable - Save Handle OfSpawnLoc[0] as (Key (Last created unit).) of 0 in Hashtable_Patrol. (I though of something like this, but I really have no idea :c )
- Unit - Change ownership of (Last created unit) to Player 11 (Dark Green) and Retain color
- Wait 2.00 seconds
- Unit - Create 1 Footman for Player 1 (Red) at SpawnLoc[1] facing Default building facing degrees
- Hashtable - Save Handle OfSpawnLoc[1] as (Key (Last created unit).) of 1 in Hashtable_Patrol.
- Unit - Change ownership of (Last created unit) to Player 11 (Dark Green) and Retain color
- Wait 2.00 seconds
- Unit - Create 1 Footman for Player 1 (Red) at SpawnLoc[2] facing Default building facing degrees
- Hashtable - Save Handle OfSpawnLoc[2] as (Key (Last created unit).) of 2 in Hashtable_Patrol.
- Unit - Change ownership of (Last created unit) to Player 11 (Dark Green) and Retain color
-
Events
-
Untitled Trigger 001
-
Events
- Map initialization
- Conditions
-
Actions
- Set VariableSet UG_Footman = (Units of type Footman)
-
Events
-
WanderCheck
-
Events
- Time - Every 0.05 seconds of game time
- Conditions
-
Actions
-
Unit Group - Pick every unit in UG_Footman and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Current order of (Picked unit)) Equal to (Order(attack))
-
Then - Actions
- Unit - Remove Wander (Neutral) from (Picked unit)
-
Else - Actions
- Unit - Order (Picked unit) to Move To (Load (Key (Picked unit).) of 0 in Hashtable_Patrol.) (heres the part where I don't know how to properly load my saved handle)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
-
Then - Actions
- Unit - Add Wander (Neutral) to (Picked unit)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
Unit Group - Pick every unit in UG_Footman and do (Actions)
-
Events
1. The trigger does not seem to recognize my Unit Group variable "UG_Footman" (only works when I dont use my varibale)
2. general question: I have no idea about hashtables. How do I save a handle from a location and load it up in another trigger?? My plan is to have a building which spawns units, that are bound to said building and its location (via hashtable) and make the units move back to said building after the attack is over. (+ the location is an array if that matters)
I dont know how to load the saved handle (if it even is the right one) accordingly in the other trigger (higlighted above).
Last edited: