Inside3D!
     

Solid Weapon Pickups
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
Ghost_Fang



Joined: 12 Nov 2009
Posts: 162

PostPosted: Tue Mar 09, 2010 4:02 am    Post subject: Solid Weapon Pickups Reply with quote

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?
Back to top
View user's profile Send private message
Error
Inside3D Staff


Joined: 05 Nov 2004
Posts: 558
Location: VA, USA

PostPosted: Tue Mar 09, 2010 7:38 am    Post subject: Reply with quote

all items are set solid in a seperate function:

Code:

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:

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);
};

_________________
Inside3D : Knowledge Is Power
Darkplaces Documentation Wiki
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Tue Mar 09, 2010 9:20 am    Post subject: Reply with quote

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.
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
Downsider



Joined: 16 Sep 2008
Posts: 478

PostPosted: Tue Mar 09, 2010 12:41 pm    Post subject: Reply with quote

Can't you, before the user does the traceline, make them solid, then after, make them untouchabale again?
Back to top
View user's profile Send private message
Dr. Shadowborg
Inside3D Staff


Joined: 16 Oct 2004
Posts: 726

PostPosted: Tue Mar 09, 2010 5:16 pm    Post subject: Reply with quote

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

http://tlb.quakedev.com/files/shkrflv1.zip
_________________
"Roboto suggests Plasma Bazooka."
Back to top
View user's profile Send private message
Scrama



Joined: 28 Aug 2009
Posts: 20
Location: Siberia, Omsk

PostPosted: Wed Mar 10, 2010 3:13 am    Post subject: Reply with quote

DO NOT play with solid, it is not necessary.

Just make a little hack:

In weapons.qc/ImpulseCommands add 2 lines
Code:

   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:

// 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 )
Back to top
View user's profile Send private message
Downsider



Joined: 16 Sep 2008
Posts: 478

PostPosted: Wed Mar 10, 2010 3:45 am    Post subject: Reply with quote

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..
Back to top
View user's profile Send private message
r00k



Joined: 13 Nov 2004
Posts: 483

PostPosted: Thu Mar 11, 2010 4:19 am    Post subject: Reply with quote

I was thinking the same thing.
Back to top
View user's profile Send private message
Scrama



Joined: 28 Aug 2009
Posts: 20
Location: Siberia, Omsk

PostPosted: Thu Mar 11, 2010 5:58 am    Post subject: Reply with quote

...and you can check direction
_________________
http://scrama_levelart.livejournal.com
Back to top
View user's profile Send private message
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Thu Mar 11, 2010 11:00 am    Post subject: Reply with quote

makevectors(self.v_angle);
if ((v_forward * normalize(ent.origin - self.origin)) > 0.5)
SelfIsFacingTowardsEnt();
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
Baker



Joined: 14 Mar 2006
Posts: 1538

PostPosted: Thu Mar 11, 2010 11:38 am    Post subject: Reply with quote

Scrama wrote:
...and you can check direction


Did you make all those maps on your site, Scrama?
_________________
Tomorrow Never Dies. I feel this Tomorrow knocking on the door ...
Back to top
View user's profile Send private message
r00k



Joined: 13 Nov 2004
Posts: 483

PostPosted: Thu Mar 11, 2010 5:37 pm    Post subject: Reply with quote

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!" Wink
Back to top
View user's profile Send private message
Teiman



Joined: 03 Jun 2007
Posts: 309

PostPosted: Thu Mar 11, 2010 6:10 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Scrama



Joined: 28 Aug 2009
Posts: 20
Location: Siberia, Omsk

PostPosted: Fri Mar 12, 2010 6:24 am    Post subject: Reply with quote

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.
_________________
http://scrama_levelart.livejournal.com
Back to top
View user's profile Send private message
gnounc



Joined: 06 Apr 2009
Posts: 120

PostPosted: Fri Mar 12, 2010 8:45 am    Post subject: Reply with quote

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)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group