What is the correct syntax for a random function with decimal?

Hello,

as the title says, what is the correct syntax for a random function with decimal? If I put a spawn behavior in a timer with "random(0.5,2)" it spawns a lot of actor without respecting the timer. Any idea about this? I think that it doesn't recognize the "0.5"...

Thanks :)

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    Hi @patapple

    As random in GSC can only deal with whole numbers, you have to add another rule to convert it to decimal.

    So in your example, random(0.5,2) , if you wanted the decimal in tenths, first times by 10.

    Change attribute YourAtt to random(5,20)
    Change attribute YourAtt to YourAtt/10

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • patapplepatapple Member Posts: 873
    edited November 2012
    ohh, really? I didn't know this one...I will try it :)

    Thanks
Sign In or Register to comment.