increasing chance of creating monster

0 favourites
  • 7 posts
From the Asset Store
This pack of sounds for monsters consists of 107 sounds, among which you can find different sounds of Attack, Death, Ste
  • I have 75 monsters in my game that are randomly created in an area each level

    I want to make it so that that level 1 picks from monster 1-2 to create, level 2 picks from monster 1-3 to create, level 3 picks from monster 1-4 to create, level 4 monsters 1-5 and so on through the first 75 levels.

    I could create individual events for all this but that would be hundreds of events and seems a little overkill.

    I tried playing around with rex's nickname plugin but I'm either getting just monster 1, or all 75 monsters, any help or ideas would be appreciated.

  • Pretty easy:

    • I hope your monsters have an Id or are they a part of an animation ? If you haven just:

    Right click on family

    Add an instance variable id = 0

    Set for every monster the correct id (1-75)

    • You need to have your actual level saved in a global variable, if you haven't done this yet just do:

    + On start of Layout

    • Set Level to 1-75

    + Every tick //I?m not sure how often you spawn them, so change this line how you like

    ++ family.id = random(1, level)

    • spawn family

    if you want to spawn all the choosen monsters at the same time do:

    + Every tick

    ++ for from 1 to level

    +++ family.id = loopindex("")

    • spawn family

    + = event

    ++ = subevent

    • = action
  • Thanks for the question. Really had to think a bit. Here is another way of doing it without using families. You can use the animation frames and set each frame as a monster. Had fun making this capx for you. If you need your monsters animated then you can select an animation instead, and let the animation run.

    dl.dropboxusercontent.com/u/79803565/RandomMonsterGenerator.capx

    Credit must go to Yann in this post scirra.com/forum/random-object-selection_topic47519.html. I was a little stumped and so went looking for help and found the idea there.

    Happy creating

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I also asked him if he uses animation frames, but the most newbies using families instead of animation frames. Cause Animation Frames are better for the performance but they are harder to understand and instances need to be defined over loops.

  • You had already created a topic on this. scirra.com/forum/scaled-chance-of-creating-sprite-from-family_topic75745_post452891.html

    Anyway here's an example using rexrainbow nickname to create from what I suggested on your earlier topic.

    rexrainbow plugin and behaviour:

    scirra.com/forum/plugin-nickname-behavior-nickname_topic57943.html

    Example:

    dropbox.com/s/u7bwc93mcu47ity/NicknameSpawnEnemy.capx

  • Wow, great replies guys...anyway I can give you reputation or thank you?

    Going to go with darklinki's solution I think as I aready assigned i'ds 1-75 to the monsters so all I have to do it assign the 'level' global variable to use as the top figure in the random spawn (feel kinda an idiot for not figuring that out myself) I can also assign 'levellower' global so the weaker monster are removed as the game continues.

    Thank you all again, so nice to see such active and helpful forum members.

  • Inserting levellower sounds very good to remove weaker monster ;)

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