Spell which gives a buff while casting

TaCoChris

New Member
Reaction score
1
Hey guys.

I'm making a spell which should add a buff to the enemy target unit, while the casting unit is casting. (Cast time 3 sec.)
- And remove the buff if the unit stops.

(Similar to the hero "Sniper" in DotA)

Problems:
If i cast, and stop the spell instant, the buff wont get off. (the buff comes on to slow)

If the spell is casted, and i stop, the buff gets off. (should stay on, when the spell is casted)

If 2 units target the same enemy unit, and one of them stops, the buff goes off (should stay on if its still targed)

Secondly, if the target unit gets purged, the buff should get off, and the casting unit, should stop.

Code:
Andrew Antiair
    Events
        Unit - A unit Finishes casting an ability
    Conditions
        (Ability being cast) Equal to Homeseeking Rocket (Andrew Antiair)
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Target unit of ability being cast) has buff Homeseeking Rocket (Buff) ) Equal to True
            Then - Actions
                Unit - Remove Homeseeking Rocket (Buff)  buff from (Target unit of ability being cast)
            Else - Actions
                Unit - Order (Casting unit) to Stop

Code:
Andrew Antiair 2
    Events
        Unit - A unit Begins channeling an ability
    Conditions
        (Ability being cast) Equal to Homeseeking Rocket (Andrew Antiair)
    Actions
        Set AndrewPoint = (Position of (Target unit of ability being cast))
        Unit - Create 1 AndrewDummy for (Owner of (Casting unit)) at AndrewPoint facing Default building facing degrees
        Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
        Unit - Order (Last created unit) to Undead Banshee - Curse (Target unit of ability being cast)

Code:
Andrew Antiair 3
    Events
        Unit - A unit Stops casting an ability
    Conditions
        (Ability being cast) Equal to Homeseeking Rocket (Andrew Antiair)
    Actions
        Unit - Remove Homeseeking Rocket (Buff)  buff from (Target unit of ability being cast)
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
have you used hashtables before?

EDIT: heres what i came up with
Trigger:
  • Map Initialization
    • Events
      • Map Initializations
    • Conditions
    • Actions
      • Hashtable - Create Hashtable


Trigger:
  • Cast Start
    • Event
      • A unit BEGINS Channeling an ability
    • Conditions
      • Ability being cast is equal to (your ability) is true (boolean condition)
    • Actions
      • Hashtable - Save integer ((Hashtable - load integer (key target unit of ability cast) + 1) of 1 in last created hashtable) as (key target unit of ability cast) of 1 in last created hashtable
      • Hashtable - Save Unit (target unit of ability cast) as (key casting unit) of 2 in last created hashtable
      • Unit - Add Buff (your buff)


Trigger:
  • Cast Stop
    • Events
      • A unit stops channeling an ability
    • Conditions
      • Ability being cast is equal to (your ability) is true
    • Actions
      • Hashtable - Save Integer (Hashtable - load integer (key target unit of ability cast) of 1 in last created hashtable) - 1 as (key target unit of ability cast) of 1 in last created hashtable
      • Hashtable - Save Unit (No Unit) as (key casting unit) of 2 in last created hashtable
      • If then else
        • If
          • (Hashtable - load integer (key casting unit) of 1 in last created hashtable) is equal to 0
        • Then
          • Unit - Remove Buff (your buff)
        • Else


the first trigger makes a hashtable
the second buffs the targets with the buff and sets an integer = itself +1 (saves the count for how many people are casting on the unit
and the 3rd removes the buff if and only if the unit has no units casting on it at that time
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
the key is the handle of the unit (basically gives you an integer value for the unit)
 

TaCoChris

New Member
Reaction score
1
i cant get a "Key Handle"
When i press at Handle, i cant choose anything?

- And its not possible to " Add buff "
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
im at work right now but when i get home ill look into it
 

tommerbob

Minecraft. :D
Reaction score
110
Are you using NewGen? NewGen does not have the GUI Hashtable functions. You need to use the vanilla WE for hashtables in GUI.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top