How do i make construct 2 select 2 terms , them being 1 and 3 ?

From the Asset Store
A complete set of Graphic, User Interface element to build 2D mobile game or PC game.
  • So , i'm developing a game where an undead enemy has 3 abilities to choose from :

    1 - Normal Attack

    2 - Life Drain ( 25 MP ) ( Can only be used when < 50% maximum HP )

    3 - Dark Shield ( 40 MP )

    To select which one will be used , I created a variable .

    Depending on his current MP , some abilities might not be available .

    My problem is : If his MP is higher than 65 ( 25 + 40 ) he should be able to select any of those 3 abilities . So this variable sets its value to round(random(1,3)) . If the result is one , the game should pick a normal attack . If the result is 2 , the game should pick life drain . If the result is 3 , the game should pick dark shield .

    But what if the Undead has 100% HP , but enough mana to use dark shield ?

    So , the only abilities usable would be Normal attack ( 1 ) and Dark shield ( 3 )

    So i tried setting the variable to this : round(random(1,3))

    The problem is , by doing that , is also includes 2 ( Life Drain ) .

    So , in short terms : I need the game to only pick "1" or "3" , without including "2".

    How do i do that ?

  • Use choose() instead of random()

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks ! Very simple , but it worked .

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