Forum

Solid Weapon Pickups

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Solid Weapon Pickups

Postby Ghost_Fang » Tue Mar 09, 2010 4:02 am

I know if i want manual weapon pickups i have to make the standard quake weapons solid to be detected by the traceline. I don't see anywhere in items.qc where it tells the weapons to be SOLID_NOT. Or is it something completely different?
Ghost_Fang
 
Posts: 336
Joined: Thu Nov 12, 2009 4:37 am

Postby Error » Tue Mar 09, 2010 7:38 am

all items are set solid in a seperate function:

Code: Select all
void() PlaceItem =
{
   local float   oldz;

   self.mdl = self.model;      // so it can be restored on respawn
   self.flags = FL_ITEM;      // make extra wide
   self.solid = SOLID_TRIGGER;
   self.movetype = MOVETYPE_TOSS;   
   self.velocity = '0 0 0';
   self.origin_z = self.origin_z + 6;
   oldz = self.origin_z;
   if (!droptofloor())
   {
      dprint ("Bonus item fell out of level at ");
      dprint (vtos(self.origin));
      dprint ("\n");
      remove(self);
      return;
   }
};


and for regenerating weapons/ammo and such it's done in this function:

Code: Select all
void() SUB_regen =
{
   self.model = self.mdl;      // restore original model
   self.solid = SOLID_TRIGGER;   // allow it to be touched again
   sound (self, CHAN_VOICE, "items/itembk2.wav", 1, ATTN_NORM);   // play respawn sound
   setorigin (self, self.origin);
};
User avatar
Error
InsideQC Staff
 
Posts: 865
Joined: Fri Nov 05, 2004 5:15 am
Location: VA, USA

Postby Spike » Tue Mar 09, 2010 9:20 am

weapons are SOLID_TRIGGER, so you can walk through them, but they still get touch notifications from players that walk inside them.

actually solid pickups will block the player's motion as well. consider using SOLID_CORPSE if your engine supports that.
failing that, you could use find and a traceline that succeeds when it reaches the center of the pickup without hitting anything.
note that to do that, you should probably make all such pickups use a single classname.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby Downsider » Tue Mar 09, 2010 12:41 pm

Can't you, before the user does the traceline, make them solid, then after, make them untouchabale again?
User avatar
Downsider
 
Posts: 621
Joined: Tue Sep 16, 2008 1:35 am

Postby Dr. Shadowborg » Tue Mar 09, 2010 5:16 pm

Or, you could like, use the same method I used to make a UT style shock rifle.

http://tlb.quakedev.com/files/shkrflv1.zip
User avatar
Dr. Shadowborg
InsideQC Staff
 
Posts: 1110
Joined: Sat Oct 16, 2004 3:34 pm

Postby Scrama » Wed Mar 10, 2010 3:13 am

DO NOT play with solid, it is not necessary.

Just make a little hack:

In weapons.qc/ImpulseCommands add 2 lines
Code: Select all
   if (self.impulse == 213) // Any impulse number
      self.use_time = time + 0.2 // time to allow item pick-up

and in items.qc/weapon_touch:
Code: Select all
// after lines
   if (!(other.flags & FL_CLIENT))
      return;
// insert next two      
   if (other.use_time > time)
      return;

Also you need to define float .use_time somewhere.
To allow player use by impulse doors/buttons etc. just insert [if use_time] construction.

and... bind KEY "impulse 213" in config is very useful )
User avatar
Scrama
 
Posts: 20
Joined: Fri Aug 28, 2009 6:16 am
Location: Siberia, Omsk

Postby Downsider » Wed Mar 10, 2010 3:45 am

I think it would be best if the entity was kept non-solid and the findradius function was used instead, so you don't even have to look at it, just be near it..
User avatar
Downsider
 
Posts: 621
Joined: Tue Sep 16, 2008 1:35 am

Postby r00k » Thu Mar 11, 2010 4:19 am

I was thinking the same thing.
r00k
 
Posts: 1110
Joined: Sat Nov 13, 2004 10:39 pm

Postby Scrama » Thu Mar 11, 2010 5:58 am

...and you can check direction
User avatar
Scrama
 
Posts: 20
Joined: Fri Aug 28, 2009 6:16 am
Location: Siberia, Omsk

Postby Spike » Thu Mar 11, 2010 11:00 am

makevectors(self.v_angle);
if ((v_forward * normalize(ent.origin - self.origin)) > 0.5)
SelfIsFacingTowardsEnt();
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby Baker » Thu Mar 11, 2010 11:38 am

Scrama wrote:...and you can check direction


Did you make all those maps on your site, Scrama?
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby r00k » Thu Mar 11, 2010 5:37 pm

I've always wondered how a static number of weapons provided on a map, with the limit of 1 weapon at a time in inventory would play out. I guess, with a balanced arsenal it could be viable.
Imagine everyone spawns with SG (axe well thats always there).
Other weapons spawn normally. If someone wants the new weapon they have to drop the old one. weapons do not respawn but are taken from a fallen enemy, thus forcing you to drop the weapon you had in hand that u used to kill that enemy.

hmm then again this might only be a good idea for an FFA game, otherwise you'll yell at your teammate "I want the RL!" ;)
r00k
 
Posts: 1110
Joined: Sat Nov 13, 2004 10:39 pm

Postby Teiman » Thu Mar 11, 2010 6:10 pm

r00k wrote:I've always wondered how a static number of weapons provided on a map, with the limit of 1 weapon at a time in inventory would play out. I guess, with a balanced arsenal it could be viable.


something like RUNES, only nothing like that
Teiman
 
Posts: 309
Joined: Sun Jun 03, 2007 9:39 am

Postby Scrama » Fri Mar 12, 2010 6:24 am

2Spike: exactly!

2Baker:
> Did you make all those maps on your site, Scrama?

Sounds like offtopic, but yes, I am the autor )

2r00k:
> I've always wondered how a static number of weapons provided on a map, with the limit of 1 weapon at a time in inventory would play out. I guess, with a balanced arsenal it could be viable.

like Counter-strike. BTW it is a good idea to limit player's arsenal in SP to 2-3 weapons at 1 time, not 1.
User avatar
Scrama
 
Posts: 20
Joined: Fri Aug 28, 2009 6:16 am
Location: Siberia, Omsk

Postby gnounc » Fri Mar 12, 2010 8:45 am

for teamplay how about allowing 1 instance of a weapon PER TEAM.
so each team can have a lightning gun...but a team cant have 2 (and you wont end up with 4 lightning guns on one team in a 4v4 scenario)
User avatar
gnounc
 
Posts: 424
Joined: Mon Apr 06, 2009 6:26 am

Next

Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest