Well, actually I need two, BUT THEY ARE VERY SIMILAR. They must be written for RPG Maker XP.
I'm afraid I don't know RGSS, but I do know how programming works, so I am able to provide the algorithms necessary in pseudocode.
Baisically, the first method, takes a value n, calculates X and Y distance between a method and the player, and will return TRUE if the player is within n the modulus of X and Y distance of the event (I am aware that this will form a square, but I'm okay with that)(Modulus, in case you don't know, is the positive value, so 1 is one and -1 is 1. Don't confuse with MOD, ie %). So the method call will have three inputs, the X and Y of a method and value n. I will be using this in the Conditional Branch of RMXP.
The second method is exactly the same, except that the X and Y values of the event are added together before comparing it to n, thus forming a Diamond area of detection. It'll make more sense once you look at the pseudocode.
Thankyou very much :D
I'm afraid I don't know RGSS, but I do know how programming works, so I am able to provide the algorithms necessary in pseudocode.
Baisically, the first method, takes a value n, calculates X and Y distance between a method and the player, and will return TRUE if the player is within n the modulus of X and Y distance of the event (I am aware that this will form a square, but I'm okay with that)(Modulus, in case you don't know, is the positive value, so 1 is one and -1 is 1. Don't confuse with MOD, ie %). So the method call will have three inputs, the X and Y of a method and value n. I will be using this in the Conditional Branch of RMXP.
The second method is exactly the same, except that the X and Y values of the event are added together before comparing it to n, thus forming a Diamond area of detection. It'll make more sense once you look at the pseudocode.
Square Algorithm;
Diamond Algorithm;
Code:
Square(Event, n){
Return((|Player.X-Event.X|>= n )AND((|Player.Y-Event.Y|>= n ));
}
Code:
Diamond(Event, n){
Return(( |Player.X-Event.X| + |Player.Y-Event.Y| ) >= n);
}
Thankyou very much :D