User Tag List

Results 1 to 10 of 10

Thread: Chance-based spawning of set items

  1. #1
    Clicker Fusion 2.5 (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    welshpixie's Avatar
    Join Date
    Sep 2016
    Location
    South Africa
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Chance-based spawning of set items

    Hi!

    Absolute newbie here. I've tried googling and searching the forums for this but can't find help that's specifically for what I want to do.

    The setup:

    On loading a frame, I want one of three types of enemy to spawn, with a different chance of spawning each; a common enemy that spawns frequently, an uncommon enemy that spawns less frequently, and a rare enemy that doesn't spawn often. Then, when the player kills whichever enemy spawned, I want another enemy to load with the same conditions as above (I know how to set 'destroy' and 'create object').

    I see there's an OR condition in the event manager, and I see that I can have an 'x chances out of y' - so I know how to say, for example, 'at the start of the frame, 8 times out of 10, spawn enemy #1'. What I don't know how to do is to say 'spawn this 8/10 OR this 5/10 OR this 2/10'.

    The follow-up from that, once I've got that figured out, is how to tell the event manager to subtract from the health of {whichever enemy got spawned}. I know how to say 'when player left-clicks on enemy#1', for example - but what happens if it's enemy #2 that spawned?

    EDIT: In the long-run I want to have each enemy type having different stats (weak to strong), with the stronger dropping better loot - I think I'm going to need to look at creating INI files?

    Help greatly appreciated

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid 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)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,366
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    Hey. The best approach in my opinion is to have a pool to select enemies from.
    Say you have a string that looks like this: "AAAAAABBBC"
    A represents the common enemy, B the less common enemy, and C is the rare enemy.
    When an enemy should spawn, select a random character from the string. A has alot bigger chance to be picked than C.

    Put that character into a string object or a string variable.

    * Start of level
    OR (Logical)
    * Player kills enemy

    - Set String SelectedEnemy to Mid$("AAAAAABBBC", random(10),1) //This will pick a random character from the string. You can also use len() to find the length of a string instead of hardcoding it.

    Now you can create the common enemy if the string is A, the less common enemy if it is B or the rare enemy if the string is C.

    * String SelectedEnemy <> ""
    + String SelectedEnemy = "C"

    - Create object RareEnemy
    - Set String of SelectedEnemy to ""


    For your follow up question, simply give all the enemies the same qualifier. To do that, select the objects in the frame editor, go to the properties and select the Events tab.
    Now you can do events on the qualifier instead of the actual objects.

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS 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)
    PlasmaVoid's Avatar
    Join Date
    Jan 2015
    Location
    SoCal
    Posts
    85
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Youll need a value to use as a randomizer. Use an objects Alterable Values, a Global Value, or even a simple Counter. For this example im going to use Alterable Value A of X object.

    Start Of Frame:
    X Object > Alterable Value A = RRandom(1,10)

    Start Of Frame:
    Alterable Value A of X Object is >= 1
    Alterable Value A of X Object is <= 3
    Create Object > "Your Enemy"


    Start Of Frame:
    Alterable Value A of X Object is >= 4
    Alterable Value A of X Object is <= 8
    Create Object > "Your Enemy 2"


    Start Of Frame:
    Alterable Value A of X Object is >= 9
    Alterable Value A of X Object is <= 10
    Create Object > "Your Enemy 3"

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS 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)
    PlasmaVoid's Avatar
    Join Date
    Jan 2015
    Location
    SoCal
    Posts
    85
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh popcorn replied at the same time i did xD. His example is definitely much easier to conceptualize. Good luck on your project!

  5. #5
    Clicker Fusion 2.5 (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    welshpixie's Avatar
    Join Date
    Sep 2016
    Location
    South Africa
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you very much, both! I'll try it out and no doubt be back at some point with more questions

  6. #6
    Clicker Fusion 2.5 (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    welshpixie's Avatar
    Join Date
    Sep 2016
    Location
    South Africa
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Screenshot - 28_09_2016 , 13_18_03.jpg

    Okay, this is what I've got. All three enemies (which are active images) have the 'bad' qualifier, and all three have an alterable value called health (with a different value per enemy).

    #1, sets the string as per Popcorn's example. (<--- this works)
    #2,3,4 - if string is (x) or if health of 'bad' is equal to or lower than 0, create enemy (x). (<--- this works)
    #5, user clicks with left button on 'bad', subtract health (<--- this works)
    #6, if the health of 'bad' is equal to or lower than 0, destroy

    #6 doesn't work The enemy image stays loaded, the new enemy spawns on top of it.

    What am I missing?

  7. #7
    Clicker Fusion 2.5 DeveloperAndroid 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)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,366
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    Hey, hard to say. It seems like it should work fine. You are sure event 6 doesn't execute?
    Could you upload your mfa?
    Btw, you should change OR to OR (Logical), since you're doing a logical OR. That that wouldn't solve the problem, though.

  8. #8
    Clicker Fusion 2.5 (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    welshpixie's Avatar
    Join Date
    Sep 2016
    Location
    South Africa
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah, changed the OR, thank you!

    Here's the mfa - https://www.dropbox.com/s/fwdi0hdmim...0Cove.mfa?dl=0

  9. #9
    Clicker Fusion 2.5 DeveloperAndroid 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)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,366
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    Ah, found it! You forgot to set Mushroom_enemies to "" after it is used. Now it will constantly create new objects.

  10. #10
    Clicker Fusion 2.5 (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    welshpixie's Avatar
    Join Date
    Sep 2016
    Location
    South Africa
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ohhhhh! I totally missed that bit. Thank you so much!

Similar Threads

  1. Import library items as unique items?
    By Alpha17x in forum Fusion 2.5
    Replies: 0
    Last Post: 23rd January 2015, 04:54 AM
  2. Spawning bad guys
    By JRP in forum Fusion 2.5
    Replies: 2
    Last Post: 8th May 2014, 05:46 PM
  3. spawning offscreen
    By life2searching in forum Multimedia Fusion 2 - Technical Support
    Replies: 10
    Last Post: 18th May 2012, 08:56 AM
  4. spawning problem
    By tailsko in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 31st August 2011, 10:56 PM
  5. Enemy spawning help.
    By GameDragon in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 28th January 2010, 03:12 AM

Posting Permissions

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