## Random Events

7 years ago

Hello, I am needing some help with my Random events. I am trying to have it if a diceroll = 5 (in this case) then it goes to @P12 but I am having trouble setting it up.

Thank you for the help.

## Random Events

7 years ago

Give a variable a random number and then use an IF statement. For instance, if you were using the variable %CS and a six-sided die:

%CS := 1D6

IF %CS = 5 THEN \$DEST := @P12

## Random Events

7 years ago

That's what I was thinking, thanks.

## Random Events

6 years ago

Can you do this on a link too? I have tried it, and then tested it, and it never worked. I even set it so that if it was any number from 1 to 6 to go to a certain page, but it didn't work.

## Random Events

6 years ago

Setting \$DEST should only work in a link script. What's the code you're using?

## Random Events

6 years ago

%RANDOM := 1D6 IF
%RANDOM = 5 OR 3 OR 2 OR 1 OR 6 THEN
\$DEST := @P15
And it still goes to a different page. Let me fill you in. They have a chance to persuade someone to give them more money. If they click "Ask For More" I have it set so if it is one of those numbers to go to the success meaning they convinced them, but it still goes to the one that says they failed.

## Random Events

6 years ago

Try this:

%RANDOM := 1D6
IF %RANDOM = 5 OR %RANDOM = 3 OR %RANDOM = 2 OR %RANDOM = 1 OR %RANDOM = 6 THEN \$DEST := @P15

You have to continually reiterate the "%RANDOM" or the system won't know what to compare. Also, in this case, you're technically testing for any value other than four, so you can just replace that whole IF part with "IF %RANDOM != 4".

## Random Events

6 years ago

Well I'll be a son of a b***h it worked! Thanks yet again!

## Random Events

6 years ago

Of course it did. It's bradin you're talking about. ^_^ Very good at that kind of stuff.

## Random Events

6 years ago

Well no kidding, he has helped me with a ton of other stuff. Don't think I would be able to handle this site without him.

## Random Events

6 years ago

Sorry to necro the thread, but I wanted to check roughly how long it would take for someone new to advanced games to set up random events? I know it's probably an iffy question, but I'm writing a story under the deadline of the Riddles and Puzzles contest (working just on variables/items/scripts now), and want to know from someone more experienced than myself if this feature is worth my time.

## Random Events

6 years ago

Well, it certainly can make the game more interesting, but is not necessary. You might want to skip it for the Riddles, and Puzzles deadline, but when not when not in a competition, and have the available time, then you should.