Coin Flip Script

Post » Sun Dec 19, 2010 7:37 am

Hi guys, I'm making a 'useful tools' mod, but I'm stumped on how to create a coin flip script that uses the GetRandomPercent to generate a number between 1 and 2. If it lands on 1, it shows a message saying it landed on heads, and if it lands on 2, it shows a message that it landed on tales. The wiki only showed how to make a dice and some other stuff I didn't understand. If someone could write a script for me (or even better write out a tutorial on how to do it step by step) that'd be great!

Thanks
User avatar
Katie Pollard
 
Posts: 3460
Joined: Thu Nov 09, 2006 11:23 pm

Post » Sun Dec 19, 2010 8:08 am

short myNumBegin OnActivate   set myNum to GetRandomPercent   if myNum < 50      MessageBox "You got a 1"   else      MessageBox "You got a 2"   endifEnd


Granted, Messagebox is not a FO3 command, but you get the idea.
User avatar
Lyd
 
Posts: 3335
Joined: Sat Aug 26, 2006 2:56 pm

Post » Sun Dec 19, 2010 6:34 am

If you're interested, there's a thread over in the New Vegas GECK forum about how http://geck.gamesas.com/index.php/GetRandomPercent works (it works the same in New Vegas and Fallout 3) - http://www.gamesas.com/index.php?/topic/1169495-how-getrandompercent-works/

Cipscis
User avatar
Brian LeHury
 
Posts: 3416
Joined: Tue May 22, 2007 6:54 am

Post » Sun Dec 19, 2010 10:41 am

short myNumBegin OnActivate   set myNum to GetRandomPercent   if myNum < 50      MessageBox "You got a 1"   else      MessageBox "You got a 2"   endifEnd

Granted, Messagebox is not a FO3 command, but you get the idea.



Yeah I know messagebox doesn't work on Fallout, but it's easy to just swap it for a 'ShowMessage' command. Thanks for the script. :goodjob:



If you're interested, there's a thread over in the New Vegas GECK forum about how http://geck.gamesas.com/index.php/GetRandomPercent works (it works the same in New Vegas and Fallout 3) - http://www.gamesas.com/index.php?/topic/1169495-how-getrandompercent-works/

Cipscis


I'm pretty sure this could help in writing future scripts. Thanks. :thumbsup:
User avatar
leni
 
Posts: 3461
Joined: Tue Jul 17, 2007 3:58 pm

Post » Sun Dec 19, 2010 7:58 pm

Sorry, but I've attatched the script to it and everything, but when I activate it in my Pipboy nothing happens. Do I have to drop it to use it because I don't want that to have to happen.
User avatar
Ross Zombie
 
Posts: 3328
Joined: Wed Jul 11, 2007 5:40 pm

Post » Sun Dec 19, 2010 8:54 am

Look through the http://geck.gamesas.com/index.php/Begin blocks. Depending on what type of object you made will depend on which begin block you will use.
OnActivate is for world objects. OnEqup would be for clothing or armor type objects.
User avatar
Rowena
 
Posts: 3471
Joined: Sun Nov 05, 2006 11:40 am


Return to Fallout 3