Inside3D!
     

Spawning Model to Block Player Movement

 
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 Jun 15, 2010 3:48 pm    Post subject: Spawning Model to Block Player Movement Reply with quote

I modified the grenade code to make a Halo 3 style deployable cover to block bullets and player movement. But as of right now it only blocks bullets. It is possible to spawn a model that'll block players too? I've tried all the SOLID_'s.

Code:
void() W_FireGrenade =
{
   local   entity missile, mpuff;
   
   self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
   
   self.punchangle_x = -2;

   missile = spawn ();
   missile.owner = self;
   missile.movetype = MOVETYPE_STEP;
   missile.solid = SOLID_BBOX;
   missile.classname = "grenade";
      
// set missile speed   

   makevectors (self.v_angle);

   if (self.v_angle_x)
      missile.velocity = v_forward*500 + v_up * 00 + crandom()*v_right*10 + crandom()*v_up*10;
   else
   {
      missile.velocity = aim(self, 10000);
      missile.velocity = missile.velocity * 400;
      missile.velocity_z = 300;
   }
   
   
// set missile duration
   missile.nextthink = time + 2;
   missile.think = BecomeCover;

   setmodel (missile, "progs/d_cover.mdl");
   setsize (missile, '0 0 0', '0 0 0');      
   setorigin (missile, self.origin);
};




Code:
void() BecomeCover =

{
   
   setmodel (self, "progs/cover.mdl");
   self.solid = SOLID_BBOX;
   self.movetype = MOVETYPE_STEP;
   setsize (self, VEC_HULL2_MIN, VEC_HULL2_MAX);
   self.nextthink = time + 15;
   self.think = BecomeExplosion;
   setorigin (self, self.origin);
};





One More thing, I deleted the
"missile.angles = vectoangles(missile.velocity);"
part of the code because if you looked up and threw it, the spawned the model facing up, and every other direction etc. But now no matter what way you face it spawns in the same direction, how would i change the missile angles to affect X & Y but not Z (if you know what i mean) so you can throw it and it only copies the direction you were facing but ignores if you were facing up or down.
Back to top
View user's profile Send private message
Sajt



Joined: 16 Oct 2004
Posts: 1026

PostPosted: Tue Jun 15, 2010 5:53 pm    Post subject: Reply with quote

missile.angles = '0 1 0' * vectoyaw(missile.velocity);

or just

missile.angles = '0 1 0' * playerentity.angles_y;
_________________
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
Back to top
View user's profile Send private message
Dr. Shadowborg
Inside3D Staff


Joined: 16 Oct 2004
Posts: 726

PostPosted: Tue Jun 15, 2010 6:22 pm    Post subject: Reply with quote

Also, to make it block the player too, you need to switch the owner from the player to the world, or something.

i.e. in BecomeCover(); add a self.owner = world;

Beware though, you'll have to do some stuff to keep it from getting the player stuck inside of it if he's too close.
_________________
"Roboto suggests Plasma Bazooka."
Back to top
View user's profile Send private message
Mexicouger



Joined: 01 May 2010
Posts: 129

PostPosted: Tue Jun 15, 2010 7:27 pm    Post subject: Reply with quote

So you started working on this eh Ghost? Nice man. It isn't as complex as I thought It would be however. Good Luck.
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
Sajt



Joined: 16 Oct 2004
Posts: 1026

PostPosted: Wed Jun 16, 2010 12:31 am    Post subject: Reply with quote

Increasing the bbox suddenly (without doing any checks to see if it is now intersecting something) scares me. The entity should drop out of the world, or trigger satanic unsticking code, or something when you do that.
_________________
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
Back to top
View user's profile Send private message
Ghost_Fang



Joined: 12 Nov 2009
Posts: 162

PostPosted: Fri Jun 18, 2010 5:44 pm    Post subject: Reply with quote

Thanks Dr. Shadowborg worked perfectly.
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
Page 1 of 1

 
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