AI

Blitz3D Forums/Blitz3D Programming/AI

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

i'm working on the ai in my game also.
here it is use it if yu want. its based on the "AIscore" idea.
Function getenemystate()
For e.enemy=Each enemy
 For c.char=Each char
  EntityPick (e\e,150)
  ;check disance
  e\score=100
  If EntityDistance(e\e,c\e)>50 
   e\score=e\score-50
  Else If EntityDistance(e\e,c\e)>30 
   e\score=e\score-30
  Else If EntityDistance(e\e,c\e)>20 
   e\score=e\score-20
  Else If EntityDistance(e\e,c\e)>10 
   e\score=e\score-10
  End If
  ;check health
  If e\hp<80 
   e\score=e\score-10
  Else If e\hp<60 
   e\score=e\score-20
  Else If e\hp<40 
   e\score=e\score-30
  Else If e\hp<20 
   e\score=e\score-40
  Else If e\hp<10 
   e\score=e\score-60
  End If
  ;check whats infront of it
  If PickedEntity=c\e 
   e\score=e\score+20
  Else If Not PickedEntity=c\e 
   e\score=e\score-10
  End If
  DebugLog "hp "+e\hp
  DebugLog "AIscore "+e\score
  ;"normalize" the score
  If e\score>100 
   e\score=100
  Else If e\score<0 
   e\score=0
 
  End If
 Next
Next
End Function