Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Nacho on Wed 04/06/2003 23:02:56

Title: Command for RANDOM in game events?
Post by: Nacho on Wed 04/06/2003 23:02:56
Is there a command for making events aleatory? It should be a great step for making RPG games... I mean... Imagine I want to do a game like Pirates! by Sid Meyer. I would put a command that should work for calculate the result of a sea battle considering the cannons, the size of the ship, the skills of the capitan... Can that be done?

I also remember a room of Indy4 where Sophia must guess the fingers of the hand that Dr. Trottier hides. And it´s aleatory because i´ve saved the game and tested 1,2,3,4 & 5 and that didn´t work.

And, if this has been asked before, sorry, I´m not very into script.
Title: Re:Command for RANDOM in game events?
Post by: miguel on Thu 05/06/2003 00:38:39
I would like to know something like that as well, I remember the RANDOM comand from the spectrumBASIC wich was not trully random, it went more like a timer. :-\
but a comand like that would be really helpfull for me as well
Title: Re:Command for RANDOM in game events?
Post by: scotch on Thu 05/06/2003 01:21:22
Ags has a random function
Random(number);
gives a number between 0 and number
so if you wanted to do the 5 fingers picked randomly thing you could do
int fingersup = Random(4)+1;
and then ask the player for their guess and compare them
if (playerguess==fingersup) {Do the stuff for if they got it right;} else {do the stuff for if they got it wrong;}

it'd work something like that anyway
Title: Re:Command for RANDOM in game events?
Post by: miguel on Thu 05/06/2003 15:21:30
got it, I'll try to use it,
thanks scotch
Title: Re:Command for RANDOM in game events?
Post by: Mr Jake on Thu 05/06/2003 20:38:17
How would I use this (if I could at all) to give a NPC 3 coords to randomly walk between?
Title: Re:Command for RANDOM in game events?
Post by: Spyros on Thu 05/06/2003 21:06:55
IN REP. EXEC
if (character[NAME].walking==0) {
   MoveCharacter(NAME,Random(319),Random(199));
}