Randoms

Post » Sat May 15, 2010 8:06 pm

Hello my friends,

I want to ask you something. How to make random 'things'. For example I created room A, B, C and D. I want to make that each time I activate doors, they teleport me to random room from A to D. Is this possible?

Thank you and sorry for my bad english :)
Martin,

User avatar
Ana Torrecilla Cabeza
 
Posts: 3427
Joined: Wed Jun 28, 2006 6:15 pm

Post » Sat May 15, 2010 2:52 pm

Yes, it's possible. Basically, have a script on the door so when you activate it, the script will run.

pseudo code:
scn randomdoorscript  int iRanNum  Begin OnActivate Player	  set iRanNum to GetRandomPercent ;Not sure of the actual function name   if iRanNum < 26	  Player.MoveTo RoomARef			 ;I use a persistent x-marker with the name RoomARef in the spot you want the player to be  elseif iRanNum < 51	  Player.MoveTo RoomBRef			 ;another x-marker, as persistent with the name RoomBRef elseif iRanNum < 76	  Player.MoveTo RoomCRef elseif iRanNum < 101	  Player.MoveTo RoomDRef endif  End


Something like that would do what you wanted. Hope that helps, good luck.

-Mush-
User avatar
Tiffany Holmes
 
Posts: 3351
Joined: Sun Sep 10, 2006 2:28 am

Post » Sat May 15, 2010 4:53 pm

Thank You very much :)
User avatar
Lizbeth Ruiz
 
Posts: 3358
Joined: Fri Aug 24, 2007 1:35 pm

Post » Sat May 15, 2010 5:17 pm

Note that such a script will prevent any actor other than the player from using the door, and even if you fix the script any followers won't know to activate the door in order to follow the player. If you want followers to be able to follow the player, then instead of using http://geck.gamesas.com/index.php/MoveTo, hide doors to each of the rooms just behind the scripted door - out of the player's reach but still accessible to NPCs - and use http://geck.gamesas.com/index.php/Activate to force the player to activate a randomly chosen door. This will move them to a random cell, and allow followers to follow them.

Cipscis
User avatar
Mrs. Patton
 
Posts: 3418
Joined: Fri Jan 26, 2007 8:00 am


Return to Fallout 3