- Joined
- Dec 1, 2010
- Messages
- 346
The following is a part of my trigger.
I'm trying to add in a check in my trade ports system where A [Homeport] and a [destination port] can not be in the same tradenode (region based system).
I have two hashtables with the following structure:
Am i misunderstanding something about how hashtables are supposed to work?
I'm trying to add in a check in my trade ports system where A [Homeport] and a [destination port] can not be in the same tradenode (region based system).
I have two hashtables with the following structure:
Hashtable [3`]
Slot 0 = Unit ID
Slot 1 = handle of homeport
Slot 2 = Handle of target tradepoint
Slot 3 = Current order integer (0 = No order, 1 = Deliver cargo to target, 2 = Return to homeport)
slot 4 = Player number [owner]
Hashtable [1`]
Slot1 = ID
Slott2: Unit type
Slot 3 = Tradenode number
slot 4 = Gold cost
slot 5 = wood cost
slot 6 =
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
And - All (Conditions) are true
-
Conditions
- (Unit-type of (Target unit of ability being cast)) Equal to Trade Port
- (Key (Load 3 of (Key (Target unit of ability being cast).) in hashtable[1].).) Not equal to (Load 3 of (Key (Load 1 of (Key (Casting unit).) in hashtable[3].).) from hashtable[1].)
-
Conditions
-
And - All (Conditions) are true
-
Then - Actions
- Game - Display to (Player group((Owner of (Casting unit)))) the text: (String((Load 3 of (Key (Casting unit).) from hashtable[1].)))
- Game - Display to (Player group((Owner of (Casting unit)))) the text: (String((Load 3 of (Load 1 of (Key (Casting unit).) from hashtable[3].) from hashtable[1].)))
- Hashtable - Save Handle Of(Target unit of ability being cast) as 2 of (Key (Casting unit).) in hashtable[3].
- Game - Display to (Player group((Owner of (Casting unit)))) the text: Set |cff00ffffdesti...
-
Else - Actions
- Game - Display to (Player group((Owner of (Casting unit)))) the text: Target a trade post...
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Game - Display to (Player group((Owner of (Casting unit)))) the text: (String((Load 3 of (Key (Casting unit).) from hashtable[1].)))
- Game - Display to (Player group((Owner of (Casting unit)))) the text: (String((Load 3 of (Load 1 of (Key (Casting unit).) from hashtable[3].) from hashtable[1].)))
-
Untitled Trigger 003 Copy
-
Events
- Time - Every 0.10 seconds of game time
- Conditions
-
Actions
-
Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
-
Loop - Actions
- Set VariableSet tempPos = (Position of (Picked unit))
- Floating Text - Create floating text that reads (String((Load 3 of (Key (Picked unit).) from hashtable[1].))) at tempPos 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.10 seconds
- Custom script: call RemoveLocation(udg_tempPos)
-
Loop - Actions
-
Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
-
Events
- Game - Display to (Player group((Owner of (Casting unit)))) the text: (String((Load 3 of (Load 1 of (Key (Casting unit).) from hashtable[3].) from hashtable[1].)))
- (Key (Load 3 of (Key (Target unit of ability being cast).) in hashtable[1].).) Not equal to (Load 3 of (Key (Load 1 of (Key (Casting unit).) in hashtable[3].).) from hashtable[1].)
Am i misunderstanding something about how hashtables are supposed to work?