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

Help with radiusdamage

broken avatar :(
Created 11 years ago
by jbird
0 Members and 1 Guest are viewing this topic.
3,249 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
Code Snippet
Plaintext
grenade_damage()
{
for(;;)
{
self waittill( "grenade_fire" , grenade , weapName );
//iprintln("thrown");
self thread grenade_damage();
{
if( weapName == "molotov" )
{
self waittill( "grenade_fire" , grenade , weapName );
//iprintln("exploded");
players = get_players();
for( i=0;i<players.size;i++ )
{
//iprintln( Distance( players[i].origin , grenade.origin ) );
if(players[i] == self)
{
SetPlayerIgnoreRadiusDamage( true );
}
}
radiusdamage(self.origin,200,50,50,self);
break;
}
else
{
grenade waittill( "explode" , position );
//iprintln("exploded");
players = get_players();
for( i=0;i<players.size;i++ )
{
//iprintln( Distance( players[i].origin , position ) );
if(players[i] == self)
{
SetPlayerIgnoreRadiusDamage( true );
}
}
radiusdamage(self.origin,256,25,25,self);
  break;
  }
  }
  }
}

I want to make it so that the player that threw the grenade doesn't get effected by the radiusdamage but the rest of the players do. Right now it makes it so all players don't get effected by the radiusdamage
This topic contains a post which is marked as the Best Answer. Click here to view it.
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 6 years ago
Posts
6,875
Respect
Forum Rank
Immortal
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Signature
If you want scripts / features made for you, then contact me by PM or email / skype etc
it will cost you tho so if you have no intention of reciprocating don't even waste my time ;)
×
Harry Bo21's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Harry Bo21's Contact & Social LinksHarryBo000[email protected]HarryBo21
Code Snippet
Plaintext
for( i=0;i<players.size;i++ )
{
//iprintln( Distance( players[i].origin , position ) );
if(players[i] == self)
{
players[ i ] SetPlayerIgnoreRadiusDamage( true ); // you were not running any of these "on" a player...
}
        else
        {
                radiusdamage(self.origin,256,25,25,players[ i ]); // should be here i think, never really used radius before, i just do distance checks
        }
}
Last Edit: June 20, 2015, 10:32:00 pm by Harry Bo21
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
My Contact & Social Links
More
×
jbird's Groups
Code Snippet
Plaintext
for( i=0;i<players.size;i++ )
{
//iprintln( Distance( players[i].origin , position ) );
if(players[i] == self)
{
players[ i ] SetPlayerIgnoreRadiusDamage( true ); // you were not running any of these "on" a player...
}
        else
        {
                radiusdamage(self.origin,256,25,25,players[ i ]); // should be here i think, never really used radius before, i just do distance checks
        }
}

It says
Code Snippet
Plaintext
players[i] SetPlayerIgnoreRadiusDamage( true );
is an unkown function
Last Edit: June 20, 2015, 11:43:22 pm by jbird
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 6 years ago
Posts
6,875
Respect
Forum Rank
Immortal
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
Harry Bo21's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Harry Bo21's Contact & Social LinksHarryBo000[email protected]HarryBo21
Then that function is designed to effect "all" players, not induviduals

check zeroys script reference, or the ugx script reference
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
My Contact & Social Links
More
×
jbird's Groups
Then that function is designed to effect "all" players, not induviduals

check zeroys script reference, or the ugx script reference

That's what I thought it might do.. Is there anyway I could make individual players not effected by radius damage?
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 11 March 2014
Last active: 5 years ago
Posts
264
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
Signature
"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
×
buttkicker845's Groups
buttkicker845's Contact & Social Links
you could try doing

Code Snippet
Plaintext
         if(players[i] == self)
         {
                    players[i] EnableInvulnerability();
         }
which should keep the player that threw the grenade from being damaged by the damageradius
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 6 years ago
Posts
6,875
Respect
Forum Rank
Immortal
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
Harry Bo21's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Harry Bo21's Contact & Social LinksHarryBo000[email protected]HarryBo21
as well as any other damage that they could potentially take at the same time. inadvisable
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 11 March 2014
Last active: 5 years ago
Posts
264
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
×
buttkicker845's Groups
buttkicker845's Contact & Social Links
true, but what are the odds of taking damage for the exact same second as them taking damage from their grenade?
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 6 years ago
Posts
6,875
Respect
Forum Rank
Immortal
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
Harry Bo21's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Harry Bo21's Contact & Social LinksHarryBo000[email protected]HarryBo21
very, especially when there are countless other ways of doing the same thing and just excluding the player from that ;)
Marked as best answer by jbird 11 years ago
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
My Contact & Social Links
More
×
jbird's Groups
I figured out how to do what I wanted to do correctly by looking in dlc3_code.gsc and looking at how it damages and downs people with traps.
Code Snippet
Plaintext
grenade_damage()
{
for(;;)
{
self waittill( "grenade_fire" , grenade , weapName );
//iprintln("thrown");
self thread grenade_damage();
{
if( weapName == "molotov" )
{
self waittill( "grenade_fire" , grenade , weapName );
players = get_players();
for(i=0;i<players.size;i++)
{
//iprintln( Distance( players[i].origin , grenade.origin ) );
if( Distance( players[i].origin , grenade.origin ) <= 200 && players[i] != self )
{
if(players[i].health > 50)
{
players[i] DoDamage( 160, grenade.origin );
}
else
{
radiusdamage(players[i].origin,10,players[i].health + 100,players[i].health + 100);
}
}
}
break;
}
else
{
grenade waittill( "explode" , position );
players = get_players();
for(i=0;i<players.size;i++)
{
//iprintln( Distance( players[i].origin , position ) );
if( Distance( players[i].origin , position ) <= 256 && players[i] != self )
{
if(players[i].health > 25)
{
players[i] DoDamage( 80, position );
}
else
{
radiusdamage(players[i].origin,10,players[i].health + 100,players[i].health + 100);
}
}
}
  break;
  }
  }
  }
}

