Spell Grappling Hook

Sim

Forum Administrator
Staff member
Reaction score
534
> Actually units have a limit of 512

522.

------------------------------------

7 triggers? You can certainly do this with less than 7 triggers.

Triggers that use the same event should be merged together, in order to reduce the number of triggers.

Grapple Init + Lightning
Grapple Effect + GrappleHook + DestroyNHalt + MoveLightning
Grapple Damage alone

-------------------------------------

> Wait until ((Distance between (Position of GrappleHook) and TargetPoint) Less than or equal to 50.00), checking every 0.10 seconds

Leak

Code:
GrappleHook
    Events
        Time - Every 0.03 seconds of game time
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units of type GrappleDummy)) Equal to 0
                GrappleSnagged Equal to False
            Then - Actions
                Unit - Create 1 GrappleDummy for (Owner of Caster1) at (CasterPosition offset by 11.00 towards Angle degrees) facing Angle degrees
                Set GrappleHook = (Last created unit)
                Unit - Order GrappleHook to Move To TargetPoint
                [B]Set GrappleHookLoc = (Position of GrappleHook)[/B]
                Trigger - Add to GrappleDamage <gen> the event (Unit - A unit comes within 66.00 of GrappleHook)
                Trigger - Turn on GrappleDamage <gen>
            Else - Actions
        Wait until ((Distance between (Position of GrappleHook) and TargetPoint) Less than or equal to 50.00), checking every 0.10 seconds
        Trigger - Turn on Grapple Effect <gen>
        Set CasterPosition = (Position of Caster1)
        Wait until ((Distance between CasterPosition and GrappleHookLoc) Less than or equal to 10.00), checking every 0.10 seconds
        Unit - Remove GrappleHook from the game
        Trigger - Turn off (This trigger)

You must remove the location before setting it to a new value.

Code:
GrappleDamage
    Events
    Conditions
        (Triggering unit) Not equal to Caster1
        (Triggering unit) Not equal to GrappleHook
    Actions
        Unit - Pause GrappleHook
        Set GrappleSnagged = True
        Unit - Cause Caster1 to damage (Triggering unit), dealing (90.00 x (Real((Level of Grapple  for Caster1)))) damage of attack type Chaos and damage type Normal
        [B]Set TargetPoint = (Position of GrappleHook)
        Set GrappleHookLoc = (Position of GrappleHook)[/B]
        Set Distance = (Distance between CasterPosition and TargetPoint)
        Wait 1.00 seconds
        Trigger - Turn on DestroyNHalt <gen>
        Trigger - Turn off (This trigger)

Same.

Code:
MoveLightning
    Events
        Time - Every 0.03 seconds of game time
    Conditions
    Actions
        [B]Set CasterPos2 = (Position of Caster1)
        Set GrappleHookLoc = (Position of GrappleHook)[/B]
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Caster1 is alive) Equal to True
            Then - Actions
                Lightning - Move (Last created lightning effect) to source CasterPos2 and target GrappleHookLoc
                Trigger - Turn on DestroyNHalt <gen>
            Else - Actions
                Lightning - Destroy Lightning

Same.

---------------------------------

Code:
Grapple Init
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Grapple 
    Actions
        Set GrappleSnagged = False
        Set Caster1 = (Casting unit)
        Set CasterPosition = (Position of Caster1)
        Set PointVarCaster1 = (Position of Caster1)
        Set TargetPoint = (Target point of ability being cast)
        Set Distance = (Distance between CasterPosition and TargetPoint)
        Set Angle = (Angle from CasterPosition to TargetPoint)
        Set N = 0.00
        Selection - Clear selection for (Owner of Caster1)
        [B]Wait 0.01 seconds[/B]
        Selection - Select Caster1 for (Owner of Caster1)
        Unit - Pause Caster1
        Animation - Play Caster1's attack animation
        Unit - Turn collision for Caster1 Off
        Trigger - Turn on GrappleHook <gen>

Remove the wait.

Code:
Lightning
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Grapple 
    Actions
        [B]Wait 0.03 seconds[/B]
        Set GrappleHookLoc = (Position of GrappleHook)
        Set CasterPos2 = (Position of Caster1)
        Lightning - Create a Magic Leash lightning effect from source CasterPos2 to target PointVarCaster1
        Set Lightning = (Last created lightning effect)
        Lightning - Change color of Lightning to (0.70 0.40 0.20) with 1.00 alpha
        Wait until (((Playable map area) contains GrappleHook) Equal to True), checking every 0.10 seconds
        Trigger - Turn on MoveLightning <gen>

Remove the wait.
 

Pigger

New Member
Reaction score
13
Actually units have a limit of 512

Missiles can go up to 900 i think

And special effects can go at any speed.

Unless that arrow you use is a dummy unit,
there is no problem to increase the speed...

Good news! It's a dummy unit :( (Sarcasm) but sarcasm aside, I just made the grappling hook it's own slide trigger so it can now travel at whatever speed I want. It's working almost perfectly now, the only problem I am having is for some reason the hook will hit a unit, the caster will go to the location, but then continues on. It's only happened about twice so I'm not too worried about it, I'll fix it later.

I've added in an immobilization part to the spell so that when a unit is hit by it, he cannot move until the caster has reached the destination.
 

Cohadar

master of fugue
Reaction score
209
It's working almost perfectly now, the only problem I am having is for some reason the hook will hit a unit, the caster will go to the location, but then continues on. It's only happened about twice so I'm not too worried about it, I'll fix it later.

You are comparing locations to see if 2 units are close.
If for example your caster is moving 100. distance per timer event
and you are comparing proximity of units with:
Code:
if distance(caster, target) < 20 then
   endslide.
endif

what could happen is this:
caster comes at 30 distance from target,
so 30>20 and it does not end but goes one timer event more.
so the distance now becomes 30-100 = 70 distance
(distance is always greater than zero = sqrt( (Cx-Tx)^2+(Cy-Ty)^2 )
and it is still bigger than 20 so the caster keeps moving.

If you set the numbers properly you can even see some weird effects
like caster oscillating around target. :D

My advice:
make it so that end distance is 2 times bigger that caster move distance per timer event
 

Pigger

New Member
Reaction score
13
You are comparing locations to see if 2 units are close.
If for example your caster is moving 100. distance per timer event
and you are comparing proximity of units with:
Code:
if distance(caster, target) < 20 then
   endslide.
endif

what could happen is this:
caster comes at 30 distance from target,
so 30>20 and it does not end but goes one timer event more.
so the distance now becomes 30-100 = 70 distance
(distance is always greater than zero = sqrt( (Cx-Tx)^2+(Cy-Ty)^2 )
and it is still bigger than 20 so the caster keeps moving.

If you set the numbers properly you can even see some weird effects
like caster oscillating around target. :D

My advice:
make it so that end distance is 2 times bigger that caster move distance per timer event

I'll try that, I hope it works, by your logic yes it should :D. And Daxtreme, I will begin merging the triggers together tonight, this whole spell since is kind of taking me aback in my current map project because of it's constant problems that are only minor yet screw it up so much.

I fixed the location leak.

I never knew you had to remove locations before you could reset them, thanks for that bit of info. Hopefully the merging will go together smoothly, if not I may have to leave it as is and maybe let someone else pick up on it just so I can continue on with my map.

Thanks again
 

Hatebreeder

So many apples
Reaction score
381
Everything is fine now :) Well i tested ur Map, and, the Spell works on yourself xD Just fix that, and you'll get a +Rep from me :)
 
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