Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: highkingtorygg on Mon 14/09/2015 20:50:45

Title: Is my use of the Random thing correct?
Post by: highkingtorygg on Mon 14/09/2015 20:50:45
Will this work?

Code (ags) Select

function room_FirstLoad()
{
if(Random(1)== 0)
{
  Display("words");
}
else{
  Display("other words");
}
}
Title: Re: Is my use of the Random thing correct?
Post by: Snarky on Mon 14/09/2015 21:19:04
Just try it?
Title: Re: Is my use of the Random thing correct?
Post by: Monsieur OUXX on Tue 15/09/2015 15:12:56
FirstLoad is called only at first load. So what you did will cause the player to say either "words" or "other words" the FIRST TIME he enters the room. Not the subsequent times.
Title: Re: Is my use of the Random thing correct?
Post by: Khris on Tue 15/09/2015 16:45:16
If a 50/50 chance was your intention, then yes, you used Random() correctly.