Forum

Check ground?!?!

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Check ground?!?!

Postby Stealth Kill » Tue Aug 05, 2008 9:57 pm

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.
Stealth Kill
 
Posts: 83
Joined: Fri Dec 29, 2006 12:34 pm

Postby Entar » Wed Aug 06, 2008 12:42 am

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.
User avatar
Entar
 
Posts: 439
Joined: Fri Nov 05, 2004 7:27 pm
Location: At my computer

Postby Electro » Wed Aug 06, 2008 5:33 am

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/
Electro
 
Posts: 312
Joined: Wed Dec 29, 2004 11:25 pm
Location: Brisbane, Australia

Postby Stealth Kill » Wed Aug 06, 2008 9:32 am

Thanks i try that :D
Stealth Kill
 
Posts: 83
Joined: Fri Dec 29, 2006 12:34 pm


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest