Randomization

faustianmood
02 Jun 2012, 21:42
Is there a way to randomize printed text. Like, say you walk into a room and half the time an npc is there and half the time he isn't. Not every other time, but randomly. Is this possible?
Sorry if this has been asked before.

sgreig
03 Jun 2012, 08:58
You could have a script that randomly places the NPC in the room.

Pertex
03 Jun 2012, 19:00
You can do it this way:
cat.png

faustianmood
04 Jun 2012, 21:45
AWESOME!
Thank you.

faustianmood
09 Jun 2012, 22:26
Ok, one more question with the RandomChance script, is it possible to base it on an object's attributes instead of just an integer? For example, let's say your character has an attribute called "luck" and if you push a button, there is a (your luck score)% chance to move a cheeseburger into the room.

Pertex
10 Jun 2012, 08:22
You can pass any value to RandomChance () for example if you have an attribute player.luck you can call
RandomChance (player.luck)
In this case maximum luck must be 100.