Raised This Month: $62 Target: $400
 15% 

Pyro Knockback / Pyro Double Jump


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Ugleh
Member
Join Date: Oct 2009
Plugin ID:
2323
Plugin Version:
1.4
Plugin Category:
Gameplay
Plugin Game:
Team Fortress 2
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Allows Pyros to have a Knockback from Compression Blasts, which gives a double jump effect
    Old 05-01-2011 , 09:08   Pyro Knockback / Pyro Double Jump
    Reply With Quote #1

    About
    Pyro Knockback gives Pyros the ability to knockback from air/compression blasts, which not only could save them from a tall fall but also gives them a double jump effect.

    The Pyro can only blast off of objects/entities, it can not just blast off of air, preventing flying.

    Video

    http://www.youtube.com/watch?v=PTLeaJK8s8Y

    Cvars
    sm_pk_enable - (def "1") <0/1> Enable PK.
    sm_pk_d - (def "-250") <-10/-20/-30/etc> Amount of Push Distance, Negative is pushed, Positive is Pulled.
    sm_pk_dr - (def "150")<60/120/180/etc> Required distance of entity to push off of.

    Chat Command
    !pyro - Toggles the knockback for the client who entered the command.

    Custom Airblast Cost Cvars
    If your server has custom airblast costs instead of the default Flamethower 20, backburner 50, then these cvars need to be set. -1 means they are not in use.
    This does not set the airblast cost, it is meant for an exception to see if the player has enough ammo to airblast.

    sm_pk_backburner - -1
    sm_pk_flamethrower - -1
    sm_pk_degreaser - -1

    sm_pk_d
    This ConVar changes the actual push distance, if you want to get pushed further you will make the number lower, i.e -1000 would push you to the skyboxes roof on most maps, while -250 seams about right for a compression blast.

    sm_pk_dr
    You can't just shoot the air and assume your going to get pushed, or shoot the water in 2fort and assume you can glide over it. There is a distance between you and the entity/object you are looking at. The normal distance between you airblasting a person is 150, so thats what I set it to, and it looks good to me.
    Attached Files
    File Type: sp Get Plugin or Get Source (PyroKnockback.sp - 1517 views - 5.0 KB)

    Last edited by Ugleh; 05-08-2011 at 06:01.
    Ugleh is offline
    xomp
    BANNED
    Join Date: Jul 2008
    Old 05-01-2011 , 11:28   Re: Pyro Knockback
    Reply With Quote #2

    Nice idea, though it isn't much use for the pyro if they are running and decide to compression blast jump since this plugin causes the pyro to loose ALL momentum.
    xomp is offline
    Send a message via Skype™ to xomp
    Ugleh
    Member
    Join Date: Oct 2009
    Old 05-01-2011 , 15:23   Re: Pyro Knockback
    Reply With Quote #3

    Quote:
    Originally Posted by xomp View Post
    Nice idea, though it isn't much use for the pyro if they are running and decide to compression blast jump since this plugin causes the pyro to loose ALL momentum.
    Im new to sourcemod, would their be a way to fix this?
    I could probably make it so users can turn it on or off.
    Ugleh is offline
    Pawn 3-pg
    Senior Member
    Join Date: Jul 2009
    Old 05-02-2011 , 10:21   Re: Pyro Knockback
    Reply With Quote #4

    Untested, but this should work to keep the pyro's momentum when airblasting.
    PHP Code:
    stock Blast(client)
    {
        new 
    Float:vector[3];    
        new 
    Float:lookingloc[3];
        new 
    Float:clientloc[3];
        new 
    Float:angles[3];
        new 
    Float:current_velocity[3];
        
        
    //Changing this to the client location.
        
    GetClientEyePositionclientclientloc );
        
    GetClientEyeAnglesclientangles );
        
        new 
    Handle:trace TR_TraceRayFilterExclientlocanglesMASK_PLAYERSOLID_BRUSHONLYRayType_InfiniteTraceEntityFilterPlayersclient );
        if(!
    TR_DidHittrace ) )
        {
        return
        }
      
    TR_GetEndPositionlookingloctrace );
        
    CloseHandle(trace);
        
        
    //No need to get the client abs origin since you already have the eye position.
        //GetClientAbsOrigin(client, clientloc);
        
        //These two lines can be replaced with GetAngleVectors
        //MakeVectorFromPoints(clientloc, lookingloc, vector);
        //NormalizeVector(vector, vector);
        
    GetAngleVectors(anglesvectorNULL_VECTORNULL_VECTOR);
        
    NegateVector(vector); //change it from the forward vector to a backward vector
        
        //Add the player's current speed to blast vector
        
    GetEntPropVector(clientProp_Data"m_vecVelocity"current_velocity);
        
    AddVectors(current_velocityvectorvector)
        
        
    ScaleVector(vectorGetConVarFloat(c_Distance));
        new 
    TheDistance;
        
    TheDistanceRoundToNearest(GetVectorDistance(lookinglocclientloc));
        if(
    TheDistance GetConVarInt(c_DistanceRequired)){
            
    TeleportEntity(clientNULL_VECTORNULL_VECTORvector);
            
        }    

    Also, you were using the eye angles to determine where the blast force was coming from, but then using the abs origin to determine the direction the push happens. If you are standing against a wall looking down at the bottom of the wall, the blast should knock you into the air, but since the blast point is higher than the abs origin, it would have tried to push you into the ground. Aiming at a spot on the floor in front of you will push you directly backwards. Using the eye position for both will fix this.
    Pawn 3-pg is offline
    Ugleh
    Member
    Join Date: Oct 2009
    Old 05-02-2011 , 23:04   Re: Pyro Knockback
    Reply With Quote #5

    Quote:
    Originally Posted by Pawn 3-pg View Post
    Untested, but this should work to keep the pyro's momentum when airblasting.
    that doesn't work, it wont let the pyro blast into the air, ill look at the code to see if i could fix it though.
    Ugleh is offline
    xomp
    BANNED
    Join Date: Jul 2008
    Old 05-03-2011 , 12:59   Re: Pyro Knockback
    Reply With Quote #6

    Quote:
    /home/groups/alliedmodders/forums/files/6/2/9/0/9/85461.attach::OnPlayerRunCmd()
    L 05/03/2011 - 11:18:54: [SM] Native "GetEntProp" reported: Entity -1 (-1) is invalid
    L 05/03/2011 - 11:18:54: [SM] Displaying call stack trace for plugin "PyroKnockback.smx":
    L 05/03/2011 - 11:18:54: [SM] [0] Line 72,
    Spammed about 200 billion times in my logs.
    xomp is offline
    Send a message via Skype™ to xomp
    Ugleh
    Member
    Join Date: Oct 2009
    Old 05-07-2011 , 23:23   Re: Pyro Knockback
    Reply With Quote #7

    Quote:
    Originally Posted by xomp View Post
    Spammed about 200 billion times in my logs.
    thats weird, i had exceptions for the client so i assume its the weapon id.
    Well I did just update it with a new feature and hopefully a fix of your error.
    Ugleh is offline
    Tylerst
    Veteran Member
    Join Date: Oct 2010
    Old 05-07-2011 , 23:43   Re: Pyro Knockback
    Reply With Quote #8

    Code:
    new weapon2 = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
    Code:
    new weapon2 = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
    if(!IsValidEntity(weapon2)) return;


    Also, add item index 208 somewhere(Upgradeable Flamethrower) else this won't work for anyone with a renamed/custom description normal flamethrower.


    and...

    Code:
    if(weapon2 >=0){
    }else{
    What?

    Last edited by Tylerst; 05-07-2011 at 23:54.
    Tylerst is offline
    Ugleh
    Member
    Join Date: Oct 2009
    Old 05-08-2011 , 04:00   Re: Pyro Knockback
    Reply With Quote #9

    Quote:
    Originally Posted by Tylerst View Post
    Code:
    new weapon2 = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
    Code:
    new weapon2 = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
    if(!IsValidEntity(weapon2)) return;
    Also, add item index 208 somewhere(Upgradeable Flamethrower) else this won't work for anyone with a renamed/custom description normal flamethrower.


    and...

    Code:
    if(weapon2 >=0){
    }else{
    What?
    thanks, im new to sourcemod so didn't know about IsValidEntity, ill update it now and add index 208 to the if statement.

    Edit:
    208 is the custom flamethrower or backburner, and whats the custom other one?

    Last edited by Ugleh; 05-08-2011 at 04:02.
    Ugleh is offline
    Tylerst
    Veteran Member
    Join Date: Oct 2010
    Old 05-08-2011 , 08:23   Re: Pyro Knockback
    Reply With Quote #10

    Quote:
    Originally Posted by Ugleh View Post
    thanks, im new to sourcemod so didn't know about IsValidEntity, ill update it now and add index 208 to the if statement.

    Edit:
    208 is the custom flamethrower or backburner, and whats the custom other one?
    208 is for custom normal flamethrowers, custom backburner/degreaser use their own indexes

    I think they did it because normal items can't use attributes, so they had to add one that does
    Tylerst is offline
    Reply


    Thread Tools
    Display Modes

    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 01:30.


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