Page 1 of 1

Moving to a valid location

Posted: Sun Dec 09, 2012 10:11 pm
by ValasImogen
I'm looking to spawn a monster at a random location, which I've got, however it has the possibility to spawn them in the walls. I can fix this by white-listing the valid tiles, but I'm wondering if there is a shortcut way to just move the spawned creature to the nearest valid location?

Re: Moving to a valid location

Posted: Sun Dec 09, 2012 10:15 pm
by Xanathar
JKos framework has an isWall function that works in the level the party is (http://sites.google.com/site/jkosgrimrock2/home)
Otherwise there'll be an isWall function in the next version of the game.

With those, you can pick a tile at random, then if it is a wall either repeat or look around the tile until you find a non-wall one.