How do I get an event trigger every X of other event ?

0 favourites
  • 5 posts
From the Asset Store
Game Triggers is as versatile as a Swiss army knife, and will be a great resource for any type of game you're creating.
  • I'm working on a simple project (link) to teach myself the platform and got most things down to have something resembling a 'game'.

    Now I'm looking into more complex triggers and mechanisms. I've tried out everything I can think of and can't make this to work:

    Trigger after every 'X' amount of 'Y'.

    For example;

    - trigger reload every 12 shots

    - spawn a power up every 20 kills

    - increase health/damage of enemies every 100 score points

    - enemy has a chance to shoot a nuke (or something) with chance increasing every 10 'regular' shots

    I figure I could make it work by using arrays (haven't gotten that far yet). I'm sure it's a very easy solution for anyone with actual experience.

    Thanks for the help in advance!

  • An array could work but it would be more clear/readable and thus easier to upkeep if you use instance variables. Here is a small example to get you started:

    drive.google.com/file/d/1eDWdZQR7hY_ocfak7CJT1ndQtzMCCoiw/view

    It will probably take a bit of studying to understand everything going on but it should answer all the questions you've asked.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I knew there are some GCSE-level programming basics that I'm missing :D

    Some extra reading helped: bbc.co.uk/bitesize/guides/zs3qrwx/revision/1

    Thanks for the demo! I think I got it.

    Out of curiosity - how does the text attach itself to the targets? Both visually and logically - I see no pins or position definitions.

  • It's easily possible. Simple maths would do it, by using the % 'Modulo' (remainder) operator.

    Go to System --> Compare two values, then write this:

    It means, when the remainder of (shots/10) = 0, then do something. So every multiple of 10 (of shots) it will become true.

    Your events will then simply be:

    ..and so on!

    (Note: It will also unexpectedly trigger when shots or kills are 0, because 0%10 is also 0. So just have another condition of shots > 0 to solve that). Let me know if it works.

  • I knew there are some GCSE-level programming basics that I'm missing :D

    Some extra reading helped: bbc.co.uk/bitesize/guides/zs3qrwx/revision/1

    Thanks for the demo! I think I got it.

    Out of curiosity - how does the text attach itself to the targets? Both visually and logically - I see no pins or position definitions.

    You're right, there are no pins or position definitions. I am using a container.

    construct.net/en/make-games/manuals/construct-3/project-primitives/objects/containers

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