Get Location info

Xyonel

Indie Developer, All-in-one artist.
Veteran
Joined
Jul 22, 2018
Messages
132
Reaction score
28
First Language
Italian
Primarily Uses
RMMV
Hey guys, someone know very well uses and limitation of get location info?
I've encountered some problem with this function, even if I get the id and put these in variables, when I recall the debug window in playtest i see that sometimes the variable give 0 value.
I use 4 get location info for a minigame that dig a tile adjacent where player is facing and then change the fog of war(tile id 0 ) into a tileid got from get loc. info, I show here an example of the work:

Capture.JPG

thus i'm using shaz tile change plugin( tile change, not tile change size)
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
28,996
Reaction score
6,676
First Language
German
Primarily Uses
RMMV
please show the screenshots of the event with the commands if you want to know what you did wrong.
variables do not change unless commanded to do so.
 

Xyonel

Indie Developer, All-in-one artist.
Veteran
Joined
Jul 22, 2018
Messages
132
Reaction score
28
First Language
Italian
Primarily Uses
RMMV
the event list is really huge, how can I show all? and it's almost a finished script so I cannot distribute for the sake of the final game integrity, i try to put some pieces and feel free to ask if something is missing.

ok I can paste almost all code, i avoided only the calculation of depth ( I hope this will not ruin my game as a spoiler for someone.)
Capture.JPG
here the script continue with other three identical pieces of direction variables and of course label( I think this label is useless )
then at the end of calculating coordinate for spawn direction, start the depth calculation:

Capture2.JPG
this is the section cut, only calculation about depth and type of spawns, I checked and there are no variable call that conflict with get location info
Capture3.JPG

