Need Help With NPC Housing.

Started by Xeantho on Mon, 09/21/2020 - 18:41

Topic category: Advanced modding

Last seen on 02:16, 29. Oct 2020
Joined Sep 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Need Help With NPC Housing.
Mon, 09/21/2020 - 18:42 (edited)

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
Last seen on 23:09, 29. Oct 2020
Joined Jun 2015
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
It doesn't work because you…
Mon, 09/21/2020 - 23:36

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.