Pertex wrote:Sure, you could use http://quest5.net/wiki/RandomChance, something like
if (RandomChance(10) ){
//spawn monster
moveobject (monster, player.parent)
}
Thanks, Pertex, I don't think this is quite what I meant. I should clarify.
Say I have three possible monsters that could spawn in a given room, perhaps a wolf, a bear, and a lion, I would like the game to essentially roll a random number of 1-3, and if it rolls 1, the wolf spawns. If 2, the bear spawns, and if 3, the lion spawns. Is there a way to make this happen?
And to expand upon that, perhaps there would be a way to include any random dice rolling function to the game? Say if I wanted to include some dice-based gambling?
This question actually has another part. I need a general code to apply to a function for specific rooms, so when the player in the rooms, a function is called which could potentially apply to all rooms. To better explain, I would like the game to check if the room has a monster in it or not when the player enters. In my game, monsters inherit an object type called "enemy". So what I'm trying to get to happen is when the player enters the room, the script checks to see if there is any object in the room with the inherited object type "enemy". If there is not, then it summons a monster. The monster should remain in the room until slain, even if the player leaves the room. And when the monster is slain and the player leaves the room, it is removed or destroyed. Is this even possible?