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

"missile_fired" notify for WaW

broken avatar :(
Created 8 years ago
by alaurenc9
0 Members and 1 Guest are viewing this topic.
1,833 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 30 December 2012
Last active: 9 months ago
Posts
577
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community 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.
Community 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
This is a notify in BO1 and so on that notifies like "grenade_fired", but for projectiles. I figured out that I could define projectile ent's by using the classname 'rocket', and I just looked at the birth time of the projectiles compared to the time if notifies "weapon_fired" and found you can match the times together. This should never glitch or break because even if two or more players managed to shoot the projectile guns in the exact same frame of time in the game, it will notify the one closest to the player that fired, so it should never be a problem. And there is a while loop that lasts for ten seconds, just incase the projectile didn't spawn immediately, and it also times out after 10 seconds just incase WaW failed again and the projectile didn't actually spawn.

Just call this function on player connect and it should work. Enjoy.
Code Snippet
Plaintext
notify_missile_fired()
{
self endon( "disconnect" );
while( true )
{
self waittill( "weapon_fired" );
weapon = self GetCurrentWeapon();
if( WeaponType( weapon ) == "projectile" )
{
self thread watch_missile_spawn( weapon, self GetEye(), GetTime() );
}
}
}

watch_missile_spawn( weapon, fire_origin, fire_time )
{
watcher_begin_time = GetTime();
while( GetTime() - watcher_begin_time < 10000 )
{
missile = GetEntArray( "rocket", "classname" );
missile = get_array_of_closest( fire_origin, missile );
for( i = 0; i < missile.size; i ++ )
{
if( ( fire_time - 50 ) == missile[i].birthtime )
{
self notify( "missile_fire", missile[i], weapon );
return;
}
}
wait 0.05;
}
}

 
Loading ...