• 🏆 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] Harshtable problem (mistake at making mui)

Status
Not open for further replies.
Level 9
Joined
Jan 23, 2008
Messages
384
hi !
i tried to make 2 simple knockback spells using what i have learned about harshtables but something its not right the spells are not mui and i cannot figure out why ... so please any help is welcomed ! :p

Here is the trigger:

  • Push
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Storm Bolt
    • Actions
      • Hashtable - Save Handle Of(Triggering unit) as 0 of (Key (Target unit of ability being cast)) in HST
      • Set C_Unit[1] = (Load 0 of (Key (Target unit of ability being cast)) in HST)
      • Hashtable - Save Handle Of(Target unit of ability being cast) as 1 of (Key (Target unit of ability being cast)) in HST
      • Set T_Unit[1] = (Load 1 of (Key (Target unit of ability being cast)) in HST)
      • Hashtable - Save Handle Of(Position of C_Unit[1]) as 2 of (Key (Target unit of ability being cast)) in HST
      • Set Z_Lok[1] = (Load 2 of (Key (Target unit of ability being cast)) in HST)
      • Hashtable - Save Handle Of(Position of T_Unit[1]) as 3 of (Key (Target unit of ability being cast)) in HST
      • Set Z_Lok[2] = (Load 3 of (Key (Target unit of ability being cast)) in HST)
      • Hashtable - Save (Angle from Z_Lok[1] to Z_Lok[2]) as 4 of (Key (Target unit of ability being cast)) in HST
      • Set Z_Angle[1] = (Load 4 of (Key (Target unit of ability being cast)) from HST)
      • Hashtable - Save 25.00 as 5 of (Key (Target unit of ability being cast)) in HST
      • Set Z_Angle[2] = (Load 5 of (Key (Target unit of ability being cast)) from HST)
      • Hashtable - Save (30.00 + (70.00 x (Real((Level of Storm Bolt for C_Unit[1]))))) as 6 of (Key (Target unit of ability being cast)) in HST
      • Set Z_Angle[3] = (Load 6 of (Key (Target unit of ability being cast)) from HST)
      • Unit - Pause T_Unit[1]
      • Trigger - Turn on ActPush <gen>
      • Wait 0.50 seconds
      • Trigger - Turn off ActPush <gen>
      • Unit - Cause C_Unit[1] to damage T_Unit[1], dealing Z_Angle[3] damage of attack type Chaos and damage type Normal
      • Unit - Unpause T_Unit[1]
      • Hashtable - Clear all child hashtables of child (Key (Target unit of ability being cast)) in HST
      • Custom script: call RemoveLocation(udg_Z_Lok[1])
      • Custom script: call RemoveLocation(udg_Z_Lok[2])
And the loop trigger is :


  • ActPush
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Hashtable - Save Handle Of(Z_Lok[2] offset by Z_Angle[2] towards Z_Angle[1] degrees) as 7 of (Key (Target unit of ability being cast)) in HST
      • Set Z_Lok[3] = (Load 7 of (Key (Target unit of ability being cast)) in HST)
      • Hashtable - Save (25.00 + Z_Angle[2]) as 8 of (Key (Target unit of ability being cast)) in HST
      • Set Z_Angle[2] = (Load 8 of (Key (Target unit of ability being cast)) from HST)
      • Unit - Move T_Unit[1] instantly to Z_Lok[3]
      • Special Effect - Create a special effect at Z_Lok[3] using Abilities\Spells\Human\FlakCannons\FlakTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation(udg_Z_Lok[3])
Ty ! i posted the map here so you could test it yourself !
 

Attachments

  • Work.w3x
    21.1 KB · Views: 46
Level 37
Joined
Mar 6, 2006
Messages
9,240
Just by looking at it quickly, I can tell you that it's the wait that causes it to be non-MUI.

Remove the wait and turn off trigger in the first trigger. Add "target unit of ability being cast" to a unit group.

In the second trigger, pick all units in that group and do the actions.
When all actions are done for the unit, remove it from the unit group and clear child hashtables. In the end of the trigger, check if the unit group is empty and if it is, turn of the trigger.

You can save 50 as a real, and then reduce it by 2 with every loop. That works as a timer, and when it hits 0, you know that 0.5 seconds has passed and you can damage and unpause the unit.

Why do you save the things in hashtable, and then load them? Just use Set C_Unit[1] = (triggering unit) for example.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
It's MUI now. I replaced

save 0 as...
save 1 as..

with something more descriptive, like speed, damage, angle etc.

I also remove a lot of unnecessary stuff.

You could set picked unit to a variable and use that instead of using picked unit in the second trigger.
 

Attachments

  • Work.w3x
    22.2 KB · Views: 57
Last edited:
Status
Not open for further replies.
Top