• 🏆 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] Move dummy hashtable

Status
Not open for further replies.
Level 10
Joined
Feb 20, 2008
Messages
448
my code bugg, its can use spell only once, the second time i cast spell the dummy dont move at all >.>,

here what i tried

  • DummyMove Hashtable
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to DummyMoveHashtable
    • Actions
      • -------- Just for configuration/readability --------
      • Set DummyMoveTrig = (Triggering unit)
      • Set KnockBackTarget = (Target unit of ability being cast)
      • Set DummyMovePoint[1] = (Position of DummyMoveTrig)
      • Set DummyMovePoint[2] = (Target point of ability being cast)
      • Set DummyMoveMaxDistance = 1500.00
      • Set DummyMoveCurDistance = 0.00
      • Set DummyMoveSpeed = 50.00
      • Set DummyMoveAngle = (Angle from DummyMovePoint[1] to DummyMovePoint[2])
      • Set DummyMoveAOE = 200.00
      • Set DummyMoveDmg = 200.00
      • -------- doing some action before storing all variable --------
      • Unit - Create 1 DummyUnit for (Triggering player) at DummyMovePoint[1] facing DummyMoveAngle degrees
      • -------- Finishing configuration --------
      • Set DummyMoveDummy = (Last created unit)
      • Unit - Turn collision for DummyMoveDummy Off
      • Set DummyMovePoint[3] = (Position of DummyMoveDummy)
      • -------- Store the values --------
      • Unit Group - Add DummyMoveDummy to DummyMoveGroupEnnemy
      • Hashtable - Save Handle OfDummyMoveTrig as (Key unit) of (Key (Last created unit)) in DummyMove
      • Unit Group - Add (Last created unit) to DummyMoveGroupUnits
      • Hashtable - Save Handle OfDummyMoveDummy as (Key target) of (Key (Last created unit)) in DummyMove
      • Hashtable - Save DummyMoveAOE as (Key aoe) of (Key (Last created unit)) in DummyMove
      • Hashtable - Save DummyMoveCurDistance as (Key curdistance) of (Key (Last created unit)) in DummyMove
      • Hashtable - Save DummyMoveMaxDistance as (Key maxdistance) of (Key (Last created unit)) in DummyMove
      • Hashtable - Save DummyMoveDmg as (Key damage) of (Key (Last created unit)) in DummyMove
      • Hashtable - Save DummyMoveSpeed as (Key speed) of (Key (Last created unit)) in DummyMove
      • Hashtable - Save DummyMoveAngle as (Key angle) of (Key (Last created unit)) in DummyMove
      • Custom script: call RemoveLocation(udg_DummyMovePoint[1])
      • Custom script: call RemoveLocation(udg_DummyMovePoint[2])
      • Custom script: call RemoveLocation(udg_DummyMovePoint[3])
      • If ((DummyMove Hashtable Loop <gen> is on) Equal to False) then do (Trigger - Turn on DummyMove Hashtable Loop <gen>) else do (-------- do nothing BUT DONT USE THE ACTION NEVER --------)
  • DummyMove Hashtable Loop
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in DummyMoveGroupUnits) Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Unit Group - Pick every unit in DummyMoveGroupUnits and do (Actions)
            • Loop - Actions
              • -------- Load all necessary variables stored in the Hashtable --------
              • Set DummyMoveTrig = (Load (Key unit) of (Key (Picked unit)) in DummyMove)
              • Set DummyMoveDummy = (Load (Key target) of (Key (Picked unit)) in DummyMove)
              • Set DummyMoveDmg = (Load (Key damage) of (Key (Picked unit)) from DummyMove)
              • Set DummyMoveSpeed = (Load (Key speed) of (Key (Picked unit)) from DummyMove)
              • Set DummyMoveAOE = (Load (Key aoe) of (Key (Picked unit)) from DummyMove)
              • Set DummyMoveCurDistance = (Load (Key curdistance) of (Key (Picked unit)) from DummyMove)
              • Set DummyMoveMaxDistance = (Load (Key maxdistance) of (Key (Picked unit)) from DummyMove)
              • Set DummyMoveAngle = (Load (Key angle) of (Key (Picked unit)) from DummyMove)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DummyMoveCurDistance Less than DummyMoveMaxDistance
                • Then - Actions
                  • -------- Move the unit and update time remaining --------
                  • Set DummyMovePoint[4] = (Position of DummyMoveDummy)
                  • Set DummyMovePoint[5] = (DummyMovePoint[4] offset by DummyMoveSpeed towards DummyMoveAngle degrees)
                  • Unit - Move (Picked unit) instantly to DummyMovePoint[5], facing DummyMoveAngle degrees
                  • Special Effect - Create a special effect at DummyMovePoint[5] using Abilities\Spells\Human\FlakCannons\FlakTarget.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Set DummyMoveGroupEnnemyCheck = (Units within DummyMoveAOE of DummyMovePoint[4] matching ((((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an ally of (Owner of DummyMoveDummy)) Equal to False)) and (((Matching unit) is in DummyMoveGroupEnnemy) Equal to False)) a
                  • Unit Group - Pick every unit in DummyMoveGroupEnnemyCheck and do (Actions)
                    • Loop - Actions
                      • Unit Group - Add (Picked unit) to DummyMoveGroupEnnemy
                      • Unit - Cause DummyMoveTrig to damage (Picked unit), dealing DummyMoveDmg damage of attack type Spells and damage type Normal
                  • Hashtable - Save (DummyMoveCurDistance + DummyMoveSpeed) as (Key curdistance) of (Key (Picked unit)) in DummyMove
                  • Custom script: call RemoveLocation(udg_DummyMovePoint[4])
                  • Custom script: call RemoveLocation(udg_DummyMovePoint[5])
                  • Custom script: call DestroyGroup (udg_DummyMoveGroupEnnemyCheck)
                • Else - Actions
                  • -------- spell is done, clean up --------
                  • Unit - Remove DummyMoveDummy from the game
                  • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in DummyMove
 
Last edited:
Level 28
Joined
Jan 26, 2007
Messages
4,789
Ehh, you save the handle as "picked unit", while you are picking every dummy? Bad idea, since that means you also pick other dummies and save it for them, while they have nothing to do with it.
Also, you don't save the DummyMoveCurDistance, so it will always be the same.

Try saving the hastables for "Last Created Unit" (which will be the dummy) and save the variables in the loop-trigger.
 
Level 10
Joined
Feb 20, 2008
Messages
448
Ehh, you save the handle as "picked unit", while you are picking every dummy? Bad idea, since that means you also pick other dummies and save it for them, while they have nothing to do with it.
Also, you don't save the DummyMoveCurDistance, so it will always be the same.

Try saving the hastables for "Last Created Unit" (which will be the dummy) and save the variables in the loop-trigger.

i did what you ask its work now but im note sure if i did it right plz look on trigger

and i also need to damage unit around the dummy unit
edit: i also found its glitch(not mui)
 
Last edited:
Level 28
Joined
Jan 26, 2007
Messages
4,789
There are 2 things that I notice:
  • At the end of the second trigger, you turn the trigger off - while some dummies may still be moving.
    It's best to check the amount of units in DummyMoveGroup and when that value is 0, then you can turn off the trigger.
  • Some variables (such as DummyMoveAOE, DummyMoveDmg) are unused since they are pre-set values, there is no real need to store them inside the hastable, unless you think that you might need it later (so you can adjust those values to the spell level / hero attributes / ...).

I didn't see anything special for the rest...
 
Level 10
Joined
Feb 20, 2008
Messages
448
There are 2 things that I notice:
  • At the end of the second trigger, you turn the trigger off - while some dummies may still be moving.
    It's best to check the amount of units in DummyMoveGroup and when that value is 0, then you can turn off the trigger.
  • Some variables (such as DummyMoveAOE, DummyMoveDmg) are unused since they are pre-set values, there is no real need
    to store them inside the hastable, unless you think that you might need it later (so you can adjust those values to the spell level / hero attributes / ...).

I didn't see anything special for the rest...

i try to fix trigger!! and im using dmg in Loop i will add different dmg depend level of spell!!

Edit : nvm we can close this topic
 
Status
Not open for further replies.
Top