• 🏆 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 : Move dummy with after effect

Status
Not open for further replies.
Level 10
Joined
Feb 20, 2008
Messages
448
Move dummy + after effect-Hashtable

here i tryed to make a spell that mode a dummy unit(invinsible) to the point target of the spell . When the point is reach, 1 integer start and a unit should be created, than the integer become to 0 this unit die and 2 dummy unit(explosion) appear with a second integer that become to 0 to end the spell!!

my problem : there is 3 created unit : The first and the third doesn't appear at all! i tryed with few different point for the dummy nothing changed

here is the code :i also added the map for the need .

edit : My old code is in the map, i added new code which is a bit cleaner but now only the dummy move the after effect doesnt work at all : its probably a condition problem but i cannot find it right, any suggestion ?


  • DummyMove Hashtable Int
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set DummyDirtMove = (Last created hashtable)
  • DummyMove Hashtable
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to DummyMoveHashtable
    • Actions
      • Set DummyTemp = (Triggering unit)
      • -------- Just for configuration/readability --------
      • Set DummyMoveTrig = (Triggering unit)
      • Set DummyMovePoint[1] = (Position of DummyMoveTrig)
      • Set DummyMovePoint[2] = (Target point of ability being cast)
      • Set DummyMoveMaxDistance = (Distance between DummyMovePoint[1] and DummyMovePoint[2])
      • Set DummyMoveCurDistance = 0.00
      • Set DummyMoveSpeed = 50.00
      • Set DummyMoveAngle = (Angle from DummyMovePoint[1] to DummyMovePoint[2])
      • Set DummyMoveAOE = 200.00
      • Set DummyMoveCountInteger = 10
      • Set DummyMoveCountInteger2 = 10
      • Set DummyMoveBoolean = False
      • Set DummyMoveBoolean2 = False
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of (Ability being cast) for DummyMoveTrig) Equal to 1
        • Then - Actions
          • Set DummyMoveDmg = 150.00
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of (Ability being cast) for DummyMoveTrig) Equal to 2
            • Then - Actions
              • Set DummyMoveDmg = 200.00
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of (Ability being cast) for DummyMoveTrig) Greater than or equal to 3
                • Then - Actions
                  • Set DummyMoveDmg = 250.00
                • Else - Actions
      • -------- doing some action before storing all variable --------
      • Unit - Create 1 DummyUnit for (Triggering player) at DummyMovePoint[1] facing DummyMoveAngle degrees
      • Set DummyMoveDummy = (Last created unit)
      • -------- Finishing configuration --------
      • Unit - Turn collision for DummyMoveDummy Off
      • Set DummyMovePoint[3] = (Position of DummyMoveDummy)
      • -------- --------------------------- --------
      • -------- Store the values --------
      • Hashtable - Save Handle OfDummyMoveTrig as (Key unit) of (Key (Triggering unit)) in DummyDirtMove
      • Hashtable - Save Handle OfDummyMoveDummy as (Key target) of (Key (Triggering unit)) in DummyDirtMove
      • Hashtable - Save Handle OfDummyMovePoint[2] as (Key loc1) of (Key (Triggering unit)) in DummyDirtMove
      • Hashtable - Save DummyMoveCountInteger as (Key integer) of (Key (Triggering unit)) in DummyDirtMove
      • Hashtable - Save DummyMoveCountInteger2 as (Key integer2) of (Key (Triggering unit)) in DummyDirtMove
      • Hashtable - Save DummyMoveBoolean as (Key boolean) of (Key (Triggering unit)) in DummyDirtMove
      • Hashtable - Save DummyMoveBoolean2 as (Key boolean2) of (Key (Triggering unit)) in DummyDirtMove
      • Hashtable - Save DummyMoveAOE as (Key aoe) of (Key (Triggering unit)) in DummyDirtMove
      • Hashtable - Save DummyMoveCurDistance as (Key curdistance) of (Key (Triggering unit)) in DummyDirtMove
      • Hashtable - Save DummyMoveMaxDistance as (Key maxdistance) of (Key (Triggering unit)) in DummyDirtMove
      • Hashtable - Save DummyMoveDmg as (Key damage) of (Key (Triggering unit)) in DummyDirtMove
      • Hashtable - Save DummyMoveSpeed as (Key speed) of (Key (Triggering unit)) in DummyDirtMove
      • Hashtable - Save DummyMoveAngle as (Key angle) of (Key (Triggering unit)) in DummyDirtMove
      • Unit Group - Add (Triggering unit) to DummyMoveGroupUnits
      • 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 DummyDirtMove)
              • Set DummyMoveDummy = (Load (Key target) of (Key (Picked unit)) in DummyDirtMove)
              • Set DummyMoveDmg = (Load (Key damage) of (Key (Picked unit)) from DummyDirtMove)
              • Set DummyMoveSpeed = (Load (Key speed) of (Key (Picked unit)) from DummyDirtMove)
              • Set DummyMoveAOE = (Load (Key aoe) of (Key (Picked unit)) from DummyDirtMove)
              • Set DummyMoveCurDistance = (Load (Key curdistance) of (Key (Picked unit)) from DummyDirtMove)
              • Set DummyMoveMaxDistance = (Load (Key maxdistance) of (Key (Picked unit)) from DummyDirtMove)
              • Set DummyMoveAngle = (Load (Key angle) of (Key (Picked unit)) from DummyDirtMove)
              • Set DummyMoveCountInteger = (Load (Key integer) of (Key (Picked unit)) from DummyDirtMove)
              • Set DummyMoveCountInteger2 = (Load (Key integer2) of (Key (Picked unit)) from DummyDirtMove)
              • Set DummyMoveBoolean = (Load (Key boolean) of (Key (Picked unit)) from DummyDirtMove)
              • Set DummyMoveBoolean2 = (Load (Key boolean2) of (Key (Picked unit)) from DummyDirtMove)
              • Set DummyMoveXtraUnit = (Load (Key Xunit) of (Key (Picked unit)) in DummyDirtMove)
              • -------- here we set leaks --------
              • -------- ------------------------------------------------------------------- --------
              • -------- ------------------------------------------------------------------- --------
              • Set DummyMovePoint[4] = (Position of DummyMoveDummy)
              • Set DummyMovePoint[5] = (DummyMovePoint[4] offset by DummyMoveSpeed towards DummyMoveAngle degrees)
              • Set DummyMovePoint[6] = (Position of DummyMoveXtraUnit)
              • Set DummyMovePoint[8] = (Position of DummyMoveTrig)
              • -------- ------------------------------------------------------------------- --------
              • -------- ------------------------------------------------------------------- --------
              • -------- if distance greater than max distance we turn boolean true --------
              • -------- ------------------------------------------------------------------- --------
              • -------- if condition are true spider suposed to appear lol --------
              • -------- ------------------------------------------------------------------- --------
              • -------- ------------------------------------------------------------------- --------
              • -------- ------------------------------------------------------------------- --------
              • -------- here we move the dummy unit and add speccial effect on it --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DummyMoveCurDistance Less than or equal to DummyMoveMaxDistance
                • Then - Actions
                  • -------- Move the unit and update time remaining --------
                  • Unit - Move DummyMoveDummy instantly to DummyMovePoint[5], facing DummyMoveAngle degrees
                  • Special Effect - Create a special effect at DummyMovePoint[5] using Abilities\Weapons\AncientProtectorMissile\AncientProtectorMissile.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Hashtable - Save (DummyMoveCurDistance + DummyMoveSpeed) as (Key curdistance) of (Key (Picked unit)) in DummyDirtMove
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • DummyMoveCurDistance Greater than or equal to DummyMoveMaxDistance
                    • Then - Actions
                      • Set DummyMoveBoolean = True
                      • Hashtable - Save DummyMoveBoolean as (Key boolean) of (Key (Picked unit)) in DummyDirtMove
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • DummyMoveCurDistance Less than or equal to DummyMoveMaxDistance
                      • DummyMoveBoolean Equal to True
                      • DummyMoveCountInteger Greater than 0
                    • Then - Actions
                      • Game - Display to (All players) the text: a
                      • Hashtable - Save (DummyMoveCountInteger - 1) as (Key integer) of (Key (Picked unit)) in DummyDirtMove
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • DummyMoveCurDistance Less than or equal to DummyMoveMaxDistance
                      • DummyMoveBoolean2 Equal to True
                    • Then - Actions
                      • Game - Display to (All players) the text: b
                      • Hashtable - Save (DummyMoveCountInteger2 - 1) as (Key integer) of (Key (Picked unit)) in DummyDirtMove
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • DummyMoveCurDistance Greater than or equal to DummyMoveMaxDistance
                      • DummyMoveBoolean2 Equal to False
                      • DummyMoveCountInteger Equal to 9
                    • Then - Actions
                      • Unit - Create 1 Akatsuki Artist for (Owner of DummyMoveTrig) at DummyMovePoint[4] facing (Facing of DummyMoveTrig) degrees
                      • Set DummyMoveXtraUnit = (Last created unit)
                      • Hashtable - Save Handle OfDummyMoveXtraUnit as (Key Xunit) of (Key (Picked unit)) in DummyDirtMove
                      • Set DummyMoveBoolean2 = True
                      • Hashtable - Save DummyMoveBoolean2 as (Key boolean2) of (Key (Picked unit)) in DummyDirtMove
                      • Game - Display to (All players) the text: trigger is gay
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • DummyMoveCurDistance Greater than or equal to DummyMoveMaxDistance
                      • DummyMoveBoolean2 Equal to True
                      • DummyMoveCountInteger2 Equal to 1
                    • Then - Actions
                      • Game - Display to (All players) the text: bomb
                      • Unit - Create 1 dummy explosion for (Owner of DummyMoveTrig) at DummyMovePoint[6] facing DummyMovePoint[8]
                      • Unit Group - Add (Last created unit) to DummyMoveGroupEnnemy
                      • Unit - Create 1 dummy explosion3 for (Owner of DummyMoveTrig) at DummyMovePoint[6] facing DummyMovePoint[8]
                      • Unit Group - Add (Last created unit) to DummyMoveGroupEnnemy
                      • Unit Group - Pick every unit in DummyMoveGroupEnnemy and do (Actions)
                        • Loop - Actions
                          • Animation - Change (Picked unit)'s animation speed to 400.00% of its original speed
                      • Unit - Remove DummyMoveXtraUnit from the game
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • DummyMoveCurDistance Greater than or equal to DummyMoveMaxDistance
                      • DummyMoveCountInteger2 Equal to 0
                    • Then - Actions
                      • Game - Display to (All players) the text: end of spell
                      • Set DummyMoveBoolean = False
                      • Set DummyMoveBoolean2 = False
                      • Unit - Remove DummyMoveDummy from the game
                      • Set DummyMoveGroupEnnemyCheck = (Units within DummyMoveAOE of DummyMovePoint[6] 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
                      • -------- FIX DMG HERE --------
                      • -------- FIX DMG HERE --------
                      • -------- FIX DMG HERE --------
                      • Unit Group - Pick every unit in DummyMoveGroupEnnemyCheck and do (Actions)
                        • Loop - Actions
                          • Unit - Cause DummyMoveTrig to damage (Target unit of ability being cast), dealing DummyMoveDmg damage of attack type Spells and damage type Normal
                      • Unit Group - Pick every unit in DummyMoveGroupEnnemy and do (Actions)
                        • Loop - Actions
                          • Unit - Remove (Picked unit) from the game
                      • Special Effect - Create a special effect at DummyMovePoint[5] using A-Bomb.mdx
                      • Special Effect - Destroy (Last created special effect)
                      • Unit - Remove DummyMoveXtraUnit from the game
                      • -------- spell is done, clean up & lastest option --------
                      • Custom script: call RemoveLocation(udg_DummyMovePoint[9])
                      • Unit Group - Remove all units of DummyMoveGroupEnnemy from DummyMoveGroupEnnemy
                      • Unit Group - Remove all units of DummyMoveGroupEnnemyCheck from DummyMoveGroupEnnemyCheck
                      • Unit Group - Remove all units of DummyMoveGroupUnits from DummyMoveGroupUnits
                      • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in DummyDirtMove
                    • Else - Actions
              • -------- ------------------------------------------------------------------- --------
              • -------- ------------------------------------------------------------------- --------
              • -------- ------------------------------------------------------------------- --------
              • Custom script: call RemoveLocation(udg_DummyMovePoint[4])
              • Custom script: call RemoveLocation(udg_DummyMovePoint[5])
              • Custom script: call RemoveLocation(udg_DummyMovePoint[6])
              • Custom script: call RemoveLocation(udg_DummyMovePoint[8])
 

Attachments

  • Request shinb.w3x
    158.1 KB · Views: 49
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,240
You do this:
  • Hashtable - Save Handle OfDummyMovePoint[2] as (Key loc1) of (Key (Target point of ability being cast)) in DummyDirtMove
and then in the same trigger:
  • Custom script: call RemoveLocation(udg_DummyMovePoint[2])
and the location is gone and can't be used anymore. Don't remove it until you don't need it anymore.

Why are you using the target point of... there? Shouldn't it be <last created unit>?

Picked unit in the "starts the effect" trigger? There's no picked unit.
 
Level 10
Joined
Feb 20, 2008
Messages
448
You do this:
  • Hashtable - Save Handle OfDummyMovePoint[2] as (Key loc1) of (Key (Target point of ability being cast)) in DummyDirtMove
and then in the same trigger:
  • Custom script: call RemoveLocation(udg_DummyMovePoint[2])
and the location is gone and can't be used anymore. Don't remove it until you don't need it anymore.

Why are you using the target point of... there? Shouldn't it be <last created unit>?

Picked unit in the "starts the effect" trigger? There's no picked unit.


-for the location i should remove it when the spell is end right ? mean i dont need it anymore!

-i use target point of ability becuz the dummy finish to move where the point is : i use the point to calculate the max distance between start & finish point.
if i use last created unit its wont probably fit becuz the unit have to move to this point no ?

-should i replace target of ... by last created unit ?

there the first reason why i do hate using hashtable function, in Dynamic indexing i wouldnt have this problem probably >.>. i have read the hashtable tutorial so much time : its didnt helped me much, i still have same problem as alway for the saving handle : to put the right thing
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
-for the location i should remove it when the spell is end right ? mean i dont need it anymore!

Then why do you try to save it to a hashtable if you don't need it anymore?

-i use target point of ability becuz the dummy finish to move where the point is : i use the point to calculate the max distance between start & finish point.
if i use last created unit its wont probably fit becuz the unit have to move to this point no ?

You save the information for the target point of ability being cast. What's the point in that? You're trying to load the information for the unit, using the unit as the ID, but you have saved it using the point as the key. It won't work.

there the first reason why i do hate using hashtable function, in Dynamic indexing i wouldnt have this problem probably >.>. i have read the hashtable tutorial so much time : its didnt helped me much, i still have same problem as alway for the saving handle : to put the right thing

Hahtables work like this basically:
  • Hashtable - Save Handle Of(Last created special effect) as (Key effect_1) of (Key (Triggering unit)) in Build_Hash
Save *what do I want to save* as *the identifier I want to store/load stuff with* of *for who I want to save all this information for*

You add the last created unit to the unit group, and load info from the picked unit. So save all info for <last created unit> in the first trigger.

You trigger is a bit of a mess. I'd rather recreate it than try to fix it for you.
 
Level 10
Joined
Feb 20, 2008
Messages
448
Then why do you try to save it to a hashtable if you don't need it anymore?



You save the information for the target point of ability being cast. What's the point in that? You're trying to load the information for the unit, using the unit as the ID, but you have saved it using the point as the key. It won't work.



Hahtables work like this basically:
  • Hashtable - Save Handle Of(Last created special effect) as (Key effect_1) of (Key (Triggering unit)) in Build_Hash
Save *what do I want to save* as *the identifier I want to store/load stuff with* of *for who I want to save all this information for*

You add the last created unit to the unit group, and load info from the picked unit. So save all info for <last created unit> in the first trigger.

You trigger is a bit of a mess. I'd rather recreate it than try to fix it for you.

yes my trigger is alot messy ,i work so much on it xD : if you wanna recreate it got for it >.>hope the result will be same


edit : i was talking with my friend and he told me key handle work with the handle reference mesn in that case last created unit , Should i create new hashtable for other unit and make them work with other hashtable in the current trigger ? it would fix my problem ?
 
Last edited:
Status
Not open for further replies.
Top