Returning damage issues

For questions about using Classic.

Post » Wed Jun 22, 2011 7:46 pm

http://dl.dropbox.com/u/32409323/USP.cap

[quote:2ltuxhv3]

System: Is global variable 'dmg' Greater or equal 100000
[size=85:2ltuxhv3] -> System: Set global variable 'dmg' to str(Int(global('dmg')/1000))&"K"[/size:2ltuxhv3]

MouseKeyboard: On key 1 pressed
[size=85:2ltuxhv3] System: Create object dmgText on layer 1 at (eneTest.X-20, eneTest.Y)
[color=#009900:2ltuxhv3]-> System: Set global variable 'dmg' toClamp(floor((1+random(0.225))*(global('ATK') *1.0 - eneTest ('DEF')*3))+1, 0,99999999999)[/color:2ltuxhv3]
[color=#990000:2ltuxhv3]-> dmgText: Set text to global('dmg')[/size:2ltuxhv3][/color:2ltuxhv3][/quote:2ltuxhv3]

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
[size=85:2ltuxhv3] -> System: Set global variable 'dmg' to str(Int(global('dmg')/1000))&"K"[/size:2ltuxhv3]

MouseKeyboard: On key 1 pressed
[size=85:2ltuxhv3] System: Create object dmgText on layer 1 at (eneTest.X-20, eneTest.Y)
[color=#990000:2ltuxhv3]-> dmgText: Set text to global('dmg')[/size:2ltuxhv3][/color:2ltuxhv3]
[color=#009900:2ltuxhv3]-> System: Set global variable 'dmg' toClamp(floor((1+random(0.225))*(global('ATK') *1.0 - eneTest ('DEF')*3))+1, 0,99999999999)[/color:2ltuxhv3]
[/quote:2ltuxhv3]

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.
B
11
S
3
G
8
Posts: 473
Reputation: 4,569

Post » Wed Jun 22, 2011 8:01 pm

Just change the event order.
[quote:2id0okz0] MouseKeyboard: On key 1 pressed
[size=85:2id0okz0] System: Create object dmgText on layer 1 at (eneTest.X-20, eneTest.Y)
[color=#990000:2id0okz0]-> dmgText: Set text to global('dmg')[/size:2id0okz0][/color:2id0okz0]
[color=#009900:2id0okz0]-> System: Set global variable 'dmg' toClamp(floor((1+random(0.225))*(global('ATK') *1.0 - eneTest ('DEF')*3))+1, 0,99999999999)[/color:2id0okz0]

System: Is global variable 'dmg' Greater or equal 100000
[size=85:2id0okz0] -> System: Set global variable 'dmg' to str(Int(global('dmg')/1000))&"K"[/size:2id0okz0][/quote:2id0okz0]
B
79
S
24
G
53
Posts: 4,735
Reputation: 40,233

Post » Wed Jun 22, 2011 8:14 pm

I did that too, and it first thing that comes put is "0" instead of the actual number.
B
11
S
3
G
8
Posts: 473
Reputation: 4,569

Post » Wed Jun 22, 2011 8:23 pm

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"
[color=#8000FF:t8cck72c]-> dmgText: Set text to global('dmg')[/color:t8cck72c][/quote:t8cck72c]
B
79
S
24
G
53
Posts: 4,735
Reputation: 40,233

Post » Wed Jun 22, 2011 10:59 pm

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.

Maybe I could use a loop to call the damage function.
I'll have to do this forever event.
B
11
S
3
G
8
Posts: 473
Reputation: 4,569

Post » Thu Jun 23, 2011 6:10 pm

[s:339p1xu4]I'm trying to get this function to work.
http://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
B
11
S
3
G
8
Posts: 473
Reputation: 4,569


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 7 guests