HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Ranged spirit link?

08-15-2004, 09:48 PM#1
wwsage
I was wondering if it's possible to make it so if a unit under the effect of spirit link, walks outside of a certain range, then the link is canceled. If it helps any, for the spell only 2 heroes are allowed to be linked (the caster and target unit), so if the target unit gets outside of the range of the caster the link needs to be killed off.

I need some tips on how to do this please.
08-16-2004, 10:43 AM#2
SpadeZ
There is an effective way only if there are 2 units involved, the Caster and the Targeted Unit. It requires 2 triggers and 3 variables. I suggest using the same variables if you you want to simplify things more. Bare in mind that this only works if there are 2 units (including caster) involved or the spell only affects one unit.

Code:
[center][color=green][size=4][b][u]__Setup__[/u][/b][/size][/color][/center]
First you need to create 3 variables

[u]Variable Name             Variable Type             Initial Value[/u]
Caster_Region             Rect (rect)                  - None -
Caster_Unit                Unit (unit)                  - None -
Linked_Units               Unit (unit)                  - None -


Code:
[color=orange][i][b][u][size=4][center]Trigger One[/center][/size][/u][/b][/i][/color]
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Spirit Link
    Actions
        Set Casting_Unit = (Casting unit)
        Set Linked_Unit = (Target unit of ability being cast)
        Set Caster_Region = (Rect centered at (Position of (Casting unit)) with size ([b][u]Size you want[/u][/b], [b][u]Size you want[/u][/b]))

Code:
[color=yellow][i][b][u][size=4][center]Trigger Two[/center][/size][/u][/b][/i][/color]
    Events
        Time - Every 0.50 seconds of game time
    Conditions
    Actions
        Rect - Center Caster_Region on offset((X of (Position of Casting_Unit)), (Y of (Position of Casting_Unit)))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units in Caster_Region((Matching unit) Equal to Linked_Unit))) Equal to 0
            Then - Actions
                Unit - Remove Spirit Link buff from Linked_Unit
            Else - Actions

That took amazingly long to write, i'm not 100% sure it will work according to plan, but i'm confident.
08-16-2004, 10:48 AM#3
Anitarf
It won't work, "finishes casting an ability" event will not yield you the "target unit of ability being cast" event response. Use the "starts the effect of an ability" event instead.
08-16-2004, 11:28 AM#4
SpadeZ

You're right. I'll correct it in the post.
08-16-2004, 03:48 PM#5
wwsage
thanks for the help.