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

[Trigger] Spell on 2 triggers, how to make it MUI

Status
Not open for further replies.
Level 7
Joined
Mar 24, 2008
Messages
184
i have several spells split on 2 triggers (mainly there is one trigger for the spell execution and another for interrupting it), i post here one of theese (the shortest one :p), just as example:

  • Aimed Shot
    • Events
      • Unit - A unit starts the transmission of an ability*
    • Conditions
      • (Ability being cast) Equals to Aimed Shot
    • Actions
      • Set AimedShotCaster = (Casting unit)
      • Set AimedShotTarget = (Target unit of ability being cast)
      • Special Effect - Create a special effect attached to the left hand of (Triggering unit) using Abilities\Spells\Undead\OrbOfDeath\OrbOfDeathMissile.mdl
      • Set AimedShotCasterSfx = (Last created special effect)
      • Set AimedShotCasted = TRUE
      • Wait 5.00 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • AimedShotCasted Equals to TRUE
        • Then - Actions
          • Special Effect - Destroy AimedShotCasterSfx
          • Set AimedShotCasted = FALSE
          • Set AimedShotCasterLoc = (Position of AimedShotCaster)
          • Set AimedShotTargetLoc = (Position of AimedShotTarget)
          • Wait ((Distance between AimedShotCasterLoc and AimedShotTargetLoc) / 800.00) seconds
          • Custom script: call RemoveLocation(udg_AimedShotCasterLoc)
          • Custom script: call RemoveLocation(udg_AimedShotTargetLoc)
          • Unit - Cause (Triggering unit) to damage AimedShotTarget, dealing (500.00 + ((Real((Agilit of AimedShotCaster (Includi bonuses)))) x 5.00)) damage of attack type Caos and damage type Universale
        • Else - Actions
And this is the trigger that interrupts it

  • Stop Aimed Shot
    • Events
      • Unit - A unit Stops casting an ability*
    • Conditions
      • (Ability being cast) Equals to Aimed Shot
      • AimedShotCasted Uguale a TRUE
    • Azioni
      • Special Effect - Destroy AimedShotCasterSfx
      • Set AimedShotCasted = FALSE
Now, since i'm learning JASS, i'm turning all the spells i've made since now in JASS, remove all the bj swapped functions (i wonder why they made them...) make local variables and make them MUI. But i don't know what to do to make such spells MUI...They have a wait, so it can't work if i keep globals...but...if i use locals i can't use 2 triggers.
so...what do i have to do?
 
Level 9
Joined
Oct 17, 2007
Messages
547
If you set the target and the caster each to a variable and have something like wait 5 seconds, within those seconds if another unit casts the spell, that spell gets activate right after the first 5 second is up and then again a few seconds later. Use another event, maybe trigger the actions after the spell has been successfully casted.
 
Level 7
Joined
Mar 24, 2008
Messages
184
i wanted a JASS way to solve my problem (though i tagged the topic "GUI"), Silvenon gave me what i needed (structs in JASS are very similar to C++ structs as far as i can see...well not that surprising since JASS is a scripting language based on C++), but thanks to everyone for your replies :smile:
 
Status
Not open for further replies.
Top