Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 96 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP Mapping

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 2
Category: CoD2 Scripting
Scripting and coding with Call of Duty 2.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Next Page
subscribe
Author Topic: Timed explosion
Senator
General Member
Since: Mar 27, 2004
Posts: 61
Last: Feb 10, 2008
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Saturday, Mar. 3, 2007 07:50 am
Hey, I have a quick question. Im making a map, go figure [duh], and I have 8 planes fly over. They work, all with sound. Now, I want to add explosions to time with the planes that fly over. I have 4 script origins labeled with targetnames of bomb1,2,3,4 respectivley. Ive searched the forums, and the only thing that comes up is Salerno beach, and ive ripped apart his GSCs trying to follow what he did, and I cant figure it out. Id also like it to have sound, but if you guys can kind of hint towards what I have to start in the script, itd be helpful. Now, from what ive tried to think of, and look for in the IWDs, is that somehow you have to give them a time to play the effect, and wait for x amount of time to play again right? How would I set that up? Thanks for any help! [jumping]
Share |
The_Caretaker
General Member
Since: Jun 8, 2004
Posts: 11625
Last: Jul 7, 2009
[view latest posts]
Level 10
Category: CoD2 Scripting
Posted: Saturday, Mar. 3, 2007 04:32 pm
the functions you're looking for:

wait();
wait(10); will wait for 10 seconds.

playsound();

tank playsound("tank_sound"); will play the sound "tank_sound" (as named in your .csv file) from the entity declared as "tank".
There are tutorials on the CoDUO section explaining this in more detail

Then it's just playing the effect, sounds and other stuff in the right order with the correct timing..

so..

planes start flying over
wait 20 seconds
bomb falls
explosion 1..
wait 4 seconds
bomb falls
explosion 2..

etc..
Share |
Senator
General Member
Since: Mar 27, 2004
Posts: 61
Last: Feb 10, 2008
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Monday, Mar. 5, 2007 05:53 am
ok, i got this, it loads, but doesnt do anything, I dont know what else to do
Code:
main()
{


    level._effect["explosion"] = loadfx("fx/explosions/artilleryExp_dirt_brown.efx");

    thread bomber();

}

bomber()
{

	orig1 = getent ("bomb1","targetname");
	orig2 = getent ("bomb2","targetname");
	orig3 = getent ("bomb3","targetname");
	orig4 = getent ("bomb4","targetname");

	origin1 = orig1 getorigin();
	origin2 = orig2 getorigin();
	origin3 = orig3 getorigin();
	origin4 = orig4 getorigin();


	wait (2);

	playfx(level._effect["explosion"], origin1);
	orig1 playsound("explosion");
	radiusDamage(origin1, 500, 2000, 1000);
	earthquake(0.75, 5, origin1, 2000);
	wait (0.20);
	playfx(level._effect["explosion"], origin2);
	orig2 playsound("explosion");
	radiusDamage(origin2, 500, 2000, 1000);
	earthquake(0.75, 5, origin2, 2000);
	wait (0.20);
	playfx(level._effect["explosion"], origin3);
	orig3 playsound("explosion");
	radiusDamage(origin3, 500, 2000, 1000);
	earthquake(0.75, 5, origin3, 2000);
	wait (0.20);
	playfx(level._effect["explosion"], origin4);
	orig4 playsound("explosion");
	radiusDamage(origin4, 500, 2000, 1000);
	earthquake(0.75, 5, origin4, 2000);
	wait (0.20);


}

And heres my plane script
Code:
main()
{
forplanes();
}

forplanes() 
{ 
level.PlaneSpeed = 4.0; 

forplane1 = getent ("forplane1","targetname"); 
forplane2 = getent ("forplane2","targetname"); 
forplane3 = getent ("forplane3","targetname"); 
forplane4 = getent ("forplane4","targetname"); 
forplane5 = getent ("forplane5","targetname"); 
forplane6 = getent ("forplane6","targetname"); 
forplane7 = getent ("forplane7","targetname"); 
forplane8 = getent ("forplane8","targetname"); 

temp = getent (forplane1.target,"targetname"); 
forplane1.dest = temp.origin; 
forplane1.start = forplane1.origin; 
forplane1 hide(); 
temp = getent (forplane2.target,"targetname"); 
forplane2.dest = temp.origin; 
forplane2.start = forplane2.origin; 
forplane2 hide(); 
temp = getent (forplane3.target,"targetname"); 
forplane3.dest = temp.origin; 
forplane3.start = forplane3.origin; 
forplane3 hide(); 
temp = getent (forplane4.target,"targetname"); 
forplane4.dest = temp.origin; 
forplane4.start = forplane4.origin; 
forplane4 hide(); 
temp = getent (forplane5.target,"targetname"); 
forplane5.dest = temp.origin; 
forplane5.start = forplane5.origin; 
forplane5 hide(); 
temp = getent (forplane6.target,"targetname"); 
forplane6.dest = temp.origin; 
forplane6.start = forplane6.origin; 
forplane6 hide(); 
temp = getent (forplane7.target,"targetname"); 
forplane7.dest = temp.origin; 
forplane7.start = forplane7.origin; 
forplane7 hide(); 
temp = getent (forplane8.target,"targetname"); 
forplane8.dest = temp.origin; 
forplane8.start = forplane8.origin; 
forplane8 hide(); 
wait 1; 

while (1) 
{ 
forplane1 thread plane_flyby("forplane_flyby"); 
wait .15; 
forplane2 thread plane_flyby("forplane_flyby"); 
wait .15;
forplane3 thread plane_flyby("forplane_flyby"); 
wait .15; 
forplane4 thread plane_flyby("forplane_flyby"); 
wait .15; 
forplane5 thread plane_flyby("forplane_flyby"); 
wait .15;
forplane6 thread plane_flyby("forplane_flyby"); 
wait .15;
forplane7 thread plane_flyby("forplane_flyby"); 
wait .15;
forplane8 thread plane_flyby("forplane_flyby"); 
wait .15;

wait 90; 
} 
} 


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

