[Trigger] Problem concerning Hashtables

Level 8
Joined
Nov 2, 2007
Messages
160
Hey guys
I want to use Hastables to store the target of it's movement order.

The hashtable is created and stored in a variable in the Initialisation.

This is the trigger that stores the target when the unit gets it's orders:

  • 1. Trigger
    • Ereignisse
      • Einheit - A unit enters MyRegion <gen>
    • Bedingungen
      • (Owner of (Triggering unit)) Gleich Spieler 12 (Braun)
    • Aktionen
      • Set Mylocation = (Center of MyRegion <gen>)
      • Einheit - Order (Triggering unit) to Move to Mylocation
      • Hashtabelle - Clear all child hashtables of child (Key (Triggering unit)) in Myhashtable
      • Hashtabelle - Save (X of Mylocation) as 0 of (Key (Triggering unit)) in Myhashtable
      • Hashtabelle - Save (Y of Mylocation) as 1 of (Key (Triggering unit)) in Myhashtable
      • Custom script: call RemoveLocation (udg_Mylocation)
The second should order the unit to move to that position again (when it has stopped):

  • 2. Trigger
    • Ereignisse
      • Spieler - Spieler 1 (Rot) select a unit
    • Bedingungen
      • (Owner of (Triggering unit)) Gleich Spieler 12 (Braun)
    • Aktionen
      • Set Mylocation= (Point((Load 0 of (Key (Triggering unit)) from Myhashtable), (Load 1 of (Key (Triggering unit)) from Myhashtable)))
      • Einheit - Order (Triggering unit) to Move to Mylocation
      • Custom script: call RemoveLocation(udg_Mylocation)
Now my problem is that every unit moves to the center of the map instead of their movement target stored in the hashtable when Player 1 selects it.

Dinah
 
Level 37
Joined
Mar 6, 2006
Messages
9,242
I tried to recreate your trigger, and it did work. But now I can't remember the map I tested it in. I copied your trigger 1:1, except I think I used "loc1" and "loc2" instead of "0" and "1".

The fact that the units move to the center of the playable area points to a failure in either saving or loading the location coordinates.
 
Top