Hello everybody!
I have posted in the thread ''JavaScript questions that don't deserve their own thread'' to be told to create my own thread!
And seems like I won't get around writing a proper function, which I am too noob with to do.
(Basic script calls more or less are already enough if not too overwhelming to handle for me)
Alright so what I need help with, because my brain cannot get around this and I really want it to be solved somehow:
In this example - which is fairly easy to understand - it returns true whenever the player is standing on Region with number 104 or below (Or no number at all).
It returns false whenever the player is standing on Region with number 105 and above.
What I wish to accomplish however, is that the game / event or whatever I call this script from, will know BEFORE the player or event even gets on top of the Region(s) and then turns to false! Like 1 or 2 tiles away it realizes ''Oh there is a wall or blocked Region up ahead so I cannot do this action now because I require at least 3 tiles distance in x and y pos. Or ohh how sad, I have to disappear or be destroyed in 2 or 1 tiles before I collide with specified Region''.
My brain would think it is as simple to do something to add and substract numbers to and from the respective x and y positions.
But that sadly did not work and just shifted the positions around to mess everything up completely.
So any help with this would be appreciated. And if possible, I would want to do this with scripts in Engine and not with Plugins.
However, if the Plugin is definitely 100% surely proved to work and never interfere with anything else ever even with the worst written other Plugins, then I would also take this.
Thanks for your time!
I have posted in the thread ''JavaScript questions that don't deserve their own thread'' to be told to create my own thread!
And seems like I won't get around writing a proper function, which I am too noob with to do.
(Basic script calls more or less are already enough if not too overwhelming to handle for me)
Alright so what I need help with, because my brain cannot get around this and I really want it to be solved somehow:
Code:
if($gameMap.regionId($gamePlayer.x, $gamePlayer.y) < 105)
{
console.log(true);
}
else if($gameMap.regionId($gamePlayer.x, $gamePlayer.y) >= 105)
{
console.log(false);
}
In this example - which is fairly easy to understand - it returns true whenever the player is standing on Region with number 104 or below (Or no number at all).
It returns false whenever the player is standing on Region with number 105 and above.
What I wish to accomplish however, is that the game / event or whatever I call this script from, will know BEFORE the player or event even gets on top of the Region(s) and then turns to false! Like 1 or 2 tiles away it realizes ''Oh there is a wall or blocked Region up ahead so I cannot do this action now because I require at least 3 tiles distance in x and y pos. Or ohh how sad, I have to disappear or be destroyed in 2 or 1 tiles before I collide with specified Region''.
My brain would think it is as simple to do something to add and substract numbers to and from the respective x and y positions.
But that sadly did not work and just shifted the positions around to mess everything up completely.
So any help with this would be appreciated. And if possible, I would want to do this with scripts in Engine and not with Plugins.
However, if the Plugin is definitely 100% surely proved to work and never interfere with anything else ever even with the worst written other Plugins, then I would also take this.
Thanks for your time!
