Page 1 of 1

bots follow ai script problem

Posted: Wed Nov 26, 2008 2:33 am
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.

Posted: Wed Nov 26, 2008 11:00 am
by jv_map
What error is there in the console?

Posted: Wed Nov 26, 2008 6:48 pm
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?

Posted: Wed Nov 26, 2008 8:50 pm
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.

Posted: Wed Nov 26, 2008 8:55 pm
by sk8infreak896
well are there any other scripts that actually work for making an ai follow you?

Posted: Thu Nov 27, 2008 11:24 am
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.

Posted: Thu Nov 27, 2008 2:59 pm
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 =)

Posted: Thu Nov 27, 2008 5:06 pm
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?

Posted: Thu Nov 27, 2008 7:51 pm
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....

Posted: Thu Nov 27, 2008 8:26 pm
by sk8infreak896
i tried that script it didnt seem to work but what file can i find friendly.scr in?

Posted: Sat Nov 29, 2008 10:12 am
by jv_map
Read the instructions on top of global/friendly.scr (in pak0.pk3). All is explained there.

Posted: Sat Nov 29, 2008 12:39 pm
by Aprop
Have you pathnodes on your map?

Posted: Sat Nov 29, 2008 6:40 pm
by sk8infreak896
yes i put pathnodes on my map