Help with a pull skill trigger

Magoiche

Member
Reaction score
20
i was trying to make the hero pull the target.

I got this trigger.(Thanks to Zanar)

Code:
Angle
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to (==) Come and Go!!! 
    Actions
        Set Angle = (Angle from (Position of (Triggering unit)) to (Position of (Target unit of ability being cast)))
        Trigger - Turn on Pull <gen>

Code:
Pull
    Events
        Time - Every 0.03 seconds of game time
    Conditions
    Actions
        Unit - Move (Target unit of ability being cast) instantly to ((Position of (Triggering unit)) offset by 30.00 towards Angle degrees)
         Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Distance between (Position of (Triggering unit)) and (Position of (Target unit of ability being cast))) Less than or equal to (<=) 80.00
            Then - Actions
                Trigger - Turn off (This trigger)
            Else - Actions

But it wont works. =O
Can someone say why? =X
 

darkbeer

Beer is Good!
Reaction score
84
there is no target unit and tirggering unit, store them in variables.

Code:
Pull
    Events
        Time - Every 0.03 seconds of game time
    Conditions
    Actions
        Unit - Move[COLOR="Red"] (Target unit of ability being cast) i[/COLOR]nstantly to [COLOR="Red"]((Position of (Triggering unit))[/COLOR] offset by 30.00 towards Angle degrees)
         Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Distance between [COLOR="Red"](Position of (Triggering unit))[/COLOR] and[COLOR="Red"] (Position of (Target unit of ability being cast)))[/COLOR] Less than or equal to (<=) 80.00
            Then - Actions
                Trigger - Turn off (This trigger)
            Else - Actions

better (and leakless) :

Code:
Angle
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to (==) Come and Go!!! 
    Actions
        set TempLoc_1 = Position of (Triggering unit)
        set TempLoc_2 = Position of (Target unit of ability being cast)
        Set Angle = (Angle from TempLoc_1 to TempLoc_2)
        set Unit[1] = Triggering Unit
        set Unit[2] = TargetUnit of abiliy being cast
        CustomScript: call RemoveLocation(udg_TempLoc_1)
        CustomScript: call RemoveLocation(udg_TempLoc_2)
        Trigger - Turn on Pull <gen>

Code:
Pull
    Events
        Time - Every 0.03 seconds of game time
    Conditions
    Actions
         set TempLoc_1 = Position of Unit[1]
         set TempLoc_2 = Position of Unit[2]
       [COLOR="DarkOrchid"]  set Angle =  (Angle from TempLoc_1 to TempLoc_2)[/COLOR]
         Unit - Move Unit[1] instantly to TempLoc_1 offset by 30.00 towards Angle degrees)
         Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Distance between TempLoc_1 and (Position of TempLoc_2 Less than or equal to (<=) 80.00
            Then - Actions
                Trigger - Turn off (This trigger)
            Else - Actions
        CustomScript: call RemoveLocation(udg_TempLoc_1)
        CustomScript: call RemoveLocation(udg_TempLoc_2)

EDIT: added the angle thing in 2nd trigger (purple)
 

Magoiche

Member
Reaction score
20
ok now its pulls.

But another problem.

It instant pulls the target to the caster.
I want it to be slow.
And whem i move the target keep folowing the caster.
why? =X


EDIT: Wait! I will test darkbeer trigger
EDIT2: Ok now its pulls but ... The skills don't pull the target to the caster it pulls to the center fo the map =O
and a message apear: double free of location in Trig_Pull_Actions
 

darkbeer

Beer is Good!
Reaction score
84
ah my bad, mixed up the units^^ this should work now and pull the target to the caster.

Code:
Angle
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to (==) Come and Go!!! 
    Actions
        set TempLoc_1 = Position of (Triggering unit)
        set TempLoc_2 = Position of (Target unit of ability being cast)
        Set Angle = (Angle from TempLoc_2 to TempLoc_1)
        set Unit[1] = Triggering Unit
        set Unit[2] = TargetUnit of abiliy being cast
        CustomScript: call RemoveLocation(udg_TempLoc_1)
        CustomScript: call RemoveLocation(udg_TempLoc_2)
        Trigger - Turn on Pull <gen>

Code:
Pull
    Events
        Time - Every 0.03 seconds of game time
    Conditions
    Actions
         set TempLoc_1 = Position of Unit[1]
         set TempLoc_2 = Position of Unit[2]
         set Angle =  (Angle from TempLoc_2 to TempLoc_1)
         Unit - Move Unit[2] instantly to TempLoc_2 offset by 30.00 towards Angle degrees)
         Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Distance between TempLoc_1 and (Position of TempLoc_2 Less than or equal to (<=) 80.00
            Then - Actions
                Trigger - Turn off (This trigger)
            Else - Actions
        CustomScript: call RemoveLocation(udg_TempLoc_1)
        CustomScript: call RemoveLocation(udg_TempLoc_2)

and that double free means you destroyed a location twice
 

Magoiche

Member
Reaction score
20
Unit - Move Unit[2] instantly to TempLoc_2 offset by 30.00 towards Angle degrees)

