Spell Grappling Hook

Pigger

New Member
Reaction score
13
This spell, grappling hook, is based off of a few things. 1) Sliding that I got from one of The Helper's tutorial section, and 2) Meat Hook from DotA (Somewhat) It is 95% done in this current form, and will be used by me in an upcoming map of mine completely finished.

Grappling Hook: Hurls out a grappling hook that will hit whatever is first in line infront of it. Pulls the caster towards the hook location shortly afterwards.

I'm not sure if it is fully leakless, as I'm a bit tired to check anymore. If you are to use this in any map please credit me on it, or atleast don't take credit for youself.

Screenshot:


Import Difficulty: Well, all you've gotta do is import units, triggers, and abilities. Not too hard to import.

EDIT: Map back up.

UPDATE: I have been doing a few other things, I now have it working perfectly I just need to finish exporting/importing it onto the test map from my current game map.

EDIT: Map is (or should be) completely fixed, finish, polished and whatever. Readme inserted into Triggers. Rope Added. Bugs fixed. Should be ready to go. Again, I'm pretty sure it's leakless.

View attachment 9966
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
hey brother...mind increase the size of your....Hook? increase its scale value...i barely able to see whats the thin thingy that fly out =.=

And there were some bugs out there....when u cast the spell...and u immediately press ''S'' (Stop)...then your hero is pause and wont be able to unpause....and when the hook came out...it just stuck there and wont disapear... Fix it..
 

Pigger

New Member
Reaction score
13
Oh boy, and here I thought I had everything fixed by now. I'm going to take it down until it's all fixed, thanks for the heads up.
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
welcome...
_______
Just a suggestion...
you can fix it with a trigger like this

E - unit stops casting a spell
C - ability being casted equal to (your spell name)
A - Remove All Position
unpause unit
and remove the dummy arrow
 

Pigger

New Member
Reaction score
13
Well, I ended up with a quick fix of just deselcting and reselecting while there is the short wait that I needed. It should be fine now.
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
i will try it later -_- buzy nw...
________
Edit:
Ok now it works better now....i think there were no leaks..is it?
But i would like to ask.....your spell name is grappling hook....which means the hook must grab something....but how come your hook didnt grab anything but the hero will be pulled?
 

Pigger

New Member
Reaction score
13
i will try it later -_- buzy nw...
________
Edit:
Ok now it works better now....i think there were no leaks..is it?
But i would like to ask.....your spell name is grappling hook....which means the hook must grab something....but how come your hook didnt grab anything but the hero will be pulled?

Well, It's not a perfect grappling hook, but it is meant to affect both units and terrain. This is the most basic of the finished forms of it. Before it was just a slide, I can make the hook more picky later on but for now it will grapple onto both units, and if none are present it will just grapple the ground.

I suppose I could do way more tweaking to it to make it more realistic, but for now I am leaving it as it is because it works as it should to an extent.

P.S. Sorry I fell asleep last night before I could post this :O
 

Sim

Forum Administrator
Staff member
Reaction score
534
You need to add implementation instructions.

The hook is way too small, and there should be some kind of "rope" linking you and the hook. Otherwise, it shouldn't be able to pull.

Why wait 0.20 seconds before pausing? My hero threw the hook, moved a bit, the hook went on and I got pulled. It shouldn't do that. The hook should be thrown first, before any wait occur.
 

Pigger

New Member
Reaction score
13
You need to add implementation instructions.

The hook is way too small, and there should be some kind of "rope" linking you and the hook. Otherwise, it shouldn't be able to pull.

Why wait 0.20 seconds before pausing? My hero threw the hook, moved a bit, the hook went on and I got pulled. It shouldn't do that. The hook should be thrown first, before any wait occur.

I'll add implementation instructions once the problems are fixed.

UPDATE: I've fixed the wait problem and am currently working on the rope issue. (Which really isn't liking me!!)
 

Cohadar

master of fugue
Reaction score
209
I actually made similar spell in my old Dragon Survival map
It is written completely in JASS but it is using some
nasty global variables, extremely hard to implement.

How it works:
If it catches a unit it will drag that unit to pudge,
you can even blink with pudge or use teleporters
and hook will still work.

If it "catches" a tree, it will drag pudge to the tree.

Code:
function Pudge_Net_Extending takes integer B returns nothing
    local real angle
        //---- extending..
    set angle = AngleBetweenPoints( udg_PNHeadLoc[B], udg_PNEndLoc[B] )
    // 40 is kvantum of movement, you can change this to speedUp/Slow the hook
    call CHS_MoveLocationToPolarProjection(udg_PNHeadLoc[B], 40, angle)  
    if ( DistanceBetweenPoints(udg_PNHeadLoc[B], udg_PNEndLoc[B]) <= 30.00 ) then
        set udg_PNStatus[B] = 2 // retracting
    endif
endfunction


function Pudge_Net_Retracting takes integer B returns nothing
    local real angle

    set angle = AngleBetweenPoints( udg_PNHeadLoc[B], udg_PNStartLoc[B] )
    call CHS_MoveLocationToPolarProjection(udg_PNHeadLoc[B], 40, angle) 
   
    call CHS_MoveLocationToLocation(udg_PNEndLoc[B], udg_PNHeadLoc[B])
