bots follow ai script problem

Please use this forum to ask all your MoHAA Bots questions / discussions

Moderator: Moderators

Post Reply
sk8infreak896
Private
Posts: 6
Joined: Tue Nov 25, 2008 4:45 am

bots follow ai script problem

Post by sk8infreak896 »

hi, i used this script to make an ai follow me and whenever the enemy ai goes to shoot the mission always crashes and goes back to the main menu. Heres the script i used:



exec global/auto.scr

level waittill prespawn
exec global/friendly.scr
level waittill spawn

//---------------------------------------------------------------------------
main:
//---------------------------------------------------------------------------

// Tells the AI to move to the player
$F1.destination = $player
$F2.destination = $player
$F3.destination = $player

// Sets the type of friendly soldier
$F1.friendtype = 1
$F2.friendtype = 1
$F3.friendtype = 1

// stagger how far away they keep from their destinations
$F1.distance = 175
$F2.distance = 225
$F3.distance = 250

// setup the friendlies to follow the player...
$F1 thread global/friendly.scr::friendlythink
$F2 thread global/friendly.scr::friendlythink
$F3 thread global/friendly.scr::friendlythink

end

can someone please help.
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

What error is there in the console?
Image
sk8infreak896
Private
Posts: 6
Joined: Tue Nov 25, 2008 4:45 am

Post by sk8infreak896 »

well i went into the console and it said Error: command overflow. possible infinite loop in thread. is there anyway to fix that so it wont crash my game?
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

I guess there's a bug in Mackey's script... I would check it out but that script is very big, it would take a while.
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
sk8infreak896
Private
Posts: 6
Joined: Tue Nov 25, 2008 4:45 am

Post by sk8infreak896 »

well are there any other scripts that actually work for making an ai follow you?
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Oh I think you should give them targetname 'friendly' (not F1, F2, ...), then use their #fnum to access them as level.friendly1, level.friendly2 etc. A bit dodgy but that's how that script was written.
Image
Aprop
Major
Posts: 291
Joined: Mon Nov 17, 2008 3:40 pm

Post by Aprop »

jv_map wrote:Oh I think you should give them targetname 'friendly' (not F1, F2, ...), then use their #fnum to access them as level.friendly1, level.friendly2 etc. A bit dodgy but that's how that script was written.
Targetname friendly? Its no needed... just give them some parms and thread the script... it work for me... maybe u need to add .tether parm? Or smth else... idk... and i cant show you mine script because its on other computer =)
sk8infreak896
Private
Posts: 6
Joined: Tue Nov 25, 2008 4:45 am

Post by sk8infreak896 »

how do i get use the #fnum to access them as level.friendly1 etc.?? and then how do i write it as a script?
Aprop
Major
Posts: 291
Joined: Mon Nov 17, 2008 3:40 pm

Post by Aprop »

Friendlies work for me without any fnums and level.friendlies99999 etc, try this:

Code: Select all

friendof local.player:

	self.accuracy		= 20		
	self.mindist		= 128	
	self.maxdist		= 4000	
	self.leash		= 640
	self tether local.player
	self.sight		= 4000
	self.noticescale	= 1
	self.waittime		= 0.1

	self thread global/friendly.scr::friendlythink
	self.friendtype = 1
	self.destination = local.player
	self.distance = 192

end
where self is friend, and local.player is.... player! It should work at all, but im not sure because there's probably small difference between mine friendly.scr and yours....
sk8infreak896
Private
Posts: 6
Joined: Tue Nov 25, 2008 4:45 am

Post by sk8infreak896 »

i tried that script it didnt seem to work but what file can i find friendly.scr in?
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Read the instructions on top of global/friendly.scr (in pak0.pk3). All is explained there.
Image
Aprop
Major
Posts: 291
Joined: Mon Nov 17, 2008 3:40 pm

Post by Aprop »

Have you pathnodes on your map?
sk8infreak896
Private
Posts: 6
Joined: Tue Nov 25, 2008 4:45 am

Post by sk8infreak896 »

yes i put pathnodes on my map
Post Reply