mob/proc/AImove()
Wincheck()
if(gamestarted==1)
Endcheck()
var/mob/Pl=P[2]
if(Pl.isturn==1)
if(turns>=1)
ai_Select()
mob/proc/Endcheck()
var/A=0
var/C=0
for(var/mob/soldier/blue/B in world)
A++
if(B.attacked==1)
C++
if(A==C)
var/mob/AI=P[2]
AI.isturn=0
Playerturn()
ID:272700
![]() Dec 9 2008, 1:22 pm
|
|
Okay, my goal is to make the AI's turn end whenever all of it's units have attacked. It works, but rarely. Is there another way to do this so that it works ALL the time?
|
After a unit attacks, have it tell the AI that it did, so the AI can reduce the waiting_to_attack variable by one. When it loses a unit, subtract one from the units_left. Then your end check would just need to see if its waiting_to_attack is bigger than 0.