News: SMF - Just Installed!
 
Welcome, Guest. Please login or register.
+  AnthraxBio
|-+  Return to Castle Wolfenstein
| |-+  Coding Tutorials
| | |-+  Destroyable Dynamite
« previous next »
Pages: [1] Print
Author Topic: Destroyable Dynamite  (Read 281 times)
SkreamerVirii
Administrator
Full Member
*****
Posts: 133


View Profile
« on: September 03, 2008, 11:17:22 PM »

In this tutorial I will explain how to make destroyable dynamite so that you can use the dynamite for many things such as a booby trap a last defense and and instant explosion
So let us begin
Open up g_missile.c and locate this part of the code

// dynamite is shootable
// JPW NERVE only in single player
if (g_gametype.integer == GT_SINGLE_PLAYER) {
bolt->health = 5;
bolt->takedamage = qtrue;
bolt->die = G_MissileDie;
}
else {
bolt->health = 5;
bolt->takedamage = qfalse;
}
Now change it to this
// dynamite is shootable
// JPW NERVE only in single player
if (g_gametype.integer == GT_WOLF) {
bolt->health = 5;
bolt->takedamage = qtrue;
bolt->die = G_MissileDie;
}
Your Done!!!
Compile and play as an engineer set the dynamite on the ground back up enough to not take any damage and use your gun to blow it up
Here is a little additional feature that fretn added

i added a piece of code that only a sniper can destroy a dynamite ... i guess that's more interesting for teamplay
here is the code:
line 542 of g_missile.c you find:
void G_MissileDie( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod ) {
if (inflictor == self)
return;
self->takedamage = qfalse;
self->think = G_ExplodeMissile;
self->nextthink = level.time + 10;
}
change it to:
void G_MissileDie( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod ) {
if (inflictor == self || !attacker->s.weapon == WP_SNIPERRIFLE)
return;
self->takedamage = qfalse;
self->think = G_ExplodeMissile;
self->nextthink = level.time + 10;
}
compile the shit and run the game ...
if you want you can put it in your tutorial with my name under it :-))))
fretn

GOOD JOB!!! fretn
My next tutorial will be on adding weapons to player classes

« Last Edit: September 03, 2008, 11:24:35 PM by SkreamerVirii » Logged
MagicOPromotion
Newbie
*
Posts: 7


View Profile WWW
« Reply #1 on: May 26, 2009, 03:49:42 PM »

Yes there should be more destroyable buildings and objects. The crap they put as destroyable targets in BHD is laughable to say the least. We need to destroy trucks, helos, hummvees and buildings.
Logged

XRumer 5.0 Palladium: best promotion software
Pages: [1] Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.6 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Free SMF 1.1.5 Forum Theme by Tamuril. © 2008.