Justn Posted June 21, 2013 Author Share Posted June 21, 2013 Hello guys I'm having an issue that I can't seem to solve on my own with this code..```' Check to see if a npc is already on that tile For i = 1 To Npc_HighIndex If MapNpc(i).num > 0 Then If MapNpc(i).x = x Then If MapNpc(i).y = y Then CheckDirection = True Exit Function End If End If End If Next```this is the code in a deafult eo to stop a player from walking on a tile with a npc on it.. The problem is that it only checks if they are on the same x or y so, left right up and down. I am trying to make it check all 8 sides surrounding a player but cant figure it out. I have tried lots of things but no matter what i change it just makes me walk through npcs from all directions.. Can someone help me out and teach me to check all 8 sides for an npc? =/ Link to comment Share on other sites More sharing options...
Sigait Posted June 21, 2013 Share Posted June 21, 2013 The x and y position in a 2D world represent the point,you can go to that point from either direction left right up down or vertical directions but still what you have to check is your x and y with the npc's x and y so,I don't see why it is a problem.Regards,Relative Null. Link to comment Share on other sites More sharing options...
Stein Posted June 21, 2013 Share Posted June 21, 2013 This doesn't specifically check left, right, up, down. It checks if anything is on the X/Y provided. Link to comment Share on other sites More sharing options...
Justn Posted June 21, 2013 Author Share Posted June 21, 2013 Ok thanks guys that makes more sense for some reason its not reading the x and y that are provided in the bit of code above that Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now