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

Stop a fx from playing on a viewmodel?

broken avatar :(
Created 12 years ago
by Ege115
0 Members and 1 Guest are viewing this topic.
2,496 views
broken avatar :(
×
broken avatar :(
Location: se
Date Registered: 30 July 2013
Last active: 2 years ago
Posts
517
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
Ege115's Groups
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
Hello there members of UGX!

I have an another scripting question, I want to learn so much about it :D.

If I am playing a fx on a viewmodel like this
Code Snippet
Plaintext
PlayViewmodelFx( localclientnum, fx, "tag_flash" );
Can I somehow interrupt/stop the fx from playing on the viewmodel? If so how?

That is my today's question :).
Marked as best answer by Ege115 12 years ago
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 6 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Scripter Elite
My Groups
More
×
YaPh1l's Groups
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
As far as I know, WaW does not provide a method to stop viewmodel FX once it has been started. Therefore you should only use oneshot FX and loop the PlayViewmodelFx() call in your code for as long as you want it to play.

- Phil.
broken avatar :(
×
broken avatar :(
Location: se
Date Registered: 30 July 2013
Last active: 2 years ago
Posts
517
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
Ege115's Groups
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
Making the fx oneshot? Well that is brilliant! Why did I not think of doing that?

Thank you Phil!

Edit: Wait, how do I stop the loop itself so the fx wont play all the time?
Last Edit: March 22, 2014, 07:08:59 pm by Ege115
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 6 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Scripter Elite
My Groups
More
×
YaPh1l's Groups
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
By putting an appropriate condition in the loop's header, for example:
Code Snippet
Plaintext
while(can_play_fx)
{
    PlayViewmodelFx(....);
    realwait(fxtime);
}
or, depending on what you need:
Code Snippet
Plaintext
while(true)
{
    if(can_play_fx)
    {
        PlayViewmodelFx(....);
        realwait(fxtime);
    }
    wait(checkwaittime);
}

- Phil.
Last Edit: March 22, 2014, 07:13:40 pm by YaPh1l
broken avatar :(
×
broken avatar :(
Location: se
Date Registered: 30 July 2013
Last active: 2 years ago
Posts
517
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
Ege115's Groups
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
Hmm, yea I know that you need the realwait to it.

I was thinking of something else about what I wanted to the script. Hmm, okey I think I know what to do myself now. But I am not sure if it will work.

Thanks anyway Phil, because before I had a fx that was not oneshot, and it looped over an over again and well yea guess what happened, I got a screen full of fx's so I couldn't see anything and lost plenty of FPS because of all the fx that looped.

So thanks for telling that a oneshot fx is needed instead. ;)
Last Edit: March 22, 2014, 07:31:06 pm by Ege115
broken avatar :(
×
broken avatar :(
[UGX] Founder
Location: usBay Area, California
Date Registered: 24 June 2011
Last active: 3 years ago
Posts
5,544
Respect
6,646Add +1
Forum Rank
Immortal
Primary Group
UGX Administrator
My Groups
More
My Contact & Social Links
More
Signature
If Java had true garbage collection, most programs would delete themselves upon execution.
×
treminaor's Groups
UGX Administrator
UGX Team Member
UGX Site Moderator Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
If the fx duration is longer than your realwait in the loop that checks if the fx should still play, you will see the fx even after you've told it to stop. Not sure if this is still your problem or not.
broken avatar :(
×
broken avatar :(
Location: se
Date Registered: 30 July 2013
Last active: 2 years ago
Posts
517
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
Ege115's Groups
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 know that it would stillplay after that.
But all I want is the fx to stop playing, or not being visible depending on what the player is doing ingame.

But I think I found the solution anyway so it should be alright now ;).
broken avatar :(
×
broken avatar :(
[UGX] Founder
Location: usBay Area, California
Date Registered: 24 June 2011
Last active: 3 years ago
Posts
5,544
Respect
6,646Add +1
Forum Rank
Immortal
Primary Group
UGX Administrator
My Groups
More
My Contact & Social Links
More
×
treminaor's Groups
UGX Administrator
UGX Team Member
UGX Site Moderator Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
Yes, I know that it would stillplay after that.
But all I want is the fx to stop playing, or not being visible depending on what the player is doing ingame.

But I think I found the solution anyway so it should be alright now ;).
Yeah controlling the life of the fx from EffectsEd and your loop is the only way to do it - you cant delete the fx midway through playing it on a viewmodel in CSC unfortunately.
broken avatar :(
×
broken avatar :(
Location: se
Date Registered: 30 July 2013
Last active: 2 years ago
Posts
517
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
Ege115's Groups
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
Quote
Yeah controlling the life of the fx from EffectsEd and your loop is the only way to do it - you cant delete the fx midway through playing it on a viewmodel in CSC unfortunately.

I just noticed that you can't delete the fx in my script. I'll keep trying different solutions.

Edit: Wait, if you can't delete fx in csc, then how did Treyarch script thier fx on viewmodels, you know if you have the wunderwaffe then there are small electricity fx right? And when you switch weapon, the fx is not visible right?

I'll go look at _zombiemode_tesla.csc and take a look.

Edit: I can't find anything, it basically looks the same as my script. Can someone tell me how treyarch hided the fx when the player switch weapon from the wunderwaffe please?
Last Edit: March 22, 2014, 09:16:13 pm by Ege115
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 6 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Scripter Elite
My Groups
More
×
YaPh1l's Groups
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
They did it just like I explained. The FX is oneshot with a very small duration. In their script, they call PlayViewmodelFx() repeatedly, so it plays the oneshot FX consecutively, resulting in the FX being constantly "on". When the player switches off the Wunderwaffe, they simply stop calling PlayViewmodelFx() in the loop. The last oneshot FX finishes playing soon after that and you don't see the FX anymore. Which is just what I told you to do in my very first post.

- Phil.
broken avatar :(
×
broken avatar :(
Location: se
Date Registered: 30 July 2013
Last active: 2 years ago
Posts
517
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
Ege115's Groups
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
I know that you told me that before, but I thought that the loop would keep playing anyway even if the player would switch to the second weapon. So I just wanted to be sure if I am doing it right.

Ah well, I just make the fx oneshot, case solved ;).

 
Loading ...