If you have enough health to survive the damage, you use dodamage, but if you have less than enough health to survive then you use radiusdamage (because dodamage restarts the game in coop for some reason) but you make the origin of the damage the player you want to damage with a very small radius.

Yes I know I answered my own question IDGAF
Last Edit: June 21, 2015, 05:48:02 am by jbird
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 10 years ago
Posts
2,789
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
Signature
Let's keep this thread on topic from here on in. -DBZ

+1 to off-topic reply -DBZ

lmao. Too funny.

Goliath Script Placer: http://ugx-mods.com/forum/index.php/topic,11234.msg125257/topicseen.html#new

"...Christ, people. Learn C, instead of just stringing random characters
together until it compiles (with warnings)..."

-Linus Torvalds
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
Code Snippet
Plaintext
grenade_damage()
{
for(;;)
{
self waittill( "grenade_fire" , grenade , weapName );
//iprintln("thrown");
self thread grenade_damage();
{
if( weapName == "molotov" )
{
self waittill( "grenade_fire" , grenade , weapName );
players = get_players();
for(i=0;i<players.size;i++)
{
//iprintln( Distance( players[i].origin , grenade.origin ) );
if( Distance( players[i].origin , grenade.origin ) <= 200 && players[i] != self )
{
if(players[i].health > 50)
{
players[i] DoDamage( 160, grenade.origin );
}
else
{
radiusdamage(players[i].origin,10,players[i].health + 100,players[i].health + 100);
}
}
}
break;
}
else
{
grenade waittill( "explode" , position );
players = get_players();
for(i=0;i<players.size;i++)
{
//iprintln( Distance( players[i].origin , position ) );
if( Distance( players[i].origin , position ) <= 256 && players[i] != self )
{
if(players[i].health > 25)
{
players[i] DoDamage( 80, position );
}
else
{
radiusdamage(players[i].origin,10,players[i].health + 100,players[i].health + 100);
}
}
}
  break;
  }
  }
  }
}

Self thread grenade_damage()? Are you seriously doing that?  :facepalm:



broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 6 years ago
Posts
6,875
Respect
Forum Rank
Immortal
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
Harry Bo21's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Harry Bo21's Contact & Social LinksHarryBo000[email protected]HarryBo21
and dodamage doesnt end the game unless your "not" calling it on a player

i also dont understand why you need a damage radius "and" a distance check, if its always dealing the same damage anyway?
Last Edit: June 21, 2015, 09:00:38 am by Harry Bo21
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
My Contact & Social Links
More
×
jbird's Groups
and dodamage doesnt end the game unless your "not" calling it on a player

i also dont understand why you need a damage radius "and" a distance check, if its always dealing the same damage anyway?
the radiusdamage is really a dodamage in disguise. If you look at the code, it says the origin is the player and the radius is 10 which is not even big enough to effect any other players.

 
Loading ...