Have questions about CoD2 mapping that aren't covered in the tutorials section? Post here!
Moderator: Core Staff
-
<LT>YosemiteSam[NL]
- Core Staff

- Posts: 2155
- Joined: December 7th, 2004, 2:07 am
- Location: Netherlands
-
Contact:
Post
by <LT>YosemiteSam[NL] » August 11th, 2010, 2:10 pm
How can I play an effect on demand (when triggered I mean, not loop in one place) ?
I tried something with oneshot effect but can't make it work.

-
waywaaaard
- Core Staff

- Posts: 2214
- Joined: February 6th, 2006, 3:18 pm
- Location: Germany/Bayern
Post
by waywaaaard » August 11th, 2010, 4:28 pm
precache the effect:
rest
playfx ( <effect id >, <position of effect>, <forward vector>, <up vector> )
Module
Effects
Summary
Play this effect.
Example
fx = playfx (enginesmoke, engine.origin);
Minimum Number of arguments: 2
1 : <effect id> The effect id returned by loadfx
2 : <position of effect> The world position of the effect
Number of optional arguments: 2
1 : <forward vector> The forward vector of the effect
2 : <up vector> The up vector of the effect
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 
-
<LT>YosemiteSam[NL]
- Core Staff

- Posts: 2155
- Joined: December 7th, 2004, 2:07 am
- Location: Netherlands
-
Contact:
Post
by <LT>YosemiteSam[NL] » August 11th, 2010, 4:39 pm
Ok so I have a trigger which triggers the efect...so it would be like this;
Code: Select all
trigger waittill ("trigger");
playfx ( "teleport_light", (400,300,200))
I want it to be a oneshotfx....just make it playoneshotfx ( "teleport_light", (400,300,200),60); ?
If this is right?...didn't know it was this simple

-
Rezil
- Core Staff

- Posts: 2030
- Joined: July 24th, 2006, 11:21 am
- Location: Cramped in a small cubicle/making another jump map
Post
by Rezil » August 11th, 2010, 5:02 pm
The way I do effects:
Code: Select all
ship_smoke()
{
o1 = getent("cruise_exhaust_1","targetname");
fx = loadfx("fx/rezil/cruise_exhaust_black_smoke.efx");
while(1)
{
playfx(fx, o1.origin);
wait 0.5;
}
}
This is for a looping effect. For a single one just don't loop it(so no while(1)).
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.
-
<LT>YosemiteSam[NL]
- Core Staff

- Posts: 2155
- Joined: December 7th, 2004, 2:07 am
- Location: Netherlands
-
Contact:
Post
by <LT>YosemiteSam[NL] » August 11th, 2010, 7:08 pm
Thx guys, I went with this one;
Code: Select all
main()
{
level thread precacheFX();
thread ppsh_spawn();
}
precacheFX()
{
level._effect["teleport_light"] = loadfx ("fx/fire/teleport_light.efx");
}
ppsh_spawn()
{
trigger = getent("weapon_pickup_ppsh_mp","targetname");
{
trigger waittill ("trigger");
maps\mp\_fx::loopfx("teleport_light", (-664,1432,248), 10);
}
}
Have to tweak it a bit more before it is to my liking.
-
Rezil
- Core Staff

- Posts: 2030
- Joined: July 24th, 2006, 11:21 am
- Location: Cramped in a small cubicle/making another jump map
Post
by Rezil » August 11th, 2010, 7:24 pm
Same thing, you only make it a level array and load it seperately. The loopfx function is basically a loop with a wait command.

Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.
-
<LT>YosemiteSam[NL]
- Core Staff

- Posts: 2155
- Joined: December 7th, 2004, 2:07 am
- Location: Netherlands
-
Contact:
Post
by <LT>YosemiteSam[NL] » August 12th, 2010, 11:56 pm
Now I want to remove the effect (play effect...pick up weapon....remove effect), checked mods online and made this script now but it doesn't work;
Code: Select all
main()
{
thread ppsh_spawn();
}
ppsh_spawn()
{
trigger = getent("weapon_pickup_ppsh_mp","targetname");
fx = loadfx("fx/fire/spawn_light.efx");
while (1)
{
playfx(fx, (-664,1432,248));
trigger waittill("trigger");
thread effect_delete();
wait 0.05;
}
}
effect_delete()
{
self.playfx = true;
while(self.playFX)
{
efx = PlayFX( level._effect["fx"], ( -664, 1432, 248 ));
wait 0.05;
}
efx Delete();
}
Any ideas ?
-
<LT>YosemiteSam[NL]
- Core Staff

