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

Recall spell problem

Status
Not open for further replies.
Level 10
Joined
Mar 17, 2012
Messages
579
Hi there! Okay, I have 2 teams, but 4 bases (2 for each) in my map.

Every hero has an ability Recall to channel it and teleport to base within 10 seconds. If someone hits him during channel - it will break his cast. If hero moves - he breaks his cast.

I have 4 points to teleport, but only 2 teams. So, look what I have (I was trying to do it MUI, but it's not what I expected :D):

  • Recall start
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Recall
    • Actions
      • Set Player_Number_Int = (Player number of (Owner of (Triggering unit)))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 2 (Blue)
        • Then - Actions
          • Set Recall_Caster[Player_Number_Int] = (Triggering unit)
          • Set Recall_ON[Player_Number_Int] = True
          • Wait 10.00 seconds
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Recall_ON[Player_Number_Int] Equal to True
            • Then - Actions
              • Special Effect - Create a special effect attached to the origin of Recall_Caster[Player_Number_Int] using MassTeleportCaster.mdx
              • Special Effect - Destroy (Last created special effect)
              • Unit - Move Recall_Caster[Player_Number_Int] instantly to (Center of Blue Orange <gen>)
              • Set Recall_ON[Player_Number_Int] = False
            • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 6 (Orange)
        • Then - Actions
          • Set Recall_Caster[Player_Number_Int] = (Triggering unit)
          • Set Recall_ON[Player_Number_Int] = True
          • Wait 10.00 seconds
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Recall_ON[Player_Number_Int] Equal to True
            • Then - Actions
              • Special Effect - Create a special effect attached to the origin of Recall_Caster[Player_Number_Int] using MassTeleportCaster.mdx
              • Special Effect - Destroy (Last created special effect)
              • Unit - Move Recall_Caster[Player_Number_Int] instantly to (Center of Blue Orange <gen>)
              • Set Recall_ON[Player_Number_Int] = False
            • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 4 (Purple)
        • Then - Actions
          • Set Recall_Caster[Player_Number_Int] = (Triggering unit)
          • Set Recall_ON[Player_Number_Int] = True
          • Wait 10.00 seconds
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Recall_ON[Player_Number_Int] Equal to True
            • Then - Actions
              • Special Effect - Create a special effect attached to the origin of Recall_Caster[Player_Number_Int] using MassTeleportCaster.mdx
              • Special Effect - Destroy (Last created special effect)
              • Unit - Move Recall_Caster[Player_Number_Int] instantly to (Center of Purple Yellow <gen>)
              • Set Recall_ON[Player_Number_Int] = False
            • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 5 (Yellow)
        • Then - Actions
          • Set Recall_Caster[Player_Number_Int] = (Triggering unit)
          • Set Recall_ON[Player_Number_Int] = True
          • Wait 10.00 seconds
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Recall_ON[Player_Number_Int] Equal to True
            • Then - Actions
              • Special Effect - Create a special effect attached to the origin of Recall_Caster[Player_Number_Int] using MassTeleportCaster.mdx
              • Special Effect - Destroy (Last created special effect)
              • Unit - Move Recall_Caster[Player_Number_Int] instantly to (Center of Purple Yellow <gen>)
              • Set Recall_ON[Player_Number_Int] = False
            • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 8 (Pink)
        • Then - Actions
          • Set Recall_Caster[Player_Number_Int] = (Triggering unit)
          • Set Recall_ON[Player_Number_Int] = True
          • Wait 10.00 seconds
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Recall_ON[Player_Number_Int] Equal to True
            • Then - Actions
              • Special Effect - Create a special effect attached to the origin of Recall_Caster[Player_Number_Int] using MassTeleportCaster.mdx
              • Special Effect - Destroy (Last created special effect)
              • Unit - Move Recall_Caster[Player_Number_Int] instantly to (Center of Pink Gray <gen>)
              • Set Recall_ON[Player_Number_Int] = False
            • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 9 (Gray)
        • Then - Actions
          • Set Recall_Caster[Player_Number_Int] = (Triggering unit)
          • Set Recall_ON[Player_Number_Int] = True
          • Wait 10.00 seconds
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Recall_ON[Player_Number_Int] Equal to True
            • Then - Actions
              • Special Effect - Create a special effect attached to the origin of Recall_Caster[Player_Number_Int] using MassTeleportCaster.mdx
              • Special Effect - Destroy (Last created special effect)
              • Unit - Move Recall_Caster[Player_Number_Int] instantly to (Center of Pink Gray <gen>)
              • Set Recall_ON[Player_Number_Int] = False
            • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 11 (Dark Green)
        • Then - Actions
          • Set Recall_Caster[Player_Number_Int] = (Triggering unit)
          • Set Recall_ON[Player_Number_Int] = True
          • Wait 10.00 seconds
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Recall_ON[Player_Number_Int] Equal to True
            • Then - Actions
              • Special Effect - Create a special effect attached to the origin of Recall_Caster[Player_Number_Int] using MassTeleportCaster.mdx
              • Special Effect - Destroy (Last created special effect)
              • Unit - Move Recall_Caster[Player_Number_Int] instantly to (Center of DG Brown <gen>)
              • Set Recall_ON[Player_Number_Int] = False
            • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 12 (Brown)
        • Then - Actions
          • Set Recall_Caster[Player_Number_Int] = (Triggering unit)
          • Set Recall_ON[Player_Number_Int] = True
          • Wait 10.00 seconds
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Recall_ON[Player_Number_Int] Equal to True
            • Then - Actions
              • Special Effect - Create a special effect attached to the origin of Recall_Caster[Player_Number_Int] using MassTeleportCaster.mdx
              • Special Effect - Destroy (Last created special effect)
              • Unit - Move Recall_Caster[Player_Number_Int] instantly to (Center of DG Brown <gen>)
              • Set Recall_ON[Player_Number_Int] = False
            • Else - Actions
        • Else - Actions
  • Recall damage
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • DamageEventTarget Equal to Recall_Caster[Player_Number_Int]
          • Recall_ON[Player_Number_Int] Equal to True
    • Actions
      • Unit - Order DamageEventTarget to Stop
      • Set Recall_ON[Player_Number_Int] = False
  • Recall stop
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
      • (Ability being cast) Equal to Recall
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Recall_ON[Player_Number_Int] Equal to True
        • Then - Actions
          • Set Recall_ON[Player_Number_Int] = False
        • Else - Actions
Help me please :vw_sad:

And yes, I was trying to use timers instead of Waits, but I can't set Integer array in Events field....(((
 

yip

yip

Level 3
Joined
Jan 15, 2014
Messages
69
My ADD strikes again!

I don't exactly know what the problem is either, but you could do something a lot simpler. Without using waits, too, cause these'll mess it up...

This is what comes to mind:

Base 'Recall' off 'Channel' or whatever targetless ability, adjust the things you need to adjust, and make the casting time 10 seconds (not the follow through time, leave that on 0). That way, it'll take 10 seconds to cast and cancel upon being given other orders.

If the unit (Starts the effect of an ability), that ability being Recall, teleport him to his corresponding base. (Also remove it from the unit group I'm about to mention)

For the cancelling-on-attack (and added special effects when casting, in case your hero doesn't have a casting animation or you want something extra), this is what I'd do:

1. When unit (Begins channeling an ability), of course being 'Recall',

Add the unit to a unit group.

Create a dummy special effect unit on it (optional), and store it as a variable (indexing, or using hashtables, so that it's MUI.) Give the special effect a 10 seconds expiration time too, and if it's cancelled early, here:

2. Using the DDS, detect when a unit from the aforementioned unit group is attacked, and delete the corresponding special effect, while ordering the attacked unit to 'Stop'. You also have to make an event for if the unit moves to delete the special effect, if you're using one.

I wrote this in a hurry, I can explain stuff better if you want :x

Or maybe someone else has a better solution.
 
Last edited:
Level 25
Joined
Sep 26, 2009
Messages
2,378
or you could just do it dynamically by setting points before hand, instead of using
"center of <some area>" which in your case also leaks.

Also, I believe the problem lies in the fact that the variable Player_Number_Int holds the number of the player who used the ability later.
 
Level 10
Joined
Mar 17, 2012
Messages
579
"center of <some area>" which in your case also leaks.

o_O How can it leak? Do centers of regions leak and should be cleaned??? :goblin_jawdrop:

I thought it conciders only Points and Positions...

Allright! I found how to do it easier))))

  • Recall start
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Recall
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 2 (Blue)
        • Then - Actions
          • Set Recall_Caster_Blue = (Triggering unit)
          • Set Recall_ON_Blue = True
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 4 (Purple)
        • Then - Actions
          • Set Recall_Caster_Purple = (Triggering unit)
          • Set Recall_ON_Purple = True
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 5 (Yellow)
        • Then - Actions
          • Set Recall_Caster_Yellow = (Triggering unit)
          • Set Recall_ON_Yellow = True
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 6 (Orange)
        • Then - Actions
          • Set Recall_Caster_Orange = (Triggering unit)
          • Set Recall_ON_Orange = True
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 8 (Pink)
        • Then - Actions
          • Set Recall_Caster_Pink = (Triggering unit)
          • Set Recall_ON_Pink = True
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 9 (Gray)
        • Then - Actions
          • Set Recall_Caster_Grey = (Triggering unit)
          • Set Recall_ON_Gray = True
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 11 (Dark Green)
        • Then - Actions
          • Set Recall_Caster_DG = (Triggering unit)
          • Set Recall_ON_DG = True
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 12 (Brown)
        • Then - Actions
          • Set Recall_Caster_Brown = (Triggering unit)
          • Set Recall_ON_Brown = True
        • Else - Actions
  • Recall damage
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • DamageEventTarget Equal to Recall_Caster_Blue
              • Recall_ON_Blue Equal to True
        • Then - Actions
          • Unit - Order DamageEventTarget to Stop
          • Set Recall_ON_Blue = False
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • DamageEventTarget Equal to Recall_Caster_Brown
              • Recall_ON_Brown Equal to True
        • Then - Actions
          • Unit - Order DamageEventTarget to Stop
          • Set Recall_ON_Brown = False
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • DamageEventTarget Equal to Recall_Caster_DG
              • Recall_ON_DG Equal to True
        • Then - Actions
          • Unit - Order DamageEventTarget to Stop
          • Set Recall_ON_DG = False
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • DamageEventTarget Equal to Recall_Caster_Grey
              • Recall_ON_Gray Equal to True
        • Then - Actions
          • Unit - Order DamageEventTarget to Stop
          • Set Recall_ON_Gray = False
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • DamageEventTarget Equal to Recall_Caster_Orange
              • Recall_ON_Orange Equal to True
        • Then - Actions
          • Unit - Order DamageEventTarget to Stop
          • Set Recall_ON_Orange = False
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • DamageEventTarget Equal to Recall_Caster_Pink
              • Recall_ON_Pink Equal to True
        • Then - Actions
          • Unit - Order DamageEventTarget to Stop
          • Set Recall_ON_Pink = False
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • DamageEventTarget Equal to Recall_Caster_Purple
              • Recall_ON_Purple Equal to True
        • Then - Actions
          • Unit - Order DamageEventTarget to Stop
          • Set Recall_ON_Purple = False
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • DamageEventTarget Equal to Recall_Caster_Yellow
              • Recall_ON_Yellow Equal to True
        • Then - Actions
          • Unit - Order DamageEventTarget to Stop
          • Set Recall_ON_Yellow = False
        • Else - Actions
  • Recall loop
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Recall
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 2 (Blue)
        • Then - Actions
          • Set Recall_Caster_Blue = (Triggering unit)
          • Unit - Move Recall_Caster_Blue instantly to (Center of Blue Orange <gen>)
          • Special Effect - Create a special effect attached to the origin of Recall_Caster_Blue using MassTeleportCaster.mdx
          • Special Effect - Destroy (Last created special effect)
          • Set Recall_ON_Blue = False
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 6 (Orange)
        • Then - Actions
          • Set Recall_Caster_Orange = (Triggering unit)
          • Unit - Move Recall_Caster_Orange instantly to (Center of Blue Orange <gen>)
          • Special Effect - Create a special effect attached to the origin of Recall_Caster_Orange using MassTeleportCaster.mdx
          • Special Effect - Destroy (Last created special effect)
          • Set Recall_ON_Orange = False
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 4 (Purple)
        • Then - Actions
          • Set Recall_Caster_Purple = (Triggering unit)
          • Unit - Move Recall_Caster_Purple instantly to (Center of Purple Yellow <gen>)
          • Special Effect - Create a special effect attached to the origin of Recall_Caster_Purple using MassTeleportCaster.mdx
          • Special Effect - Destroy (Last created special effect)
          • Set Recall_ON_Purple = False
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 5 (Yellow)
        • Then - Actions
          • Set Recall_Caster_Yellow = (Triggering unit)
          • Unit - Move Recall_Caster_Yellow instantly to (Center of Purple Yellow <gen>)
          • Special Effect - Create a special effect attached to the origin of Recall_Caster_Yellow using MassTeleportCaster.mdx
          • Special Effect - Destroy (Last created special effect)
          • Set Recall_ON_Yellow = False
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 8 (Pink)
        • Then - Actions
          • Set Recall_Caster_Pink = (Triggering unit)
          • Unit - Move Recall_Caster_Pink instantly to (Center of Pink Gray <gen>)
          • Special Effect - Create a special effect attached to the origin of Recall_Caster_Pink using MassTeleportCaster.mdx
          • Special Effect - Destroy (Last created special effect)
          • Set Recall_ON_Pink = False
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 9 (Gray)
        • Then - Actions
          • Set Recall_Caster_Grey = (Triggering unit)
          • Unit - Move Recall_Caster_Grey instantly to (Center of Pink Gray <gen>)
          • Special Effect - Create a special effect attached to the origin of Recall_Caster_Grey using MassTeleportCaster.mdx
          • Special Effect - Destroy (Last created special effect)
          • Set Recall_ON_Gray = False
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 11 (Dark Green)
        • Then - Actions
          • Set Recall_Caster_DG = (Triggering unit)
          • Unit - Move Recall_Caster_DG instantly to (Center of DG Brown <gen>)
          • Special Effect - Create a special effect attached to the origin of Recall_Caster_DG using MassTeleportCaster.mdx
          • Special Effect - Destroy (Last created special effect)
          • Set Recall_ON_DG = False
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 12 (Brown)
        • Then - Actions
          • Set Recall_Caster_Brown = (Triggering unit)
          • Unit - Move Recall_Caster_Brown instantly to (Center of DG Brown <gen>)
          • Special Effect - Create a special effect attached to the origin of Recall_Caster_Brown using MassTeleportCaster.mdx
          • Special Effect - Destroy (Last created special effect)
          • Set Recall_ON_Brown = False
        • Else - Actions
 
Last edited:
Level 10
Joined
Apr 18, 2009
Messages
576
Taking the center of a region will give you a point. Points leak if you don't destroy them.

I made a MUI implementation of this Recall spell (mostly for my own amusement but I guess you can have the map to look at). Just briefly explaining the concept: I used dummy units with expiration timers as timers for the channeling period of each spell instance. I used a technique with read and write index described in this tutorial to make the spell MUI.

You are free to ask me questions about the code or the general concept or whatever if you're interested in implementing something similar.
 

Attachments

  • MUI Recall Example Map.w3x
    19.1 KB · Views: 45
Status
Not open for further replies.
Top