Enemy AIby Forum_account |
To download this demo for your Linux/Mac installation, enter this on your command line:
DreamDownload byond://Forum_account.EnemyAI##version=4 Emulator users, in the BYOND pager go to File | Open Location and enter this URL:byond://Forum_account.EnemyAI##version=4 A sequence of examples that start with simple enemy AI and introduce new features one at a time. [More]
|
Advertisement Phat T: (Oct 30 2012, 2:41 am)
hello there. I`m wondering if you can make tutorial how to prevent AI from walking diagonally. And how to make AI use projectile. Ty for youre respond!
Forum_account: (Jul 21 2011, 9:48 am)
Phoestre wrote:
Explains a lot if you are experienced with DM but not AI. However ai proc seems not to be efficient, still a good starting point for AI beginners. Thanks for the positive feedback! There is an example in this demo (I forget what number it is) that shows how to improve efficiency by deactivating the AI loops for mobs when a player isn't nearby. Phoestre: (Jul 21 2011, 9:41 am)
Explains a lot if you are experienced with DM but not AI. However ai proc seems not to be efficient, still a good starting point for AI beginners.
Lodenis: (Jul 12 2011, 1:15 pm)
Really good, but quite hard to understand if you haven't coded similar to this...
|
Copyright © 2013 BYOND.
All rights reserved.

ai()
if(dead) return
if(state == NORMAL)
get_target()
if(health < 10)
world << "[name] runs and hides!"
// hiding_spots is a global list of the locations of
// all instances of /obj/hiding_spot.
var/dist_max = 0
var/spot_choose
for(var/spot in hiding_spots)
var/this_dist = get_dist(src, spot)
if(this_dist > dist_max)
dist_max = this_dist
spot_choose = spot
hiding_spot = spot_choose
state = HIDE
return ai()