Indie Dev

Hello Guest!. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, sell your games, upload content, as well as connect with other members through your own private inbox!

need help with npc vision script - sloved

Kit Ramos

Villager
Xy$
0.00
Hello, I'm trying to write a script for an npc that wonders around, where if the player gets to close the player is caught and sent to a different map. I get what needs to be done in the JavaScript part but not how to get the information the script needs or how to pop a dialog and send the player off once the script determines the player is to close.

I figure I need to:
1) get the players x cord and y cord, and then the npc's x,y and direction. and place those into js variables,
2) do some math calculate the cords the npc can currently see,
3) then compare that to the players cords to determine if the npc see's the player or not.
4) if so alert the player they've been caught and teleport them to the caught map.

Since I've used a lot of JavaScript on websites I've made I know how to do steps 2 and 3.
But I have nod idea how to do steps 1 and 4 so far all the tutorials I can find seem to focus on how to do steps 2 and 3 but no where can I find any listing of what to do for the other steps.

so if some one can please fill me in on the details here or least point me to where this information is written down it would be a great help.
[doublepost=1466136058,1463026290][/doublepost]Finally figured it out, once I found out I could get the console open with the F8 key and that it has autocomplete. I was able able to pick though to find what I needed. if anyone wants me to type up what I learned then let me know, otherwise just letting everyone know I fixed this issue.
 
Top