Inside3D!
     

Spawn Models?

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
Stealth Kill



Joined: 29 Dec 2006
Posts: 83

PostPosted: Wed Sep 19, 2007 7:48 pm    Post subject: Spawn Models? Reply with quote

Hi

Where can I find a code to spawn models???

I want to spawn a head to kick it Laughing
Back to top
View user's profile Send private message
leileilol



Joined: 15 Oct 2004
Posts: 1321

PostPosted: Wed Sep 19, 2007 8:17 pm    Post subject: Reply with quote

local entity blah;

blah = spawn();
Back to top
View user's profile Send private message
Urre



Joined: 05 Nov 2004
Posts: 1073
Location: Sweden

PostPosted: Thu Sep 20, 2007 6:39 am    Post subject: Reply with quote

setmodel(blah, "progs/head.mdl");
setsize(blah, '0 0 -2', '0 0 2');
setorigin(blah, here);
_________________
Look out for Twigboy
Back to top
View user's profile Send private message Visit poster's website
Electro



Joined: 29 Dec 2004
Posts: 241
Location: Brisbane, Australia

PostPosted: Thu Sep 20, 2007 7:34 am    Post subject: Reply with quote

blah.movetype = MOVETYPE_BOUNCE;
blah.solid = SOLID_TRIGGER;
blah.touch = HeadKick;

community effort keep it going guys! eventually he will have all the code he needs! mwhaha
_________________
Unit reporting!
http://www.bendarling.net/
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Sajt



Joined: 16 Oct 2004
Posts: 1026

PostPosted: Thu Sep 20, 2007 7:40 am    Post subject: Reply with quote

I haven't touched QC in a long time, but here goes!

Code:
float() crandom; // i think this was defined in weapons.qc, so probably need a prototype...

void() HeadKick =
{
  local vector dir;
  local vector xyvel;

  if (other.classname != "player")
    return;
  if (!(self.flags & FL_ONGROUND))
    return;

  xyvel = other.velocity;
  xyvel_z = 0;

  if (vlen(xyvel) < 30)  // don't kick if moving slowly
    return;

  dir = normalize(xyvel);

  self.velocity = dir * 500 + '0 0 300';
  self.avelocity_x = crandom() * 200.0;
  self.avelocity_y = crandom() * 200.0;
  self.avelocity_z = crandom() * 200.0;
  self.flags = self.flags - (self.flags & FL_ONGROUND);

  sound(self, CHAN_BODY, "headkick.wav", 1, ATTN_NORM);
};

_________________
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
Urre



Joined: 05 Nov 2004
Posts: 1073
Location: Sweden

PostPosted: Fri Sep 21, 2007 1:49 pm    Post subject: Reply with quote

Heheh, yeah, that ought to pretty much do it, if you get all the weird parts and are able to fix them, such as the origin it spawns at. If you want to simply make the gibbed monster/player heads kickable, go into each characters gib function, and find the head, and give that gib a .touch function the way Electro showed, and add the function Sajt made, and you've got yourself some kickable head gibs!
_________________
Look out for Twigboy
Back to top
View user's profile Send private message Visit poster's website
Stealth Kill



Joined: 29 Dec 2006
Posts: 83

PostPosted: Sun Oct 14, 2007 6:15 am    Post subject: Reply with quote

how can the Zeusbot kick gibs?

i tried this

if(other.classname != "player" || other.classname == "bot" || other.classname == "monster")
Back to top
View user's profile Send private message
Gilgamesh



Joined: 26 Oct 2004
Posts: 67
Location: Brazil

PostPosted: Sun Oct 14, 2007 4:28 pm    Post subject: Reply with quote

if(other.classname != "player" && other.classname != "bot" && other.classname != "monster")
_________________
#EOP
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
Stealth Kill



Joined: 29 Dec 2006
Posts: 83

PostPosted: Tue Oct 16, 2007 6:13 pm    Post subject: Reply with quote

hmmmm

it doesn´t work
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