I noticed an error in the script about get location info in the third image at the beginning, under the three consecutive "end", i will adjust the get location info accordingly cause is declared after the If check, this however does not solve my problem (this simple error was caused by some trial in order to resolve my bug, i'll adjust that).
still checking for some clue in the script.
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,302
Reaction score
11,900
First Language
English
Primarily Uses
RMMV
You should have just kept this in your original thread where we discussed the layers.

Would you mind changing your MV theme to the 'light' theme and grabbing those screenshots again? The combination of pastel colours on a black background with white lines in between makes it really hard to read.

Can you also show a list of your variables so it's clear which ones are used in the Get Location Info and the script calls? One uses the name only and the other uses the id only, and there's nothing to show which ones match up.
 

Xyonel

Indie Developer, All-in-one artist.
Veteran
Joined
Jul 22, 2018
Messages
132
Reaction score
28
First Language
Italian
Primarily Uses
RMMV
Hey shaz, I thought that another different post would help me more quickly, I appreciate your help however, here are the screenshot you've requested:
Capture.JPG

... and the other directions...

Capture2.JPG

... and the other calculations...

Captur3.JPG Capture4.JPG Captur5.JPG Capture6.JPG Capture7.JPG Capture8.JPG
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,302
Reaction score
11,900
First Language
English
Primarily Uses
RMMV
Everything I can see above appears to be okay (keeping in mind some of those commands are cut off, but I'm assuming you're setting layer 2 to be whatever is in variable 21.

Can you please provide the full list of commands that sets the variables based on the player's facing direction?

I am thinking maybe one of those calculations is incorrect and it's looking at a wrong location. If that were the case, you would only have the issue when facing a certain direction, and you would ALWAYS have the issue when facing that direction ... unless there is an error in more than one direction branch.
 

Xyonel

Indie Developer, All-in-one artist.
Veteran
Joined
Jul 22, 2018
Messages
132
Reaction score
28
First Language
Italian
Primarily Uses
RMMV
more than one direction branch Shaz, in addition there's another bug(maybe is linked with the previously one), I'll show as first image the second bug and then other directional variables:
Capture3.JPG Capture.JPG Capture2.JPG


sometimes the error is more depth, beginning with no changetile it keep to not change these:

Capture4.JPG
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
28,996
Reaction score
6,676
First Language
German
Primarily Uses
RMMV
I think it will help you to restructure your event using subevents with the call command.
Place the part where you analyse the map (with the coordinate commands and get location info and all that) into an independent common event and have the original event call that common event at appropiate times.
Use the same principle for other parts that are distinct to organise your event better.

calling a common event makes that common event a subevent to the current event, retaining all special data (calling a common event from a map event still has all data from that map event for example), and that would help you making the event better readable especially if it is as long as the one you have. And that should help in locating any logic errors as well.
 

Xyonel

Indie Developer, All-in-one artist.
Veteran
Joined
Jul 22, 2018
Messages
132
Reaction score
28
First Language
Italian
Primarily Uses
RMMV
ok I'll try that.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,302
Reaction score
11,900
First Language
English
Primarily Uses
RMMV
Actually I think the entire event can be made much simpler, without looping and without branches. Can you explain what cave spawn hell and tile 55 are all about?

Are you able to zip up your project and send it to me to play with?
 

Xyonel

Indie Developer, All-in-one artist.
Veteran
Joined
Jul 22, 2018
Messages
132
Reaction score
28
First Language
Italian
Primarily Uses
RMMV
yes let me do a demo
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,302
Reaction score
11,900
First Language
English
Primarily Uses
RMMV
I'll grab it when I finish work this afternoon. Can you just give me a rundown on those spawn hell and tile 55 questions?

Edit: So I'm having a play around with it now, and while I haven't encountered any issues, I can give you a few comments on your design.

Firstly, the game has incredible lag. You have 3 parallel process common events all running at the same time, and none of them has a Wait command anywhere. Do you need all three of them? Can you combine them into just one? Or for the first two, can you add a Wait on every frame? Do those checks really need to be done 60 times a second?

Second, your common event for the cave building is massive. I would break it up into several common events. I have done this myself just to make it easier to see what's what. The first common event is set to parallel process. All it does is monitor for a keypress, and when that happens it calls the second and third common events. The second common event sets variables 13-20 based on the player's facing direction. The third common event is the one that handles changing the tiles. I have removed the cave counter loop, and just said "change the tile in front of the player, then the one in front of that, the one to the left, and the one to the right". For each of those last three, it calls the final common event which is the one that determines the tile id to change it to. In that common event, every time variable 21 is set, I added an Exit Event Processing command. This means it will only do a couple of conditions before determining the next tile id to draw, and will then jump out, rather than continue to do checks we know aren't going to be true.

Now the one serious issue that I found, after splitting all of that up and adding some console output each time a tile is changed, is that you have some errors in the section where you're determining what tile to draw. If you play with the console visible, you will probably run across this error sooner or later, as it outputs lots of red text to the console. You have several IF conditions where you say $gameVariables.value(12) = 999 and $gameVariables.value(12) = 1000. Those should be == and not = because the first is the comparison operator, and the second is the assignment. This needs to be fixed in every location where you've done it. It's not the cause of your problem though. I still haven't been able to reproduce it, so am continuing to try.


How exactly do you know that there's an issue with the Get Location Info command and that it SHOULD be returning a non-zero value but it's returning zero? Which variable are you looking at in the debug window, what are you expecting it to be, and what do you see on the map that indicates it hasn't worked? Can you make it happen then open the debug window, and grab a screenshot so I can see the map AND the debug window with the variable values? It seems to be doing exactly what I expect it to be doing.


Edit 2: Okay, I've got it. The issue is with your cave counter loop, going from 1 to 3, and the tests that are done inside. In some cases, if the tile it's about to draw has already been drawn (because you've changed direction), it won't attempt to draw the next tile. For example, you are going left and dig a tile. The tile in front of you changes to 17, and the one to the left, above and below it change as well. Then you step forward onto that tile and turn to face up. You dig. The tile in front of you changes to 17. Cave counter is 0, so it draws the tile above the one it's just done, and changes cave counter to 1. On the next iteration it's trying to draw the tile to the right, but it's already been drawn, so the tile id from Get Location Info is not 0. Therefore it does not redraw that tile, and it also doesn't increment cave counter. So the third tile, to the left, is never drawn because the test for cave counter = 2 fails. The next time you move, it will draw tile 17 in front of the player, but when it goes to draw the surrounding tiles, cave counter is already 1, so it's not going to draw the tile beyond and will go straight to checking left and right tiles.

The way I have rearranged your common event, removing the cave counter altogether, and tidying up (compressing) some of your other logic, this issue is completely removed. I will do a bit more testing, and will then send your common event file back to you. Just back up the one you already have, replace it with my version, and take a look at how I've reorganized things.
 
Last edited:

Xyonel

Indie Developer, All-in-one artist.
Veteran
Joined
Jul 22, 2018
Messages
132
Reaction score
28
First Language
Italian
Primarily Uses
RMMV
thanks It's an experienced work, I'm glad that you helped me to use your plugin properly, you'll be credit as well I'll create an easter egg in game(as I do for people who participated in my work intensively).
now it's time to studying your work and get used to it, then i'll move to other things.

Last thing I can say is that I must use a separated common event for stamina degradation used for some action(in world map for movement and in other situation like mine for digging) i'll try to implement by myself but feel free to suggest some directions :)

edit: a good implementation would be to avoid player trying to dig in permanent tiles(like surface dirt and rock)
I'll try that too
 
Last edited:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,302
Reaction score
11,900
First Language
English
Primarily Uses
RMMV
You could add a Wait 5 frames to your other common event, at the very top, because it's not something you have to check on every single frame. The digging one should not have a wait, because it needs to detect as soon as the key is pressed (I added a 1 frame wait and it wouldn't pick up all my key presses), but others that don't monitor for input should have a wait.

To avoid digging in permanent tiles, draw with a region code in the areas you don't want to be able to dig, then when looking at each tile, first check the region code (also using Get Location Info), and if it's that region code, just skip to the next step.

You might also want to put that along the edges of your map, so the player can't dig right to the edges - if they do, and they step to the edge and try to dig further, you might get an error trying to change a tile that doesn't exist.
 

Xyonel

Indie Developer, All-in-one artist.
Veteran
Joined
Jul 22, 2018
Messages
132
Reaction score
28
First Language
Italian
Primarily Uses
RMMV
bytheway i noticed that by standard your script does not "dig" tiles other than void ones, why?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,302
Reaction score
11,900
First Language
English
Primarily Uses
RMMV
I believe it does the same as yours, but the code is more compact.

You have:
Code:
If Caves tileid1 = 55
  do some stuff
Else
  If Caves tileid1 # 17
    do some other stuff
  End
End

For first direction,
If Caves tileid2 = 0
  If Caves tileid1 = 55
    do nothing
  Else
    change the tile
  End
End

For the second direction,
If Caves tileid3 = 0
  If Caves tileid1 = 55
    do nothing
  Else
    change the tile
  End
End

For the third direction,
If Caves tileid4 = 0
  If Caves tileid1 = 55
    do nothing
  Else
    change the tile
  End
End
On those 3 tiles to be changed, you say "do nothing" if tileid1 is 55. You can do the same thing by leaving out that test, and just putting those sections into the Else branch of the If Caves tileid1 = 55 test.

So I've changed it to this:
Code:
If Caves tileid1 = 55
  do some stuff
Else
  If Caves tileid1 # 17
    do some other stuff
  End
  If Caves tileid2 = 0 (first direction)
    change the tile
  End
  If Caves tileid3 = 0 (second direction)
    change the tile
  End
  If Caves tileid4 = 0 (third direction)
    change the tile
  End
End
Note that I haven't added any extra conditions to what you already had - I just removed some that were redundant by moving things around a bit, and I removed that looping you had in there.

The plugin commands in your original common event only get run if the Caves tileid2, 3, and 4 are 0. So you are also not digging tiles other than the void ones.
 
Last edited:

Xyonel

Indie Developer, All-in-one artist.
Veteran
Joined
Jul 22, 2018
Messages
132
Reaction score
28
First Language
Italian
Primarily Uses
RMMV
For your script i mean your plugin, i mean that does not overwrite the already draw tiles, why?

btw I managed to get cave hell spawn only one time, now I'm moving to adding stamina degradation.
stamina degradation is a stand alone common event, it's okay or a plugin is much more lagfree?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,302
Reaction score
11,900
First Language
English
Primarily Uses
RMMV
For your script i mean your plugin, i mean that does not overwrite the already draw tiles, why?
This is neither a script nor a plugin. It is an event. Scripts/plugins are very different.

Are you certain that yours did overwrite the already drawn tiles? You specifically say to only draw the tile if the tile id that's already there is 0. I'm doing the same thing as you.

Not sure on the event vs plugin for stamina degradation. However, I don't think this is going to work:
Code:
$gameVariables.value(6) === (18 || 19)
It's not valid javascript syntax.
 

Xyonel

Indie Developer, All-in-one artist.
Veteran
Joined
Jul 22, 2018
Messages
132
Reaction score
28
First Language
Italian
Primarily Uses
RMMV
I was referring to your PLUGIN"shaz change tile" XD

in a blank event if I use changetile plugin command(referred to your plugin, cause I'm not completely noob XD) the command does not overwrite the tile, I can check if other things happen, I'll inform in case, just need the info of overwriting(if it's part of the Script(script is the core of a plugin xD)


ok i tested the OR operator inside parenthesis, does not work, thanks!
another step forward in scripting!

now I'm using $gameVariables.value(6) >= (18) && $gameVariables.value(6) <= (19)
 
Last edited:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,302
Reaction score
11,900
First Language
English
Primarily Uses
RMMV
Oh, sorry. It should. It doesn't check anything that's already there - it just makes the change you tell it to make.

I haven't come across any issues where it doesn't work, and it worked for me in your project. If it's related to this map we can either continue troubleshooting it here, or you can post in the thread for the plugin. Show me which command doesn't appear to be overwriting the tile, and we'll take it from there.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Why is it that every time I take a short break from here, we get a new moderator?
Stream will be going live early today as I will be working on some music before I transition to art! When I switch to art, I will be focusing on making a new stream avatar~ Feel free to drop by!
For anyone who has uploaded a game to Steam and wonders if they actually check your game's build when you first upload it, I can personally vouch for Steam.
6 more towns to make in my game. SIX. not done with interiors yet but SIX EXTERIORS.
what to do when you come across a person that has stated "What if I say, f*** their EULA? I could probably get away with it." concerning asset packs sold here... on this site ...

Forum statistics

Threads
93,496
Messages
913,017
Members
123,031
Latest member
yasukun55
Top