View previous topic :: View next topic |
Author |
Message |
Stealth Kill
Joined: 29 Dec 2006 Posts: 83
|
Posted: Wed Sep 19, 2007 7:48 pm Post subject: Spawn Models? |
|
|
Hi
Where can I find a code to spawn models???
I want to spawn a head to kick it  |
|
Back to top |
|
 |
leileilol

Joined: 15 Oct 2004 Posts: 1321
|
Posted: Wed Sep 19, 2007 8:17 pm Post subject: |
|
|
local entity blah;
blah = spawn(); |
|
Back to top |
|
 |
Urre

Joined: 05 Nov 2004 Posts: 1073 Location: Sweden
|
Posted: Thu Sep 20, 2007 6:39 am Post subject: |
|
|
setmodel(blah, "progs/head.mdl");
setsize(blah, '0 0 -2', '0 0 2');
setorigin(blah, here); _________________ Look out for Twigboy |
|
Back to top |
|
 |
Electro
Joined: 29 Dec 2004 Posts: 241 Location: Brisbane, Australia
|
Posted: Thu Sep 20, 2007 7:34 am Post subject: |
|
|
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 |
|
 |
Sajt
Joined: 16 Oct 2004 Posts: 1026
|
Posted: Thu Sep 20, 2007 7:40 am Post subject: |
|
|
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 |
|
 |
Urre

Joined: 05 Nov 2004 Posts: 1073 Location: Sweden
|
Posted: Fri Sep 21, 2007 1:49 pm Post subject: |
|
|
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 |
|
 |
Stealth Kill
Joined: 29 Dec 2006 Posts: 83
|
Posted: Sun Oct 14, 2007 6:15 am Post subject: |
|
|
how can the Zeusbot kick gibs?
i tried this
if(other.classname != "player" || other.classname == "bot" || other.classname == "monster") |
|
Back to top |
|
 |
Gilgamesh
Joined: 26 Oct 2004 Posts: 67 Location: Brazil
|
Posted: Sun Oct 14, 2007 4:28 pm Post subject: |
|
|
if(other.classname != "player" && other.classname != "bot" && other.classname != "monster") _________________ #EOP |
|
Back to top |
|
 |
Stealth Kill
Joined: 29 Dec 2006 Posts: 83
|
Posted: Tue Oct 16, 2007 6:13 pm Post subject: |
|
|
hmmmm
it doesn´t work |
|
Back to top |
|
 |
|