I'm trying to make a lantern for my game, but the image of it doesnt work to be over the character.
The weird thing is that if i do the same thing in a new game file, it works, it just does nothing in my current game file.
Any idea what could be causing this? the image appears on the top left corner, and doesnt move at all, even if the variabels used to set it in place actually change as the character moves...
UPDATE: The variables that are set after the character's Screen X and Screen Y coordinates sometimes update with the right coordinate, but sometimes they don't update at all.... I have no idea why...
if it works in a new game but not in the current one, I'm wondering if maybe you have a plugin installed that's messing with the refresh of your game file for some reason?
there's no real way to tell simply by looking at the scripts itself but its actually extremely easy to tell, since this lantern system works completely fine on a new game all you have to do is make a new game then add a single plugin/ play around with that plugin for a little while whilst also testing the lantern system in game/ if you see no change in the lanterns behavior remove that plugin and move onto the next one/ repeat this cycle for all your plugins (remember- there could be more than one culprit here so be thorough ok.)
there is also a chance this could be the result of two plugins interacting badly with each other, if the above test fails try testing two at a time to see if its a compatibility issue causing you problems. chances are though you wont need to resort to that.
that's no worries either, just test the scripts one by one like I told you by placing the ones you are currently using into the new game project and playing around with them until the lantern stops working, it shouldn't matter weather the scripts are modded or not the testing protocol still remains the same.
chances are no actually, software errors are unfortunately rarely as clear cut as that, don't get me wrong though its worth looking into first, but if its not the issue I suggest taking the program step by step through the basic troubleshooting steps, if its the type of plugin that requires you to use a script call then test each one of these script calls one by one to see which one if any are causing the issue, if all of them do then its probably something wrong within the script itself meaning something within the script is bugged. if the script is modded, add in the un modified version and see if you get the same error if not then re add your modifications one by one and test the lantern system, the moment the system stops working is the moment that you've got your culprit.
you'll need to check through the actual JS themselves too, otherwise you wont be able to narrow down the issue. sorry if that sounded a little confusing or I worded it improperly (to be fair you're not the only one that's tired LOL)
yeah if you cant find anything just post a reply to this thread and ill check it tomorrow and well try something else.
For the record, this is RMXP, not RMMV, so plugins and javascript are words that do not apply here.
You could also upload a demo of the project; would make the debugging process easier for everyone. Also, do not touch the base scripts unless you absolutely know what you're doing. Edits to the base scripts should 99% of the time be implemented as a separate script.
SO, i know which script does the thing, but reverting it to the original isnt working for some reason...
In the sprite_picture script, i have these lines:
self.x = 0 - $game_map.display_x / 4#@picture.x
self.y = 0 - $game_map.display_y / 4#@picture.y
clearly I put the right thing after the #
I modified this so the pictures that are bigger than the screen don't move when the character move (it works for the lights I use in the outside map)
It's worth mentioning that even with this there was a time where a lantern could work perfectly fine :/
the problem is that if I revert the lines (self.x = @picture.x for example) the pictures outside stop working (I can't see them at all) and the lantern pictur STILL do not follow me...
Hmm... this seems difficult...
At this point maybe you should try just working around the problem instead of resolving it directly? Try creating a separate project and making a script specifically for your lantern outside of the game and see if that works?
-
Other than that... I think it’s just a trial and error thing where you keep messing with the script whilst taking notes and see if any changes resolve the issues. Unfortunately that’s just an every day part of programming LOL
Ok then, maybe a different work around then? Maybe make a separate sprite sheet for your character with a lantern instead of having an image following the character? I mean if you can? That sounds like it’d be a lot easier than just writing a new script.
This is What I'm trying to achieve:
The first picture is with all the lights on.The second is with the lantern on and everythig else off. The 3rd is showing how it doesnt work lol
A new sprite doesnt work because i need everything else to be completely dark...
Also, is there a way to make that a Picture "deletes" parts of another picture? for example, a completely black picture, and over it the lanters that "deletes" the picture underneath where it could iluminate something?
For now i'll try to come up wiht a script that positions the lantern picture over the character... wish me luck (or give me an already existing script XD)