effects on demand
Moderator: Core Staff
-
- Core Staff
- Posts: 2155
- Joined: December 7th, 2004, 2:07 am
- Location: Netherlands
- Contact:
effects on demand
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.
I tried something with oneshot effect but can't make it work.
-
- Core Staff
- Posts: 2214
- Joined: February 6th, 2006, 3:18 pm
- Location: Germany/Bayern
Re: effects on demand
precache the effect:
rest
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
visit my blog: Link
Soviet wrote:Yeah, watch out, Peds will hit you with his +5 D-Battleaxe of homosexuality
-
- Core Staff
- Posts: 2155
- Joined: December 7th, 2004, 2:07 am
- Location: Netherlands
- Contact:
Re: effects on demand
Ok so I have a trigger which triggers the efect...so it would be like this;
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
Code: Select all
trigger waittill ("trigger");
playfx ( "teleport_light", (400,300,200))
If this is right?...didn't know it was this simple
-
- Core Staff
- Posts: 2030
- Joined: July 24th, 2006, 11:21 am
- Location: Cramped in a small cubicle/making another jump map
Re: effects on demand
The way I do effects:
This is for a looping effect. For a single one just don't loop it(so no while(1)).
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;
}
}
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.
[...]
#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.
-
- Core Staff
- Posts: 2155
- Joined: December 7th, 2004, 2:07 am
- Location: Netherlands
- Contact:
Re: effects on demand
Thx guys, I went with this one;
Have to tweak it a bit more before it is to my liking.
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);
}
}
-
- Core Staff
- Posts: 2030
- Joined: July 24th, 2006, 11:21 am
- Location: Cramped in a small cubicle/making another jump map
Re: effects on demand
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.
[...]
#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.
-
- Core Staff
- Posts: 2155
- Joined: December 7th, 2004, 2:07 am
- Location: Netherlands
- Contact:
Re: effects on demand
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;
Any ideas ?
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();
}
-
- Core Staff
- Posts: 2155
- Joined: December 7th, 2004, 2:07 am
- Location: Netherlands
- Contact:
Re: effects on demand
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 ?
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 ?
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: effects on demand
Code: Select all
loopfxDeletion (ent)
{
self endon ("death");
ent waittill ("effect deleted");
self delete();
}
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
-
- Core Staff
- Posts: 2155
- Joined: December 7th, 2004, 2:07 am
- Location: Netherlands
- Contact:
Re: effects on demand
this is the code now;
Running it with the compiler (or just start a devmap) I get this error;
I also added the following line, but that 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 loopfxDeletion (ent);
wait 0.05;
}
}
loopfxDeletion (ent)
{
self endon ("death");
ent waittill ("effect deleted");
self delete();
}
Code: Select all
uninitialised variable 'ent': (file 'maps/mp/call_spawn_effect.gsc', line 16)
thread loopfxDeletion (ent);
Code: Select all
ent = playfx(fx, (-664,1432,248));
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: effects on demand
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...
---
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
-
- Core Staff
- Posts: 2155
- Joined: December 7th, 2004, 2:07 am
- Location: Netherlands
- Contact:
Re: effects on demand
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.You are playing FX, to remove the FX, just stop the loop.
-
- Core Staff
- Posts: 2155
- Joined: December 7th, 2004, 2:07 am
- Location: Netherlands
- Contact:
Re: effects on demand
I have this code now but it doesn't recognize the "stopfx" command (cause it is not correct ) ;
How do I stop it ?
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;
}
}
-
- Core Staff
- Posts: 2155
- Joined: December 7th, 2004, 2:07 am
- Location: Netherlands
- Contact:
Re: effects on demand
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();
}
-
- Core Staff
- Posts: 2030
- Joined: July 24th, 2006, 11:21 am
- Location: Cramped in a small cubicle/making another jump map
Re: effects on demand
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.
[...]
#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.
Who is online
Users browsing this forum: No registered users and 1 guest