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

need help understanding this

Status
Not open for further replies.
Level 6
Joined
Sep 27, 2008
Messages
258
If i have 2 spells like this
  • Punch
    • Events
    • Unit - A unit Starts the effect of an ability
    • Conditions
    • (Ability being cast) Equal to Punch
    • Actions
    • Set Caster = (Triggering unit)
    • Set Target = (Target unit of ability being cast)
    • Set LoopCounter = 0
    • Trigger - Turn on KnockbackMove <gen>
  • PunchMove
    • Events
    • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
    • Set TempLoc00 = (Position of Caster)
    • Set TempLoc01 = (Position of Target)
    • Set TempLoc02 = (TempLoc01 offset by 5.00 towards (Angle from TempLoc00 to TempLoc01) degrees)
    • Unit - Move Target instantly to TempLoc02
    • Custom script: call RemoveLocation(udg_TempLoc00)
    • Custom script: call RemoveLocation(udg_TempLoc01)
    • Custom script: call RemoveLocation(udg_TempLoc02)
    • Set LoopCounter = (LoopCounter + 1)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
    • LoopCounter Greater than 50
    • Then - Actions
    • Trigger - Turn off (This trigger)
    • Else - Actions
Kick
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Kick
Actions
Set Caster = (Triggering unit)
Set Target = (Target unit of ability being cast)
Set LoopCounter = 0
Trigger - Turn on KnockbackMove <gen>[/TRIGGER]
  • KickMove
    • Events
    • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
    • Set TempLoc00 = (Position of Caster)
    • Set TempLoc01 = (Position of Target)
    • Set TempLoc02 = (TempLoc01 offset by 5.00 towards (Angle from TempLoc00 to TempLoc01) degrees)
    • Unit - Move Target instantly to TempLoc02
    • Custom script: call RemoveLocation(udg_TempLoc00)
    • Custom script: call RemoveLocation(udg_TempLoc01)
    • Custom script: call RemoveLocation(udg_TempLoc02)
    • Set LoopCounter = (LoopCounter + 1)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
    • LoopCounter Greater than 50
    • Then - Actions
    • Trigger - Turn off (This trigger)
    • Else - Actions
so lets say i have 2 spells on 2 different heroes
Hero A has punch
Hero C has kick

if on the same map
Hero A uses punch on Hero B and Hero C uses kick on Hero D will it bug out since they are not Mui
or will they not since it is 2 separate triggers?
 
Level 26
Joined
Mar 19, 2008
Messages
3,140
Click here for great tutorial about MUI/hashtables.

People tend to make thier spells/abilities MUI because it enables many unit cast the same spell without bugging. Imagen it like this: each ability casted in proper MUI trigger will act like alone private spell.

Without MUI casting the same ability by differend units will make irritating actions.

Look on this:
  • Init
    • Events
      • Unit - Starts the effect of the ability
    • Conditions
      • (Ability being cast) Equal to Heal
    • Actions
      • Set Your_unit = (Target of Ability being cast)
      • Wait 6 seconds
      • Set Life of (Your_unit) to (Life of (Your_unit) + 100)
If lets say caster A casts it on given target B, and after a while (like 2-3) sec other unit C cast the same ability on another unit D, only the second one (target D) will be healed by a total amount of 200. MUI spells will call a private functions for each case (just to understand).
 
Level 6
Joined
Sep 27, 2008
Messages
258
i know if they are casting the same ability but what i am talking about is 2 different abilities Ability 1=Punch and ability 2=kick with 2 different triggers the triggers do the same thing but there are 2 different triggers one for ability 1 which is punch and 1 for ability 2 which is kick
 
Level 26
Joined
Mar 19, 2008
Messages
3,140
Both triggers intefere with each other because they share variabes. Read my previous post once again.
Unit A casts kick on Unit B
After 2 sec Unit C cats punch on Unit D

All actions will refer to unit D.
Lets review its once again:
After casting kick ability, variable Target = Target of ability being cast (kick). This stays now in memory - variable Targets points given unit (target of kick), lets say unit B. Loop turns on (refering to Target)

Now other unit cast punch on different target. Variable Target is now set to Target of ability being cast (punch). Before our variable pointed at unit B, but now by your action it will start pointing at target of punch, lets call it unit D.
Punch's loop turns on.

However Kick's loop is still runing on, each time refering to unit pointed by Target variable, and because Target is now pointing unit D, unit B will no longer interfere with your functions.
 
Level 6
Joined
Sep 27, 2008
Messages
258
oh ok i see what you mean but instead of useing hashtables can i just sett it up like this

Punch variables
  • Set Caster[1] = (Triggering unit)
  • Set Target[1] = (Target unit of ability being cast)
kick variables
  • Set Caster[2] = (Triggering unit)
  • Set Target[2] = (Target unit of ability being cast)
by using array
 
Status
Not open for further replies.
Top