Returning damage issues

This forum is currently in read-only mode.
From the Asset Store
This sound pack features 117 game sounds : Axe,Punch Swing & Hit & Damage. This is a perfect collection for your game.
  • http://dl.dropbox.com/u/32409323/USP.cap

    [quote:2ltuxhv3]

    System: Is global variable 'dmg' Greater or equal 100000

    -> System: Set global variable 'dmg' to str(Int(global('dmg')/1000))&"K"

    MouseKeyboard: On key 1 pressed

    System: Create object dmgText on layer 1 at (eneTest.X-20, eneTest.Y)
    • > System: Set global variable 'dmg' toClamp(floor((1+random(0.225))*(global('ATK') *1.0 - eneTest ('DEF')*3))+1, 0,99999999999)
    -> dmgText: Set text to global('dmg')

    This what I have. It doesn't, it still displays the full value.

    However, if I do it like this:

    [quote:2ltuxhv3]

    System: Is global variable 'dmg' Greater or equal 100000

    -> System: Set global variable 'dmg' to str(Int(global('dmg')/1000))&"K"

    MouseKeyboard: On key 1 pressed

    System: Create object dmgText on layer 1 at (eneTest.X-20, eneTest.Y) -> dmgText: Set text to global('dmg')

    • > System: Set global variable 'dmg' toClamp(floor((1+random(0.225))*(global('ATK') *1.0 - eneTest ('DEF')*3))+1, 0,99999999999)

    It will work, but the first text will say "0", then it will show the value as "123K".

    I need to get it to work without showing the "0" first.

  • Just change the event order.

    [quote:2id0okz0] MouseKeyboard: On key 1 pressed

    System: Create object dmgText on layer 1 at (eneTest.X-20, eneTest.Y) -> dmgText: Set text to global('dmg')

    • > System: Set global variable 'dmg' toClamp(floor((1+random(0.225))*(global('ATK') *1.0 - eneTest ('DEF')*3))+1, 0,99999999999)

    System: Is global variable 'dmg' Greater or equal 100000

    -> System: Set global variable 'dmg' to str(Int(global('dmg')/1000))&"K"

  • I did that too, and it first thing that comes put is "0" instead of the actual number.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Opps, you need to set the text again in the second event. You could also make the second event a sub event of the first.

    [quote:t8cck72c] MouseKeyboard: On key 1 pressed

    System: Create object dmgText on layer 1 at (eneTest.X-20, eneTest.Y)

    -> dmgText: Set text to global('dmg')

    -> System: Set global variable 'dmg' toClamp(floor((1+random(0.225))*(global('ATK') *1.0 - eneTest ('DEF')*3))+1, 0,99999999999)

    System: Is global variable 'dmg' Greater or equal 100000

    -> System: Set global variable 'dmg' to str(Int(global('dmg')/1000))&"K"

    -> dmgText: Set text to global('dmg')

  • Still not working. It sets the number to the value "dmg" while the text is still visible instead of setting it at the point of creation. I've updated the cap so can see what I mean.

    Okay, I fixed it sort of, by adding it under the press one event.

    <img src="http://dl.dropbox.com/u/32409323/imgevent.png">

    Maybe I could use a loop to call the damage function.

    I'll have to do this forever event.

  • [s:339p1xu4]I'm trying to get this function to work.

    img339.imageshack.us/img339/9153/clipboard04z.png

    However, it's not working. I'm trying to get it so that I don't have to add that create damage event for every single hit and for every single enemy.[/s:339p1xu4]

    Nevermind, I had it spawn a layer that wasn't even created yet.=P

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