Index | FAQ | Search | Memberlist | Usergroups | Profile | Log in to check your private messages | Log in | Register

kickheads on & off?

| Inside3d Forums Forum Index -> QuakeC Programming

View previous topic :: View next topic
Author | Message
--- | ---
smd Joined: 23 Sep 2007 Posts: 23 |

Posted: Fri Oct 12, 2007 11:59 am Post subject: kickheads on & off? |

i've tried out the kickheads tutorial from Ivana Gibson and it works great. but i only want to kick these heads when i press the MOUSE2 button, so i have added the command .float kickgibs; into the defs.qc then if (self.impulse == 25)
self.kickgibs = TRUE;
if (self.impulse == 26)
self.kickgibs = FALSE;
into weapons.qc
and this
alias +kickgibs_on "impulse 25"
alias -kickgibs_on "impulse 26"
bind MOUSE2 +kickgibs_on
into my autoexec.cfg
and finally
//**********************************************
//Kicking Gibs n Dead Heads
//**********************************************
void() kick_touch;
void() kick_touch =
{
local vector v;
if (self.kickgibs != TRUE)
return;
// only a player can kick it
if (other.classname != "player")
return;
//randomize sound
if (random()< 0.6)
sound(other, CHAN_ITEM, "zombie/z_hit.wav", 1, ATTN_NORM);
else
sound(other, CHAN_ITEM, "zombie/z_miss.wav", 1, ATTN_NORM);
//define velocity
//you can play with these formulas to adjust
//trajectory
v_x = (other.velocity_x*2+50*random());
v_y = (other.velocity_y*2+50*random());
v_z =250 + 160 * random()+(other.velocity_y+other.velocity_x)*0.30;
self.flags = self.flags - ( self.flags & FL_ONGROUND );
self.velocity = v;
};
but it doesnt work!!!
i hope someone knows whats wrong...

Back to top |

Urre Joined: 05 Nov 2004 Posts: 1073 Location: Sweden |

Posted: Fri Oct 12, 2007 12:16 pm Post subject: |

At my first glance it looks like it should work (only looked at the code you added though), what happens? Does it kick it anyway, or does it not work at all? _________________ Look out for Twigboy

Back to top |

smd Joined: 23 Sep 2007 Posts: 23 |

Posted: Fri Oct 12, 2007 1:37 pm Post subject: |

when i remove if (self.kickgibs != TRUE) return; it works, but without pressing the MOUSE2 button. with if (self.kickgibs != TRUE)
return; nothing happens!

Back to top |

CocoT Joined: 14 Dec 2004 Posts: 599 Location: Belly-Gum |

Posted: Fri Oct 12, 2007 3:43 pm Post subject: |

Shouldn't it be other.kickgibs? _________________ http://www.planetcocot.net/

Back to top |

RenegadeC Joined: 15 Oct 2004 Posts: 370 Location: The freezing hell; Canada |

Posted: Fri Oct 12, 2007 4:11 pm Post subject: |

CocoT wrote:
Shouldn't it be other.kickgibs?

Yes it should be.
Also it'd work even nicer just adding "if (other.button2) stuff();" for kicking gibs when holding down the jump button.

Back to top |

smd Joined: 23 Sep 2007 Posts: 23 |

Posted: Fri Oct 12, 2007 4:51 pm Post subject: |

CocoT wrote:
Shouldn't it be other.kickgibs?

yes that is the solution!
now it works fine
thanksssssss !!!

Back to top |

CocoT Joined: 14 Dec 2004 Posts: 599 Location: Belly-Gum |

Posted: Tue Oct 16, 2007 2:38 pm Post subject: |

_________________ http://www.planetcocot.net/

Back to top |

Sajt Joined: 16 Oct 2004 Posts: 1026 |

Posted: Wed Oct 17, 2007 3:01 am Post subject: |

You might get head kicking mode stuck on if you release the button while firing a weapon, then press another impulse before it finishes firing. Using impulses for on/off things is dangerous at best. You'll have to check for those impulses before the attack_finished check, wherever that is.
_________________
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 |

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

Posted: Wed Oct 17, 2007 3:53 am Post subject: |

I'd ditch all the code and at the top of kick_touch put

Code:
if (!other.button2) return;

done.
_________________
Unit reporting!
http://www.bendarling.net/

Back to top |

Display posts from previous:

| 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