UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

Grief Friendly Fire Help

broken avatar :(
Created 11 years ago
by jbird
0 Members and 1 Guest are viewing this topic.
1,687 views
broken avatar :(
×
broken avatar :(
Location: usUnited States
Date Registered: 13 May 2014
Last active: 5 days ago
Posts
167
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
×
jbird's Groups
I'm trying to add grief fire into world at war. When you shoot players, it slows them down and when you knife them it pushes them. This is what I have so far from somebody else but it doesn't do anything currently.
Code Snippet
Plaintext
Callback_PlayerDamage( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, modelIndex, psOffsetTime )
{
//CODER MOD: TOMMY K, this is to prevent a player killing another player
if( isdefined( eAttacker ) && isPlayer( eAttacker ) )
{
if( self != eAttacker )
{
self thread griefing( eAttacker );
return;
}
else if( sMeansOfDeath != "MOD_GRENADE_SPLASH"
&& sMeansOfDeath != "MOD_GRENADE"
&& sMeansOfDeath != "MOD_EXPLOSIVE"
&& sMeansOfDeath != "MOD_PROJECTILE"
&& sMeansOfDeath != "MOD_PROJECTILE_SPLASH"
&& sMeansOfDeath != "MOD_BURNED" )
{
//player should be able to damage they're selves with grenades and stuff
//otherwise don't damage the player, so like airstrikes  won't kill the player
return;
}
}

// Override MUST call finishPlayerDamage if the damage is to be applied
if( IsDefined( level.overridePlayerDamage ) )
{
self [[level.overridePlayerDamage]]( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, modelIndex, psOffsetTime );
return;
}
 
self finishPlayerDamageWrapper( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, modelIndex, psOffsetTime );
}
 
griefing( eAttacker )
{
if( eAttacker meleeButtonPressed() )
self setVelocity( vectorToAngles( eAttacker.origin - self.origin ) ); // Not tested, you'll have to play around with this. Most likely won't push the player in the correct direction.

self setMoveSpeedScale( .3 );
wait( 1 );
self setMoveSpeedScale( 1 );
}
Also I want to remove the green friendly fire crosshairs for teammates, how do you remove that?
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 2 years ago
Posts
1,186
Respect
1,332Add +1
Forum Rank
Zombie Colossus
Primary Group
Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
Signature
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntStuffyBluntstuffy@BluntZombieStuffyZombie
Also I want to remove the green friendly fire crosshairs for teammates, how do you remove that?

setting this on a player should do that.

Code Snippet
Plaintext
player.activatecrosshair = false;


I've been messing with player on player damage a few months ago, b4 the xmas contest started, then i left it half-done and never got back to it yet. But if you get the code above working you'll prob get issue's with the game restarting because friendly fire is not allowed by default. Set this dvar to prevent that.

Code Snippet
Plaintext
		SetDvar( "friendlyfire_enabled", "0" );


I left the project when i was trying to link damage triggers ( allready placed in radiant ) to the players, and use those to register damage from other players..

Maybe it helps a little

 
Loading ...