Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

RandomInt for scripts that modify spell effects.


DelusionsOfGradeur
 Share

Recommended Posts

I'm rather new to papyrus scripting, so this may take me a minute to explain. I'll try to keep it brief if you will bear with me.

 

I've figured out how to generate random intergers, but I am having some trouble with using the return value to set values for properties/variables.

 

In some scripts, I know you can use Utility.RandomInt () to set a value, but, in scripts which modify spell effects, the Utility script cannot be accessed to return the value.

I have found that I can still generate the value by adding 'Int Function Random (int aiMin = 0, int aiMax = 100) Native Global', but I have no idea how to access or utilize the returned value. Any suggestions?

Link to comment
Share on other sites

Alrighty, I think  I may have figured this out by placing my event within the bounds of the function. At the very least my script is returning no errors or warnings. Can someone tell me if this is correct?

 

Int Function RandomInt(int aiMin = 1, int aiMax = 100) Native Global

     Int myVariable = RandomInt(1, 100)

          If (myVariable < 51)

               debug.messagebox("Yay it works?")

          EndIf

EndFunction

 

Also, is line 2 necessary, or can I just use "If (RandomInt(1, 100) > 51)"?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...