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

Playing Cherry FX on Weapon Clip

broken avatar :(
Created 10 years ago
by nabaro
0 Members and 1 Guest are viewing this topic.
3,879 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 22 January 2014
Last active: 3 years ago
Posts
143
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
nabaro's Groups
nabaro's Contact & Social Linkschelseafan122099nabarogamerblast11
My Electric Cherry script is fully functional except for one thing: the spark emitted from the weapon does not show up. Here is the script, and as always, thanks in advance!

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

main()
{
level._effect["cherry_burst"] = loadfx("misc/zombie_elec_trail_oneshot");
flag_wait("all_players_connected");
wait(1);
players = get_players();
for(i = 0; i < players.size; i++)
{
players[i] thread cherry_effect();
players[i] thread cherry_down();
}
}

cherry_effect()

while(1)
{
self waittill( "reload_start" );
if( self HasPerk("specialty_boost"))
{
cherry_weapon = self GetCurrentWeapon();
ammo_left = self GetWeaponAmmoClip( cherry_weapon );
clip_size = WeaponClipSize( cherry_weapon );
ratio = ammo_left / clip_size;
damage = 1200 - (ratio * 1200);
iprintln( damage );
PlayFxOnTag(level._effect[ "cherry_burst" ], cherry_weapon, "tag_clip");
touching_check = spawn("trigger_radius",self.origin,1,200,200);
zombies = getaispeciesarray("axis","all");
for(j = 0; j < zombies.size; j++)
{
if(zombies[j] IsTouching( touching_check ))
{
zombies[j] maps\_zombiemode_tesla::tesla_play_death_fx( 1 );
zombies[j] SetFlashBanged( true, 1 );
}
else
{
continue;
}
}
touching_check delete();
SetPlayerIgnoreRadiusDamage( true );
RadiusDamage( self.origin, 200, damage, 50, self );
wait(5);
}
else
{
}
}
}

cherry_down()
{
while(1)
{
if(self HasPerk("specialty_boost"))
{
self waittill_any( "fake_death", "death", "player_downed" );
touching_check = spawn("trigger_radius",self.origin,1,200,200);
zombies = getaispeciesarray("axis","all");
for(j = 0; j < zombies.size; j++)
{
if(zombies[j] IsTouching( touching_check ))
{
zombies[j] maps\_zombiemode_tesla::tesla_play_death_fx( 1 );
zombies[j] SetFlashBanged( true, 1 );
}
else
{
continue;
}
}
touching_check delete();
SetPlayerIgnoreRadiusDamage( true );
RadiusDamage( self.origin, 150, 1200, 50, self );
self UnSetPerk("specialty_boost");
}
else
{
wait(0.05);
continue;
}
}
}
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
cherry_weapon contains a string with the name of the weapon, which is not an entity, so you cannot play an FX off of it.

- Phil.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 22 January 2014
Last active: 3 years ago
Posts
143
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
nabaro's Groups
nabaro's Contact & Social Linkschelseafan122099nabarogamerblast11
So what would I do as an alternative to express the weapon as an entity?
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
i think you could spawn a tag_origin and link that tag origin to the clip and play the fx there then delete?
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 22 January 2014
Last active: 3 years ago
Posts
143
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
nabaro's Groups
nabaro's Contact & Social Linkschelseafan122099nabarogamerblast11
How would I go about doing that? When it comes to tags, I'm clueless  :)
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
Thing is, you cannot access the first-person weapon model joints from the player entity in GSC, afaik.

- Phil.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 22 January 2014
Last active: 3 years ago
Posts
143
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
nabaro's Groups
nabaro's Contact & Social Linkschelseafan122099nabarogamerblast11
Oh, in that case, what is the tag for a player's hand?
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
tag_weapon_right might be useful.

- Phil.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 22 January 2014
Last active: 3 years ago
Posts
143
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
nabaro's Groups
nabaro's Contact & Social Linkschelseafan122099nabarogamerblast11
So I would replace:
Code Snippet
Plaintext
 PlayFxOnTag(level._effect[ "cherry_burst" ], cherry_weapon, "tag_clip"); 
