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

Knife fx

broken avatar :(
Created 10 years ago
by Undeadmetal
0 Members and 1 Guest are viewing this topic.
1,583 views
broken avatar :(
×
broken avatar :(
Location: usOregon
Date Registered: 20 August 2014
Last active: 1 year ago
Posts
308
Respect
Forum Rank
Perk Hacker
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Personal Quote
Coding Hobbyist, Application & Web Development
Signature
×
Undeadmetal's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Undeadmetal's Contact & Social LinksOnlyAGamer
I have a custom gun with a tactical knife and I had an interesting idea to make the tactical knife have an effect on the zombie when knifed but I have no idea how to add that so that when I knife the zombies it goes through with the effect. any Ideas where I'd look to change something like that? Or just how to initiate fx for a weapon?
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 30 December 2012
Last active: 2 years ago
Posts
577
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Signature
My preferred name is "xSanchez78".
Check me out here: www.steamcommunity.com/id/xSanchez78
×
alaurenc9's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
alaurenc9's Contact & Social LinksxSanchez78xSanchez78xSanchez78xSanchez78xSanchez78xSanchez78
play the fx on the knife or the zombie hit?

if it's the zombie hit, um.....

I would do something like: go into _zombiemode_spawner.gsc, then in zombie_spawn_init() at the bottom put

Code Snippet
Plaintext
self thread play_knife_damage_fx();

then in that same file or if you add it to another file, you need to specify that in the function thread but make a function something like this:

Code Snippet
Plaintext
play_knife_damage_fx()
{
while( true )
{
self waittill( "damage", amount, attacker, direction_vec, point, type );
if( !IsDefined( self ) )
{
return;
}
if( type == "MOD_MELEE" && self.damageweapon == "your tactical weapon name" )
{
PlayFXOnTag( level._effect[ "your effect name" ], self, "your fx tag" );
}
}
}

if you want an fx on the knife, then you would have to do this in csc like so:

Code Snippet
Plaintext
#include clientscripts\_utility; 
#include clientscripts\_fx;
#include clientscripts\_music;

init()
{
level thread player_init();
}

player_init()
{
waitforallclients();
players = GetLocalPlayers();
for( i = 0; i < players.size; i ++ )
{
players[i] thread play_melee_fx( i );
}
}

play_melee_fx( localClientNum )
{
self endon( "disconnect" );
while( true )
{
while( !IsMeleeing( localClientNum ) )
{
wait 0.001;
}
currentweapon = GetCurrentWeapon( localClientNum );
if( currentweapon == "your tactical weapon name" )
{
PlayViewmodelFX( localClientNum, level._effect[ "your fx name" ], "your fx tag" );
}
while( IsMeleeing( localClientNum ) )
{
wait 0.001;
}
}
}

and call this from your mapname.csc or wutever.

effects must be loaded in csc AND gsc if you use this in csc.

these all should work but i only made it in 2 mins so don't expect it to.
Last Edit: December 19, 2015, 12:27:05 am by alaurenc9

 
Loading ...