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!

can you check if a tile contains an event with a conditional scriptcall using either tile xy or screen xy?

CynicSyndrome

Towns Guard
Xy$
0.36
can you check if a tile contains an event with a conditional script call using either tile xy or screen xy? I cannot seem to find the right script for this, also I am wondering how to call for the value of map weather.
 

LTN Games

Master Mind
Resource Team
Xy$
0.01
You should be able to check against the events array in the map and compare their coordinates with yours.

Replacing 3 with the tile position you want, at least I'm pretty sure it's the tile position.
JavaScript:
$gameMap.events().some(event => {
    return event.x === 3 && event.y === 3
})
If you want screen position you can try this but my guess is it won't work as good as using the tile position
JavaScript:
$gameMap.events().some(event => {
    return event.screenX() === 3 && event.screenY() === 3
})
As for the type of weather currently being used on the map you can use this
JavaScript:
$gameScreen.weatherType() // Returns the type of weather on screen (rain, snow etc)

$gameScreen.weatherPower() // Returns the power of the weather
I hope this helps!
 
Top