I am not an expert but this is wrong isn't? xD
Anyway the target keeps comign to the centers of the map =O
 

darkbeer

Beer is Good!
Reaction score
84
tempLoc2 is the curent position of the unit, angle is the angle towards the caster and unit 2 is the targeted unit, so no this is correct.

show me your trigger, i guess you set some variable wrong.
 

Magoiche

Member
Reaction score
20
Code:
Angle
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to (==) Come and Go!!! 
    Actions
        Set TempLoc_1 = (Position of (Triggering unit))
        Set TempLoc_2 = (Position of (Target unit of ability being cast))
        Set Angle = (Angle from TempLoc_1 to TempLoc_2)
        Set CAG_Target_and_Caster[1] = (Triggering unit)
        Set CAG_Target_and_Caster[2] = (Target unit of ability being cast)
        Custom script:   call RemoveLocation(udg_TempLoc_1)
        Custom script:   call RemoveLocation(udg_TempLoc_2)
        Trigger - Turn on Pull <gen>
Code:
Pull
    Events
        Time - Every 0.03 seconds of game time
    Conditions
    Actions
        Set TempLoc_1 = (Position of CAG_Target_and_Caster[1])
        Set TempLoc_1 = (Position of CAG_Target_and_Caster[2])
        Set Angle = (Angle from TempLoc_1 to TempLoc_2)
        Unit - Move CAG_Target_and_Caster[2] instantly to (TempLoc_1 offset by 15.00 towards Angle degrees)
         Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Distance between TempLoc_1 and TempLoc_2) Less than or equal to (<=) 80.00
            Then - Actions
                Trigger - Turn off (This trigger)
            Else - Actions
        Custom script:   call RemoveLocation(udg_TempLoc_1)
        Custom script:   call RemoveLocation(udg_TempLoc_2)

Done
And the text thing apears everytime or only in test map?
 

darkbeer

Beer is Good!
Reaction score
84
heres your mistake, thats why that message appears
Code:
Pull
    Events
        Time - Every 0.03 seconds of game time
    Conditions
    Actions
        Set TempLoc_1 = (Position of CAG_Target_and_Caster[1])
 [COLOR="Red"]       Set TempLoc_1 = (Position of CAG_Target_and_Caster[2])[/COLOR] // musst be TempLoc_2
        Set Angle = (Angle from TempLoc_1 to TempLoc_2)
        Unit - Move CAG_Target_and_Caster[2] instantly to (TempLoc_1 offset by 15.00 towards Angle degrees)
         Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Distance between TempLoc_1 and TempLoc_2) Less than or equal to (<=) 80.00
            Then - Actions
                Trigger - Turn off (This trigger)
            Else - Actions
        Custom script:   call RemoveLocation(udg_TempLoc_1)
        Custom script:   call RemoveLocation(udg_TempLoc_2)
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
You should also reverse the points when setting the angle variable, and also move the unit to Temp_Loc2 offset by 15...

Also Point with polar offset leaks, so you should set it into a variable too such as

Set Offset_Point = Temp_Loc2 offset by 15 towards angle degrees
 

Magoiche

Member
Reaction score
20
[autoheadshot] LOL [/autoheadshot]

oh man thanks very much for all the help =D
+rep and credits in my map =P
 

WolfieeifloW

WEHZ Helper
Reaction score
372
This thread is over 3 years old, don't necro it please.
Look at it, it's setting the position of a unit, or the point.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top