Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 28

Thread: Push player with a bash possible?

  1. #11
    Administrator James's Avatar
    Join Date
    May 2010
    Location
    on the intraweb
    Posts
    3,180

    Default

    I think what Ryback was initially saying with velocity could work.

    Before we fixed AntiSTWH in the patch, I wrote a serverside script that would prevent STWH.
    Basically what makes STWH work is the player leans into a wall. So the script checks if a player is leaning against the wall, and if they are, it pushes them back which stops STWH.

    Anyway, what it sounds like is when you bash a player, instead of it damaging the enemy you push them away. So you're just executing a script from the bash animation that uses velocity to push them. Just play around with this script


    main:
    level waittill prespawn
    level waittill spawn

    while(1)
    {
    //Do this for all players
    for(local.i = 1; local.i <= $player.size; local.i++)
    {
    local.player = $player[local.i]
    //Check if they’re leaning. You don’t really need this in your bash script
    local.lean = (local.player getcontrollerangles 0)[2]

    //This just checks if you’re leaning left. If you lean left the value is 0 > 16
    if(local.lean > 0)
    {
    local.headpos = local.player gettagposition "eyes bone"
    local.origin = local.player gettagposition "Bip01 Spine"
    local.yes = sighttrace local.origin local.headpos 1

    if(!local.yes)
    {
    iprintln "leaning left agaisnt something"

    for(local.j = 1; local.j <=16; local.j++)
    {
    //This is really the only piece of code that would be relevant in your bash/push script
    //Basically this applies the reverse amount of force that you lean into the wall
    //The script negates it. If you want to push harder, just increase the j value
    local.player.velocity += local.player.leftvector * -(local.j)
    }
    }
    }
    //This is exactly the same as above, only instead of checking leaning left, this checks leaning right
    //These values range from 0 < -16
    else if(local.lean < 0)
    {
    local.headpos = local.player gettagposition "eyes bone"
    local.origin = local.player gettagposition "Bip01 Spine"
    local.yes = sighttrace local.origin local.headpos 1

    if(!local.yes)
    {
    iprintln "leaning right agaisnt something"


    for(local.j = 1; local.j <=16; local.j++)
    {
    local.player.velocity += local.player.leftvector * (local.j)
    }
    }
    }
    }

    waitframe
    }
    end


    Really, the only relevant piece of code you would need in what you're trying to accomplish is this:

    local.player.velocity += x


    Replace x with some number. The higher the number the greater the push back.
    Play around with it and see what you can do.

  2. #12

    Default

    cool thanks i will try a bit after the weekend , weekend is beer drinking time , i dotn mess aorund with modding after a smoke or some beers :P

  3. #13
    Developer Sor's Avatar
    Join Date
    Aug 2010
    Location
    The Medieval City of Bruges
    Posts
    747

    Default

    This will perform the push. Force is the distance the player will be pushed in that direction, if I remember correctly.
    local.force = 200;
    local.dir = angles_toforward local.pusher.viewangles;
    local.pushed pusher local.pusher local.pusher local.dir local.force;

    If you want this to be a side effect of bashing, you could either edit the state files or register to the damage event.
    For more info about the parameters, see this post of mine: http://www.x-null.net/forums/showthr...ll=1#post19498

    Note that both local.pushed and local.pusher don't necessarily have to be players. They can be any entity.
    Though you'd need another way to determine the direction if that's the case.
    Last edited by Sor; May 22nd, 2015 at 03:27 PM.
    Morpheus Script (MoH) => You try to shoot yourself in the foot only to discover that MorpheusScript already shot your foot for you.

  4. #14
    Administrator James's Avatar
    Join Date
    May 2010
    Location
    on the intraweb
    Posts
    3,180

    Default

    Sor, is the last line a typo?
    Did you mean

    local.pushed pusher local.power local.pusher local.dir local.force;


    Or did you intentionally type local.pusher twice?

  5. #15
    Developer Sor's Avatar
    Join Date
    Aug 2010
    Location
    The Medieval City of Bruges
    Posts
    747

    Default

    No, power was the typo. The function just requires an inflictor and an attacker even though it does not inflict damage.
    Morpheus Script (MoH) => You try to shoot yourself in the foot only to discover that MorpheusScript already shot your foot for you.

  6. #16

    Default

    so... executing a script in the bash in mike torso like ryback says... than use the moh ball mod for the direction to push.... and the push maybe for the push after the teleport mod like

    push_player3:
    local.trigger = spawn trigger_push origin ( -1895.47 -1877.34 481.77 ) "target" "roof"
    spawn script_origin "targetname" "roof" origin ( -1918.85 -1967.10 481.77 )
    wait 1
    local.trigger remove

    but than use the coords like the moha ball mod it uses?

  7. #17

    Default

    Code:
    //ShortRangeKick
    	if ( (local.player.fireheld == 1) && (local.player.useheld != 1) )
    	{
    	$ball playsound snd_bh_flesh2
    	wait .1
    	$ball playsound steilhandgranate_snd_grenade_throw
    
    		$ball.velocity = local.player.forwardvector * 500 + local.player.leftvector * 0 + local.player.upvector * 300
    	local.player iprint ("ShortRangeKick")
    	}
    	if ( (local.player.useheld != 1) && (local.player.fireheld != 1) )
    	{
    	$ball playsound dog_fs
    
    	$ball playsound steilhandgranate_snd_grenade_throw
    
    	$ball.velocity = local.player.forwardvector * 400 + local.player.leftvector * 0 + local.player.upvector * 100
    	}
    	level.ball_triggered = 0
    
    	end
    this is the ball kick from beachsoccer mod... can i do something with this?
    where is ryback if u need him

  8. #18

    Default

    Code:
    // Pistol whip for silent kills
    state ATTACK_PISTOL_SECONDARY
    {
    	movetype legs
    
    	entrycommands
    	{
    		viewmodelanim fire_secondary 1
    	}
    
    	action
    	{
    		pistol_butt	: default
                    thread pushbash // <-------------go to pushbash thread
    	}
    	
    	states
    	{
    		STAND	 	: KILLED
    		
    		STAND	 	: ANIMDONE_TORSO
    	}
    }
    Code:
    thread pushbash:
    
    //pushbash
    	if ( (local.player.fireheld == 1) && (local.player.useheld != 1) )
    	{
    	$pushbash playsound snd_bh_flesh2
    	wait .1
    	$pushbash playsound steilhandgranate_snd_grenade_throw
    
    		$pushbash.velocity = local.player.forwardvector * 500 + local.player.leftvector * 0 + local.player.upvector * 300
    	local.player iprint ("ShortRangeKick")
    	}
    	if ( (local.player.useheld != 1) && (local.player.fireheld != 1) )
    	{
    	$pushbash playsound dog_fs
    
    	$pushbash playsound steilhandgranate_snd_grenade_throw
    
    	$pushbash.velocity = local.player.forwardvector * 400 + local.player.leftvector * 0 + local.player.upvector * 100
    	}
    	level.pushbash_triggered = 0
    
    	end
    or im just doign somehting now? :P

  9. #19

    Default

    I'm not sure the script from beachsoccer would work, as it creates a listener for those kicks, $ball the ball that is spawned. I did just finish my Push Laser, it's not a bash, but it can be edited pretty much anyway you please. Right now I have it set up to a short range laser (100 units) that pushes the player in front of you at a speed of 500, it's set up like this right now as it was created as a way to get noobs out of doorways. But it can be adapted to what you're looking for, as long as you can deal with it being a laser.

    You could also, if you only wanna be able to push enemies and not friends, you could also edit your colt45.tik and p38.tik to have stronger knockback

    dmbulletknockback 50000 <- for colt, launch enemies away
    dmbulletknockback -50000 <- for p38, pull enemies to you/past you

    Though this would only apply to the bullets. Perhaps it works the other way, adding this line in the secondary dm options

    secondary dmbulletknockback xxxxxx may work for the bash, but only on enemies

    I can post my modded pistols if you want, so you can have it and see what I'm explaining.

    Also if you want my Push Laser it will be posted in Enhancements when I get home in about 3-3 1/2 hours.

  10. #20

    Default

    oke i have executed the scr file from the mike torso file..... it works somehow but when i push.... i push myself to... and it doesnt mather where i bash... if i bash in the air the othe rplayers moves :P.
    what did i do wrong?

    Code:
    main:
    
    
    	for (local.i = 1; local.i <= local.default.size; local.i++)
    	{
    		local.t = local.default[local.i][1]
    		if (level.push[local.t] == NIL)
    		{
    			level.push[local.t] = local.default[local.i][2]
    		}
    	}
    
    
    	thread push_2
    
    end
    
    push_2:
    
    	local.power = 200
    for (local.i = 1; local.i <= $player.size; local.i++)
    	{
    	for (local.f = $player.size; local.f > 0; local.f--)
    	      {
    
    		if ($player[local.i].fireheld == 1)
    		   {
    			local.dir = (angles_toforward $player[local.i].viewangles)
    			$player[local.f] pusher $player[local.i] $player[local.i] local.dir local.power 
    		   }
    		else if ($player[local.f].fireheld == 1)
    	           {
    			local.dir = (angles_toforward $player[local.f].viewangles)
    			$player[local.i] pusher $player[local.f] $player[local.f] local.dir local.power 
    		   }
                  }
             }
    
    end
    tips?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •