Started by
Xeantho
on
Topic category: Advanced modding
I am attempting to make a Terraria-like NPC system. In this system I am using an item that needs to be in the inventory of the player as well as a procedure that checks if the floor beneath it in a 5x5 area is made of stone. I have tested it a few times and it doesnt seem to work. Any advice?https://imgur.com/a/MpqlN2t
Edited by Xeantho on Mon, 09/21/2020 - 18:42
It doesn't work because you're always using "x-y" to check the layer below the player. It should be "y-x" because if you check the layer x=1 and you're at layer 65 (for example) then 1-65 = -64 so it will check layer -64 (do you see what's the problem now?) It's because you substract. When you add stuff (x+1) then you have the right to don't care of the order you place the numbers.