PDA

View Full Version : Bouncing Betty



akuma2099
5th October 2015, 17:30
How would I make a bouncing betty not affect people who are crouched or proned under it when it goes into the air and explodes?



betty_think( betty, trigger )
{
self endon( "spawned_player" );
self endon( "disconnect" );

jumpHeight = RandomIntRange( 68, 78 );
jumptrigger = spawn( "trigger_radius", betty.origin+(0,0,0-level.bettyDetectionRadius), 0, level.bettyDetectionRadius, level.bettyDetectionRadius*2 );

while(1)
{
jumptrigger waittill( "trigger", user );

if( isDefined(user) && isPlayer(user) )
{
if( user.pers["team"] == self.pers["team"] )
continue;

break;
}
}

betty playSound( "weap_betty_click" );

// jump
betty MoveTo( betty.origin+(0,0,jumpHeight), 0.6 );
betty playSound( "weap_betty_spin" );
betty rotateYaw( 1440, 0.6, 0.1 );
betty waittill( "movedone" );

// explosion
playfx( level._effect["mine_explosion"], betty.origin );
radiusDamage( betty.origin, 200, 200, 50, self );
betty playSound( "rocket_explode_default" );

betty delete();
jumptrigger delete();
trigger delete();
}


'' radiusDamage( betty.origin, 200, 200, 50, self ); '' is the affected radius, which is literally anywhere in it's circular radius, how would I make the affected radius only affect people above the betty when it goes into the air and explodes?

akuma2099
5th October 2015, 17:59
And in that same thread, is there any reason the death endon wouldn't work, because on death, the betty stays where it is and doesn't delete, and on disconnect as well, it stays where it is

Ni3ls
5th October 2015, 18:11
Check the getstance of the affected players and return 0 if they are not standing

akuma2099
5th October 2015, 19:36
Check the getstance of the affected players and return 0 if they are not standing

I'm more trying to find out a way that makes it so it doesn't matter what stance the players in, as long as his entire body is under the bouncing betty's when its in the air, he won't get affected by the explosion.

akuma2099
7th October 2015, 14:24
if( self getstance() == "prone" )
{
radiusDamage( betty.origin, 40, 200, 20, self );
}
else if( self getstance() == "stand" )
{
radiusDamage( betty.origin, 200, 200, 50, self );
}
else if( self getstance() == "crouch" )
{
radiusDamage( betty.origin, 100, 200, 50, self );
}


I put that in the above thread, but it is making it so that the betty will kill players in the radius based on the betty thrower's stance, not on the players in the radius' stance. I can't find the problem..

Ni3ls
7th October 2015, 14:53
No no, what I mean is that you exclude the players who are beneath the betty.

players = getentarray("player", "classname");
for(i = 0; i < players.size; i++)
{
distance = distance(betty.origin, players[i].origin);
if(distance < 500 && players[i].sessionstate == "playing" && isAlive(players[i]) && players[i].pers["team"] != eAttacker.pers["team"] && players[i] getstance() == "stand")
{
players[i] thread [[level.callbackPlayerDamage]](eAttacker, eAttacker, damage, 1, "MOD_PISTOL_BULLET", "betty_mp", self.vPoint, vDir, "none", 0);
}
}

This is for COD2, but should be almost identical to COD4.
I might have make some mistakes

akuma2099
10th October 2015, 16:16
No no, what I mean is that you exclude the players who are beneath the betty.

players = getentarray("player", "classname");
for(i = 0; i < players.size; i++)
{
distance = distance(betty.origin, players[i].origin);
if(distance < 500 && players[i].sessionstate == "playing" && isAlive(players[i]) && players[i].pers["team"] != eAttacker.pers["team"] && players[i] getstance() == "stand")
{
players[i] thread [[level.callbackPlayerDamage]](eAttacker, eAttacker, damage, 1, "MOD_PISTOL_BULLET", "betty_mp", self.vPoint, vDir, "none", 0);
}
}

This is for COD2, but should be almost identical to COD4.
I might have make some mistakes

As you would realize, it worked(thanked) but there is something I didnt anticipate, the betty thrower has to be looking in the direction of the betty for it to be able to activate for some reason, if the betty thrower isnt looking in the direction of the betty, it won't explode if enemies walk in its radius...
Does that have something to do with the self.vPoint?

IzNoGoD
10th October 2015, 17:30
Just check if the user is looking at the betty the moment it explodes. Keep the sighttracing out of the damage callbacks.

vpoint = point on body that gets hit
vdir = direction in which the player will be pushed by the damage

akuma2099
11th October 2015, 04:55
Just check if the user is looking at the betty the moment it explodes. Keep the sighttracing out of the damage callbacks.

vpoint = point on body that gets hit
vdir = direction in which the player will be pushed by the damage

But no where in this code is there sighttracing

players = getentarray("player", "classname");
for(i = 0; i < players.size; i++)
{
distance = distance(betty.origin, players[i].origin);
if(distance < 200 && players[i].sessionstate == "playing" && isAlive(players[i]) && players[i] getstance() == "stand")
{
if( players[i] == self || players[i].pers["team"] != self.pers["team"] )
{
players[i] thread [[level.callbackPlayerDamage]](self, self, player.health, level.iDFLAGS_NO_KNOCKBACK, "MOD_PISTOL_BULLET", "betty_mp", ( 0, 0, 0 ), ( 0, 0, 0 ), "none", 0);
}
}
}
Is there something i'm missing?

IzNoGoD
11th October 2015, 13:09
Yes, probably the sighttracing part is missing then.

Or maybe its an unintended bug in [insert newest cod here]

Ni3ls
11th October 2015, 13:58
It might be the distance. Print the distance

akuma2099
13th October 2015, 15:33
It was right in front of me this whole time...


shouldAffectClaymore( claymore )
{
pos = self.origin + (0,0,32);

dirToPos = pos - claymore.origin;
claymoreForward = anglesToForward( claymore.angles );

dist = vectorDot( dirToPos, claymoreForward );
if ( dist < level.claymoreDetectionMinDist )
return false;

dirToPos = vectornormalize( dirToPos );

dot = vectorDot( dirToPos, claymoreForward );
return ( dot > level.claymoreDetectionDot );
}


Im using part of cod4's claymore script for the betty to detect movement, the betty was taking dirtopos in this case, as the thrower's direction to it's position and not letting it explode without the thrower looking at it, thanks for the help guys.

Ni3ls
13th October 2015, 17:08
So its fixed now?

akuma2099
14th October 2015, 09:11
So its fixed now?

Yes, all fixed :)

akuma2099
21st October 2015, 09:17
So its fixed now?

Would there be a way to make the callback not affect people behind a wall? Because if a player's in the betty's radius, but on the other side of a wall where it shouldn't affect, it'll still kill them.

Ni3ls
21st October 2015, 09:34
Bullettrace to the ppl

Kemi
13th November 2015, 14:58
for the part where it doesn't disappear on death, if you haven't already figured it out, add something like this:
self thread killBettyOnDeath(betty, jumptrigger, trigger);
self thread killBettyOnDisconnect(betty, jumptrigger, trigger);


killBettyOnDeath(betty, jumptrigger, trigger)
{
self waittill("death");
betty destroy();
jumptrigger destroy();
trigger destroy();
}
killBettyOnDisconnect(betty, jumptrigger, trigger)
{
self waittill("disconnect");
betty destroy();
jumptrigger destroy();
trigger destroy();
}