Yes, I am having problems with playing a fx on entities, structs, origins, etc. Whatever I do, the fx never shows up ingame, and I have the fx included in mapname_patch.csv. But still doesn't shows up ingame. I have tried different solutions, but nothing works. So I decided to ask here. This is the latest and most simply solution I have here. But doesn't work either.
I don't know if I have to spawn an origin or something to play the fx. Could someone correct this script for me? Or just help?
and you dont define a tag-name, so maybe that's the problem...
Also, if it's a looped fx you're playing you should be ok with this code (but you can't stop the fx playing).. If it's a one-shot FX you need to put the playfx in a loop so it keeps playing the FX.
The most simple thing to try if anything plays is changing the playfxontag() to playfx() (IF it's a looping FX that is..)
I just jammed this in my tight schedule for ya For playing fx first you need to know what you want to do with it, and what fx it is to determine the best way to play it. some example's: -play a looping fx on the same place the entire game: --> playfx() -play a (looping) FX that you want to stop / move around stuff like that --> playfxontag() -play any looping fx you want to stop sometime --> playfxontag()
A looping FX just keeps playing forever so you useally attach that to a spawned model(tag) and then delete the model when you want the FX to stop playing.. When you want a non-looping fx to play for a longer time, put it in a while loop and just stop the loop..
An very simple example of how to attach a FX to a model and delete it:
Code Snippet
Plaintext
looped_fx() { fx_tag = spawn( "script_model", self.origin ); fx_tag setmodel( "tag_origin" ); fx_tag linkto( ENTITY TO LINK TO, "TAG TO LINK TO" ); PlayFXOnTag( level._effect["light"], fx_tag, "tag_origin" );
self waittill( "kill_looped_fx" );
fx_tag unlink(); fx_tag delete(); }
NOTE: you spawn the model named "tag_origin" (that is an actual model, look in xmodel-utils) and that model also has a tag named tag_origin.. You could have also spawned a car, and played the fx on any tag but then you would have to delete the entire car to stop the FX playing..
Not sure where you're using the origin_fx and struct_fx variable's for in your version
It didn't work, the fx is still not playing. This is getting really wierd. Okey, this is what I am trying to do, I made a function for a misc model that will move to a direction, and I want a fx playing on it, so I added a script origin on the model in radiant. Then I tried to make a fx function were a fx is playing and is linked to the model I have in radiant.
But all my tries never worked, and it is not still working. Hmm, I am precahing the fx in mapname.gsc and in mapname_fx.gsc but there is still nothing. I have always having problems with playing fx's in scripts.
origin should actually be fx_origin. I assume that is the code you are using?
- Phil.
Yes, I used that script. And changed it to fx_origin, but I removed the last three lines because I don't want the fx to delete or unlink itself in my case. But shouldn't it work anyway?
I don't get it, the fx should play ingame. There is nothing more we can do, is it?
This may be the most strangest thing for me in mapping why it is not working when it should work.
Did you try the same thing, but just with let's say the 'powerup_on' fx (or another one you know for sure is working) to see if the script works but it's maybe the FX that's not loaded / suitable?