Script for Stuka that flies into a tree and explodes (?)

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

Moderator: Core Staff

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

Script for Stuka that flies into a tree and explodes (?)

Post by Lennard » October 18th, 2009, 4:17 pm

I wanna make a script, which flies a Stuka into a tree and explodes with a big boom and a lot of smoke after the crash, now I already got the Stuka flying into the tree, but how can i make a explosion in the tree at the time that it flies into it?

Here's my script for the Stuka ( I used the tutorial )
main()
{

level thread planes();
}

planes()
{
level.PlaneSpeed = 1.5;

stuka1 = getent ("stuka1","targetname");

temp = getent (stuka1.target,"targetname");
stuka1.dest = temp.origin;
stuka1.start = stuka1.origin;
stuka1 hide();

wait 2;

while (1)
{
stuka1 thread plane_flyby("stuka_flyby");
wait .15;

wait 60;
}
}


plane_flyby(sound)
{
// If you specified a sound to play then play it
if (isdefined (sound))
self playsound (sound);

wait 15;

self show();

self moveto(self.dest, level.PlaneSpeed, 0.1, 0.1);

wait level.PlaneSpeed;

self hide();
self.origin = self.start;
}
Now there is also a diff weird thing, I didnt fill in any sounds, but I do hear one? Not that it's not good, it's actually perfect, but I don't know how I did it.

Thx for the help

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

Re: Script for Stuka that flies into a tree and explodes (?)

Post by waywaaaard » October 18th, 2009, 5:20 pm

Your sound issue: I guess aren't really into scripting at the moment but in the plane flyby function you are using this piece of code

Code: Select all

self playsound (sound);
which basically plays the sound "stuka_flyby"

No you follow the code and see where the plane model is hidden again, you couldn't now spawn there and effect like explosion, smoke etc
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: Script for Stuka that flies into a tree and explodes (?)

Post by Lennard » October 18th, 2009, 5:23 pm

Ah ok, that problem is solved than, but to explain it a little bit easier.

It's just like a mortar exploding on the ground.
Do you know how to make that?

Basically all I want is a script that causes an explosion after the impact of the plane, a little bit easier explained.

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

Re: Script for Stuka that flies into a tree and explodes (?)

Post by waywaaaard » October 18th, 2009, 5:35 pm

try this

Code: Select all


main()
{

level thread planes();
}

planes()
{
level.PlaneSpeed = 1.5;

stuka1 = getent ("stuka1","targetname");

temp = getent (stuka1.target,"targetname");
stuka1.dest = temp.origin;
stuka1.start = stuka1.origin;
stuka1 hide();

wait 2;

while (1)
{
stuka1 thread plane_flyby("stuka_flyby");
wait .15;

wait 60;
}
}


plane_flyby(sound)
{
// If you specified a sound to play then play it
if (isdefined (sound))
self playsound (sound);

wait 15;

self show();
self moveto(self.dest, level.PlaneSpeed, 0.1, 0.1);
wait level.PlaneSpeed;

// added an explosion
boom = loadfx("fx/explosions/mp_bomb.efx");
playfx(boom, self.dest); 

self hide();
self.origin = self.start;
}
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: Script for Stuka that flies into a tree and explodes (?)

Post by Lennard » October 18th, 2009, 5:49 pm

It doesn't do anything :O? The stuka flew into the tree but there wasn't even a sound of an explosion :?

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

Re: Script for Stuka that flies into a tree and explodes (?)

Post by waywaaaard » October 18th, 2009, 6:01 pm

mh if you open the console the big one with shift+~ are there any error messages?
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: Script for Stuka that flies into a tree and explodes (?)

Post by Lennard » October 18th, 2009, 6:08 pm

ain't shift + ~ for Cod2 and Cod4?
This is Cod1, but w/e, I don't see any errors.

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: Script for Stuka that flies into a tree and explodes (?)

Post by Drofder2004 » October 18th, 2009, 8:02 pm

Its been a while, but should you not be preloading your FX at the beginning of the script?
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

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

Re: Script for Stuka that flies into a tree and explodes (?)

Post by Lennard » October 18th, 2009, 8:54 pm

what do you mean ? how do I do that ?

User avatar
Nightmare
Core Staff
Core Staff
Posts: 2688
Joined: January 12th, 2006, 10:09 pm
Contact:

Re: Script for Stuka that flies into a tree and explodes (?)

Post by Nightmare » October 19th, 2009, 2:58 am

Code: Select all

boom = loadfx("fx/explosions/mp_bomb.efx");
wait 0.05;
playfx(boom, self.dest); 
Add that wait so the server can go through a frame.
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet

-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]

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

Re: Script for Stuka that flies into a tree and explodes (?)

Post by Lennard » October 19th, 2009, 9:23 am

It says Script Compile Error.

I copied & pasted the code you sent and pasted it at the end of the script, is that right?
main()
{

level thread planes();
}

planes()
{
level.PlaneSpeed = 3.3;

stuka1 = getent ("stuka1","targetname");

temp = getent (stuka1.target,"targetname");
stuka1.dest = temp.origin;
stuka1.start = stuka1.origin;

wait 2;

while (1)
{
stuka1 thread plane_flyby("stuka_flyby");
wait .15;

wait 35;
}
}


plane_flyby(sound)
{
// If you specified a sound to play then play it
if (isdefined (sound))
self playsound (sound);

wait 15;

self show();

self moveto(self.dest, level.PlaneSpeed, 0.1, 0.1);

wait level.PlaneSpeed;

wait 3;

self hide();
self.origin = self.start;
}

boom = loadfx("fx/explosions/mp_bomb.efx");
wait 0.05;
playfx(boom, self.dest);

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

Re: Script for Stuka that flies into a tree and explodes (?)

Post by waywaaaard » October 19th, 2009, 12:00 pm

Code: Select all

main()
{

level thread planes();
}

planes()
{
level.PlaneSpeed = 1.5;

stuka1 = getent ("stuka1","targetname");

temp = getent (stuka1.target,"targetname");
stuka1.dest = temp.origin;
stuka1.start = stuka1.origin;
stuka1 hide();

wait 2;

while (1)
{
stuka1 thread plane_flyby("stuka_flyby");
wait .15;

wait 60;
}
}


plane_flyby(sound)
{
// If you specified a sound to play then play it
if (isdefined (sound))
self playsound (sound);

wait 15;

self show();
self moveto(self.dest, level.PlaneSpeed, 0.1, 0.1);
wait level.PlaneSpeed;

// added an explosion
boom = loadfx("fx/explosions/mp_bomb.efx");
wait 0.5;
playfx(boom, self.dest);

self hide();
self.origin = self.start;
}
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: Script for Stuka that flies into a tree and explodes (?)

Post by Lennard » October 19th, 2009, 1:39 pm

nope, doesn't work.

i was wondering, doesn't the tree have the be a entity? it's now just a misc_model, coz its now just flying into the tree and nothing else happens..

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 46 guests