;AI Behavior Test (Global short behavior 0) ;* 1 fight 2 crossfire 3 surprise 4 melee_charge 5 melee_leaping_charge 6 vehicle 7 enter_friend_vehicle_impulse - don't know how to do impulses right now 8 vehicle_charge 9 uncover (included with cover, 13) 10 investigate 11 grenade_uncover 12 flee 13 cover (included with uncover, 9) 14 check_friend 15 shoot_corpse 16 obey 17 guard 18-23 not sure right now (impulses) 24 vehicle_switch_seats 25 vehicle_pickup 26 vehicle_fight *; ;---------------------Command scripts ;one command script for each behavior (script command_script fight (cs_set_behavior fight) ) (script command_script cross_fire (cs_set_behavior crossfire) ) (script command_script melee_charge (cs_set_behavior melee_charge) ) (script command_script melee_leaping_charge (cs_set_behavior melee_leaping_charge) ) (script command_script vehicle (cs_set_behavior vehicle) (if (not (vehicle_test_seat_list warthog1 "W-driver" (ai_actors marine))) (cs_go_to behaviors/mid1) ) ;wait for the marine to get into the hog (sleep_until (vehicle_test_seat_list warthog1 "W-driver" (ai_actors marine))) ;drive around (cs_go_to behaviors/p1) (cs_go_to behaviors/p2) (cs_go_to behaviors/p3) (cs_go_to behaviors/p4) (if (= behavior 6) (set behavior 0) ) ) (script command_script vehicle_charge (cs_set_behavior vehicle_charge) ) (script command_script surprise ;(cs_go_to behaviors/p4) (cs_set_behavior surprise) ) (script command_script uncover (cs_set_behavior uncover) ) (script command_script investigate (cs_set_behavior investigate) ) (script command_script cover (cs_set_behavior cover) ) (script command_script grenade_uncover (cs_set_behavior grenade_uncover) ) (script command_script flee (cs_set_behavior flee) ) (script command_script check_friend (cs_set_behavior check_friend) ) (script command_script shoot_corpse (cs_set_behavior shoot_corpse) ) (script command_script guard (cs_set_behavior guard) ) (script command_script vehicle_fight (cs_set_behavior vehicle_fight) ) (script command_script vehicle_switch_seats (cs_set_behavior vehicle_switch_seats) ) (script command_script vehicle_pickup (cs_set_behavior vehicle_pickup) ) (script command_script mid (cs_go_to behaviors/mid1) ) (script command_script midlook (cs_teleport behaviors/mid1 behaviors/p2) ;(cs_go_to_and_face behaviors/mid1 behaviors/p2) (cs_look behaviors/p2 300) ) (script command_script p4 (cs_teleport behaviors/p4 behaviors/mid1) ) ;---------------------Static scripts (script static void espawn ;spawn an elite if there isn't one, kill them all then place if more than 1 (if (!= (ai_living_count elite) 1) (begin (if (> (ai_living_count elite) 1) (ai_kill elite) ) (ai_place elite) ) ) ) (script static void 2mspawn ;make 2 marines, if more than 2 kill them all (none), if 1 place 1 if none, place 2 (if (!= (ai_living_count marine) 2) (begin (if (> (ai_living_count marine) 2) (ai_kill marine) ) (if (= (ai_living_count marine) 0) (begin (ai_place marine) (ai_place marine) ) (ai_place marine) ) ) ) ) (script static void mspawn ;spawn a marine if there isn't one, if more than 1 kill them all then place (if (!= (ai_living_count marine) 1) (begin (if (> (ai_living_count marine) 1) (ai_kill marine) ) (ai_place marine) ) ) ) ;---------------------Continuous scripts ;each continuos script checks for the behavior variable then sets up the encounter for best demonstrating that behavior ;then executes the specified behaviors via a command script call ;----------1. FIGHT (script continuous fightbeh (sleep_until (= behavior 1)) (mspawn) (espawn) ;ai_set_orders and call command scripts (ai_set_orders marine behaviors/engage) (cs_run_command_script marine fight) (print "marine, fight") (ai_set_orders elite behaviors/engage) (cs_run_command_script elite fight) (print "elite, fight") ;wait for someone to die (sleep_until (or (= (ai_living_count elite) 0) (= (ai_living_count marine) 0))) ) ;----------2. CROSSFIRE (script continuous crossfirebeh (sleep_until (= behavior 2)) (2mspawn) (espawn) ;set the orders and call command scripts (ai_set_orders marine behaviors/engage) (cs_run_command_script marine cross_fire) (print "marines, crossfire") (ai_set_orders elite behaviors/self_preservation) (print "elite, self preserve (all)") ;wait for someone to die (sleep_until (or (= (ai_living_count elite) 0) (< (ai_living_count marine) 2))) ) ;----------3. SURPRISE (script continuous surprisebeh (sleep_until (= behavior 3)) ;clean shit up so the elite doesn't check friend and look in the wrong direction (garbage_collect_unsafe) ;(ai_braindead elite true) ;spawn 1 marine, 1 elite (mspawn) (espawn) (ai_set_orders marine behaviors/null) (print "marine, null") (ai_set_orders elite behaviors/null) (print "elite, null") (cs_run_command_script elite midlook) (cs_run_command_script marine p4) (sleep 15) (ai_set_orders marine behaviors/engage) (cs_run_command_script marine surprise) (print "marine, surprise") (sleep_until (or (= (ai_living_count elite) 0) (= (ai_living_count marine) 0))) ;the fucking elite keeps looking around and messing shit up. NOt sure what he's looking at (maybe he hears something...?) ) ;----------4. MELEE_CHARGE (script continuous melee_chargebeh (sleep_until (= behavior 4)) (mspawn) (espawn) ;ai_set_orders and call command scripts (ai_set_orders elite behaviors/charge) (ai_berserk elite true) (cs_run_command_script elite melee_charge) (print "elite, melee_charge") (ai_set_orders marine behaviors/self_preservation) (print "marine, self preserve (all)") (cs_run_command_script all mid) ;wait for someone to die (sleep_until (or (= (ai_living_count elite) 0) (= (ai_living_count marine) 0))) ) ;----------5. MELEE_LEAPING_CHARGE (script continuous melee_leaping_chargebeh (sleep_until (= behavior 5)) (mspawn) (espawn) (ai_berserk elite true) ;ai_set_orders and call command scripts (ai_set_orders elite behaviors/charge) (cs_run_command_script marine melee_leaping_charge) (print "elite, melee_leaping_charge") (ai_set_orders marine behaviors/self_preservation) (print "marine, self_preservation (all)") (cs_run_command_script all mid) ;wait for someone to die (sleep_until (or (= (ai_living_count elite) 0) (= (ai_living_count marine) 0))) ) ;----------6. VEHICLE (script continuous vehiclebeh (sleep_until (= behavior 6)) ;I think the marine will do this w/o an enemy nearby? (ai_kill elite) (mspawn) ;ai_set_orders and call command scripts (ai_set_orders marine behaviors/vehicle) (sleep 5) (cs_run_command_script marine vehicle) (print "marine, vehicle") ;here's where I insert a hack to keep the marine driving around... ;The cs turns behavior into 0 when it the marine reaches the last point on his circuit (sleep_until (or (= behavior 0) (= (ai_living_count marine) 0))) ;then I set behavior back to 6 to loop vehiclebeh (set behavior 6) ) ;----------8. VEHICLE_CHARGE (script continuous vehicle_chargebeh (sleep_until (= behavior 8)) (mspawn) ;check if the marine is in the hog and if he is make him charge, else put him in the hog (if (vehicle_test_seat_list warthog1 "W-driver" (ai_actors marine)) ;spawn an elite and drive him down (begin (espawn) ;ai_set_orders and call command scripts (ai_set_orders marine behaviors/vehicle) (cs_run_command_script marine vehicle_charge) (print "marine, vehicle_charge") (ai_set_orders elite behaviors/self_preservation) (print "elite, self_preservation(all)") ;wait for someone to die (sleep_until (or (= (ai_living_count elite) 0) (= (ai_living_count marine) 0))) ) ;if the marine isn't in the hog put the marine in the hog (begin (ai_go_to_vehicle marine warthog1 "W-driver") ;for some reason this doesn't work when I continuously order the marine to drive, he just stands there. Sleeping for a bit seems to help... (sleep_until (vehicle_test_seat_list warthog1 "W-driver" (ai_actors marine)) 15 150) ) ) ) ;----------9. UNCOVER & COVER (script continuous uncover_and_coverbeh (sleep_until (or (= behavior 9) (= behavior 13))) ;spawn 1 marine, 1 elite (mspawn) (espawn) ;set orders and call command scripts, elite goes for cover while the marine tries to uncover him (ai_set_orders marine behaviors/engage) (print "marine, engage") (ai_set_orders elite behaviors/self_preservation) (cs_run_command_script elite cover) (print "elite, cover") (cs_run_command_script all mid) ;sleep a little so they have some time to fight (sleep 45) ;wait for the elite to hide (sleep_until (or (< (ai_status elite) 3) (or (= (ai_living_count elite) 0) (= (ai_living_count marine) 0)))) (ai_set_orders marine behaviors/search) (cs_run_command_script marine uncover) (print "marine, uncover") ;wait for someone to die (sleep_until (or (= (ai_living_count elite) 0) (= (ai_living_count marine) 0))) ) ;----------10. INVESTIGATE (script continuous investigatebeh (sleep_until (= behavior 10)) (mspawn) (espawn) ;make the marine shoot at the elite and make the elite go into cover (ai_set_orders marine behaviors/engage) (print "marine, engage") (ai_set_orders elite behaviors/self_preservation) (cs_run_command_script elite cover) (print "elite, cover") ;wait for the elite to get into cover (marine doesn't see the elite). Then have the marine investigate (I hope) (if (not (objects_can_see_object (ai_actors marine) (list_get (ai_actors elite) 0) 45)) (begin (ai_set_orders marine behaviors/search) (cs_run_command_script marine investigate) (print "marine, investigate") ) ) (sleep_until (or (= (ai_living_count elite) 0) (= (ai_living_count marine) 0))) ) ;----------11. grenade_uncover (script continuous grenade_uncoverbeh (sleep_until (= behavior 11)) ;spawn 1 marine, 1 elite (mspawn) (espawn) ;set orders and call command scripts, elite goes for cover while the marine tries to uncover him (ai_set_orders marine behaviors/search) (cs_run_command_script marine grenade_uncover) (print "marine, grenade_uncover") (ai_set_orders elite behaviors/self_preservation) (cs_run_command_script elite cover) (print "elite, cover") ;wait for someone to die (sleep_until (or (= (ai_living_count elite) 0) (= (ai_living_count marine) 0))) ) ;----------12. flee (script continuous fleebeh (sleep_until (= behavior 12)) (mspawn) (espawn) ;set orders and call command scripts, elite goes for cover while the marine tries to uncover him (ai_set_orders marine behaviors/self_preservation) (cs_run_command_script marine flee) (print "marine, flee") (ai_set_orders elite behaviors/engage) (print "elite, engage (all)") ;wait for someone to die (sleep_until (or (= (ai_living_count elite) 0) (= (ai_living_count marine) 0))) ) ;----------14. check_friend (script continuous check_friendbeh (sleep_until (= behavior 14)) ;spawn 2 marines and make them go to the same location (2mspawn) ;clean up crab so the marine checks his dead friend only (garbage_collect_unsafe) (cs_run_command_script marine mid) ;wait for the marines to get to the point (sleep 60) ;kill one marine and make the other check him (ai_set_orders marine behaviors/post_combat) (unit_kill (unit (list_get (ai_actors marine) 0))) (cs_run_command_script marine check_friend) ;sleep for 10 seconds and run it again (sleep 300) ) (script startup alliances (ai_allegiance player covenant) (ai_allegiance player human) (ai_vehicle_enterable_team warthog1 human) (set behavior 0) )