Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: Bouncing Betty

  1. #1
    Private
    Join Date
    Jul 2015
    Posts
    44
    Thanks
    7
    Thanked 2 Times in 2 Posts

    Bouncing Betty

    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?

    Code:
    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?

  2. #2
    Private
    Join Date
    Jul 2015
    Posts
    44
    Thanks
    7
    Thanked 2 Times in 2 Posts
    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

  3. #3
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    Check the getstance of the affected players and return 0 if they are not standing

  4. The Following User Says Thank You to Ni3ls For This Useful Post:

    akuma2099 (14th October 2015)

  5. #4
    Private
    Join Date
    Jul 2015
    Posts
    44
    Thanks
    7
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by Ni3ls View Post
    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.

  6. #5
    Private
    Join Date
    Jul 2015
    Posts
    44
    Thanks
    7
    Thanked 2 Times in 2 Posts
    Code:
    	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..

  7. #6
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    No no, what I mean is that you exclude the players who are beneath the betty.
    Code:
        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

  8. The Following User Says Thank You to Ni3ls For This Useful Post:

    akuma2099 (7th October 2015)

  9. #7
    Private
    Join Date
    Jul 2015
    Posts
    44
    Thanks
    7
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by Ni3ls View Post
    No no, what I mean is that you exclude the players who are beneath the betty.
    Code:
        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?
    Last edited by akuma2099; 10th October 2015 at 16:20.

  10. #8
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    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
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  11. The Following User Says Thank You to IzNoGoD For This Useful Post:

    akuma2099 (14th October 2015)

  12. #9
    Private
    Join Date
    Jul 2015
    Posts
    44
    Thanks
    7
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by IzNoGoD View Post
    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
    Code:
    	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?

  13. #10
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Yes, probably the sighttracing part is missing then.

    Or maybe its an unintended bug in [insert newest cod here]
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  14. The Following User Says Thank You to IzNoGoD For This Useful Post:

    akuma2099 (14th October 2015)

Posting Permissions

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