Weird Grid Offsets [fixed]

Description: It's archive, posting new is here http://wohlsoft.ru/forum/viewforum.php?f=11

Sambo M
Topic author, Count
Count
Avatar
Sambo M
Topic author, Count
Count
Age: 25
Reputation: 15
Posts: 264
Joined: 27 Jun 2014

Post #1by Sambo » 17 Jan 2016, 1:21

In the newest version of PGE, NPC offsets are different from how they used to be. I like to have the grid for coins at 16x16, and they used to line up with the coins on a 32x32 grid, but in this version, the coins with a 16x16 grid are 4 pixels to the right of those on a 32x32 grid. This makes it so the grid locks them inside of blocks. I heard that in the newer version, the grid offset would be automatic, and would not need to be individually configured for each NPC. Apparently, the algorithm you used for this only works with a 32x32 grid.
Last edited by Sambo on 22 Jan 2016, 3:04, edited 1 time in total.
Image
Current Project:
Image

Wohlstand M
Lead Developer
Lead Developer
Avatar
Wohlstand M
Lead Developer
Lead Developer
Age: 30
Reputation: 493
Posts: 1747
Joined: 15 Feb 2014
English Pronouns: he/him
Location: Moscow, Russia
Website Youtube channel URL Skype Tencent QQ

Post #2by Wohlstand » 17 Jan 2016, 8:23

Value of grid offset should be less than half of grid size, or it will always be offseted to next cell. That a small mistake in the configs. If you redefining grid size, also modify grid-offset-x and grid-offset-y (in the npc.txt: gridoffsetx and gridoffsety)
And ya, npc.txt supports redefinition of grid size and grid offsets, but rise those values are not binded to npc.txt editor gui. (Values are will not be rejected, but you will can't edit them until I will append spin boxes for those values

Sambo M
Topic author, Count
Count
Avatar
Sambo M
Topic author, Count
Count
Age: 25
Reputation: 15
Posts: 264
Joined: 27 Jun 2014

Post #3by Sambo » 18 Jan 2016, 21:37

Ok, so if the grid size is 32 x 32 and the width is 28, the offset is 2.
What should it be then, if the grid size is 16 x 16?

In the older version of the editor, the coin NPC still aligned properly when I changed the grid size without changing the offsets, so I don't understand why that should be different now. Either way, adding 2 to the x position of the NPC should line it up correctly.

Let's say, for example, that I placed a coin at position (32,32). The x offset of 2 makes the coin's position (34,32), right? This should be the same on a 16 x 16 grid as on a 32 x 32 grid, but for some reason, this is not what happens.

Added after 27 minutes 14 seconds:
The grid settings in npc.txt don't seem to work.
I just put these in my npc-10.txt in my episode folder:

Code: Select all

grid=16
gridoffsetx=2

Nothing happened.
Image
Current Project:
Image

Wohlstand M
Lead Developer
Lead Developer
Avatar
Wohlstand M
Lead Developer
Lead Developer
Age: 30
Reputation: 493
Posts: 1747
Joined: 15 Feb 2014
English Pronouns: he/him
Location: Moscow, Russia
Website Youtube channel URL Skype Tencent QQ

Post #4by Wohlstand » 18 Jan 2016, 22:37

gridoffsetx 2 should be fine. In point from INI-file where are absolute offset relative to left-top corner. In the NPC.txt's I recently made offset relative pre-aligned position: that position is alignings to the middle of a cell by horizontal and aligns at bottom by vertical. Bossedit and Sednaiur are requested me make this to don't confuse them. Anyway I will check out stuff and if need, I will fix that
EDIT: Ouch, it's a bug, because wrong validation condition on those fields and validator reject those fields (try to open npc.txt file in PGE Editor and it will show that it thinks that those fields are "invalid", because checking condition is invalid :P)

FIXED!
anyway, for your case If you wish to keep same align position for coins, my recommended config would be:

Code: Select all

grid=16
gridoffsetx=0
gridalign=1

gridalign=1 means that NPC's horizontal center will be aligned to edge between cells while gridalign=0 means that NPC will be aligned at horizontal center of cell itself.

Sambo M
Topic author, Count
Count
Avatar
Sambo M
Topic author, Count
Count
Age: 25
Reputation: 15
Posts: 264
Joined: 27 Jun 2014

Post #5by Sambo » 22 Jan 2016, 3:04

OK. It works now. Thanks
Image
Current Project:
Image


Return to “Troubleshooting”

Who is online (over the past 5 minutes)

Users browsing this forum: 1 guest