wait 2; 

self show(); 

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

wait level.PlaneSpeed; 

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

and, my sound alias, I did notice some weird thing goin on when the planes flew over, it like stopped the sound
Code:
null,1,null.wav,,,,,,,,,,,,,,,,,,,,


ambient_forest,,ambient/forest.mp3,0.2,0.2,0.9,0.9,,,local,streamed,,looping,,,,,,,,,,
creek,,misc/creek.mp3,0.9,0.9,1,1,1000,1500,auto,streamed,,looping,,,,,,,,,,
house,,misc/house.mp3,0.7,0.75,1,1,500,700,auto,streamed,,looping,,,,,,,,,,
forplane_flyby,,plane/forplane_flyby.wav,0.5,,,,,,local,,,,,,,,,,,,,
explosion,,Explosions/mortar_dirt05.wav,0.8,1,,,,,,local,,,,,forestb8,,,,,,,,


as for the map, i have script origins with targetnames of bomb1-4, and script origins with targetnames of orgi1-4
Share |
P.C.Invasion
General Member
Since: Mar 22, 2005
Posts: 700
Last: Oct 21, 2013
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Monday, Mar. 5, 2007 06:13 am
Try putting your vectors in parenthesis.
Share |
WHC_Grassy
General Member
Since: Apr 20, 2005
Posts: 1426
Last: Aug 25, 2007
[view latest posts]
Level 8
Category: CoD2 Scripting
Posted: Monday, Mar. 5, 2007 07:40 am
You only have a 2 second delay before it starts to play the fx, and then only .20 between them.
Maybe it's all over before you spawn and you missed it! :)


edited on Mar. 5, 2007 02:40 am by WHC_Grassy
Share |
Senator
General Member
Since: Mar 27, 2004
Posts: 61
Last: Feb 10, 2008
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Monday, Mar. 5, 2007 09:43 pm
I tried upping the time between the effect and the time between the effects, and no go, they still dont show up. I dont know what else to do.
Share |
Senator
General Member
Since: Mar 27, 2004
Posts: 61
Last: Feb 10, 2008
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Tuesday, Mar. 6, 2007 02:43 am
Anyone have any ideas on why this ain't playing the effect, or the sounds, I dont know what else it is, as I said, Im not good at scripting. Would they have to be script_models instead of script_origins?
Share |
The_Caretaker
General Member
Since: Jun 8, 2004
Posts: 11625
Last: Jul 7, 2009
[view latest posts]
Level 10
Category: CoD2 Scripting
Posted: Tuesday, Mar. 6, 2007 05:33 pm
try this:

playfx(level._effect["explosion"], orig1.origin);
Share |
Senator
General Member
Since: Mar 27, 2004
Posts: 61
Last: Feb 10, 2008
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Tuesday, Mar. 6, 2007 11:43 pm
Ok, ive made a bit of progress, I forgot thread planes() on my plane script, that fixed my fog and all that, and now I got when the bombs are dropped, my screen shakes, so thats there. If I use the script_fx thing, would that fix it? Or should I still stick with the script_origin? The effect and sound dont work yet, i shouldve said that

edited on Mar. 6, 2007 06:53 pm by Senator
Share |
PfcOutlaw
General Member
Since: May 20, 2004
Posts: 29
Last: Sep 13, 2008
[view latest posts]
Level 2
Category: CoD2 Scripting
Posted: Saturday, Mar. 17, 2007 12:18 pm
I have been playing around with this and have gotten it to work as an arty strike basically, no planes or such, just a couple of nice explosions at a timed period. I just have a couple of questions that have eluded me.

how would you get a script like this to repeat itself after its run thru the first time?

And would it be possible to have a random selection of just 2 or 3 "targets" out of a possible 6 or more "targets"?

thanks in advance
Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 Scripting

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»