ID:155591
 
What I need help with is giving the enemy the moves it has and be able to use it in a battle against a usr.

It's turn based and so far I have it so the usr can attack and after the damage is done it waits for the enemy.

I know I have to make a list of moves for it to choose from.. but the list[] thing I don't get. Can someone please help?
list example:
mob/ai
var/list/attacks = list(/mob/ai/proc/bigbang,/mob/ai/proc/runaway) // attacks[1] would be big bang, attacks[2] would be run away. - can be used with call proc.
//procs here

Used like so:
mob/ai/proc/use_attack()
pick(attacks) //random selection, to create a more intelegent ai, seperate the attack types and use heals and buffs when needed.



In response to Pirion
Doesn't seem to work.. it says the pick statement has no effect..
In response to Kidman90
You want to assign the return value to a varible so it can be used later.
In response to Pirion
Does this work?:
mob/proc/RandomAttack()
src.picker=pick(/mob/ai/proc/bigbang,/mob/ai/proc/runaway)


/mob/ai/proc/bigbang()
//Code Goes here
/mob/ai/proc/runaway()
//Code Goes here

mob/var/picker

You can run the RandomAttack() var for your enemy everytime their turn comes.