Wall that explodes by triggering a bomb

Have questions about CoD/UO mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

Locked
Lennard
CJ Wannabe
CJ Wannabe
Posts: 24
Joined: July 22nd, 2009, 3:27 pm

Wall that explodes by triggering a bomb

Post by Lennard » October 21st, 2009, 9:17 am

Hi, I followed a tutorial to make a wall explode by triggering a bomb.
Here's the tutorial. http://codjumper.com/forums/viewtopic.php?f=18&t=2074

As I wanted to follow the tutorial's instructions perfectly, I created a new empty map to get a better overview.

I followed the instructions, and when I was done with mapping, I copied & pasted the script and placed it in my maps/mp folder of my .pk3 file.

For those who wanna see the script ( You can also click on the tutorial's link ) Here's what I have.
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();
}
Now when I compiled, I started up CoD, and tried to test, CoD fails.. Always when I try it fails. It keeps stuck at one point, it doesn't even show me a levelshot, it just fails.

I tried several things to fix this, I first started with following the instructions again, and read the instructions carefully. After when I was done and compiled again, it still failed.

Then I tried to edit the script a bit. Now this is what I edited:

Here's a part from the script like it was before editing
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();
}
Now you see these parts:
// 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"); [/quote

and this part:
// Run the function that does the wall explosion
level wallbomb();
I replaced them under the
wallbomb()
, so that the wallbomb thread (?) became like this:

wallbomb()
{

// 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");

// Run the function that does the wall explosion
level 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();
}
Now it didn't fail at loading anymore, but now the script is not working!

I asked Nightmare for help via xfire, he told me that it was probably something wrong at mapping.
Ill post my .map file here soon if anybody asks me here.

Thanks alot!

P.S. I hope you wanna take your time to read this bigass topic. :P
Last edited by Lennard on October 21st, 2009, 11:24 pm, edited 2 times in total.

User avatar
waywaaaard
Core Staff
Core Staff
Posts: 2214
Joined: February 6th, 2006, 3:18 pm
Location: Germany/Bayern

Re: Exploding wall

Post by waywaaaard » October 21st, 2009, 3:43 pm

ohm should it be in your start thread wallbomb(); instead of level wallbomb(); and in your edited part here:
wallbomb()
{

// 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");

// Run the function that does the wall explosion
level 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();
}
you want to start the function in the function that would create and infinite loop and when the stack is full and error
THAT HANDS WERE NOT TRACED!
visit my blog: Link
Soviet wrote:Yeah, watch out, Peds will hit you with his +5 D-Battleaxe of homosexuality :roll:

Lennard
CJ Wannabe
CJ Wannabe
Posts: 24
Joined: July 22nd, 2009, 3:27 pm

Re: Exploding wall

Post by Lennard » October 21st, 2009, 5:23 pm

thx for the reply, it's not failing anymore but it still doesn't work. I press F at the bomb, but I don't hear a sound, no walls disappear and no effects appear.

megazor helped me out a bit, and he could make it play an explosion sound, and get the perfect wall deleted, but there's still no smoke and fire.

This is the script:
main()
{
maps\mp\_load::main();


precacheModel("xmodel/bomb");
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";


thread wallbomb();
}

wallbomb()
{
lol = loadfx("fx/explosions/mp_bomb.efx");
bomb = getent ("wallbomb","targetname");
bomb.trigger = getent (bomb.target,"targetname");
wallbefore = getent ("wallbefore","targetname");
wallafter = getent ("wallafter","targetname");

wallafter hide();

bomb.trigger waittill ("trigger",other);
if ((isPlayer(other)) && (other.pers["team"] == "allies"))
{
return;
}

bomb playsound ("MP_bomb_plant");
bomb.trigger delete();
bomb setmodel ("xmodel/bomb");
wait 0.5;
bomb playLoopSound("bomb_tick");
wait 15;
bomb stopLoopSound("bomb_tick");
bomb delete();
playfx(lol, wallbefore.origin);
//wallbefore playfx(level._effect["wallexplosion2"], origin);
radiusDamage(origin, 500, 2000, 1000);
wallafter show();
wallbefore delete();
Any idea's?

Lennard
CJ Wannabe
CJ Wannabe
Posts: 24
Joined: July 22nd, 2009, 3:27 pm

Re: Exploding wall

Post by Lennard » October 21st, 2009, 5:29 pm

I tried to fix it myself a bit, and I actually improved it a bit, but there's only 1 thing left that's not right.
When I trigger the bomb, it explodes, the perfect wall disappears, I do hear a sound, and there actually IS an explosion, but just not on the right place. How could I get it on the right place? Thx alot!

Here's the script.
main()
{
maps\mp\_load::main();


precacheModel("xmodel/bomb");
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";


thread wallbomb();
}

wallbomb()
{
lol = loadfx("fx/explosions/mp_bomb.efx");
lal = loadfx("fx/explosions/explosion1_heavy.efx");
bomb = getent ("wallbomb","targetname");
bomb.trigger = getent (bomb.target,"targetname");
wallbefore = getent ("wallbefore","targetname");
wallafter = getent ("wallafter","targetname");

wallafter hide();

bomb.trigger waittill ("trigger",other);

bomb playsound ("MP_bomb_plant");
bomb.trigger delete();
bomb setmodel ("xmodel/bomb");
wait 0.5;
bomb playLoopSound("bomb_tick");
wait 5;
bomb stopLoopSound("bomb_tick");
bomb delete();
playfx(lol, wallbefore.origin);
playfx(lal, wallbefore.origin);
radiusDamage(origin, 500, 2000, 1000);
wallafter show();
wallbefore delete();
}

Lennard
CJ Wannabe
CJ Wannabe
Posts: 24
Joined: July 22nd, 2009, 3:27 pm

Re: Exploding wall

Post by Lennard » October 21st, 2009, 11:19 pm

close this topic please i made a better one to read coz many ppl probaby dont want to even take their time to read this coz it looks so big.

thx for helping again !

Locked

Who is online

Users browsing this forum: No registered users and 23 guests