Moving FX Lights

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

Moderator: Core Staff

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

Re: Moving FX Lights

Post by Nightmare » April 24th, 2009, 12:42 am

Drofder2004 wrote:small modification to the above...

Code: Select all

 
Firstly, remember this is an INFINITE LOOP, why would you want the engine to find the entity more than once if it isn't changing? Keep it outside the loop.

Secondly, Loops inside loops = infinite amounts of infinite loops.
Every time the loop went round, it created a NEW fx to play, after 1 minute passing you would have 6, eventually stacking to the point where your FPS would be shot and the server would crash.
What is it with people reading too fast these days?
The first script I posted is fine, the second one needs to be fixed, I agree, but you didn't follow the specifications I set in example 2.

Code: Select all

main()
{
	   maps\mp\_load::main();   //Load main functions
	   lightOrigin = getent ("fxOrigin","targetname");   //Assign the fxOrigin entity to lightOrigin
	   level._effect["light"] = loadfx ("fx/light/light.efx");  //Load myLight effect from myFxFolder
	   lightOrigin thread lightsMove();   //Run moving light thread while sending assigned lightOrigin
}

lightsMove(){    //Move lightOrigin back and forth along the X axis 64 units while looping continuously.
	trigger = getent ("lighttrigger","targetname");
	trigger waittill ("trigger");
	maps\mp\_fx::loopfx("light",lightOrigin.origin, 1); //Play loaded light effect at lightOrigin's origin every sec.
	while(1)
	{
	      wait(1);
	      self moveZ (-1000,1,0.5,0.5);
	      self waittill ("movedone");
	      wait(10);     
	      self moveZ (1000,1,0.5,0.5);
	      self waittill ("movedone");
         trigger waittill ("trigger");
	}
}
There.
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]

Scorpion
CJ Wannabe
CJ Wannabe
Posts: 39
Joined: November 18th, 2007, 9:14 pm
Location: Burnley,United Kingdom

Re: Moving FX Lights

Post by Scorpion » April 24th, 2009, 2:10 pm

Yup

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

Re: Moving FX Lights

Post by Drofder2004 » April 24th, 2009, 7:42 pm

Sorry, I figured he wanted it to move once after being triggered, not loop forever after a trigger >.<
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

Post Reply

Who is online

Users browsing this forum: No registered users and 26 guests