|
Post by Prominence on Mar 27, 2005 22:21:27 GMT -5
Create Event: COMMENT: variables execute code:
gaining = true XP = objRistarStatCarrier.XP alarm[0] = 135 global.leveled = false
Alarm Event for alarm 0: COMMENT: destroy execute code:
if global.leveled = true { instance_create(124, 112, objLevelUp) } instance_destroy( );
Step Event: COMMENT: gain a level execute code:
if XP >= 100 { XP = 0 global.leveled = true } COMMENT: gain experience after battle execute code:
if objPlayerParent.XPGain > 0 { XP += 1 objPlayerParent.XPGain -= 1 gaining = true }
if gaining = true and objPlayerParent.XPGain <= 0 { objPlayerParent.XP = XP gaining = false alarm[0] = 30 }
Draw Event: COMMENT: draw yourself execute code:
draw_sprite(sprExperienceBar, XP, 64, 160) draw_set_color(c_white) draw_text(170, 160, string(XP))
For some reason after it gains a level and goes back to 0 XP, when I enter battle again and get a single EXP point it sets global.leveled to true...when it should only do that if its >= 100. why is it doing this? I set it to 0 when it gets to 100.
|
|
|
Post by shad0w on Mar 27, 2005 22:48:56 GMT -5
add this: create event: gained=0
change this: step: if objPlayerParent.XPGain > 0 && gained=0 { gained=1 XP += 1 objPlayerParent.XPGain -= 1 gaining = true }
|
|
|
Post by Prominence on Mar 28, 2005 0:13:36 GMT -5
that caused an error at the end of battle, as well I only gained 1 XP.
|
|
|
Post by shad0w on Mar 28, 2005 0:29:36 GMT -5
Im not sure why an error would occur. Also, didn't you ask for it to only add 1 xp?
|
|
|
Post by Prominence on Mar 28, 2005 1:23:36 GMT -5
yeah, gain one every step, its for an effect to see the experience bar increasing. Instead it just gains one then stops. and I'll upload a screenie of the error.
|
|
|
Post by Prominence on Mar 28, 2005 1:31:28 GMT -5
and when I run in debug mode, global.leveled is 0 all the time, but right when the experience bar is created, it is set to 1. Since this does not happen in create or anything, I'm certian its the if XP >= 100 { XP = 0 leveled = true } for some reason it senses 0 as a 100...maybe when it goes back it remembers it being pervious...or somethin?
|
|
|
Post by shad0w on Mar 28, 2005 3:53:19 GMT -5
Oh, i misuderstood.
Hmmm, i can't figure out how to fix it without testing, but just a tip, instead of reseting to 0, make it so it subtracts 100, so the player gets the extra XP from 100.
|
|
|
Post by Prominence on Mar 28, 2005 12:53:42 GMT -5
I'll try that, though it may be incorrect by one or something. I'll edit my results. EDIT: damn, exact same thing as when I just set it to 0. This is very, very weird.
|
|
|
Post by Prominence on Mar 29, 2005 18:34:33 GMT -5
alright this should not be happening. Here's the info: Create Event: COMMENT: variables execute code:
gaining = true XP = objRistarStatCarrier.XP alarm[0] = 135 global.leveled = false
Alarm Event for alarm 0: COMMENT: destroy execute code:
if global.leveled = true { instance_create(124, 112, objLevelUp) } instance_destroy( );
Step Event: COMMENT: gain a level execute code:
if XP = 100 { XP -= 100 global.leveled = true } COMMENT: gain experience after battle execute code:
if objPlayerParent.XPGain > 0 { XP += 1 objPlayerParent.XPGain -= 1 gaining = true }
if gaining = true and objPlayerParent.XPGain <= 0 { objPlayerParent.XP = XP gaining = false alarm[0] = 30 }
Draw Event: COMMENT: draw yourself execute code:
draw_sprite(sprExperienceBar, XP, 64, 160) draw_set_color(c_white) draw_text(170, 160, string(XP))
in debug mode the experience bar's XP is 0, and global.leveled is false, but the second the experience bar is created, it set global.leveled to true.
|
|
|
Post by Nailog on Apr 5, 2005 18:04:32 GMT -5
I'm not sure what the problem is, but here are some things you could try ...
Make the leveled variable local to the experience bar, instead of global.
Is there a reason you set alarm 0 in the Create event? The Step event handles the setting of the alarm, so the line in the Create event is useless, I believe.
You could remove the gaining variable completely by using an if / else if structure testing the XPGain variable.
You might want to try and keep all of the stats and such in one object, instead of spread across several different ones. For instance, either use the Stat Carrier for everything, or use the Player Parent.
|
|
|
Post by Prominence on Apr 22, 2005 22:46:08 GMT -5
still, probelms problems problems. Could I trust one person with the .gm6 for some help? thanks,
-Prominence
|
|
|
Post by Nailog on Apr 23, 2005 8:47:41 GMT -5
If you'd like, I could try to help. It'd be best if you had AIM, though, so I could ask you questions and get immediate response.
AIM: Nailog EfnAim
|
|
|
Post by MeleeMaster on Apr 23, 2005 23:17:56 GMT -5
Maybe, if it's "sensing" it wrong, maybe you could try using decimal increments instead? (1xp could be equal to .01xp, and 100xp could be 1xp).
|
|