endfunction

function Pudge_Net_Towering takes integer B returns nothing
    local real angle

    set angle = AngleBetweenPoints( udg_PNStartLoc[B], udg_PNEndLoc[B] )
    call CHS_MoveLocationToPolarProjection(udg_PNStartLoc[B], 40, angle) 
endfunction

// LoopA is group , LoopB is player number
function NetFilter takes nothing returns nothing
    local group victimsGroup = C_I2G(bj_forLoopAIndex)

    if (GetEnumUnit() == udg_PNPudge[bj_forLoopBIndex]) then
        call GroupRemoveUnitSimple(GetEnumUnit(), victimsGroup)
        return
    endif
    
    if ( IsUnitType(GetEnumUnit(), UNIT_TYPE_STRUCTURE) == true ) then
        call GroupRemoveUnitSimple(GetEnumUnit(), victimsGroup)
        return
    endif
    
    if (IsUnitDeadBJ(GetEnumUnit()) == true) then
        call GroupRemoveUnitSimple(GetEnumUnit(), victimsGroup)
        return
    endif

    // towers are units to awoid "base under attack" game messages
    // so we must ignore them manually
    if (GetUnitTypeId(GetEnumUnit()) == 'h003') then
        call GroupRemoveUnitSimple(GetEnumUnit(), victimsGroup)
        return
    endif

endfunction

//-----
function GetTree takes nothing returns nothing
    set udg_PNSnaggedDestructable[GetForLoopIndexB()] = GetEnumDestructable()
endfunction


function Search_Victim takes integer B returns nothing
    local real angle
    local string modelName = "Abilities\\Spells\\Human\\AerialShackles\\AerialShacklesTarget.mdl"
    local group victimsGroup = GetUnitsInRangeOfLocAll(88.00, udg_PNHeadLoc[B])
        
    // clean up unwanted victims
    set bj_forLoopAIndex = C_G2I(victimsGroup)
    set bj_forLoopBIndex = B
    call ForGroup(victimsGroup, function NetFilter )

    set udg_PNSnaggedUnit[B] = FirstOfGroup(victimsGroup)
    call DestroyGroup(victimsGroup)
      
    if (udg_PNSnaggedUnit[B] == null) then
        call EnumDestructablesInCircleBJ( 88.00, udg_PNHeadLoc[B], function GetTree )
        if ( udg_PNSnaggedDestructable[B] != null )  then
            set udg_PNStatus[B] = 3 // towering
            call MoveLocation(udg_PNEndLoc[B], GetDestructableX(udg_PNSnaggedDestructable[B]), GetDestructableY(udg_PNSnaggedDestructable[B]))
            call CHS_MoveLocationToLocation(udg_PNHeadLoc[B], udg_PNEndLoc[B])
            call SetUnitPathing( udg_PNPudge[B], false )
        endif
    else 
        if ( IsUnitAlly(udg_PNSnaggedUnit[B], ConvertedPlayer(B)) == false ) then
            call UnitDamageTargetBJ( udg_PNPudge[B], udg_PNSnaggedUnit[B], udg_PNDmg[B], ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL )
        endif
        
        set udg_PNEffect[B] = AddSpecialEffectTarget(modelName, udg_PNSnaggedUnit[B], "chest")
        call SetUnitPathing( udg_PNSnaggedUnit[B], false )
        set udg_PNStatus[B] = 2 // retracting
    endif        
    
endfunction

function Move_Victim takes integer B returns nothing
    local real angle
    if ( udg_PNSnaggedDestructable[B] != null )then
        set angle = AngleBetweenPoints( udg_PNStartLoc[B], udg_PNEndLoc[B] ) 
        call SetUnitPositionLocFacingBJ( udg_PNPudge[B], udg_PNStartLoc[B], angle )
    else
        set angle = AngleBetweenPoints( udg_PNStartLoc[B], udg_PNHeadLoc[B] ) 
        call SetUnitPositionLocFacingBJ( udg_PNSnaggedUnit[B], udg_PNHeadLoc[B], angle )
    endif
endfunction


function  EndProcessingCondition takes integer B returns nothing
    if ( DistanceBetweenPoints(udg_PNStartLoc[B], udg_PNEndLoc[B]) <= 80.00 ) then
       call SetUnitPathing( udg_PNSnaggedUnit[B], true )
       call SetUnitPathing( udg_PNPudge[B], true )
       call DestroyLightning( udg_PNLightning[B] )
       call DestroyEffect( udg_PNEffect[B] )
       call   RemoveLocation( udg_PNStartLoc[B]  )
       call   RemoveLocation( udg_PNEndLoc[B]    )
       call   RemoveLocation( udg_PNHeadLoc[B]   )
       
       // This must be the last command of processing
       set udg_PNStatus[B] = 0       
    endif
endfunction

