Author |
Topic: Destructible custom car |
cskiller86 |
|
General Member Since: Nov 23, 2009 Posts: 528 Last: Oct 25, 2011 [view latest posts] |
|
|
Category: CoD4 MP Mapping Posted: Monday, Aug. 16, 2010 12:41 pm |
|
Hey, guys.
So, I finally made my destructible custom car, but I took the easy route. It's based on the breakable windows script. So the normal car is replaced with a destroyed version, while an FX is played to cover up the replacement.
See here www.youtube.com
The destroyed version is a placeholder at the moment. I need to add a trigger to inflict damage in a certain radius and some explosions sounds, but I think it looks pretty realistic.
The only problem is that the car can be destroyed with bullets also. Does anyone know some way to destroy it only with explosives (grenades, RPG, C4) ?
Thanks. |
|
|
|
_INSANE_ |
|
General Member Since: Nov 7, 2008 Posts: 352 Last: Jul 10, 2011 [view latest posts] |
|
|
|
Category: CoD4 MP Mapping Posted: Monday, Aug. 16, 2010 06:49 pm |
|
In the damage script..if you have meansofdeath defined...
Code: car waittill("damage", damage, attacker, direction_vec, point, mod);
then say something below it like...
Code: if(isDefined(mod) && (mod == "MOD_RIFLE_BULLET" || mod == "MOD_PISTOL_BULLET"))
continue; |
|
|
|
cskiller86 |
|
General Member Since: Nov 23, 2009 Posts: 528 Last: Oct 25, 2011 [view latest posts] |
|
|
Category: CoD4 MP Mapping Posted: Tuesday, Aug. 17, 2010 01:14 pm |
|
Thanks for the reply, but I don't get it.
I tried just pasting the code, but I get an error: cannot cast undefined to bool. So, how do I define mod ?
Here's what the code looks like now:
Code: self waittill ("damage",amount, mod);
if(isDefined(mod) && (mod == "MOD_RIFLE_BULLET" || mod == "MOD_PISTOL_BULLET"))
continue;
rmptotaldamage+=amount;
if(rmptotaldamage>rmptargetdamage)
{
rmpbroken=1;
} The thread has been called on the trigger_damage, so the self at the beginning is that trigger.
I don't understand the waittill command very well. I know that a trigger_multiple or trigger_use will be triggered only when an entity will step inside or press Use if the following code is used Code: triggername waittill ("trigger". entity) where entity can be level.player or an NPC in SP. Or that, in the code excerpt above, the trigger will be triggered only when it has "absorbed" a certain amount of damage.
So, I'm guessing there are multiple triggering conditions for each type of triggers. But what are those ? What words can be used ? Does anyone have a list ?
On another note, I tried making a blast damage when the car explodes, using a trigger_hurt, but I can't seem to make it work. I've ticked the START_OFF, NO_PROTECTION and ONCE flags, but I don't know how to trigger it. I want it to trigger when the damage one is triggered (when the car switch takes place and the FX is played). I tried this code Code: rmpblast waittill("trigger", rmptrigs); where rmpblast is the trigger_hurt and rmptrigs is the trigger_damage.
Another option was moving the trigger (but apparently you can't do that).
So how do I activate a trigger based on another trigger or event ?
Thanks. |
|
|
|
cskiller86 |
|
General Member Since: Nov 23, 2009 Posts: 528 Last: Oct 25, 2011 [view latest posts] |
|
|
|
liverare |
|
General Member Since: Apr 20, 2010 Posts: 30 Last: Nov 28, 2010 [view latest posts] |
|
|
|
|
_INSANE_ |
|
General Member Since: Nov 7, 2008 Posts: 352 Last: Jul 10, 2011 [view latest posts] |
|
|
|
|
radiantprospect |
General Member Since: Aug 8, 2010 Posts: 23 Last: Jun 17, 2011 [view latest posts] |
|
|
|
cskiller86 |
|
General Member Since: Nov 23, 2009 Posts: 528 Last: Oct 25, 2011 [view latest posts] |
|
|
Category: CoD4 MP Mapping Posted: Thursday, Aug. 19, 2010 11:41 am |
|
@liverare: yeah, I already tried ticking the RIFLE_NO, PISTOL_NO and MELEE_NO flags, but that didn't help (I was still able to shoot the car and the trigger would activate).
@radiantprospect: thanks; the texture is com_streetlines2; it's a decal applied on a thin patch of terrain
@INSANE: I'm not a complete noob when it comes to scripting, but I'm not that good either, so could you explain more in-depth, please ?
I recently discovered that MOD is Means Of Death :), but how do I define it at the start of the script ? Or even better is there a variable that the game uses to store the MOD ?
I've tried this Code: self waittill ("damage",amount,MOD_MELEE); which I thought it would only add damage to the trigger if it was made by melee, but it doesn't work like that I guess.
On another note, I removed the trigger_hurt altogether because I found a better way to inflict damage to players. It's the RadiusDamage() command. And it's a lot better because it has a linear damage, so it will hurt you more if you are closer to the car and less if you are further away. |
|
|
|
_INSANE_ |
|
General Member Since: Nov 7, 2008 Posts: 352 Last: Jul 10, 2011 [view latest posts] |
|
|
|
Category: CoD4 MP Mapping Posted: Thursday, Aug. 19, 2010 06:42 pm |
|
I never said you didn't know what you were doing... i only said you probably have to use the full line.
When something like a vehicle is damaged... it's notified with a series of different variables or whatnot... that are in a certain order. Like i said, try leaving the line the way i had it.. instead of cutting out stuff.
This is in mp\_destructible.gsc
type is the meansofdeath in this line..but u can change it to whatever word you want.. like i had 'mod'.
Code: self waittill("damage", damage, attacker, direction_vec, point, type); |
|
|
|
cskiller86 |
|
General Member Since: Nov 23, 2009 Posts: 528 Last: Oct 25, 2011 [view latest posts] |
|
|
Category: CoD4 MP Mapping Posted: Thursday, Aug. 19, 2010 09:38 pm |
|
Oops, I didn't mean to imply that you said I don't know what I'm doing.
I just didn't understand your second reply and thought that someone more advanced would have understood it.
So I was explaining that even though I know a little bit of scripting, I'm not very good so I'd appreciate a simpler explanation.
Sorry for the confusion.
Anyway, I added the line exactly how you wrote it and it works like a charm.
This is what I have now: Code: while(!rmpbroken)
{
self waittill("damage", amount, attacker, direction_vec, point, type);
iprintln ("Damage type: " + type);
if (type == "MOD_RIFLE_BULLET" || type == "MOD_PISTOL_BULLET" || type == "MOD_MELEE" )
continue;
rmptotaldamage+=amount;
iprintln ("Damage: " + amount);
iprintln ("Total damage: " + rmptotaldamage);
if(rmptotaldamage>rmptargetdamage)
{
rmpbroken=1;
}
}
But there is something I don't understand about the script. AFAIK this line Code: if (type == "MOD_RIFLE_BULLET" || type == "MOD_PISTOL_BULLET" || type == "MOD_MELEE" )
continue; would translate to: if the type of damage is pistol, rifle or melee then continue and destroy the car. But in the game, the exact opposite is happening, the script continues only if the damage is NOT caused by pistol, rifle or melee. Which is exactly what I want, I'm not complaining, I just don't understand why it happens this way.
Now I have to find out how to change the killicon.
Anyway thank you very much for your help, Insane.
And if you have any more information about the waittill command, feel free to share :D |
|
|
|