;//TF-341 Artificial Intelligence Script
;//Script by Errant AI, Requires FPSC x9 v1.18 Beta 6 or later and character with TF341 animations.
desc = DarkAI TF341 default AI for enemy or non-recruitable ally - Assign to Main AI slot must be used with a Shoot AI script
;------------------------------------------------------------------------------------------------------------------------------------------------------
;//generic cooldown clock
:state=0:dimlocalvar=cooldown
:varless=cooldown 0:setvar=cooldown 2000
:vargreater=cooldown 0:subvar=cooldown 1
;//Walking animations
:isdarkai=1,ducking=0,strafingleft=1:animationnormal,animate=49,resethead
:isdarkai=1,ducking=0,strafingright=1:animationnormal,animate=49,resethead
:isdarkai=1,ducking=0,movingforwards=1:animationnormal,animate=49
:isdarkai=1,ducking=0,runningforwards=1:animationnormal,animate=40,resethead
:isdarkai=1,ducking=0,movingbackwards=1:animationreverse,animate=49,resethead
:isdarkai=1,ducking=0,idle=1:animationnormal,animate=48
;//Crouching Animations
:isdarkai=1,ducking=1,strafingleft=1:animationnormal,animate=34,resethead
:isdarkai=1,ducking=1,strafingright=1:animationnormal,animate=34,resethead
:isdarkai=1,ducking=1,movingforwards=1:animationnormal,animate=34,resethead
:isdarkai=1,ducking=1,movingbackwards=1:animationreverse,animate=34,resethead
:isdarkai=1,ducking=1,idle=1:animationnormal,animate=33,resethead
;------------------------------------------------------------------------------------------------------------------------------------------------------
;//Team Behavior
;//Look around occasionally
:varequal=cooldown 2000,random=50:rotateheadrandom=50
;//Auto follow if player stays relatively close
:state=1,aiteam=1,plrdistwithin=200,plrdistfurther=100,aihastarget=0,aicanshoot=0:aifollowplr=1,state=2
:state=1,aiteam=1,plrdistfurther=500:aifollowplr=0,state=2
:aiteam=1,plrdistwithin=100:aifollowplr=0
;//2ndary Characters can move around occasionally
:aiteam=4,varequal=cooldown 1000,idle=1,random=500:aimoverandom
:aiteam=5,varequal=cooldown 1000,idle=1,random=500:aimoverandom
;------------------------------------------------------------------------------------------------------------------------------------------------------
;//Shot Damage - Flinch (random) left / right / gut - go to shoot script
::headshot=1,headshotdamage=275
:shotdamage=1,varequal=beenshot 0:setvar=beenshot 1
:varequal=beenshot 1,varequal=patrol 1:bloodspurt=1,setvar=beenshot 5
:varequal=beenshot 1,varequal=patrol 0,random=2:aistop,setaiactive=0,setframe=45,setvar=beenshot 2,sound=audiobank\eai\melee_i_soft.wav
:varequal=beenshot 2:incframe=45,freeze
:varequal=beenshot 2,framebeyond=45 80:setvar=setanim 1,setaiactive=1,setvar=beenshot 5
:varequal=beenshot 1,varequal=patrol 0,random=1:aistop,setaiactive=0,setframe=46,setvar=beenshot 3,sound=audiobank\eai\melee_i_soft.wav
:varequal=beenshot 3:incframe=46,freeze
:varequal=beenshot 3,framebeyond=46 80:setvar=setanim 1,setaiactive=1,setvar=beenshot 5
:varequal=beenshot 1,varequal=patrol 0:aistop,setaiactive=0,setframe=44,setvar=beenshot 4,sound=audiobank\voices\male\land.wav
:varequal=beenshot 4:incframe=44,freeze
:varequal=beenshot 4,framebeyond=44 80:setvar=setanim 1,setaiactive=1,setvar=beenshot 5
:varequal=beenshot 5:setvar=beenshot 0,animate=34,state=999
;------------------------------------------------------------------------------------------------------------------------------------------------------
;//Watch for enemy
:always:airotatetotarget
;//Listen for enemy
:state=1,aicanshoot=0,aiheardsound=500:aimovetosound
;------------------------------------------------------------------------------------------------------------------------------------------------------
;//Assist team if called while in standby mode (RoE permitting)
:isdarkai=1,aicalled=2000,aihastarget=0,idle=1:airespondtocall
;------------------------------------------------------------------------------------------------------------------------------------------------------
;//Go to shoot script
:state=1,aicanshoot=1:aisettarget,state=999
:state=30,aicanshoot=1:state=999
:state=999:aistop,setvar=beenshot 99,state=1000
:state=1000:aistop,setaiactive=0,setframe=24,state=1001
:state=1001:incframe=24,freeze
:state=1001,frameatend=24:setaiactive=1,aistop,state=1002
:state=1002:etimerstart,aicallteam=5000,state=2,setvar=beenshot 0,resethead,shootplr
;------------------------------------------------------------------------------------------------------------------------------------------------------
;//Open Doors
:nearactivatable=0:settarget,activatetarget=2
;------------------------------------------------------------------------------------------------------------------------------------------------------
;//Start Script
:state=0:setaiactive=1,alwaysactive=1,reloadweapon,aiattackawareness=1,state=2
:state=2:state=1,etimerstart
;//End
i tried an online converter which didn't really work too well and i have very little knowledge in lua scripting. the best i could do is print a message and play sounds atm haha.
here is the lua that it converted too -
; Save as fpi_9391.lua
package.path = "scriptbank/?.lua;"
require "fpi2lua"
function fpi_9391_main(e)
-- //TF-341 Artificial Intelligence Script
-- //Script by Errant AI, Requires FPSC x9 v1.18 Beta 6 or later and character with TF341 animations.
-- DarkAI TF341 default AI for enemy or non-recruitable ally - Assign to Main AI slot must be used with a Shoot AI script
-- ------------------------------------------------------------------------------------------------------------------------------------------------------
-- //generic cooldown clock
if (fpi_state(e, 0)) then
fpi_dimlocalvar(e, "cooldown");
end
if (fpi_varless(e, "cooldown 0")) then
fpi_setvar(e, "cooldown 2000");
end
if (fpi_vargreater(e, "cooldown 0")) then
fpi_subvar(e, "cooldown 1");
end
-- //Walking animations
if (fpi_isdarkai(e, 1) and fpi_ducking(e, 0) and fpi_strafingleft(e, 1)) then
fpi_animationnormal(e, false);
fpi_animate(e, 49);
fpi_resethead(e, false);
end
if (fpi_isdarkai(e, 1) and fpi_ducking(e, 0) and fpi_strafingright(e, 1)) then
fpi_animationnormal(e, false);
fpi_animate(e, 49);
fpi_resethead(e, false);
end
if (fpi_isdarkai(e, 1) and fpi_ducking(e, 0) and fpi_movingforwards(e, 1)) then
fpi_animationnormal(e, false);
fpi_animate(e, 49);
end
if (fpi_isdarkai(e, 1) and fpi_ducking(e, 0) and fpi_runningforwards(e, 1)) then
fpi_animationnormal(e, false);
fpi_animate(e, 40);
fpi_resethead(e, false);
end
if (fpi_isdarkai(e, 1) and fpi_ducking(e, 0) and fpi_movingbackwards(e, 1)) then
fpi_animationreverse(e, false);
fpi_animate(e, 49);
fpi_resethead(e, false);
end
if (fpi_isdarkai(e, 1) and fpi_ducking(e, 0) and fpi_idle(e, 1)) then
fpi_animationnormal(e, false);
fpi_animate(e, 48);
end
-- //Crouching Animations
if (fpi_isdarkai(e, 1) and fpi_ducking(e, 1) and fpi_strafingleft(e, 1)) then
fpi_animationnormal(e, false);
fpi_animate(e, 34);
fpi_resethead(e, false);
end
if (fpi_isdarkai(e, 1) and fpi_ducking(e, 1) and fpi_strafingright(e, 1)) then
fpi_animationnormal(e, false);
fpi_animate(e, 34);
fpi_resethead(e, false);
end
if (fpi_isdarkai(e, 1) and fpi_ducking(e, 1) and fpi_movingforwards(e, 1)) then
fpi_animationnormal(e, false);
fpi_animate(e, 34);
fpi_resethead(e, false);
end
if (fpi_isdarkai(e, 1) and fpi_ducking(e, 1) and fpi_movingbackwards(e, 1)) then
fpi_animationreverse(e, false);
fpi_animate(e, 34);
fpi_resethead(e, false);
end
if (fpi_isdarkai(e, 1) and fpi_ducking(e, 1) and fpi_idle(e, 1)) then
fpi_animationnormal(e, false);
fpi_animate(e, 33);
fpi_resethead(e, false);
end
-- ------------------------------------------------------------------------------------------------------------------------------------------------------
-- //Team Behavior
-- //Look around occasionally
if (fpi_varequal(e, "cooldown 2000") and fpi_random(e, 50)) then
fpi_rotateheadrandom(e, 50);
end
-- //Auto follow if player stays relatively close
if (fpi_state(e, 1) and fpi_aiteam(e, 1) and fpi_plrdistwithin(e, 200) and fpi_plrdistfurther(e, 100) and fpi_aihastarget(e, 0) and fpi_aicanshoot(e, 0)) then
fpi_aifollowplr(e, 1);
fpi_set_state(e, 2);
end
if (fpi_state(e, 1) and fpi_aiteam(e, 1) and fpi_plrdistfurther(e, 500)) then
fpi_aifollowplr(e, 0);
fpi_set_state(e, 2);
end
if (fpi_aiteam(e, 1) and fpi_plrdistwithin(e, 100)) then
fpi_aifollowplr(e, 0);
end
-- //2ndary Characters can move around occasionally
if (fpi_aiteam(e, 4) and fpi_varequal(e, "cooldown 1000") and fpi_idle(e, 1) and fpi_random(e, 500)) then
fpi_aimoverandom(e, false);
end
if (fpi_aiteam(e, 5) and fpi_varequal(e, "cooldown 1000") and fpi_idle(e, 1) and fpi_random(e, 500)) then
fpi_aimoverandom(e, false);
end
-- ------------------------------------------------------------------------------------------------------------------------------------------------------
-- //Shot Damage - Flinch (random) left / right / gut - go to shoot script
if (fpi_(e, false)) then
fpi_headshot(e, 1);
fpi_headshotdamage(e, 275);
end
if (fpi_shotdamage(e, 1) and fpi_varequal(e, "beenshot 0")) then
fpi_setvar(e, "beenshot 1");
end
if (fpi_varequal(e, "beenshot 1") and fpi_varequal(e, "patrol 1")) then
fpi_bloodspurt(e, 1);
fpi_setvar(e, "beenshot 5");
end
if (fpi_varequal(e, "beenshot 1") and fpi_varequal(e, "patrol 0") and fpi_random(e, 2)) then
fpi_aistop(e, false);
fpi_setaiactive(e, 0);
fpi_setframe(e, 45);
fpi_setvar(e, "beenshot 2");
fpi_sound(e, "audiobank\eai\melee_i_soft.wav");
end
if (fpi_varequal(e, "beenshot 2")) then
fpi_incframe(e, 45);
fpi_freeze(e, false);
end
if (fpi_varequal(e, "beenshot 2") and fpi_framebeyond(e, "45 80")) then
fpi_setvar(e, "setanim 1");
fpi_setaiactive(e, 1);
fpi_setvar(e, "beenshot 5");
end
if (fpi_varequal(e, "beenshot 1") and fpi_varequal(e, "patrol 0") and fpi_random(e, 1)) then
fpi_aistop(e, false);
fpi_setaiactive(e, 0);
fpi_setframe(e, 46);
fpi_setvar(e, "beenshot 3");
fpi_sound(e, "audiobank\eai\melee_i_soft.wav");
end
if (fpi_varequal(e, "beenshot 3")) then
fpi_incframe(e, 46);
fpi_freeze(e, false);
end
if (fpi_varequal(e, "beenshot 3") and fpi_framebeyond(e, "46 80")) then
fpi_setvar(e, "setanim 1");
fpi_setaiactive(e, 1);
fpi_setvar(e, "beenshot 5");
end
if (fpi_varequal(e, "beenshot 1") and fpi_varequal(e, "patrol 0")) then
fpi_aistop(e, false);
fpi_setaiactive(e, 0);
fpi_setframe(e, 44);
fpi_setvar(e, "beenshot 4");
fpi_sound(e, "audiobank\voices\male\land.wav");
end
if (fpi_varequal(e, "beenshot 4")) then
fpi_incframe(e, 44);
fpi_freeze(e, false);
end
if (fpi_varequal(e, "beenshot 4") and fpi_framebeyond(e, "44 80")) then
fpi_setvar(e, "setanim 1");
fpi_setaiactive(e, 1);
fpi_setvar(e, "beenshot 5");
end
if (fpi_varequal(e, "beenshot 5")) then
fpi_setvar(e, "beenshot 0");
fpi_animate(e, 34);
fpi_set_state(e, 999);
end
-- ------------------------------------------------------------------------------------------------------------------------------------------------------
-- //Watch for enemy
if (fpi_always(e, false)) then
fpi_airotatetotarget(e, false);
end
-- //Listen for enemy
if (fpi_state(e, 1) and fpi_aicanshoot(e, 0) and fpi_aiheardsound(e, 500)) then
fpi_aimovetosound(e, false);
end
-- ------------------------------------------------------------------------------------------------------------------------------------------------------
-- //Assist team if called while in standby mode (RoE permitting)
if (fpi_isdarkai(e, 1) and fpi_aicalled(e, 2000) and fpi_aihastarget(e, 0) and fpi_idle(e, 1)) then
fpi_airespondtocall(e, false);
end
-- ------------------------------------------------------------------------------------------------------------------------------------------------------
-- //Go to shoot script
if (fpi_state(e, 1) and fpi_aicanshoot(e, 1)) then
fpi_aisettarget(e, false);
fpi_set_state(e, 999);
end
if (fpi_state(e, 30) and fpi_aicanshoot(e, 1)) then
fpi_set_state(e, 999);
end
if (fpi_state(e, 999)) then
fpi_aistop(e, false);
fpi_setvar(e, "beenshot 99");
fpi_set_state(e, 1000);
end
if (fpi_state(e, 1000)) then
fpi_aistop(e, false);
fpi_setaiactive(e, 0);
fpi_setframe(e, 24);
fpi_set_state(e, 1001);
end
if (fpi_state(e, 1001)) then
fpi_incframe(e, 24);
fpi_freeze(e, false);
end
if (fpi_state(e, 1001) and fpi_frameatend(e, 24)) then
fpi_setaiactive(e, 1);
fpi_aistop(e, false);
fpi_set_state(e, 1002);
end
if (fpi_state(e, 1002)) then
fpi_etimerstart(e, false);
fpi_aicallteam(e, 5000);
fpi_set_state(e, 2);
fpi_setvar(e, "beenshot 0");
fpi_resethead(e, false);
fpi_shootplr(e, false);
end
-- ------------------------------------------------------------------------------------------------------------------------------------------------------
-- //Open Doors
if (fpi_nearactivatable(e, 0)) then
fpi_settarget(e, false);
fpi_activatetarget(e, 2);
end
-- ------------------------------------------------------------------------------------------------------------------------------------------------------
-- //Start Script
if (fpi_state(e, 0)) then
fpi_setaiactive(e, 1);
fpi_alwaysactive(e, 1);
fpi_reloadweapon(e, false);
fpi_aiattackawareness(e, 1);
fpi_set_state(e, 2);
end
if (fpi_state(e, 2)) then
fpi_set_state(e, 1);
fpi_etimerstart(e, false);
end
-- //End
end
so if anyone could help with this i would greatly appreciate it