How do I randomize an event?

0 favourites
  • 4 posts
From the Asset Store
Very simple code without excess options (15 events for server and 11 events for client)
  • Example:

    + Condition A

    + Condition B

    + Condition C

    + Condition D

    + 1 out of 4 chances or 25% chance of happening

    -> Action

    Is there a way to make this event happen randomly on a 25% probability chance even if conditions A,B,C,D are always true?

    P.S.

    I am not talking about Pick random instance or pick random whatever.

  • I suggest a random numbered variable (1-4). Condition a-b-c-d respectively would act out depending on what the variable was (a=1, b=2, etc.)

    No clue how you do that in construct 2, though.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • not sure I understood you.

    I'll replace the generic condition and action names with a new example using sort of pseudocode:

    +Enemy is alive

    +Enemy is on ground

    +Enemy is not attacking

    +Enemy is near player

    + 1 out of 4 chances or 25% chance of happening

    ->Attack

    so assuming the first 4 conditions are always true, the enemy won't attack every time those 4 conditions are true. Instead, the enemy will attack if those 4 conditions are true AND randomly (randomly would have to be configurable like X out of Y chances or in percentage).

  • + Condition A
    + Condition B
    + Condition C
    + Condition D
    + System: random(1) < 0.25
         -> Attack[/code:3mgvvr7d]
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)