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

[Script] Daedra's buyable AI

broken avatar :(
Created 12 years ago
by daedra descent
0 Members and 1 Guest are viewing this topic.
3,622 views
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 10 years ago
Posts
2,789
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
Signature
Let's keep this thread on topic from here on in. -DBZ

+1 to off-topic reply -DBZ

lmao. Too funny.

Goliath Script Placer: http://ugx-mods.com/forum/index.php/topic,11234.msg125257/topicseen.html#new

"...Christ, people. Learn C, instead of just stringing random characters
together until it compiles (with warnings)..."

-Linus Torvalds
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
Little script that adds the ability for players to buy their own little AI partner. This is only V1, next version will have a lot more built-in ways to customize the AI. Report any issues that you find that isn't in the TODO list so i can fix them.

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

// V1
// TODO:
// -try to fix closest node issue where AI would just run off and get killed.
// -increase responsiveness of the AI
// -add easy AI customization
// -fix trigger if statement bug

main()
{
// The max amount of "drones"
level.friendly_limit = 2;
// the cost of the trigger
level.h_cost = 1000;
// how many seconds until the AI move to a new node
level.drone_wait = 2;

level.ally = GetSpawnerTeamArray( "allies");
level.a_trigger = Getent("helper_trig","targetname");

thread drone_update();
thread trig_setup();
}
trig_setup()
{
level.a_trigger SetHintString( "Press F to buy a Friend [cost: " + level.h_cost + "]" );
while(isdefined(level.a_trigger) && isdefined(level.h_cost) )
{
player = get_players();
level.a_trigger waittill("trigger", player);

// there are three possible outcomes for when the player uses the trigger
if(player.score >= level.h_cost && level.friendlies.size != level.friendly_limit)
{
thread drone_spawn();
thread drone_move(player);
player maps\_zombiemode_score::minus_to_player_score( level.h_cost );

}
if(player.score >= level.h_cost && level.friendlies.size == level.friendly_limit)
{
player iprintln("You cannot buy anymore allies at this time!");
}
if(player.score < level.h_cost)
{
player maps\_zombiemode_perks::play_no_money_perk_dialog();
}
wait(1);
}
}
drone_spawn()
{
// spawns the AI array
for(i = 0; i < level.ally.size; i++)
{
level.ally[i] StalingradSpawn();

}
}
drone_move(player)
{
// moves the AI to the player
while(1)
{
if(isdefined(level.friendlies) )
{
for(i = 0; i < level.friendlies.size; i++)
{
nodes = GetAllNodes();
new_nodes = getClosest( player.origin, nodes );

level.friendlies[i] SetGoalNode( new_nodes );
}
}
wait(level.drone_wait);
}
}
drone_update()
{
// updates the array, needed for the if limit check
while(1)
{
level.friendlies = GetAISpeciesArray( "allies", "all" );
wait(.1);
}
}

Last Edit: May 05, 2014, 06:24:02 am by daedra descent
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 6 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
dd now i have to say it xD this script its actually interesting
btw get all nodes gets an array of the nodes, doesnt it?
maybe because you didnt looped through it thats why the ai just runs randomly
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 10 years ago
Posts
2,789
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
dd now i have to say it xD this script its actually interesting
btw get all nodes gets an array of the nodes, doesnt it?
maybe because you didnt looped through it thats why the ai just runs randomly

Yeah it does. and no i don't think its because its not looped. When ai ran off they ran off on a deck that was about 24 units up from the ground, so its possible that they where just grabbing those nodes. Also, AI don't like to move when their in the middle of firing their gun.

 
Loading ...