• 🏆 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!

Wondering what I forgot o.o

Status
Not open for further replies.
Something in this isnt working properly and I cant figure out why lol I'm a hashtable noob plz help meh XD

  • Untitled Trigger 001
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units owned by Neutral Hostile) and do (Actions)
        • Loop - Actions
          • Set CustomValueCounter = (CustomValueCounter + 1)
          • Unit - Set the custom value of (Picked unit) to CustomValueCounter
      • Hashtable - Create a hashtable
      • Set ThreatTable = (Last created hashtable)
      • Set ThreatMultiplier[1] = 10
      • Set ThreatMultiplier[2] = 9
      • Player - Make Player 1 (Red) treat Player 2 (Blue) as an Ally with shared vision
      • Player - Make Player 2 (Blue) treat Player 1 (Red) as an Ally with shared vision
  • ThreatGenerating
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
    • Actions
      • Set ThreatGenerated1 = (Integer((Damage taken)))
      • Hashtable - Save (ThreatGenerated1 x ThreatMultiplier[(Player number of (Owner of (Attacking unit)))]) as (Custom value of (Attacked unit)) of (Player number of (Owner of (Attacking unit))) in ThreatTable
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Set ThreatInt = (Load (Custom value of (Attacked unit)) of (Player number of (Owner of (Attacking unit))) from ThreatTable)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ThreatInt Greater than (Load (Custom value of (Attacked unit)) of (Integer A) from ThreatTable)
            • Then - Actions
              • Unit - Order (Attacked unit) to Attack (Attacking unit)
              • Game - Display to (All players) the text: (Test: + (Name of (Owner of (Attacked unit))))
            • Else - Actions
 
Level 7
Joined
May 3, 2007
Messages
210
Explain what the problem is.. Why did you decide to suddenly stop using Triggering Unit in the second trigger. Issueing orders to neurtal hostile is, how it has been put to me: "unpredictable". In other words, there is a lot of interior stuff going on that makes ordering around units that controlled by those interior factors odd. Also, perhaps your loop is overlapping with other proc'd events sense it uses Integer A (a blizz defined global) instead of a udg.

That's all I can really comment on about right now.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Unit is attacked doesn't produce damage taken. You need to use a damage detection system.

  • Add Events to Damage Detection 1
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Set Temp_Group_1 = (Units in (Playable map area)) // pick only neutral hostile
      • Unit Group - Pick every unit in Temp_Group_1 and do (Actions)
        • Loop - Actions
          • Trigger - Add to Damage Detection <gen> the event (Unit - (Picked unit) Takes damage)
      • Custom script: call DestroyGroup(udg_Temp_Group_1)
  • Add Events to Damage Detection 2
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • *is owned by neutral hostile*
    • Actions
      • Trigger - Add to Damage Detection <gen> the event (Unit - (Triggering unit) Takes damage)

  • Damage Detection
    • Events
    • Conditions
    • Actions
      • Set Temp_Real_1 = (Damage taken)
      • *your other actions*
Modify this to suit your system.
 
Status
Not open for further replies.
Top