Checking Terrain Tags with Conditional Branch

Dymdez

Newbie-in-Chief
Veteran
Joined
Feb 4, 2014
Messages
752
Reaction score
154
First Language
English
Primarily Uses
Hi - What is the easiest way to check a terrain tag? I want to setup a conditional branch that checks if the player is on a tile with terrain tag 5 then something happens. I know the script call for terrain tags is "$game_player.terrain_tag" but can't figure out how to get that meaningfully into a conditional branch.

Thank you
 

Juunanagou

Veteran
Veteran
Joined
Jul 19, 2012
Messages
122
Reaction score
42
First Language
Italian
Primarily Uses
Have you tried to make the condition

if Script ($game_player.terrain_tag==5)

It's on the fourth tab. I'm not sure if it will works but if that's the script call then I'd give a try.
 

Susan

Veteran
Veteran
Joined
Sep 1, 2014
Messages
2,748
Reaction score
8,346
First Language
No idea...
Primarily Uses
RMMV
You would have to have either a map event or common event running a parallel process while checking the terrain tag. You can use the script call mentioned by Juunanagou. You can use region ID this way as well.
 

Dymdez

Newbie-in-Chief
Veteran
Joined
Feb 4, 2014
Messages
752
Reaction score
154
First Language
English
Primarily Uses
Have you tried to make the condition

if Script ($game_player.terrain_tag==5)

It's on the fourth tab. I'm not sure if it will works but if that's the script call then I'd give a try.
Genius. Didn't know the conditional branches worked like this - thank you.

Susan, I will use a map event with player touch/below player on the tiles I want to trigger the condition, thank you!
 

Juunanagou

Veteran
Veteran
Joined
Jul 19, 2012
Messages
122
Reaction score
42
First Language
Italian
Primarily Uses
Tried out.

$game_map.terrain_tag(x,y)==5

change x and y with the x and y of the map of the part you want to check. I made a simple event that controlled if that part has that terrain tag that plays a sound and makes an exlamaton mark on the character and it works. The tag is not game_character but game_map. Hope it's the thing you are searching for.
 

Dymdez

Newbie-in-Chief
Veteran
Joined
Feb 4, 2014
Messages
752
Reaction score
154
First Language
English
Primarily Uses
Tried out.

$game_map.terrain_tag(x,y)==5

change x and y with the x and y of the map of the part you want to check. I made a simple event that controlled if that part has that terrain tag that plays a sound and makes an exlamaton mark on the character and it works. The tag is not game_character but game_map. Hope it's the thing you are searching for.
What you first suggested already worked - would this be an improvement, or?
 

Juunanagou

Veteran
Veteran
Joined
Jul 19, 2012
Messages
122
Reaction score
42
First Language
Italian
Primarily Uses
Dunno, at first it didn't worked, but I changed it because I probably made a mistake. I didn't know the conditional branch worked like this too, it's a new thing for me too. Probably the first is more generic, it checks all the terrain tags, while the second check a particular spot on the map. Maybe for you the first one is better since in a particular spot you know what tag you are walking on.
 

Susan

Veteran
Veteran
Joined
Sep 1, 2014
Messages
2,748
Reaction score
8,346
First Language
No idea...
Primarily Uses
RMMV
@Dymdex :

Having a parallel process event with this conditional branch eliminates the need for you to place multiple events on the map to check the same thing, which can cause your game to lag if used extensively. That's one of the purpose to have terrain tags and region IDs in the first place.

Plus, you can place other events on those tiles.

Example :

Try creating two 30 x 30 map with 25% of the tiles made of those with the terrain tag.

- On the first one, place the events on the map as you mentioned to check that condition..

- On the second one, create a parallel process event checking the same condition.

Do try it out.
 

Dymdez

Newbie-in-Chief
Veteran
Joined
Feb 4, 2014
Messages
752
Reaction score
154
First Language
English
Primarily Uses
Thank you, point made, you're certainly right and I will do that.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,853
Messages
1,016,986
Members
137,561
Latest member
visploo100
Top