mob/verb/attack()
mob/proc
Lvlup()
Asign_Stats()
Get_Damage(magic=0)
//AI
AI_Mode()
AI_Loop()
var/check=0//counter and checks every 10 ticks
spawn()
while(src)
if(!AI_Active)
//this mob is no longer active will return to default state
loc=locate(start_x, start_y, start_z)
step_x=start_sx; step_y=start_sy
dir=start_dir
break
AI_CALL()
check++
if(check>=10)
check=0
if(!AI_Check()) {AI_Active=0}
sleep(3)
AI_Check()
var/found_player=0
for(var/mob/Player/P in view()) {found_player=1;break}
return found_player
AI_Activate()
if(!client) {return}
var/list/non_active_ais=Unactive_AI_list()
for(var/mob/M in non_active_ais)
M.AI_Active=1; M.AI_Loop()
Unactive_AI_list()
if(!client) {return}
var/list/L=list()
for(var/mob/NPC/N in view()) {if(!N.AI_Active) L+=N}
return L
mob
var
AI_Active; IS_AI=0; AI_STATUS
start_x; start_y; start_z; start_dir
start_sx; start_sy
New()
..()
start_x=x ; start_y=y ; start_z=z; start_dir=dir
start_sx=step_x ; start_sy=step_y
Player
Move()
..()
AI_Activate()//check everytime a player moves
proc
AI_CALL()
walk(src,0)
switch(AI_STATUS)
if("Wander") walk_rand(src,rand(1,10),0)
if("Wander2")
if(prob(30)) {sleep(rand(20,50))}//pause n wait
walk_rand(src,rand(4,7),0)
Problem description:
I'm starting a new ai system and i'm looking for tips. i'm not sure this would be an efficent way to start. Basically my monsters/creatures move around the map and have different ai settings and i don't want them doing anything if theres not a player arround to witness these events, what would be an acceptable way to activate the ai's?