FX with multiple origins - same targetname.

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

Moderator: Core Staff

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

Post by Nightmare » August 10th, 2007, 6:53 pm

Did you call all the sciprt_origin lamps? or do you mean lamps1, lamps2, etc.
If you give all the script_origins the same name, it will not work.
Also, the script doesn't look right to me.
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]

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

Post by Nightmare » August 10th, 2007, 10:48 pm

well you would have to give them a different name each: lamps1, lamps2, lamps3
you can't have more than one origin have the same name.
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]

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

Post by Drofder2004 » August 11th, 2007, 2:28 am

No, the method is fine, you are using an array and therefore you do NOT have to have different names...

The problem is your coding...

Code: Select all

lamp_effects()
{
   lamps = getentarray("lamps","targetname");
   for(i=0;i<lamps.size;i++)
   lamps[i] thread lamps_fx ();
}
Ok, so above, we no have an array of lamps and every lamp now is threaded to a function.

Code: Select all

lamps_fx()
{
lamps = getent("lamps","targetname");
level._effect["fire"] = loadfx ("fx/fire/flame_small_em.efx");
maps\mp\_fx::loopfx("fire", ("lamps"), 0.6);
}
Now, for some reason, you have chosen to detect the lamp again, you do not need to, you threaded the lamp above...
Also, the "level._effect" should be put in your main, not your function.
And another thing, is your "loopfx" function is wrong... This is what it should be referring to...

loopfx(fxId, fxPos, waittime, fxPos2, fxStart, fxStop, timeout)
fxId = Name of FX
fxPos = Origin
waittime = how many times a second should the fx be played
fxPos2 = direction origin
The last 3, you can ignore...

So, change this code to the following...

Code: Select all

lamps_fx()
{
   maps\mp\_fx::loopfx("fire", self.origin, 0.6, (self.origin + (0,0,1));
}
Or you can rewrite the entire thing to..

Code: Select all

lamp_effects()
{
   lamps = getentarray("lamps","targetname");
   for(i=0;i<lamps.size;i++)
      maps\mp\_fx::loopfx("fire", lamps[i].origin, 0.6, (lamps[i].origin + (0,0,1));
}

Although, this entire script would be more map efficient if you did not use the script_origins and just used numbered origins ;)
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

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

Post by Drofder2004 » August 11th, 2007, 2:53 am

Also, another thing to note, if you are using the normal lantern (like you see around CoD2 maps) you can do so very easily...

Just load the prefab
"prefabs\lamps\lantern_lit.map"

Place it where you want...

In your GSC file make sure the following is present:
maps\mp\_load::main();

and compile and play.
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 37 guests