• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] Spell Help

Status
Not open for further replies.
Level 11
Joined
Aug 6, 2009
Messages
697
So I was making this spell, and when I use the spell, nothing works. (This is a work in progress and was just seeing if my guy would pause, but he won't even pause.) Also, I am new to hashtables and MUI.
Nagashi:
  • Nagashi
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Nagashi
    • Actions
      • Set NagashiCaster = (Triggering unit)
      • Set NagashiAngle = (NagashiAngle + (360.00 / (Real((Integer A)))))
      • Set NagashiAngle2 = 0.00
      • Set NagashiPoint = (Position of NagashiCaster)
      • Set NagashiPoint2 = (NagashiPoint offset by NagashiLoops towards NagashiAngle degrees)
      • Set NagashiTime = 6.00
      • Set NagashiLoops = 100.00
      • Hashtable - Save NagashiAngle as 0 of (Key (Triggering unit)) in NagashiHash
      • Hashtable - Save NagashiAngle2 as 1 of (Key (Triggering unit)) in NagashiHash
      • Hashtable - Save NagashiTime as 2 of (Key (Triggering unit)) in NagashiHash
      • Hashtable - Save Handle OfNagashiCaster as 3 of (Key (Triggering unit)) in NagashiHash
      • Hashtable - Save Handle OfNagashiPoint as 4 of (Key (Triggering unit)) in NagashiHash
      • Hashtable - Save Handle OfNagashiPoint2 as 5 of (Key (Triggering unit)) in NagashiHash
      • Hashtable - Save NagashiLoops as 6 of (Key (Triggering unit)) in NagashiHash
      • Unit - Pause NagashiCaster
      • Unit Group - Add NagashiCaster to NagashiDummyGroup
Nagashi Loop:
  • Nagashi Loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in NagashiDummyGroup and do (Actions)
        • Loop - Actions
          • Set NagashiAngle = (Load 0 of (Key (Picked unit)) from NagashiHash)
          • Set NagashiAngle2 = (Load 1 of (Key (Picked unit)) from NagashiHash)
          • Set NagashiTime = (Load 2 of (Key (Picked unit)) from NagashiHash)
          • Set NagashiCaster = (Load 3 of (Key (Picked unit)) in NagashiHash)
          • Set NagashiPoint = (Load 4 of (Key (Picked unit)) in NagashiHash)
          • Set NagashiPoint2 = (Load 5 of (Key (Picked unit)) in NagashiHash)
          • Set NagashiLoops = (Load 6 of (Key (Picked unit)) from NagashiHash)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • NagashiTime Greater than 0.00
            • Then - Actions
              • For each (Integer A) from 0 to 19, do (Actions)
                • Loop - Actions
                  • Set NagashiAngle2 = (Load 1 of (Key (Picked unit)) from NagashiHash)
                  • Unit - Create 1 Nagashi Dummy for (Owner of NagashiCaster) at NagashiPoint2 facing Default building facing degrees
                  • Unit - Add a 6.00 second Generic expiration timer to (Last created unit)
                  • Set NagashiAngle = (Load 0 of (Key (Picked unit)) from NagashiHash)
              • Hashtable - Save (NagashiTime - 1.00) as 2 of (Key (Picked unit)) in NagashiHash
              • Hashtable - Save (NagashiLoops + 100.00) as 6 of (Key (Picked unit)) in NagashiHash
            • Else - Actions
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in NagashiHash
              • Unit Group - Remove (Picked unit) from NagashiDummyGroup
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Nagashi:

1- Create an Integer Variable for (Key (Triggering Unit). I'll call it "ID" to avoid repeating actions. Reduce parentheses as much as you can this way.

2- You don't need to set everything in variables before saving it into hashtable. You can save 0.00 as 1 of ID instead of creating NagashiAngle2 = 0.00 and then save the variable as 1 of ID. This is up to you if you want to improve or not.

3- "Set NagashiAngle = (NagashiAngle + (360.00 / (Real((Integer A)))))" has no sense at all, since you're not using Integer A anywhere. It basically returns "0" Being then "NagashiAngle + 360 / 0" which would be "NagashiAngle". The game saves the value at the moment, not the formula for ulter use in other triggers.

4- You should turn on the trigger after adding the unit to the NagashiDummyGroup and check in the loop if there's someone in the Group, to turn it off if there's no one there.

5- You have to remove the points after saving them in the Hash, otherwise they will leak and your game will prone to lag eventually.

  • Nagashi
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Nagashi
    • Actions
      • Set NagashiCaster = (Triggering unit)
      • Custom script: set udg_ID = GetHandleId(udg_NagashiCaster)
      • Set NagashiAngle = (NagashiAngle + (360.00 / (Real((Integer A)))))
      • Set NagashiAngle2 = 0.00
      • Set NagashiPoint = (Position of NagashiCaster)
      • Set NagashiPoint2 = (NagashiPoint offset by NagashiLoops towards NagashiAngle degrees)
      • Set NagashiTime = 6.00
      • Set NagashiLoops = 100.00
      • Hashtable - Save NagashiAngle as 0 of ID in NagashiHash
      • Hashtable - Save NagashiAngle2 as 1 of ID in NagashiHash
      • Hashtable - Save NagashiTime as 2 of ID in NagashiHash
      • Hashtable - Save Handle OfNagashiCaster as 3 of ID in NagashiHash
      • Hashtable - Save Handle OfNagashiPoint as 4 of ID in NagashiHash
      • Hashtable - Save Handle OfNagashiPoint2 as 5 of ID in NagashiHash
      • Hashtable - Save NagashiLoops as 6 of ID in NagashiHash
      • Unit - Pause NagashiCaster
      • Unit Group - Add NagashiCaster to NagashiDummyGroup
      • Custom script: call RemoveLocation(udg_NagashiPoint1)
      • Custom script: call RemoveLocation(udg_NagashiPoint2)
1- The same thing with the ID to replace (Key (Picked Unit))

2- Same thing about Point removing

3- There's no "Unpause" unit after removing from the group

Nagashi Loop:
  • Nagashi Loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in NagashiDummyGroup and do (Actions)
        • Loop - Actions
          • Custom script: set udg_ID = GetHandleId(GetEnumUnit())
          • Set NagashiAngle = (Load 0 of ID from NagashiHash)
          • Set NagashiAngle2 = (Load 1 of ID from NagashiHash)
          • Set NagashiTime = (Load 2 of ID from NagashiHash)
          • Set NagashiCaster = (Load 3 of ID in NagashiHash)
          • Set NagashiPoint = (Load 4 of ID in NagashiHash)
          • Set NagashiPoint2 = (Load 5 of ID in NagashiHash)
          • Set NagashiLoops = (Load 6 of ID from NagashiHash)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • NagashiTime Greater than 0.00
            • Then - Actions
              • For each (Integer A) from 0 to 19, do (Actions)
                • Loop - Actions
                  • Set NagashiAngle2 = (Load 1 of ID from NagashiHash) <-- You already did this
                  • Unit - Create 1 Nagashi Dummy for (Owner of NagashiCaster) at NagashiPoint2 facing Default building facing degrees
                  • Unit - Add a 6.00 second Generic expiration timer to (Last created unit)
                  • Set NagashiAngle = (Load 0 of ID from NagashiHash) <-- You already did this before.
              • Hashtable - Save (NagashiTime - 1.00) as 2 of ID in NagashiHash
              • Hashtable - Save (NagashiLoops + 100.00) as 6 of ID in NagashiHash
            • Else - Actions
              • Hashtable - Clear all child hashtables of child ID in NagashiHash
              • Unit - Unpause (Picked Unit)
              • Unit Group - Remove (Picked unit) from NagashiDummyGroup
          • Custom script: call RemoveLocation(udg_NagashiPoint1)
          • Custom script: call RemoveLocation(udg_NagashiPoint2)
 
Level 11
Joined
Aug 6, 2009
Messages
697
The unit group I added at the bottom of the loop trigger is supposed to remove every unit in that group with that instance, but that doesn't seem to be happening. Any ideas?


Nagashi:
  • Nagashi
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Nagashi
    • Actions
      • Set NagashiCaster = (Triggering unit)
      • Custom script: set udg_ID = GetHandleId (udg_NagashiCaster)
      • Set NagashiAngle2 = 0.00
      • Set NagashiPoint = (Position of NagashiCaster)
      • Set NagashiTime = 3.00
      • Set NagashiLoops = 0.00
      • Set NagashiAngle = 0.00
      • Hashtable - Save NagashiAngle as 0 of ID in NagashiHash
      • Hashtable - Save NagashiAngle2 as 1 of ID in NagashiHash
      • Hashtable - Save NagashiTime as 2 of ID in NagashiHash
      • Hashtable - Save Handle OfNagashiCaster as 3 of ID in NagashiHash
      • Hashtable - Save Handle OfNagashiPoint as 4 of ID in NagashiHash
      • Hashtable - Save NagashiLoops as 6 of ID in NagashiHash
      • Unit - Pause NagashiCaster
      • Unit Group - Add NagashiCaster to NagashiDummyGroup
Loop:
  • Nagashi Loop
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in NagashiDummyGroup and do (Actions)
        • Loop - Actions
          • Custom script: set udg_ID = GetHandleId(GetEnumUnit())
          • Set NagashiAngle = (Load 0 of ID from NagashiHash)
          • Set NagashiAngle2 = (Load 1 of ID from NagashiHash)
          • Set NagashiTime = (Load 2 of ID from NagashiHash)
          • Set NagashiCaster = (Load 3 of ID in NagashiHash)
          • Set NagashiPoint = (Load 4 of ID in NagashiHash)
          • Set NagashiPoint2 = (Load 5 of ID in NagashiHash)
          • Set NagashiLoops = (Load 6 of ID from NagashiHash)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • NagashiTime Greater than 0.00
            • Then - Actions
              • For each (Integer A) from 1 to 30, do (Actions)
                • Loop - Actions
                  • Set NagashiPoint2 = (NagashiPoint offset by NagashiLoops towards NagashiAngle degrees)
                  • Hashtable - Save Handle OfNagashiPoint2 as 5 of ID in NagashiHash
                  • Unit - Create 1 Nagashi Dummy for (Owner of NagashiCaster) at NagashiPoint2 facing Default building facing degrees
                  • Set NagashiAngle = (NagashiAngle + (360.00 / 30.00))
                  • Hashtable - Save NagashiAngle as 0 of ID in NagashiHash
                  • Unit Group - Add (Last created unit) to DummyRemoveGroup
              • Hashtable - Save (NagashiTime - 0.50) as 2 of ID in NagashiHash
              • Hashtable - Save (NagashiLoops + 100.00) as 6 of ID in NagashiHash
            • Else - Actions
              • Hashtable - Clear all child hashtables of child ID in NagashiHash
              • Unit Group - Remove (Picked unit) from NagashiDummyGroup
              • Unit Group - Pick every unit in DummyRemoveGroup and do (Unit - Remove (Picked unit) from the game)
              • Unit - Unpause NagashiCaster
 
Status
Not open for further replies.
Top