I'm currently trying to adjust something where it appears in the middle of screen. It has 4 objects that are 24 pixels each representing + the number of enemies on the screen which are 24 pixels each
So my location of x was:
x= 272 - [12 * $data_enemies]
with $data_enemies being the variable. Since the number of enemies change each round.
Instead we have been getting a nil Error
Then when I use an unless nil argument
it will error out with a uninitialized constant error.
is there a way to put a location based on the number of enemies on the screen?
Okay, $game_troop.members.size is the number you need.
However, you need to figure out where it's drawn. Where were you putting that line of code that you had? You can't just bang it into the module, you have to find out where it says to actually draw it (by this time the database has been populated), and make your adjustment there. It'll probably be a Scene_Battle class or one of its windows.
GAUGE_X = 272
is populating a constant. When this happens, $data_enemies and $game_troop do not exist. That's where your 'nil' error is coming from.
You will have to add YSA:😮RDER_GAUGE::GAUGE_X = 272 - 12 * $game_troop.members.size somewhere in the script (and even then I'm not sure if it'll just give an error - if it's REALLY treating that like a constant and not allowing you to change it). Do a search for SHOW_SWITCH - I'm betting there's a condition using it that says whether to show the gauge or not, and that would probably be a likely spot to put the new position.
Maybe a link to the entire script would be helpful. In fact, when you're asking for help with a script, you should always add a link to it, so people don't have to go searching and hope they find the same one.
Please give a link to the FULL script, as you downloaded it. There's obviously more to it than this, and I don't really want to keep asking for bits and pieces until you hopefully provide the particular bit I need to see.
As I said, if you put it where the constant was defined, then $data_enemies and $game_troop don't exist at that point. So obviously it won't work. You need to put it somewhere that's got code that will run at the beginning of each individual battle, because each battle will have a specific number of enemies, and you want the gauge positioned according to the number of enemies.
Once I can see the FULL script (link to it, do NOT post it here), I'll be able to find out where it should go.
Alright got the changes in. Do i need to put 272 up in the top x_gauge= or leave it as is at 0.
Currently I tried with both and now it's align to the left again.
You should be able to completely ignore YSA:😮RDER_GAUGE::GAUGE_X now, as it shouldn't be used anywhere.
I think I missed one line, and looking at it, it appears there's also a bug in the script, where it's positioning the y coordinate based on the width, not the height.
Try this instead:
<removed as it wasn't right>
I'm not quite sure it's right, but it's pretty early in the day and the best I can do at the moment.
No worries. You caught me really late last night and I posted the reply really early.
Take your time on it. I'm not releasing the demo anytime soon. (LOL I still have about 50 skills to design)
did you try what I just posted?
oh - it probably won't work, as it looks like it's just hiding it off the screen.
Can you JUST make the changes I gave you yesterday, and post a screenshot?
Yep here ya go!
[IMG]http://i1272.photobucket.com/albums/y396/devilarms2099/CenterGuage1_zps1692431c.jpg[/IMG]
Yep looks good. The only thing weird left on it is that the dead battler's icon's don't disappear from the screen I'll take a look at it in the morning though.
[IMG]http://i1272.photobucket.com/albums/y396/devilarms2099/CenterGuage2_zps2c8d16f1.jpg[/IMG]
Good luck. I don't THINK the changes I made would have anything to do with this, but if you want to confirm, you could just disable that script (click somewhere in the script, Control+A then Control+Q), then copy the original script into a new script slot and see if it still does it. Then of course, to reinstate, just delete the newest script, and Control+A, Control+Q to uncomment the original.