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

move AI

broken avatar :(
Created 9 years ago
by buttkicker845
0 Members and 1 Guest are viewing this topic.
1,816 views
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
how do you make an AI move to a specific location? ive tried using the method setGoalPos(); but they dont seem to go to the location. is there something specific that needs to be done in order to make them go to the location?
this is the code i have, this gets called on the AI once they are spawned
Code Snippet
Plaintext
moveAllies()
{
        players = get_players();
while(1)
{
self setGoalPos(players[0].origin);
iPrintln("owner position at " + players[0].origin);
wait(1);

}
}
Marked as best answer by buttkicker845 9 years ago
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 8 years ago
Posts
2,790
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
If your using the mg42portable or an other AI with an LMG that would be why. Treyarch, in typical Treyarch fashion, thought it would be a great idea to do some BS move logic on all AI with LMGs in _spawner.gsc.

Otherwise try adding this before get_players():

Code Snippet
Plaintext
	if(!isdefined(self))
{
iprintln("Error: Self is not defined!");
return;
}
else if(!isAI(self))
{
iprintln("Error: Self is not an AI");
return;
}

Should help you figure out whats giving you trouble.

Also, i wouldn't recommend setting the goal to the players exact origin. If you do, the AI will keep running into the player even if they are right next to each other. Try using nodes instead with setGoalNodes().

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
thanks, i got it to work by modifying the script from this tutorial you made

http://ugx-mods.com/forum/index.php?topic=2722.msg26517#msg26517

do you know of a way to make the team members to be more responsive and move to the new position quicker than they do? right now it takes them a little while before moving
Last Edit: June 18, 2015, 03:12:08 am by buttkicker845
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 4 years ago
Posts
6,877
Respect
1,004Add +1
Forum Rank
Immortal
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Signature
If you want scripts / features made for you, then contact me by PM or email / skype etc
it will cost you tho so if you have no intention of reciprocating don't even waste my time ;)
×
Harry Bo21'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.
Harry Bo21's Contact & Social Links[email protected]HarryBo21HarryBo000
try reducing the wait  in the loop :

wait(1);

wait .1;

 
Loading ...