• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Hashtable: Location is not saved correctly

Status
Not open for further replies.
Level 2
Joined
Jun 23, 2010
Messages
8
Hi.

I'm working on some small triggers, which should order a unit to move to its spawnpoint if it runs to far away from his spawnpoint (greater than 1000).
So I tryed to save the locationhandle of units when they enter the map in my hastable.

I made some function to show where the stored location is and find out that it is not saved correctly. After hours of testing and searching for the reason why my saved loaction isn't identical with the units location I'm asking you for help.

  • MonsterStoreLoc
    • Ereignisse
      • Einheit - A unit enters (Playable map area)
    • Bedingungen
      • Or - Any (Conditions) are true
        • Bedingungen
          • (Owner of (Triggering unit)) Gleich Spieler 12 (Braun)
          • (Owner of (Triggering unit)) Gleich Spieler 9 (Grau)
      • ((Triggering unit) has buff Unverwundbar) Gleich False
    • Aktionen
      • Hashtabelle - Save Handle Of(Position of (Triggering unit)) as (Key Loc) of (Key (Triggering unit)) in MonsterHash
      • Video - Ping minimap for (All players) at (Load (Key Loc) of (Key (Triggering unit)) in (MonsterHash)) for 1.00 seconds, using a Einfach ping of color (100.00%, 0.00%, 0.00%)
      • Video - Ping minimap for (All players) at (Position of (Triggering unit)) for 1.00 seconds
If you need more information ask for it.

Thank you for help,
Skyfire

Edit: Position will be still wrong :(
Added triggers, which I forgot:
  • MonsterReactionOnDamage
    • Ereignisse
      • Spiel - GDD_Event becomes Gleich 0.00
    • Bedingungen
      • Or - Any (Conditions) are true
        • Bedingungen
          • (Owner of GDD_DamagedUnit) Gleich Spieler 12 (Braun)
          • (Owner of GDD_DamagedUnit) Gleich Spieler 9 (Grau)
    • Aktionen
      • Custom script: set bj_wantDestroyGroup = true
      • Einheitengruppe - Pick every unit in (Units owned by (Owner of GDD_DamagedUnit) matching ((Matching unit) Gleich GDD_DamagedUnit)) and do (Actions)
        • Schleifen - Aktionen
          • Set MonsterTempLoc = (Load (Key Loc) of (Key (Picked unit)) in MonsterHash)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Bedingungen
          • (Distance between MonsterTempLoc and (Position of GDD_DamagedUnit)) Kleiner gleich 600.00
          • (Current order of GDD_DamagedUnit) Gleich (Order(<Leerer String>))
        • 'THEN'-Aktionen
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • 'IF'-Bedingungen
              • (GDD_DamageSource has buff Unverwundbar) Gleich True
            • 'THEN'-Aktionen
              • Einheit - Order GDD_DamagedUnit to Angreifen/Bewegen nach (Position of Hero[(Player number of (Owner of GDD_DamageSource))])
              • Spiel - Display to (All players) the text: Order Attack (Hero)
            • 'ELSE'-Aktionen
              • Einheit - Order GDD_DamagedUnit to Angreifen/Bewegen nach (Position of GDD_DamageSource)
              • Spiel - Display to (All players) the text: Order Attack (Sourc...
        • 'ELSE'-Aktionen
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • 'IF'-Bedingungen
              • (Distance between MonsterTempLoc and (Position of GDD_DamagedUnit)) Größer gleich 1000.00
            • 'THEN'-Aktionen
              • Einheit - Order GDD_DamagedUnit to Bewegen nach MonsterTempLoc
              • Spiel - Display to (All players) the text: Order Back (OnDamag...
            • 'ELSE'-Aktionen
      • Custom script: call RemoveLocation (udg_MonsterTempLoc)
  • MonsterReactionOnAttack
    • Ereignisse
      • Einheit - A unit Wird angegriffen
    • Bedingungen
      • Or - Any (Conditions) are true
        • Bedingungen
          • (Owner of (Attacking unit)) Gleich Spieler 12 (Braun)
          • (Owner of (Attacking unit)) Gleich Spieler 9 (Grau)
    • Aktionen
      • Einheitengruppe - Pick every unit in (Units owned by (Owner of (Attacking unit)) matching ((Matching unit) Gleich (Attacking unit))) and do (Actions)
        • Schleifen - Aktionen
          • Set MonsterTempLoc = (Load (Key Loc) of (Key (Picked unit)) in MonsterHash)
          • Spiel - Display to (All players) the text: (Unit which is used for Loc + (Name of (Picked unit)))
          • Video - Ping minimap for (All players) at (Position of (Picked unit)) for 1.00 seconds, using a Einfach ping of color (100.00%, 0.00%, 0.00%)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Bedingungen
          • (Distance between MonsterTempLoc and (Position of (Attacking unit))) Größer gleich 1000.00
        • 'THEN'-Aktionen
          • Einheit - Order (Attacking unit) to Bewegen nach MonsterTempLoc
          • Spiel - Display to (All players) the text: (Order Back (OnAttack) Distance: + (String((Distance between (Position of (Attacking unit)) and MonsterTempLoc))))
          • Video - Ping minimap for (All players) at MonsterTempLoc for 1.00 seconds, using a Einfach ping of color (100.00%, 100.00%, 100.00%)
        • 'ELSE'-Aktionen
      • Custom script: call RemoveLocation (udg_MonsterTempLoc)
Edit2: Ignore pings and text messages.
 
Last edited:
Level 2
Joined
Jun 23, 2010
Messages
8
Yes:
  • MonsterHash
    • Ereignisse
      • Map initialization
    • Bedingungen
    • Aktionen
      • Hashtabelle - Create a hashtable
      • Set MonsterHash = (Last created hashtable)
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
So the Event of "giving the Warning message to the player owning the unit" occurs onAttack and onDamamge ?

I would do with interval of 0.03 (1.00 can still be acceptable) checking the distance of each loaded starting location.
If its distance > maxDistance, order the unit to move to startingLocation.

Can the unit moved instantly to startingLocation or do you still want to order the unit to move naturally ?
 
Level 2
Joined
Jun 23, 2010
Messages
8
I thought about a permanent loop. Maybe i change it, if i need it. But the problem would be the same: Location is not correct.
And i want the unit to move naturally back.

Edit:
How to set/get coordiantes?
Can you post an example for GUI?
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Awww it should take less than 5 minutes to test the map :/

EDIT:
This test map uses Coordinates instead Locations.
It should use Coordinates because this trigger would run permanently (well, not until all unit dies in the Unit Group).
 

Attachments

  • SpawnPoint.w3x
    14.1 KB · Views: 31
Last edited:
Status
Not open for further replies.
Top