All pastes #37417 Raw Edit

Anonymous

public text v1 · immutable
#37417 ·published 2006-01-19 14:39 UTC
rendered paste body

called by gameserver(ai script should provide that functions):

onEventMinionDied(self,minion)
onEventMinionSpawned(self,minion)
onIntentionAttack(self,target)
onEventSpawned(self)
onEventAggression(self,target,aggro)
onEventAttacked(self,attacker)
onEventSeeCreature(self,creature,dist) // dist are always < 1000
onEventSeeSpell(/*notdone*/)


exported by AI engine(can be called from ai script):

getStat(actor,stat) // stat are 0,1,2,3,4(hp,mp,cp,lvl,name)
sayMessage(actor,type,msg)
useSkill(actor,skillid)
spawnCreature(npcid,count,x,y,z)
moveToLocation(actor,x,y,z)
teleToLocation(actor,x,y,z)
setFlag(actor,flag_name,flag_value)
getFlagString(actor,flag_name)
getFlagInteger(actor,flag_name)
calcRandom(range)
setTimer(/*notdone*/)

//reload ai
//setai <ai>

sample file(warrior1.ai):

func onEventMinionDied(int self, int minion)
endfunc

func onEventMinionSpawned(int self,int minion)
endfunc

func onIntentionAttack(int self,int target)
  sayMessage(self,0,"attacking!")
endfunc

func onEventSpawned(int self)
  sayMessage(self,0,"spawned!")
endfunc

func onEventAggression(int self,int target,int aggro)
endfunc

func onEventAttacked(int self,int attacker)
  sayMessage(self,0,"attacked! by "+getStat(attacker,4))
  useSkill(self,2152)
endfunc

func onEventSeeCreature(int self,int creature,int dist)
  sayMessage(self,0,"see creature!")
endfunc

//reload ai
target some keltir or other shitty mob
//setai warrior1

w00t