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

Turret and AI Help

broken avatar :(
Created 6 years ago
by Deleted User
0 Members and 1 Guest are viewing this topic.
1,327 views
broken avatar :(
  • DeletedUser
  • Deleted Member
×
broken avatar :(
DeletedUser
This user is deleted :(
How do you get AI to use turrets? I got the turrets to work for the player but i cant get the AI to use them. even when i tell them to target it they run to it but dont use it,
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 11 March 2014
Last active: 3 years ago
Posts
264
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
Signature
"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
×
buttkicker845's Groups
buttkicker845's Contact & Social Links
This is a function inside of the utility for the ber2 map which is the "Eviction" mission
Code Snippet
Plaintext
// Will force an AI to use a turret
// Guy - Ai
// Turret - turret to use
// ender - what level notification will stop this thread
//This should be called using thread*
guy_stay_on_turret( guy, turret, ender )
{
if( IsDefined( ender ) )
{
level endon( ender );
}
turret endon( "death" );
guy endon( "death" );

level thread maps\_mgturret::mg42_setdifficulty( turret, getdifficulty() );
turret setmode( "auto_ai" );
turret SetTurretIgnoreGoals( true );

if( !IsDefined( guy GetTurret() ) )
{
guy UseTurret( turret );
}

wait( 0.5 );
}

If you want the guy to stop using the turret and move again you will need to use some notify to end the thread
broken avatar :(
  • DeletedUser
  • Deleted Member
×
broken avatar :(
DeletedUser
This user is deleted :(
This is a function inside of the utility for the ber2 map which is the "Eviction" mission
Code Snippet
Plaintext
// Will force an AI to use a turret
// Guy - Ai
// Turret - turret to use
// ender - what level notification will stop this thread
//This should be called using thread*
guy_stay_on_turret( guy, turret, ender )
{
if( IsDefined( ender ) )
{
level endon( ender );
}
turret endon( "death" );
guy endon( "death" );

level thread maps\_mgturret::mg42_setdifficulty( turret, getdifficulty() );
turret setmode( "auto_ai" );
turret SetTurretIgnoreGoals( true );

if( !IsDefined( guy GetTurret() ) )
{
guy UseTurret( turret );
}

wait( 0.5 );
}

If you want the guy to stop using the turret and move again you will need to use some notify to end the thread

alright man! thank you!

Double Post Merge: January 17, 2018, 11:29:41 pm
This is a function inside of the utility for the ber2 map which is the "Eviction" mission
Code Snippet
Plaintext
// Will force an AI to use a turret
// Guy - Ai
// Turret - turret to use
// ender - what level notification will stop this thread
//This should be called using thread*
guy_stay_on_turret( guy, turret, ender )
{
if( IsDefined( ender ) )
{
level endon( ender );
}
turret endon( "death" );
guy endon( "death" );

level thread maps\_mgturret::mg42_setdifficulty( turret, getdifficulty() );
turret setmode( "auto_ai" );
turret SetTurretIgnoreGoals( true );

if( !IsDefined( guy GetTurret() ) )
{
guy UseTurret( turret );
}

wait( 0.5 );
}

If you want the guy to stop using the turret and move again you will need to use some notify to end the thread

What are the KvP's for the dude in radiant?
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 11 March 2014
Last active: 3 years ago
Posts
264
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
×
buttkicker845's Groups
buttkicker845's Contact & Social Links
What are the KvP's for the dude in radiant?

Any AI reference can be passed into the function, as well as the turret variable

I want to point out that these functions and scripts for AI are set up to be more generic than the ones for zombieMode. They weren't designed so people can just call a beginning function and the script runs and handles everything for you, they require you to program the logic behind these supporting functions.

Than being said it maybe possible to automatically link a guy to use a turret and that be the only thing he does, but idk.

 
Loading ...