ItsMods

Full Version: Destructible Editing 2
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Good evening

This is a second part from yesterdays tutorial about destructibles, this is not as good as the other. Is just info, I also found some other commands for them, but the game doesnt use them, because they are basically useless Sad

Destructibles uses 2 commands like hide() and show(), but for parts:

Code:
destructible ShowPart(tag name);
destructible HidePart(tag name);

The damages that it can suffer are depending on the damage mod:

Code:
melee = mod_melee, mod_crush
bullet = mod_pistol_bullet, mod_rifle_bullet
splash = mod_grenade, mod_grenade_splash, mod_projectile, mod_projectile_splash, mod_splsh
impact = mod_impact
unknown = mod_unknown

There are 2 types of destructibles: "real" destructibles and vehicles. You can know if its a vehicle using this:

Code:
isVehicle = ( GetSubStr( level.destructible_type[ self.destuctableInfo ].v[ "type" ], 0, 7 ) == "vehicle" );

You can destroy a destructible by using this:

Code:
destructible notify( "damage", 100000, self, self.origin, self.origin, "MOD_EXPLOSIVE", "", "" );

On some vehicles you can make their alarm sound with:

Code:
destructible do_car_alarm();

It uses this function to make them solid, it aplies a script_brushmodel

Code:
destructible destructible_handles_collision_brushes();

You can increase the number of destructibles with this:

Code:
level.destructibleSpawnedEntsLimit = 50;

Also destructibles have some damage and sound constants that can be nice to modify, you can find them in _destructible.gsc

Code:
MAX_SIMULTANEOUS_CAR_ALARMS = 2; //the number of alarms that can be played at same time, increasing it and shooting many cars is not a good idea, with a number higher than 4 laggs as hell
CAR_ALARM_ALIAS = "car_alarm"; //alarm sound
CAR_ALARM_OFF_ALIAS = "car_alarm_off"; //another alarm sound
CAR_ALARM_TIMEOUT = 25; //time it takes to the car alarm to stop if the car is not destroyed before, increase it to make an annoying battlefield, :troll:

MP_DAMAGE_BIAS = 1.0; //when you shot the damage that the destructible takes is the same as your weapon does
MP_EXPLOSIVE_DAMAGE_BIAS = 13.0; //with explosives the damage that your weapon cause is multiplied by 13
MP_SHOTGUN_BIAS = 4.0; //same as previous but with shotguns and multiplied by 4

You can modify these to customize a bit your maps

I also found this, but I havent tested it, when the map finishes loading some objects get deleted, I would like to know what they are:

Code:
deletables = GetEntArray( "delete_on_load", "targetname" );
foreach ( ent in deletables )
ent Delete();

And this is the way to get all destructibles:

Code:
destructibles = GetEntArray("destructible","targetname");

Destructibles also use this functions: SetCanDamage( true ); and ScriptModelPlayAnim

Another interesting thing is the use of a FX that creates a light, you can spawn this fx on your map on dark spots, can be great for zombie mod mapedits, on a dark bunker for example:

Code:
level._effect["spotlight_fx"] = loadfx("misc/fluorescent_spotlight");

All this + what I explained in this link allow you to customize many objects in the maps easily, also, you can modify many other objects such as metal detectors, vending machines or fans in _dynamic_world.gsc

http://www.itsmods.com/forum/Thread-Dest...iting.html

Good luck, Big Grin and OMA and Nyan Cat and Narwhal and Meow
ty Tongue
are you sure about it ?
Code:
level._effect["spotlight_fx"] = loadfx("misc/fluorescent_spotlight");
it works only on some maps :3?
(10-08-2011, 17:58)Se7en Wrote: [ -> ]ty Tongue
are you sure about it ?
Code:
level._effect["spotlight_fx"] = loadfx("misc/fluorescent_spotlight");
it works only on some maps :3?

It works in all the maps that contain a fluorescent, and I think that all maps have at least 1(maybe afghan not)