TyranoBuilder Visual Novel Studio

TyranoBuilder Visual Novel Studio

1CoinOnly Mar 30, 2015 @ 10:58pm
Dice Roll/Random events
Hi again!

So I am about to start my text based RPG/simulation game. I normally program on game maker pro and they have a unique command where you can roll the dice and make random events happen.

For example

If dice roll = 1/4 then get $50
if dice roll = 1/2 then get $20
else get $10

Just curious if there is a similar command I can use. Flags work for basic encounters and txt events but for inventory and stat raising I really need this or a similar function as it is the only thing stopping me from starting the game

Thanks again for the help!
< >
Showing 1-2 of 2 comments
Equil Mar 31, 2015 @ 4:31am 
I think you'd have to use javascript. Haven't actually tested it myself in the program, but it'd go something like this:

var playermoney; //varible for player's money var dice; //varible for the dice playermoney = 0; dice =+ Math.random(); //Set dice varible to a randomly generated number dice =+ Math.floor(dice * 4); //Set the dice random value to round down to a whole number, by multiplying by 4 it makes the possible random value 0-4. alert("Player money is at " + playermoney + " and dice rolled " + dice + "."); if (dice == 1 || dice == 2) { //if dice rolled 1 or 2, give player $20 playermoney += 20; alert("Player money is at " + playermoney); } else if (dice == 3 || dice == 4) { //if dice rolled 3 or 4, give player $50 playermoney += 50; alert("Player money is at " + playermoney); } else { //if player rolled anything else, give $10 playermoney += 10; alert("Player money is at " + playermoney); }

The iScript thing in the maker uses javascript, I'm not sure if this would work though. Guess you could test it.
Last edited by Equil; Mar 31, 2015 @ 4:33am
jay_rab Mar 31, 2015 @ 7:56am 
This guide might help you, at the bottom of the page they talk about random variables: http://steamcommunity.com/sharedfiles/filedetails/?id=415474805
< >
Showing 1-2 of 2 comments
Per page: 1530 50

Date Posted: Mar 30, 2015 @ 10:58pm
Posts: 2