This shows you the differences between two versions of the page.

Link to this comparison view

mod_older_hot [2013/07/24 16:29]
slitherinewiki created
mod_older_hot [2013/07/24 16:30] (current)
Line 1: Line 1:
 +====== AI Scripting and Orders ======
 +One new feature of 2.0.6 was the ability to set up a list of up to 4 orders for the AI to follow.  This is now the recommended way to order the AI's unit around.
 +==== The Order List ====
 +Team orders include a destination (either an AI point or a tile coordinate), and an aggression to use for the order.  There are some helper functions included in FUNCTIONS.BSF (MakeAIOrderCoord and MakeAIOrderAIPoint) and so giving orders is as simple as the examples below:
 +// Give team 0 on side 1 (the AI side) a sequence of 3 orders
 +// first order, go to 30, 26 with aggression 2 (move as a group)
 +SetTeamOrder(1, 0, 0, MakeAIOrderCoord(30, 26, 2)) ;
 +// then, once you get there, head to AI point 4 with aggression 8 (avoid enemy while moving)
 +SetTeamOrder(1, 0, 1, MakeAIOrderAIPoint( 4, 8)) ;
 +// once there, change to aggression 16 (seek and destroy).  0,0 coordinate means we don't want to set a team destination.
 +SetTeamOrder(1, 0, 2, MakeAIOrderCoord(0,0, 16)) ;
 +As orders are executed they will be removed from the list, and the remaining orders will move up.  So you can use GetTeamOrder to determine which orders have been completed and which have not.
 +==== Immediate Ordering ====
 +Orders will wait for the previous order to complete (that is, the for team to not have a destination it is trying to get to) before the next order begins.  If you want to have direct control over your team (e.g. to react to the player) then you can directly set team data 0 using the SetTeamData function and the MakeAI* functions above.  An alternative is to use the MoveTeam helper function, as shown below.
 +// move team 3 to AI point 6, with aggression 8
 +MoveTeam(1, 3, 6, 8) ;
 +// move team 4 to 22,32 using aggression 2.  Note that you need to pass the aggression in twice
 +// once to the helper function and once to MoveTeam
 +MoveTeam(1, 4, MakeAIOrderCoord(22, 32, 2), 2) ;
 ====== Update 2.0.6 New Features ====== ====== Update 2.0.6 New Features ======
mod_older_hot.txt · Last modified: 2013/07/24 16:30 by slitherinewiki
Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki