How would I create an enemy that turns a turn script on?
lightwriter
08 Oct 2015, 19:57Basically, I'm creating a randomly generated labyrinth and want there to be enemies that randomly spawn like zombies and giant spiders but I need a way to tell if there is a monster in the room to turn the battle script on.
The Pixie
08 Oct 2015, 20:59I have had a mess around with random dungeon's myself.
If I get what you mean, you want a script that fires every turn, and if there is no monster in the room then it has a chance of generating one.
So first the turn script checks the current room (player.parent) for monsters. How you do that depends on how monsters are set up. If you have a monster type, you could do this:
If I get what you mean, you want a script that fires every turn, and if there is no monster in the room then it has a chance of generating one.
So first the turn script checks the current room (player.parent) for monsters. How you do that depends on how monsters are set up. If you have a monster type, you could do this:
monsters_present = false
foreach (o, GetDirectChildren (player.parenty)) {
if (DoesInherit (o, "monster")) {
monsters_present = true
}
}
if (not monsters_present) {
// randomly generate monster
}