- Posts: 2155
- Joined: December 7th, 2004, 2:07 am
- Location: Netherlands
-
Contact:
Post
by <LT>YosemiteSam[NL] » August 13th, 2010, 4:45 pm
Is the delete(); command even possible (been trying for over 2 hours now

).
It's the last thing I need for my deck16 map. Can I post the final version in the "post your complete maps here" forum, or is that just for jumpmaps ?
-
Drofder2004
- Core Staff

- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Post
by Drofder2004 » August 13th, 2010, 7:04 pm
Code: Select all
loopfxDeletion (ent)
{
self endon ("death");
ent waittill ("effect deleted");
self delete();
}
This is the code used in CoD4, but I cannot find it referenced by any other code...
If it doesn't work, it should produce an error, run the map with /developer 1
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
-
<LT>YosemiteSam[NL]
- Core Staff

- Posts: 2155
- Joined: December 7th, 2004, 2:07 am
- Location: Netherlands
-
Contact:
Post
by <LT>YosemiteSam[NL] » August 13th, 2010, 7:21 pm
this is the code now;
Code: Select all
main()
{
thread ppsh_spawn();
}
ppsh_spawn()
{
trigger = getent("weapon_pickup_ppsh_mp","targetname");
fx = loadfx("fx/fire/spawn_light.efx");
while (1)
{
playfx(fx, (-664,1432,248));
trigger waittill("trigger");
thread loopfxDeletion (ent);
wait 0.05;
}
}
loopfxDeletion (ent)
{
self endon ("death");
ent waittill ("effect deleted");
self delete();
}
Running it with the compiler (or just start a devmap) I get this error;
Code: Select all
uninitialised variable 'ent': (file 'maps/mp/call_spawn_effect.gsc', line 16)
thread loopfxDeletion (ent);
I also added the following line, but that doesn't work;
Code: Select all
ent = playfx(fx, (-664,1432,248));
-
Drofder2004
- Core Staff

- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Post
by Drofder2004 » August 13th, 2010, 9:07 pm
You havent defined what "ent" is...
---
I am confused as to what exactly you are needing to delete?
You are playing FX, to remove the FX, just stop the loop.
If you are using an entity to play the FX on, then you can delete the entity... but in this case, there is no entity involved...
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
-
<LT>YosemiteSam[NL]
- Core Staff

- Posts: 2155
- Joined: December 7th, 2004, 2:07 am
- Location: Netherlands
-
Contact:
Post
by <LT>YosemiteSam[NL] » August 13th, 2010, 9:29 pm
You are playing FX, to remove the FX, just stop the loop.
This is what I want....when triggered the loop should stop and start again after 60 seconds. But I don't know how to stop the loop to remove the FX.
-
<LT>YosemiteSam[NL]
- Core Staff

- Posts: 2155
- Joined: December 7th, 2004, 2:07 am
- Location: Netherlands
-
Contact:
Post
by <LT>YosemiteSam[NL] » August 14th, 2010, 7:14 pm
I have this code now but it doesn't recognize the "stopfx" command (cause it is not correct

) ;
Code: Select all
main()
{
thread ppsh_spawn();
}
ppsh_spawn()
{
trigger = getent("weapon_pickup_ppsh_mp","targetname");
fx = loadfx("fx/fire/spawn_light.efx");
while (1)
{
playfx(fx, (-664,1432,248));
trigger waittill("trigger");
stopfx(fx, (-664,1432,248));
wait 60;
}
}
How do I stop it ?
-
<LT>YosemiteSam[NL]
- Core Staff

- Posts: 2155
- Joined: December 7th, 2004, 2:07 am
- Location: Netherlands
-
Contact:
Post
by <LT>YosemiteSam[NL] » August 15th, 2010, 4:02 pm
Ok, still working on it but to no avail...this code I'm working with now but how do I get the entity to reappear ?;
Code: Select all
main()
{
thread ppsh_spawn(getent("ppsh_fxorigin","targetname"));
thread deletefx(getent("weapon_pickup_ppsh_mp","targetname"),
getent("ppsh_fxorigin","targetname"));
}
ppsh_spawn(o1)
{
//o1 = spawn("script_origin",(-664,1432,248));
//trigger = getent("weapon_pickup_ppsh_mp","targetname");
fx = loadfx("fx/fire/spawn_light.efx");
while(1)
{
playfx(fx,o1.origin);
wait 0.5;
}
}
deletefx(trigger,o1)
{
trigger waittill("trigger");
o1 delete();
}
-
Rezil
- Core Staff

- Posts: 2030
- Joined: July 24th, 2006, 11:21 am
- Location: Cramped in a small cubicle/making another jump map
Post
by Rezil » August 15th, 2010, 4:23 pm
What exactly do you want? The effect to stop when you trigger it and then to restart after a certain period of time?
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.
Users browsing this forum: No registered users and 0 guests