with
Code Snippet
Plaintext
 PlayFxOnTag(level._effect[ "cherry_burst" ], self, "tag_weapon_right");
?
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
Yes.

- Phil.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 22 January 2014
Last active: 3 years ago
Posts
143
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
nabaro's Groups
nabaro's Contact & Social Linkschelseafan122099nabarogamerblast11
Unfortunately, this doesn't work and neither does
Code Snippet
Plaintext
PlayFx(level._effect["cherry_burst"], self.origin);
leading me to believe that there is a problem with the fx. Here is the full script now.
Code Snippet
Plaintext
#include maps\_anim; 
#include maps\_utility;
#include common_scripts\utility;
#include maps\_music;
#include maps\_zombiemode_utility;

main()
{
level._effect["cherry_burst"] = loadfx("env/electrical/fx_player_md");
flag_wait("all_players_connected");
wait(1);
players = get_players();
for(i = 0; i < players.size; i++)
{
players[i] thread cherry_effect();
players[i] thread cherry_down();
}
}

cherry_effect()

while(1)
{
self waittill( "reload_start" );
if( self HasPerk("specialty_boost"))
{
cherry_weapon = self GetCurrentWeapon();
ammo_left = self GetWeaponAmmoClip( cherry_weapon );
clip_size = WeaponClipSize( cherry_weapon );
ratio = ammo_left / clip_size;
damage = 1200 - (ratio * 1200);
iprintln( damage );
PlayFx(level._effect["cherry_burst"], self.origin);
touching_check = spawn("trigger_radius",self.origin,1,200,200);
zombies = getaispeciesarray("axis","all");
for(j = 0; j < zombies.size; j++)
{
if(zombies[j] IsTouching( touching_check ))
{
zombies[j] maps\_zombiemode_tesla::tesla_play_death_fx( 1 );
zombies[j] SetFlashBanged( true, 1 );
}
else
{
continue;
}
}
touching_check delete();
SetPlayerIgnoreRadiusDamage( true );
RadiusDamage( self.origin, 200, damage, 50, self );
wait(5);
}
else
{
}
}
}

cherry_down()
{
while(1)
{
if(self HasPerk("specialty_boost"))
{
self waittill_any( "fake_death", "death", "player_downed" );
touching_check = spawn("trigger_radius",self.origin,1,200,200);
zombies = getaispeciesarray("axis","all");
for(j = 0; j < zombies.size; j++)
{
if(zombies[j] IsTouching( touching_check ))
{
zombies[j] maps\_zombiemode_tesla::tesla_play_death_fx( 1 );
zombies[j] SetFlashBanged( true, 1 );
}
else
{
continue;
}
}
touching_check delete();
SetPlayerIgnoreRadiusDamage( true );
RadiusDamage( self.origin, 150, 1200, 50, self );
self UnSetPerk("specialty_boost");
}
else
{
wait(0.05);
continue;
}
}
}
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, is it included in a CSV?

- Phil.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 22 January 2014
Last active: 3 years ago
Posts
143
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
nabaro's Groups
nabaro's Contact & Social Linkschelseafan122099nabarogamerblast11
It is in zone_source/english/assetinfo/mapname.csv. Is that okay or should it be included elsewhere?
broken avatar :(
×
broken avatar :(
Former UGX Lead Asset Creator
Location: ca
Date Registered: 17 August 2012
Last active: 5 years ago
Posts
1,932
Respect
Forum Rank
Zombie Destroyer
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
Personal Quote
Eh?
Signature

(Click to enter portfolio)
×
SajeOne's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
Just suggesting another way that might be easier for you.. Although you can not access the viewmodel from server script you can access it from clientscript. A function in the wunderwaffe client script called:
Code Snippet
Plaintext
PlayViewmodelFx( <localclientnum>, <FX>, <tag> )

It's used to play an FX on a tag within the viewmodel. Should work just the same.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 22 January 2014
Last active: 3 years ago
Posts
143
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
nabaro's Groups
nabaro's Contact & Social Linkschelseafan122099nabarogamerblast11
So basically I would use this function in a .csc file rather than a .gsc?

 
Loading ...