User Tag List

Results 1 to 5 of 5

Thread: Randomizer Between Two Numbers

  1. #1
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module
    RickyRombo's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere between here and there
    Posts
    3,167
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Randomizer Between Two Numbers

    How do you have the Randomizer in the expression generate a number between x and y, e.g. 2 and 10? Should be easy, just want to make sure I do it right. I want to make my RPG character be able to have his weapon hit damage between numbers that change as the user levels up.

    Sorry for two completely different threads in one day, I'm making two games at the same time.

  2. #2
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Nov 2006
    Posts
    696
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Randomizer Between Two Numbers

    Well you would use something along these lines.

    You would use Random(x+1)+y as the expression for the amount of damage to deal.

    In this scenario x would be the range of the high and low values minus 1. For instance a high of 10 and a low of 0 would have a range of 10 so you would use 10 as x and it would allow you to deal dame 0,1,2,3,4,5,6,7,8,9 but not 10 so that's why you add one to x.

    In this case y is your minimum. y represents the lowest amount of damage you can deal. If you want the minimum of a level 10 person to be 5 then you would use Random(x+1)+5. If you were using 10 for x and five for y then you could deal 5,6,7,8,9,10,11,12,13,14,15.

    Hope this makes sense and helps.

  3. #3
    No Products Registered

    Join Date
    May 2008
    Location
    California
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Randomizer Between Two Numbers

    Gerblegod7's way works well, but you can also use the Randomizer extension which always you to get a random number between 2 values.
    Here's the link:
    http://www.clickteam.info/extensions/extview.php?id=51

  4. #4
    Clicker

    Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Jun 2006
    Location
    Killeen, TEXAS
    Posts
    1,062
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Re: Randomizer Between Two Numbers

    or mersenne twister random object by c.branch is nicer.

  5. #5
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Jun 2006
    Posts
    6,773
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Randomizer Between Two Numbers

    Simplified version of Gerblegod's post:

    X = lower
    Y = upper
    D = Y-X

    (X+Random(D+1))

Similar Threads

  1. Random Numbers and expiring the result numbers.
    By Corlen in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 26th April 2013, 04:11 PM
  2. [Request] Randomizer object for Flash
    By Fanotherpg in forum Extension Development
    Replies: 8
    Last Post: 22nd August 2010, 01:11 AM
  3. Using randomizer object to change colors
    By FormerTGFGuy in forum Multimedia Fusion 2 - Technical Support
    Replies: 12
    Last Post: 28th September 2009, 10:13 PM
  4. Randomizer help
    By Zaxoni in forum File Archive
    Replies: 2
    Last Post: 16th February 2009, 04:26 PM
  5. Randomizer Request
    By YAS in forum Extension Development
    Replies: 2
    Last Post: 8th September 2006, 12:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •