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

detect zombies

broken avatar :(
Created 9 years ago
by arceus
0 Members and 1 Guest are viewing this topic.
1,499 views
broken avatar :(
×
broken avatar :(
Senpai
Location: us
Date Registered: 28 September 2013
Last active: 3 years ago
Posts
605
Respect
Forum Rank
Zombie Enslaver
Primary Group
Box Mappers Elite
My Groups
More
My Contact & Social Links
More
×
arceus's Groups
Box Mappers Elite
Box Mappers Elite
arceus's Contact & Social LinksarceusNT
ok so I'm working on something and for it i need to detect the zombies are right in front of the player i looked at a thunder gun script but i got confused, if anyone could help that would be great thanks before hand.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 16 October 2014
Last active: 9 years ago
Posts
48
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
n122q45's Groups
n122q45's Contact & Social Links
try this
Code Snippet
Plaintext
get_array_of_closest( org, array, excluders, max, maxdist )
{
// pass an array of entities to this function and it will return them in the order of closest
// to the origin you pass, you can also set max to limit how many ents get returned
if( !IsDefined( max ) )
max = array.size;
if( !isdefined( excluders ) )
excluders = [];

maxdists2rd = undefined;
if( isdefined( maxdist ) )
maxdists2rd = maxdist * maxdist;

// return the array, reordered from closest to farthest
dist = [];
index = [];
for( i = 0;i < array.size;i ++ )
{
excluded = false;
for( p = 0;p < excluders.size;p ++ )
{
if( array[ i ] != excluders[ p ] )
continue;
excluded = true;
break;
}
if( excluded )
continue;

length = distancesquared( org, array[ i ].origin );

if( isdefined( maxdists2rd ) && maxdists2rd < length )
continue;

dist[ dist.size ] = length;


index[ index.size ] = i;
}

for( ;; )
{
change = false;
for( i = 0;i < dist.size - 1;i ++ )
{
if( dist[ i ] <= dist[ i + 1 ] )
continue;
change = true;
temp = dist[ i ];
dist[ i ] = dist[ i + 1 ];
dist[ i + 1 ] = temp;
temp = index[ i ];
index[ i ] = index[ i + 1 ];
index[ i + 1 ] = temp;
}
if( !change )
break;
}

newArray = [];
if( max > dist.size )
max = dist.size;
for( i = 0;i < max;i ++ )
newArray[ i ] = array[ index[ i ] ];
return newArray;
}

check_zombie()
{
view_pos = self gettagorigin("tag_flash");
zombies = get_array_of_closest( view_pos, GetAiSpeciesArray( "axis", "all" ), undefined, undefined, 60 ); // 60 is the distance to see how far the zombie can be
if ( !isDefined( zombies ) )
{
return;
}
}
broken avatar :(
×
broken avatar :(
[UGX] Documentation Writer & Programmer
Location: usLos Angeles, CA
Date Registered: 23 August 2013
Last active: 6 months ago
Posts
1,322
Respect
Forum Rank
Zombie Colossus
Primary Group
UGX Team Member
My Groups
More
My Contact & Social Links
More
Personal Quote
(ง º ω º )ง u wont sum m8y?
Signature
Do not take life too seriously. You will never get out of it alive.
×
DidUknowiPwn's Groups
UGX Team Member
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.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Code Snippet
Plaintext
zombies = get_array_of_closest( self GetTagOrigin( "j_head" ), GetAiSpeciesArray( "axis", "all" ), undefined, undefined, GetDvarInt("player_meleeRange") );
Should do it.

 
Loading ...