3Dmajid,
Here you go:
;Artificial Intelligence Script:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;Original Script by xplosys
;Additional Script Enhancement by Seth Black
;Header
desc = Ally Follow & Shoot Full Control
;This is a simple "follow the player script" with the appearance of allies thrown in.
;When player gets within range of the entity, entity will take a defensive stance and face player. Now where player goes, the entity will follow.
;AI using this script cannot hurt each other or the player.
;The animations seem to work when they want to.
;Change the plrdistwithin= distance to suit.
;Add animations for more realism (squat, strafe, etc)
;If you only want the character to follow you, comment out the last :state=1 line and adjust the distances with the plrdistwithin conditions.
;When you encounter enemies and need help (remember that these allies cannot really help you or hurt you,
;they are just firing blindly with no assigned target) press Z. The character will come forward and return fire with you.
;If you move away from the battle, the character will stop firing and follow you again.
;NOTES:
;1. I don't know of any way to make the character do this automatically (without you pressing a key).
;2. The first time you bring the character into battle, his run animation does not work properly. After the first time, it does. Could be my system.
;3. This was tested with SciFi characters in V1.07.
==============================================================================================================
Seth Black's Notes:
;With enhancements, player must be closer to entity to get entity's attention.
;Entity no longer uses animate=51, as it looked uh, well...stupid. Instead, animate=5 is used and frozen. Looks more natural.
;Entity can now be told to cease its weapon attack by pressing the X KEY.
;Entity can now be told to stop following the player, remaining stationary, by pressing the END KEY
;Bazooka and Grenade wielding entities CAN DESTROY DOORS, and ALL OTHER ENTITIES including CHARACTERS
;If the player shoots the entity, the entity will begin shooting the player
;Pretty cool effects can be acheived with this script.
==============================================================================================================
;Triggers
; *** YOU MUST GET WITHIN RANGE TO PICK UP YOUR ENTITY
:state=0,plrdistwithin=60:state=1,rotatetoplr,animate=1
; *** ENTITY FOLLOWS YOU
:state=1,plrdistfurther=150:animate=5,followplr
:state=1,plrdistwithin=75:freeze
;:state=1,plrdistwithin=75:freeze,animate=51
; *** Press Z TO ENGAGE ATTACK
:state=1,scancodekeypressed=44:state=3,animate=5
; *** ENTITY REPOSITION TO ENGAGE ENEMY
:state=3:rotatetoplr,rotatey=30,animate=5,runfore=60,rotatey=-30,state=4
; *** RANDOMIZE ANIMATIONS
:state=4,random=1:state=10,setframe=3
:state=4,random=1:state=11,setframe=4
;*** ENTITY RETURNS FIRE
:state=5,ifweapon=1,plrdistwithin=300:useweapon,rundecal=6
:state=5,ifweapon=0:state=6,setframe=6
:state=5,plrdistfurther=160:state=1
***IF PLAYER SHOOTS ENTITY, ENTITY SHOOTS PLAYER
:shotdamage=1:shootplr
;***Press X TO DISENGAGE ATTACK (Seth Black)
:state=5,scancodekeypressed=45:state=1,animate=1
;***Press END TO DROP OFF YOUR ENTITY (Seth Black)
:scancodekeypressed=207:state=0,animate=1
; *** ENTITY RELOAD IF EMPTY
:state=6:incframe=6
:state=6,frameatend=6:state=4,reloadweapon,sound=audiobankgunsreload.wav
; *** PLAY ANIMATION
:state=10:incframe=3
:state=10,frameatend=3:state=5
:state=11:incframe=4
:state=11,frameatend=4:state=5
;End of Script:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
This will get the job done nicely for you.
If you want your friend to be able to actually kill enemies, you'll need to arm him/her with a
LAW Rocket, Bazooka, Glaive, or
Grenades. Be sure to alter the
SHOOT SCRIPT in
PROPERTIES accordingly.
Enjoy!
Thanks,
Seth Black
Widow 13 - Coming Spring 2008