basicly what we are going to create is a bomb that you can plant to blow something up? Intrested? if not dont read well you should be lets get down to business:
Mapping:
1. Create the area you want to test the bomb on.. (Do not add the blown up wall or the wall before)
2. First create the blown up wall as a "Script_Brushmodel" (Its easier to do this first. because you can select them more easyer)
3. Select all the brushes click "n"
Code: Select all
Key: targetname
Value: wallafter
5."n" again
Code: Select all
key:targetname
value:wallbefore
Code: Select all
key:model
value:xmodel/bomb_objective_incomplete
Code: Select all
key:targetname
Value:wallbomb
Thats it for the mapping wasnt that hard was it?
Scripting
Code: Select all
main()
{
maps\mp\_load::main();
// Precache the model we will use once the bomb is planted on the wall
precacheModel("xmodel/bomb");
// Set up the effects used for wall explosion
level._effect["wallexplosion"] = loadfx("fx/explosions/mp_bomb.efx");
level._effect["wallexplosion2"] = loadfx("fx/explosions/explosion1_heavy.efx");
game["allies"] = "american";
game["axis"] = "german";
game["american_soldiertype"] = "airborne";
game["american_soldiervariation"] = "normal";
game["german_soldiertype"] = "fallschirmjagergrey";
game["german_soldiervariation"] = "normal";
game["attackers"] = "allies";
game["defenders"] = "axis";
// Run the function that does the wall explosion
level wallbomb();
}
wallbomb()
{
// Get all of the wall parts, the bomb, and the bomb trigger
bomb = getent ("wallbomb","targetname");
bomb.trigger = getent (bomb.target,"targetname");
wallbefore = getent ("wallbefore","targetname");
wallafter = getent ("wallafter","targetname");
// Hide the destroyed version of the wall until it's blown up
wallafter hide();
// Wait until the bomb is triggered and is triggered by the right team
// Can change the team to "axis" if you want Axis to blow up the wall instead
while (1)
{
bomb.trigger waittill ("trigger",other);
if ((isplayer (other)) && (other.pers["team"] == "allies"))
break;
}
// The bomb was planted by the right team so play a bomb planting sound
bomb playsound ("MP_bomb_plant");
// Delete the bombs trigger since it's not needed anymore
bomb.trigger delete();
// Change the bomb model from the flashing bomb to the solid bomb model
bomb setmodel ("xmodel/bomb");
// Wait .5 seconds for the bomb planting sound to finish
wait .5;
// Now play a looping tick sound on the bomb
bomb playLoopSound("bomb_tick");
// Wait 15 seconds for the bomb to blow up, can change this to something else if you want
wait 15;
// Bomb will explode now so stop the ticking sound
bomb stopLoopSound("bomb_tick");
// Set the origin for the explosion and radius damage
origin = bomb getorigin();
// Delete the exploded bomb
bomb delete();
// Play the explosion effects
playfx(level._effect["wallexplosion"], origin);
playfx(level._effect["wallexplosion2"], origin);
// Do radius damage to kill players in the area, perameters are (origin, range, maxdistance, mindistance)
radiusDamage(origin, 500, 2000, 1000);
// Show the destroyed version of the wall
wallafter show();
// Delete the whole version of the wall
wallbefore delete();
}
Thanks to drofder for basics of scripting from his scripts