User Tag List

Results 1 to 7 of 7

Thread: Easy way to randomly Spread Value

  1. #1
    Clicker Multimedia Fusion 2HTML5 Export Module
    Kentronisk's Avatar
    Join Date
    Nov 2011
    Posts
    206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Easy way to randomly Spread Value

    I have N number of objects (between 2-6, depending on amount of players), and I want to give each player an ID between 1 and N (if its just 2 players, I want ID 1 and 2, and not anything higher).
    A normal spread value will always return the same ID to each player, and its not random enough.

    Anyone have a simple way to do this??

  2. #2
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleXNA Export Module
    ProdigyX's Avatar
    Join Date
    Jan 2011
    Posts
    1,197
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Try

    Code:
    + Pick Object Alpha at random
    + Object Alpha Alterable Value A = 0 (or some other default value)
    + MyCounter is less than <Number of Object Alpha>
    - Set Alterable Value A to MyCounter
    - Add 1 to MyCounter
    or

    Code:
    + <Some trigger event>
    - Spread Value <Number of Object Alpha> through Alterable Value A
    - Set Object Alpha AV A to 1 + ((Object Alpha AV A + Random(<any number here>)) mod <Number of Object Alpha>)

  3. #3
    Clicker Multimedia Fusion 2HTML5 Export Module
    Kentronisk's Avatar
    Join Date
    Nov 2011
    Posts
    206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for reply.

    I should have mentioned that I would preffer this to happen in 1 event. As far as I understand, the first one must run Number of Alpha object times, minimum.
    I tried the second one, but in my file its not guaranteed that the values will be unique. For the record, I want this too :b

    Any other ideas??

  4. #4
    Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator ProUnicode Add-on

    Join Date
    Jun 2011
    Posts
    628
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    - Some action -> Start loop for each object
    - On for each loop -> set value to random(N)

  5. #5
    Forum Moderator Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleSWF Export Module
    DavidN's Avatar
    Join Date
    Jun 2006
    Location
    Boston, MA, USA
    Posts
    4,044
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could run ProdigyX's first suggestion in an On Loop event, triggering the loop [number of players] times.

    I think that the assignment of spread values is dependent on creation order or order within the layer, so you could randomly pick players and toggle their layers around to see if that does anything before you spread the value.

  6. #6
    Clicker Fusion 2.5Android Export ModuleiOS Export Module
    Fusion 2.5 (Steam)HTML5 Export Module (Steam)

    Join Date
    Nov 2007
    Location
    Canada, BC
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    whipped this up quickly, not exactly 1 line to randomize, hit spacebar to randomize the id's
    random id assign.mfa

  7. #7
    Clicker Multimedia Fusion 2HTML5 Export Module
    Kentronisk's Avatar
    Join Date
    Nov 2011
    Posts
    206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have solved my stuckness by doing a completely different approach. My goal was to place players around according to their ID, but I rather did a fastloop and swapped positions X times.

    I will quickly try to answer my thread title anyway.
    First off, I didnt mean 1 event (yet another mistake, I should stop making threads 3 at night). What I ment was to randomly spread the IDs in as many lines of events it takes, but in the first loop. I have events lower down in my game that requires the IDs to be randomly spread the first time they run. My dirty backup plan for this would be to make a sort of initialize group of events, and do not activate the rest of the events before this group have completed X times. The events used in this group could be ProdigyX's or Mook06's examples.
    I dont exactly know how the "pick one element" event works, but Im imagining it may pick the same element multiple times, so a loop "number of objects" times would probably not be enough.

    Anyway, Im sure the next person reading this thread (if any) are able to find something useful! As always, thanks a lot for all replies!

Similar Threads

  1. Randomly Even Well Placed Squares
    By XStar in forum Multimedia Fusion 2 - Technical Support
    Replies: 30
    Last Post: 29th October 2012, 04:15 PM
  2. How are spread values spread ?
    By rudy in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 6th December 2011, 09:15 PM
  3. Randomly pick spawnpoint?
    By Zambaku in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 20th May 2011, 11:56 AM
  4. How do I randomly spawn weapons?
    By Caesar in forum Lacewing
    Replies: 4
    Last Post: 10th April 2009, 10:36 PM
  5. add backdrop works randomly
    By thewreck in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 19th February 2007, 03:13 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
  •