probability of an event (per object instance)

0 favourites
  • 9 posts
From the Asset Store
Per Pixel Destruction like in "Worms" (perfect performance, no third party plugins)
  • If I want to make an event happen on 50% chance, I add

    System: Random(1) <= 0.5

    But, if I want to make an event happen on an Probability% chance and Probability is an instance variable of Player, using these events........

    System: Random (1) <= Player.Probability

    For Each Player

    ....... It doesn't work

    I have events setting the value of Probability instance variable depending on different situations. and yes, I checked that the values are correctly being set and none of the values are zero, I even tried setting Probability to 1 so 1 means it should always happen, but it is not working.

    Help please

  • Move the For Each up. You need to check the probability for each Player.

  • blackhornet

    It still doesn't work.

    I used "Compare two values" for the System: Random (1) <= Player.Probability condition and I think "Compare two values" can't detect between object instances. Now I need an alternative way of comparing same variable but can detect between instances of Player object.

    Any ideas?

  • Post what you've got so far.

  • Now, I had to make a new test file showing what I am saying because my game is already complex and it won't help anyone trying to solve this problem because my game has many systems already implemented.

    The example file uses keyboard inputs as conditions BUT they are just for example purposes.

    In my game, I don't use keyboard inputs as conditions, but you get the point of the problem.

  • random(1) will never be 1 ..hardly 0.2

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Don't use =, use <=.

  • korbaach

    blackhornet

    ok. thanks

    but it still can't distinguish between object instances.

    I saw the description of Compare two values in the add action window. It said there it's not for objects.

    How do I achieve this for each instance of an object? Is it possible?

  • .

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