//===========================================================================
//  We use bj_forLoopBIndex to determine current player we process
//  because A and B loop indexes are passed throught trigger calls
//===========================================================================
function Trig_Pudge_Net_Routing_Actions takes nothing returns nothing
    local integer B = 1
    local integer netsInProcess = 0

    loop
        // only players 1..5 and 7..11 use pudge hook
        exitwhen B > 11
        if ( udg_PNStatus[B] != 0) then
            set netsInProcess = netsInProcess + 1
           
            call MoveLocation(udg_PNStartLoc[B], GetUnitX(udg_PNPudge[B]), GetUnitY(udg_PNPudge[B]) )
            call MoveLightningLoc(udg_PNLightning [B], udg_PNStartLoc[B], udg_PNHeadLoc[B])
            
            if (udg_PNStatus[B]==1) then
               call Pudge_Net_Extending(B)
            elseif (udg_PNStatus[B]==2) then
               call Pudge_Net_Retracting(B)
            elseif (udg_PNStatus[B]==3) then
               call Pudge_Net_Towering(B)               
            endif
            
            if ((udg_PNSnaggedUnit[B] == null) and (udg_PNSnaggedDestructable[B] == null)) then
                call Search_Victim(B)
            else
                call Move_Victim(B)      
            endif
            
            call EndProcessingCondition(B)
            
        else
        endif
        set B = B + 1
    endloop
    
    //if we dont use this trigger turn it off so it wont lag
    if (netsInProcess == 0) then
        call DisableTrigger(GetTriggeringTrigger())
    endif
endfunction

//===========================================================================
function InitTrig_Pudge_Net_Routing takes nothing returns nothing
    set gg_trg_Pudge_Net_Routing = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_Pudge_Net_Routing, 0.04 )
    call TriggerAddAction( gg_trg_Pudge_Net_Routing, function Trig_Pudge_Net_Routing_Actions )
endfunction

I will attach the map below, so you can see how it works

NOTE: this map is unstable, it was written in times when I didn't know shit about JASS, I am working on version 2.0 and at some point I will redo the hook spell.

But I see you are completing you spell right now,
if you write it to be MUI I will be more than glad to steal it :D
 

Pigger

New Member
Reaction score
13
Cohadar I thank you for letting me look at you map and for the aid. I know nothing of JASS unfortunatly, Everything for my grapple spell seems to work flawlessly, except for right now when I am trying to make a lightning effect act as a rope. The lightning just acts funny, I have a thread on it in the main forums as to keep questions out of this forum.
 

Cohadar

master of fugue
Reaction score
209
Did you upload a new version?

The old one does not grapple to the unit really,
If grapples to the ground where target is standing,
so if target moves it looks silly.

Nice idea of putting an arrow in the hook top,
I will steal it :)

Keep up the good work.

ALSO: learn to program in some real programming language,
it will develop the right kind of brain attitude,
so you will be able to design more complicated spells.

EDIT:

Code:
Wait until (((Playable map area) contains GrappleHook) Equal to True), checking every 0.10 seconds
This is extremely bad way of doing things, and would create impossible lag in any real map.
Learn to use timers.
 

Pigger

New Member
Reaction score
13
Did you upload a new version?

The old one does not grapple to the unit really,
If grapples to the ground where target is standing,
so if target moves it looks silly.

Nice idea of putting an arrow in the hook top,
I will steal it :)

Keep up the good work.

ALSO: learn to program in some real programming language,
it will develop the right kind of brain attitude,
so you will be able to design more complicated spells.

EDIT:

Code:
Wait until (((Playable map area) contains GrappleHook) Equal to True), checking every 0.10 seconds
This is extremely bad way of doing things, and would create impossible lag in any real map.
Learn to use timers.

Yeah, I've only really begun to do things "seriously" in the World Editor in about the past month or so, I'm still learning. How does it create lag if I might ask? Thanks for the positive and constructive feedback.

It should be a new version up, I never renamed them so I can never tell. There are maybe a few things I could/would change about the spell (such as making the hit unit stop moving until the caster gets to it) but I feel it is complete to my standards (as of right now).
 

Cohadar

master of fugue
Reaction score
209
Everything that uses "Entire map area" creates lag,
because game must loop through a group of all units in map
just to check if there is your hook in there somewhere.

There are better ways to do this,
and like I said those are timers.

Learn, learn and only learn...
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
sry for the straight complaining...
______
The hook is Way TOO slow....hate pausing my unit for a long time...
And why dont make it like lvl 4 800range but 9999999999999999999 casting range...it would be nicer...(for my thought)
 

Pigger

New Member
Reaction score
13
sry for the straight complaining...
______
The hook is Way TOO slow....hate pausing my unit for a long time...
And why dont make it like lvl 4 800range but 9999999999999999999 casting range...it would be nicer...(for my thought)

The complaining is fine. As I was saying to Cohadar, I'm still learning, and the best way I was able to do for the hook would be to make it a unit and just make it move. I suppose I could go back and make the hook a sliding unit too :(
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
make the hook movesped faster would make it more realistic

Edit: and play the hero's animation before the hook is created
 

Pigger

New Member
Reaction score
13
> make the hook movesped faster would make it more realistic
I'm pretty sure that I have it set to max (if not is' 521) so I can't make it any faster.
 

Cohadar

master of fugue
Reaction score
209
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...
 
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