Jump to content

Recommended Posts

Posted

There's 2 functions for this. An integer and a float.

 

(Examples only)

 

GlobalVariable property myGlobal auto
 
Function Something()
    Int iRand  = Utility.RandomInt(0, 50)
    myGlobal.SetValue(iRand as Float)
EndFunction
 
Function Something2()
    Float fRand = Utility.RandomFloat(0.0, 50.0)
    myGlobal.SetValue(fRand)
EndFunction
  • 1 month later...
Posted (edited)

This script always gives me 0

Help please.

 

 

  Reveal hidden contents

 

 

Changed...

RndNum.SetValue(iRand as int)

to

RndNum.SetValue(iRand as float)

 

Still 0

Edited by antstubell
Posted

Script as written has nothing calling the Something function. As a result, there is no random value generated or applied to the global variable. Thus the returned value of the global variable will always be the initial value that you gave the record. Which in this case seems to have been 0.

 

Call the function inside the OnActivate event prior to checking for the random value.

 

  Reveal hidden contents

 

Posted (edited)

Something() function is not called. You wont need that though, you can put the code for that right in the Event you're using. Then it will start generating a random number on every activation.

 

Edit: ninja'd lol

Edited by Rasikko
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...