- Joined
- Mar 2, 2016
- Messages
- 1
- Reaction score
- 0
- First Language
- English
- Primarily Uses
Hi there
I'm trying to create a script call to determine if two gameMap.events overlap running from a Conditional Branch IF statement.
So far I've got the following working correctly:
Math.abs($gameMap.event(001).x - $gameMap.event(002).x) + Math.abs($gameMap.event(001).y - $gameMap.event(002).y) == 1
My issue is that I want to introduce OR statements into the equation to account for instances where several different events might land interact with event 001. So far I have:
Math.abs($gameMap.event(001).x - $gameMap.event(002).x) + Math.abs($gameMap.event(001).y - $gameMap.event(002).y) == 1 || Math.abs($gameMap.event(001).x - $gameMap.event(003).x) + Math.abs($gameMap.event(001).y - $gameMap.event(003).y) == 1 || Math.abs($gameMap.event(001).x - $gameMap.event(004).x) + Math.abs($gameMap.event(001).y - $gameMap.event(004).y) == 1
I've tried a number of different variations on the code after searching around pretty extensively for answers, but I'm very new to Javascript and so far I'm coming up with nada. I feel like my problem is lying in the way I've used my OR (||) statements as the first event on event scenario (001 on 002) will still trigger the desired response, just none of the following ones.
I would be monumentally thankful for any assistance at this point.
Kind regards and thank you in advance.
Prod
I'm trying to create a script call to determine if two gameMap.events overlap running from a Conditional Branch IF statement.
So far I've got the following working correctly:
Math.abs($gameMap.event(001).x - $gameMap.event(002).x) + Math.abs($gameMap.event(001).y - $gameMap.event(002).y) == 1
My issue is that I want to introduce OR statements into the equation to account for instances where several different events might land interact with event 001. So far I have:
Math.abs($gameMap.event(001).x - $gameMap.event(002).x) + Math.abs($gameMap.event(001).y - $gameMap.event(002).y) == 1 || Math.abs($gameMap.event(001).x - $gameMap.event(003).x) + Math.abs($gameMap.event(001).y - $gameMap.event(003).y) == 1 || Math.abs($gameMap.event(001).x - $gameMap.event(004).x) + Math.abs($gameMap.event(001).y - $gameMap.event(004).y) == 1
I've tried a number of different variations on the code after searching around pretty extensively for answers, but I'm very new to Javascript and so far I'm coming up with nada. I feel like my problem is lying in the way I've used my OR (||) statements as the first event on event scenario (001 on 002) will still trigger the desired response, just none of the following ones.
I would be monumentally thankful for any assistance at this point.
Kind regards and thank you in advance.
Prod
