Percentage & Randomization

0 favourites
  • 3 posts
  • Hi~

    I wanted to create a percentage & random event~

    For example, there are 4 items~ (I1, I2, I3, I4)

    And 3 objects~ (O1, O2, O3)

    Questions example~

    01 >

    When O1 is destroyed, 20% spawn I1~

    02 >

    When O2 is destroyed, 10% spawn I2 & 25% spawn I3~

    But will only spawn 1 item at a time~

    Which means randomly pick I2 or I3 then detect the %~

    03 >

    If O3 is destroyed 4, 8, 12, 16, 20... times~ (Multiply of 4)

    50% spawn I4~

    Maybe it's too many~

    But hope someone will help~

    Really appreciated~ ^^

  • Hey

    So I think this is what you are looking for. I imagine this is not how the enemies will behave in your game.

    Just for testing purposes if an item is not spawned the System will wait 2 seconds and Spawn a new guy. If an Item is spawned the system will wait for you to collect it before it spawns a new guy.

    I hope this helps and good luck.

    Game File

    dl.dropbox.com/u/64691866/RandomSpawns.capx

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Yes it is~

    Ah, so we can type "random(10)" something like that~

    This is great, I didn't know about this yet~

    So the concept is if the drop rate is 20%~

    We firstly set random(5) to give the object hold 5 numbers~

    then, if the number is 0, spawn the item, else, destroy the object~

    Another example, if the drop rate is 15%~

    We firstly set random(20) to give the object hold 20 numbers~

    then, if the number is 0/1/2, spawn item, else, destory the object~

    And the concept of multiply of 4 is adding a variable~

    Each time player destroys the object will +1 to the value~

    If the value = 4, start the random event, then set value back to 0~

    I get it now~

    Thank you very much, Mr427~

    Really appreciated~ ^^

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)