Rpg inflict damage

0 favourites
  • 11 posts
From the Asset Store
🙌 J-BoB Damage & Hit Sound Pack comes with 585 high-quality sound effects
  • I create system of damaging enemy, when value attacks is 10 substract 10 from hp by hit. But it is possible to add expression which this change damaging type i mean substract 10 (+- 1) or + 10 % ?

    dl.dropbox.com/u/44710358/rpg.capx

  • if you mean randomly subtract 9 to 11 then:

    subtract ATTACK - 1 + floor(random(3)) from HP

    or if you want 10%:

    subtract ATTACK - floor(ATTACK * 0.1) + floor(random(ATTACK * 0.3)) from HP

  • when my value damage shows 10 substract 10 + something when i add attack points to 15 substract 15 + something.

    What means 'floor' before ()? i first time see this

  • floor is rounding down - it acts like round() but when you have floor(1.9) it rounds down to 1 when round() rounds to 2, while ceil is the opposite it rounds always up, so ceil(1.1) becomes 2. useful with random().

    back to your question, you can simply subtract 10 + something from HP you dont have to limit yourself to a value you can subtract a whole expression like 10 + variable1 * 2 - variable2 from HP.

    or maybe i don't get the real issue here :(

  • Well it starts to work always substract 10 from hp + something like 1-4 :)

    Ok when i check your option "floor(ATTACK * 0.1) + floor(random(ATTACK * 0.3)"

    I change "floor(random(ATTACK * 0.3)" to "floor(random(1,5)"

    And this is it! :) MANY THANKS !!!

    Dziekuje :)

  • ranma i have last question to you or anyone. How display text who tell us how many damage has been inflicted ?

    Capx is updated

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • you can create a text object and set its text to the same value that you subtracted from HP. give it a fade behavior with fade in 0, wait 1 and fade out 1, destroy after fade checked, and it will fade nicely every time you inflict damage.

  • ranma yes i have this without right displayed text. I dont know how do this 'set text to the same value that you substracted from HP'

  • there is an event for text object: Set Text, you are using it on "dam" and "hp" objects.

    create new text objects and set its text to floor(ATTACK * 1) + floor(random(1,5)) like you do for "dam".

  • ranma I have already set substract 'floor(ATTACK * 1) + floor(random(1,5))'

    now when i add this same expresions to 'set text' numbers displayed and substracted will be always different. I check this before

  • use a local variable then and store floor(ATTACK * 1) + floor(random(1,5)) in it.

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