Page 1 of 1

Exploding wall (2)

Posted: October 21st, 2009, 11:18 pm
by Lennard
Since my first topic was kinda big and probably most of the ppl didn't even want to take their time to read my problem and try to find the solution, here's a shorter one.

I wanna make a wall explode by triggering a bomb. I followed a tutorial by it's instructions and tried the script. The script didn't work, now I got some help from megazor and the CJ team, and now it's already better, but I still need some help at one part.

When I trigger the bomb, The perfect wall disappears, I hear an explosion sound, I also do see an explosion but not at the place where the perfect wall was, it's somewhere in the back of the map :shock:.
I hope anyone knows what the problem is. Here's my 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();
}
Thx alot!

Re: Exploding wall (2)

Posted: October 21st, 2009, 11:26 pm
by Nightmare
It's obvious why the effect is playing somewhere else.
I'm willing to bet you never set the origin of the script_brushmodel labeled "wallbefore".
So by default, it will play at origin (0,0,0).

Two ways going about this:

Mapping way:
Select your wall before, press n.
key: origin
value: x y z (Replace those with the origin given in Radiant, to do this, hold your mouse over the 2d grid and look at the bottom for the values).

Scripting way:
Get the origin values of where you want to place your explosion effect from radiant with the same way as explained above.
In the script replace the following with the values you obtained.

Code: Select all

playfx(lol, ((x,y,z)));
playfx(lal, ((x,y,z)));