Forum

Spawn Models?

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Spawn Models?

Postby Stealth Kill » Wed Sep 19, 2007 7:48 pm

Hi

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

I want to spawn a head to kick it :lol:
Stealth Kill
 
Posts: 83
Joined: Fri Dec 29, 2006 12:34 pm

Postby leileilol » Wed Sep 19, 2007 8:17 pm

local entity blah;

blah = spawn();
leileilol
 
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Postby Urre » Thu Sep 20, 2007 6:39 am

setmodel(blah, "progs/head.mdl");
setsize(blah, '0 0 -2', '0 0 2');
setorigin(blah, here);
I was once a Quake modder
User avatar
Urre
 
Posts: 1109
Joined: Fri Nov 05, 2004 2:36 am
Location: Moon

Postby Electro » Thu Sep 20, 2007 7:34 am

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
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 Sajt » Thu Sep 20, 2007 7:40 am

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

Code: Select all
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.
Sajt
 
Posts: 1215
Joined: Sat Oct 16, 2004 3:39 am

Postby Urre » Fri Sep 21, 2007 1:49 pm

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!
I was once a Quake modder
User avatar
Urre
 
Posts: 1109
Joined: Fri Nov 05, 2004 2:36 am
Location: Moon

Postby Stealth Kill » Sun Oct 14, 2007 6:15 am

how can the Zeusbot kick gibs?

i tried this

if(other.classname != "player" || other.classname == "bot" || other.classname == "monster")
Stealth Kill
 
Posts: 83
Joined: Fri Dec 29, 2006 12:34 pm

Postby Gilgamesh » Sun Oct 14, 2007 4:28 pm

if(other.classname != "player" && other.classname != "bot" && other.classname != "monster")
#EOP
Gilgamesh
 
Posts: 67
Joined: Tue Oct 26, 2004 6:08 pm
Location: Brazil

Postby Stealth Kill » Tue Oct 16, 2007 6:13 pm

hmmmm

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