Raised This Month: $ Target: $400
 0% 

Hero Abiliy : Hook (Like Pudge's from DotA)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MiloSx7
Member
Join Date: Oct 2011
Location: Serbia, Nish
Old 05-25-2013 , 19:30   Hero Abiliy : Hook (Like Pudge's from DotA)
Reply With Quote #1

Ok so I'm really confused by looking at other plugins that create this trails, like grenade_trail does, and one thing i know it is made so it follows the bomb.

The thing that I need is a trail that will go out from players body, hit another player (ally or enemy doesn't matter), and then bring that entity back to the, lets name it "Hooker"

I'm kinda new to scripting and i really don't understand how to do this, i don't want any models or stuff, just a simple grey trail going out of "hookers" body and hooking first thing that hits.

Making a range for hook would also be very nice

Thank you, a lot!

[The problem is hooking through walls, it would be good if hook could stop if collides with wall]
__________________
MiloS
MiloSx7 is offline
Send a message via MSN to MiloSx7
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 05-26-2013 , 02:27   Re: Hero Abiliy : Hook (Like Pudge's from DotA)
Reply With Quote #2

Pseudocode:

Code:
//Plugin Init
Register hook entity touch

//Hook start function
Create hook entity
Set hook entity properties (movetype, solid, owner, etc.)
Create TE_BEAMENTS (trail) message from owner to hook
Use velocity_by_aim to set velocity for hook

//Hook touch function
If entity is valid player,
   If player is owner
      Remove the hook entity
   Else
      set velocity on player towards hook's owner
Set velocity on hook towards owner
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
MiloSx7
Member
Join Date: Oct 2011
Location: Serbia, Nish
Old 05-26-2013 , 07:23   Re: Hero Abiliy : Hook (Like Pudge's from DotA)
Reply With Quote #3

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <engine>

new g_trail

public plugin_init()
{
    
register_forward(FM_EmitSound"EmitSound")
    
    
register_touch("Hook""*" "HookTouch")
}

public 
plugin_precache()
{
    
g_trail precache_model("sprites/smoke.spr")
}

public 
GuttingHook(id)
{
    if(
is_user_alive(id))
    {
        new 
FloatOrigin[3], FloatvAngle[3], FloatVelocity[3]
        
        
entity_get_vector(idEV_VEC_v_anglevAngle)
        
entity_get_vector(idEV_VEC_origin Origin)
        
        new 
Ent create_entity("info_target")
        
        
entity_set_string(EntEV_SZ_classname"Hook")
        
        
vAngle[0] *= -1.0
        
        entity_set_origin
(EntOrigin)
        
entity_set_vector(EntEV_VEC_anglesvAngle)
        
        
entity_set_int(EntEV_INT_effects2)
        
entity_set_int(EntEV_INT_solidSOLID_BBOX)
        
entity_set_int(EntEV_INT_movetypeMOVETYPE_FLY)
        new 
killer entity_set_edict(EntEV_ENT_ownerid)
        new 
victim entity_set_edict(EntEV_ENT_enemyid)
        
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
        
write_byte(TE_BEAMENTS)
        
write_short(killer)
        
write_short(victim)
        
write_short(g_trail)
        
write_byte(0)
        
write_byte(0)
        
write_byte(10)
        
write_byte(10)
        
write_byte(255)
        
write_byte(190)
        
write_byte(190)
        
write_byte(190)
        
write_byte(255)
        
write_byte(8)
        
message_end()
        
        
VelocityByAim(id200Velocity)
        
entity_set_vector(EntEV_VEC_velocity ,Velocity)
    }
}
public 
HookTouch(ent)
{
    if(!
is_valid_ent(ent))
    {
        return
    }
    
    new 
attacker entity_get_edict(entEV_ENT_owner)
    
    new 
entlist[33]
    new 
numfound find_sphere_class(ent"player"230.0entlist32)
    
    for(new 
0numfoundi++)
    {        
        new 
pid entlist[i]
        
        if(!
is_user_alive(pid) || get_user_team(attacker) == get_user_team(pid))
        {
            continue
        }
        
        
ExecuteHam(Ham_TakeDamagepidentattacker55.01)
    }
    
    
remove_entity(ent)
}

public 
EmitSound(idiChannelszSound[], Float:fVolFloat:fAttniFlagsiPitch 
{
    if(
equal(szSound"common/wpn_denyselect.wav"))
    {
        
GuttingHook(id)
    }

Heh, as I said, I'm really newbie in this so, this is how it got done. It don't work, of course, i only see a white line under myself and it lasts about 2-3 seconds...

PHP Code:
write_short(killer)
write_short(victim
This 2 lines are confusing me and i think that's where I'm mistaking.

Please help me, tell me if i did anything wrong because i know i did, because i basically c/p-ed another plugins...

Thanks!
__________________
MiloS
MiloSx7 is offline
Send a message via MSN to MiloSx7
MiloSx7
Member
Join Date: Oct 2011
Location: Serbia, Nish
Old 05-26-2013 , 16:57   Re: Hero Abiliy : Hook (Like Pudge's from DotA)
Reply With Quote #4

Bring Up My Post

Anyone?? Please i really want this so bad, if you won't script at least tell me what i did wrong in my code

Ty
__________________
MiloS
MiloSx7 is offline
Send a message via MSN to MiloSx7
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 05-26-2013 , 18:08   Re: Hero Abiliy : Hook (Like Pudge's from DotA)
Reply With Quote #5

Don't bump your posts for two weeks.

Use the entity id variable and the player id variable.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
MiloSx7
Member
Join Date: Oct 2011
Location: Serbia, Nish
Old 05-27-2013 , 00:51   Re: Hero Abiliy : Hook (Like Pudge's from DotA)
Reply With Quote #6

Ok sorry about that :\

So i was right when i said i got wrong there? Ok ill fix it when i get back from school

Thanks
__________________
MiloS
MiloSx7 is offline
Send a message via MSN to MiloSx7
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:21.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode