Check ground?!?!

Discuss programming in the QuakeC language.
Post Reply
Stealth Kill
Posts: 83
Joined: Fri Dec 29, 2006 12:34 pm

Check ground?!?!

Post by Stealth Kill »

I need heeeeelp

If the player is on the entity "func_bomb_target" you should be able to plant the bomb.

in W_Attack i changed W_FireBomb (); with CheckGround ();

and this is the checkground function.

Code: Select all

void() CheckGround =
{
	if (other.classname == "func_bomb_target")
	{
	      W_FireC4 ();
	}
           else 
           {
          centerprint (self, "You can not plant bomb here\n");  }


};
i i try to plant a a bomb it centerprints always You can not plant bomb here. If i´m on func_bomb_target too.
Entar
Posts: 439
Joined: Fri Nov 05, 2004 7:27 pm
Location: At my computer
Contact:

Post by Entar »

I'm not real good at QC, but my guess is that you need to put your check in the player's .touch function, and set a .variable for the player (or flag or something) in there if other.classname == "func_bomb_target" - then, when the player tries to use C4, check that variable.
Electro
Posts: 312
Joined: Wed Dec 29, 2004 11:25 pm
Location: Brisbane, Australia
Contact:

Post by Electro »

It's because 'other' is 'world' every time when you're calling that code.

why not make a touch function for the func_bomb_target

then in that you can do stuff like

Code: Select all

void() Func_BombTarget_Touch =
{
local entity oself;

if (other.classname != "player")
    return; // only allow players to register touchs

if (!other.hasbomb)
    return; // make sure they have the bomb

if (!other.flags & FL_ONGROUND)
    return; // don't plant bomb midair

other.hasbomb = FALSE; // take the bomb off them
// spawn the bomb in the world here etc...
oself = self;
self = other;
W_FireBomb ();
self = oself;
};
...well you get the idea.. or at least some ideas, hopefully.[/code]
Benjamin Darling
http://www.bendarling.net/

Reflex - In development competitive arena fps combining modern tech with the speed, precision and freedom of 90's shooters.
http://www.reflexfps.net/
Stealth Kill
Posts: 83
Joined: Fri Dec 29, 2006 12:34 pm

Post by Stealth Kill »

Thanks i try that :D
Post Reply