RPG Maker VX Ace

RPG Maker VX Ace

View Stats:
gameking31 Jun 14, 2014 @ 3:09pm
Help with a very specific 'if' statement
I've tried to refrain from bugging people online for help with stuff, and generally gotten off pretty well until now. This is a very specific situation that I'm having difficulty with. Don't worry, it's not a custom script compatability issue, just me not knowing how to code.

Currently, there are two outside scripts that are in fact, working together.

Fomar's Animated Battlers
http://cobbtocs.co.uk/wp/?p=70
(Only thing modified is the number of vertical frames changed to 11)

Mog's Damage Popup
http://rpgmaker.net/scripts/275/

Now, in Mog's Damage Popup when the numbers spawn, they spawn off center for their sprite. (understandably so too, as the game views the entire spritesheet as the size for the character)

I changed the DAMAGE_POSITION_CORRECTION variables around, but due to how the game flips the enemy sprites, the perfect x position for an enemy sprite may not particularly be where I want it for a hero's sprite.

For the life of me, I cannot figure out how to program such an if statement. Ideally, it would look something like this...

If (image name) == "Name of one of the hero characters"
DAMAGE_POSITION_CORRECTION[0] = -100
else
DAMAGE_POSITION_CORRECTION[0] = 100
end


But of course, everything I do causes the game to cry and yell 'syntax error'.
how would I write this?

Thank you so much in advance for this. I've lost too much sleep over this one.
< >
Showing 1-15 of 18 comments
Ellye Jun 14, 2014 @ 4:05pm 
I can't check the scripts you're using right now, but I'd guess that "DAMAGE_POSITION_CORRECTION" is a constant - it has a single, unchangeable, value set up once, probably upon class creation. It's not an instance variable, nor is it a standard variable that gets constantly re-written.

If that's the case, you're probably getting your syntax errors because, at the point of execution, it's unlikely that the script would have any context for the if statement you're making. Or, if for some weird reason it does have the right context, it's still a syntax error because you wouldn't be able to define a constant more than once (and such an statement would only make logical sense inside a loop, which means you're trying to define it more than once).

A tip for a cheap work-around: try to locate the part in the script where DAMAGE_POSITION_CORRECTION is actually used. Make a similar if-statement in that place instead (but don't try to redefine DAMAGE_POSITION_CORRECTION, just use the if-statement to check whether the function will use an additional adjustment or not).
Last edited by Ellye; Jun 14, 2014 @ 4:08pm
gameking31 Jun 14, 2014 @ 4:18pm 
The reason for my syntax errors is because I suck at programming and know little about what I'm doing XD

I've already located where it's called upon, and the whole script actually works fine. My only problem is I don't know HOW to make that if statement. i don't know how to check either...

a. Who's turn it is
or
b. which sprite the code is looking at to determine the relative location of the popup.

Everything works perfectly as the scripts are supposed to, I just need to chane the DAMAGE POSITION CORRECTION but only when the damage is inflicted to an ally. I just have no idea how to write the if statement, cuz I have no idea what variable I'd be calling on
Hajami Jun 14, 2014 @ 4:37pm 
Can u upload a little demo project, maybe thatway its easier than to rebuild your construction.
gameking31 Jun 14, 2014 @ 6:17pm 
How do I do that? I seem to be the only person across the internet unable to figure this out, because everyone on google seems to take it as common knowledge
gameking31 Jun 14, 2014 @ 6:17pm 
Upload it I mean. I have the zip file ready to go
Mystix Jun 14, 2014 @ 7:02pm 
Use a free file-sharing site/service such as at http://dropbox.com , {LINK REMOVED} , etc..
gameking31 Jun 14, 2014 @ 7:10pm 
https://www.dropbox.com/s/4pzp682yom7glvt/MmocraftVx_demo.exe

Just put it on Dropbox. Anyhow, this is the demo.
gameking31 Jun 14, 2014 @ 9:46pm 
Still hoping for a solution on this one. maybe this wasn't as simple as I thought...
gameking31 Jun 15, 2014 @ 3:24pm 
Still not solved. Can anyone help me now that I've got the demo finally up on dropbox? I really want to get this one out of the way
Hajami Jun 16, 2014 @ 3:29am 
Ok i download it, but what exactly did u wanted to archieve? i dont mean the variable manipulation. i mean what thing that ingame is. (sorry my english aint the best couldnt understand ur first post fully)).
Last edited by Hajami; Jun 16, 2014 @ 3:33am
Hajami Jun 16, 2014 @ 3:31am 
LOL Dude there were only 2 Soundtracks in that Demo nothing else. A Joker huh? :)
gameking31 Jun 16, 2014 @ 3:47pm 
Probably should've given instructions there. I removed a ton of stuff so I wouldn't be throwing a huge file on here, but forgot to remove some soundtracks XD

Anyhow, talking to the lady at the start point will trigger a battle with two highwaymen. Enemy sprites aren't supposed to move, so don't worry about that one, but when the damage numbers show up, they appear either too far to the right or left. To correct this, of course you just ajust the DAMAGE_POSITION_CORRECTION variables to fit where you want them.

now in Mog's Damage Popup the problem lies in that if I adjust it for the hero sprites, the damage will not show up in the right place for the bad guys, and if I adjust it for the baddies, the hero's damage shows up in the wrong place.

What I want to know is what do I literally have to copy and paste to tell it...

IF (The sprite you're looking at) = good guy
DAMAGE_POSITION_CORRECTION = some numbers
ELSE (The sprite you're looking at) = bad guy
DAMAGE_POSITION_CORRECTION = some other numbers

I don't need to know what numbers to use there, I just need to know how to set up that If/else statement
Hajami Jun 17, 2014 @ 12:33am 
DUDE there was no DEMO GAME. There was just 2Soundtracks in empty Folders.
Thats why i asked:
A Joker huh? XD (I ment: you excidental uploaded the wrong? or are u a troll?)


Last edited by Hajami; Jun 17, 2014 @ 12:34am
gameking31 Jun 17, 2014 @ 3:29am 
Oh... well then... perhaps I should actually CHECK MY FILES before telling people to download them... I feel like that kid who when asked to turn to page 64 of his physics book, shoots up his hand and yells at the teacher that he can't find it, to which the teacher replies, fighting back the laughter, "that's because you're holding Doctor Suess's 'The Foot Book'... upside down" I... am going to download dropbox on my friend's compy and attempt to re-upload the thing with actual stuff in it!
Hajami Jun 17, 2014 @ 3:44am 
ok no problem^^ i doubt i can help anyway^^ but who knows, maybe someone else.
Last edited by Hajami; Jun 17, 2014 @ 3:44am
< >
Showing 1-15 of 18 comments
Per page: 1530 50

Date Posted: Jun 14, 2014 @ 3:09pm
Posts: 18