UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

Problems with playing fx's. *Sigh*

HOT
broken avatar :(
Created 10 years ago
by Ege115
0 Members and 1 Guest are viewing this topic.
5,510 views
broken avatar :(
×
broken avatar :(
Location: se
Date Registered: 30 July 2013
Last active: 1 month ago
Posts
517
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
×
Ege115's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Ege115's Contact & Social LinksEge115
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?
Code Snippet
Plaintext
fx()
{
ent = getent ("ent","targetname");
level._effect["light"] = loadFX("env/light/fx_ray_headlight_truck");
struct_fx = getstructarray("struct_fx","targetname");

for(i=0;i<struct_fx.size;i++)
{
PlayFxOnTag( level._effect["light"], struct_fx.origin );
struct_fx[i] enablelinkto();
struct_fx[i] linkto (ent);
}
}
Thanks in advance.
Last Edit: April 18, 2014, 07:49:59 pm by Ege115
This topic contains a post which is marked as the Best Answer. Click here to view it.
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 1 year ago
Posts
1,187
Respect
1,404Add +1
Forum Rank
Zombie Colossus
Primary Group
Community Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
Signature
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntstuffy@BluntZombieBluntStuffyStuffyZombie
Well the correct syntax for playfxontag() is

Code Snippet
Plaintext
PlayFXOnTag( <effect id >, <entity>, <tag name> )

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..)

http://www.zeroy.com/script/effects/playfx.htm

http://www.zeroy.com/script/effects/playfxontag.htm

I could try to explain a bit better later, but i'm a bit busy atm.. Let me know if this makes any sense at all..


----EDIT----


Oh and btw, you should put the

Code Snippet
Plaintext
level._effect["light"] 			= loadFX("env/light/fx_ray_headlight_truck");

in the precachemyfx() function in yourmapname.gsc
Last Edit: April 18, 2014, 08:34:57 pm by BluntStuffy
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 4 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Community Scripter Elite
My Groups
More
×
YaPh1l's Groups
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
and you dont define a tag-name
You don't even pass an entity as the second argument, but a vector. Also, you are trying to link script_structs. That does not work.

- Phil.
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 1 year ago
Posts
1,187
Respect
1,404Add +1
Forum Rank
Zombie Colossus
Primary Group
Community Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntstuffy@BluntZombieBluntStuffyStuffyZombie
I just jammed this in  my tight schedule for ya  :D
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..

broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 8 years ago
Posts
2,790
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
Signature
Let's keep this thread on topic from here on in. -DBZ

+1 to off-topic reply -DBZ

lmao. Too funny.

Goliath Script Placer: http://ugx-mods.com/forum/index.php/topic,11234.msg125257/topicseen.html#new

"...Christ, people. Learn C, instead of just stringing random characters
together until it compiles (with warnings)..."

-Linus Torvalds
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
Code Snippet
Plaintext
level._effect["light"] 			= loadFX("env/light/fx_ray_headlight_truck");

This should go in one of the functions in MAPNAME_fx.gsc along with other FX.
broken avatar :(
×
broken avatar :(
Location: se
Date Registered: 30 July 2013
Last active: 1 month ago
Posts
517
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
×
Ege115's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Ege115's Contact & Social LinksEge115
So I spawn like a tag_origin like this?
Code Snippet
Plaintext
fx()
{
ent = getent ("ent","targetname");
level._effect["light"] = loadFX("env/light/fx_ray_headlight_truck");
origin_fx = getentarray("origin_fx","targetname");

for(i=0;i<struct_fx.size;i++)
{
origin = spawn ("script_model", struct_fx[i].origin);
origin setmodel ("tag_origin");

PlayFxOnTag( level._effect["light"], origin_fx, "tag_origin");
origin_fx[i] enablelinkto();
origin_fx[i] linkto (ent);
}
}
And the fx I have is already looping.
And my case is that I need playfxontag()
Something I have missed?
Last Edit: April 18, 2014, 09:21:37 pm by Ege115
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 1 year ago
Posts
1,187
Respect
1,404Add +1
Forum Rank
Zombie Colossus
Primary Group
Community Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntstuffy@BluntZombieBluntStuffyStuffyZombie
Assuming that ent is the entity you want to link the FX to, this is how i would do it.. Should work this way
Code Snippet
Plaintext
main()
{
level._effect["light"] = loadFX("env/light/fx_ray_headlight_truck");
thread fx();
}


fx()
{
ent = getent ("ent","targetname");

fx_origin = spawn ("script_model", ent.origin);
origin setmodel ("tag_origin");

PlayFxOnTag( level._effect["light"], fx_origin, "tag_origin" ); // Here the tag_origin is not a variable so put it in between ""

fx_origin linkto(ent);

        self waittill( "stop_fx");
        fx_origin unlink();
        fx_origin delete();
}

Not sure where you're using the origin_fx and struct_fx variable's for in your version
broken avatar :(
×
broken avatar :(
Location: se
Date Registered: 30 July 2013
Last active: 1 month ago
Posts
517
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
×
Ege115's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Ege115's Contact & Social LinksEge115
Assuming that ent is the entity you want to link the FX to, this is how i would do it.. Should work this way
Code Snippet
Plaintext
main()
{
level._effect["light"] = loadFX("env/light/fx_ray_headlight_truck");
thread fx();
}


fx()
{
ent = getent ("ent","targetname");

fx_origin = spawn ("script_model", ent.origin);
origin setmodel ("tag_origin");

PlayFxOnTag( level._effect["light"], fx_origin, "tag_origin" ); // Here the tag_origin is not a variable so put it in between ""

fx_origin linkto(ent);

        self waittill( "stop_fx");
        fx_origin unlink();
        fx_origin delete();
}

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.
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 4 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Community Scripter Elite
My Groups
More
×
YaPh1l's Groups
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
I made a function for a misc model that will move to a direction
You cannot access misc_models via script. Only script_models.

- Phil.
broken avatar :(
×
broken avatar :(
Location: se
Date Registered: 30 July 2013
Last active: 1 month ago
Posts
517
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
×
Ege115's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Ege115's Contact & Social LinksEge115
You cannot access misc_models via script. Only script_models.

- Phil.
Opps, I mean script_models. I did it via script_model.
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 4 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Community Scripter Elite
My Groups
More
×
YaPh1l's Groups
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
Well, in that code from BluntStuffy
Code Snippet
Plaintext
origin setmodel ("tag_origin");
origin should actually be fx_origin.
I assume that is the code you are using?

- Phil.
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 4 years ago
Posts
941
Respect
Forum Rank
The Decider
Primary Group
Member
My Contact & Social Links
More
×
jjbradman's Groups
jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
why dont you use ugx_easy_fx and put your precache line inside their gsc and then you can use that fx with ugx easy fx setup or in your own script.

if you made it the way i said you would have your precache line in ugx file and your script just would be like this

Code Snippet
Plaintext
#include maps\_utility; 
#include common_scripts\utility;
#include maps\_zombiemode_utility;

fx()
{
ents = getentarray("ent","targetname");
      for(i=0; i<ents.size; i++ )
  {
ents[i] thread play_fx();
  }
}


play_fx()
{
fx_origin = spawn ("script_model",self.origin);
fx_origin setmodel ("tag_origin");

PlayFxOnTag( level._effect["light"], fx_origin, "tag_origin" ); // Here the tag_origin is not a variable so put it in between ""

fx_origin linkto(ent);//here link fx_origin to the moving ent

        self waittill( "stop_fx");
        fx_origin unlink();
        fx_origin delete();
}
Last Edit: April 18, 2014, 11:33:06 pm by jjbradman
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 1 year ago
Posts
1,187
Respect
1,404Add +1
Forum Rank
Zombie Colossus
Primary Group
Community Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntstuffy@BluntZombieBluntStuffyStuffyZombie
Well, in that code from BluntStuffy
Code Snippet
Plaintext
origin setmodel ("tag_origin");
origin should actually be fx_origin.
I assume that is the code you are using?

- Phil.

 :-[ oops, my bad..!
broken avatar :(
×
broken avatar :(
Location: se
Date Registered: 30 July 2013
Last active: 1 month ago
Posts
517
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
×
Ege115's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Ege115's Contact & Social LinksEge115
Well, in that code from BluntStuffy
Code Snippet
Plaintext
origin setmodel ("tag_origin");
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.

why dont you use ugx_easy_fx and put your precache line inside their gsc and then you can use that fx with ugx easy fx setup or in your own script.
I tried that as well. It is like fx is just impossible for me. I am out of ideas.
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 1 year ago
Posts
1,187
Respect
1,404Add +1
Forum Rank
Zombie Colossus
Primary Group
Community Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntstuffy@BluntZombieBluntStuffyStuffyZombie
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?

 
Loading ...