Jump to content
Reat

Using Terrain Tags

Recommended Posts

Terrain Tags are a new feature introduced in Ace. They can be accessed in the Tileset tab of the Database, on the right side list of buttons. A single tileset can have up to 8 different terrain tags set. On their own, these tags don't do anything, and the command Get Location Info: Terrain Tag must be used in events. What you can do with these tags is far more versatile than they appear. Terrain Tags can do many of the functions of Regions, but on a larger scale and with less busy work for the game maker. I have two examples that illustrate what you can do with them:

 

*Note: this tutorial assumes you have basic understanding of writing events, using conditional branching, variables, ect*

 

TILE-BASED RANDOM BATTLES

 

This one is simple: changes random battles to only occur on specific tiles, such as bush tiles, in a similar vein as how random battles work in the Pokémon series.

 

The first step is to create a common event named Random Battles (or whatever you want) with a Trigger: Parallel Process and a Condition Switch: Random Battles. You will need to set three variables: one for the player's X value, one for the player's Y value, and the last to hold the location info value. The code inside the event should be as follows:

 

Control Variables: [0001:X] = Players Map X
Control Variables: [0002:Y] = Players Map Y
Get Location Info: [0003], Terrain Tag, Variable [0001][0002]
Conditional Branch: Variable [0003:Location Info] == 1
	Change Encounter: Enable
Else
	Change Encounter: Disable
Branch End

 

And that's the entire code! Now you have two more steps, but they are relatively easy. The first is to go to tileset -> terrain tag and denote whatever tiles you want to have encounters in as terrain tag 1 (just click on them once if they're at the default of 0). I used the bush tiles in the A tab. The second step is for when you place random battles in the map properties: make sure you have the troop ranges to be the whole map, not by region. And that's it! Now wherever you place the designated tiles and have troops enabled, random battles will only occur in that location. This save you a lot of time having to place regions by hand over all your maps. If you want random encounters to occur anywhere on the map, such as in a cave or dungeon, simply flip the Condition Switch: Random Battles off.

 

CHANGE ACTOR GRAPHIC DEPENDING ON LOCATION

 

This event is just as simple as the previous one. What it does is change the actor's graphic depending on their location - so if they are swimming it will automatically change to a swimming graphic, and back to a walking graphic if they go on land.

 

The first step is to create a common event named Swimming (or whatever you want) with a Trigger: Parallel Process and a Condition Switch: Swimming. You will need to set three variables: one for the player's X value, one for the player's Y value, and the last to hold the location info value (you can reuse the ones in the previous code if you're using them both). The code inside the event should be as follows:

 

Control Variables: [0001:X] = Players Map X
Control Variables: [0002:Y] = Players Map Y
Get Location Info: [0003], Terrain Tag, Variable [0001][0002]
Conditional Branch: Variable [0003:Location Info] == 1
	Change Actor Graphic: [Eric], 'swimming eric', 0, 'Actor4', 0
Else
	Change Actor Graphic: [Eric], 'Actor4', 0, 'Actor4', 0
Branch End

 

And that's the entire code! Now you have two more steps, but they are relatively easy. The first is to go to tileset -> terrain tag and denote whatever tiles you want to change the graphic while on. I used the coast tiles in the A tab. The second step is for you to change the passage setting for those tiles so the player can freely enter and exit them. And that's it! You can use the darker ocean tiles as a border to keep the player from swimming too far into the water, and If you want to keep the player from swimming entirely, simply flip the Condition Switch: Swimming off.

 

CLIFF JUMPING

 

This one is a bit more complex, but allows you to do something that would otherwise require and endless number of events per map: jump down cliffs! Again using the Pokemon series as an example, this common event will allow you to jump down one tile cliffs just as is common in that game. Useful for creating puzzles or easy ability to leave dungeons or limit the ability for player's to backtrack.

 

The first step is to create a common event named Cliff Jumping (or whatever you want) with a Trigger: Parallel Process and a Condition Switch: Jumping. You will need to set three variables: one for the player's X value, one for the player's Y value, and the last to hold the location info value (you can reuse the ones in the previous codes if you're using them all). The code inside the event should be as follows:

 

Conditional Branch: The C Button is Being Pressed #Note: the C button is the trigger button for me 'z'#
	  Control Variables: [0001:X] = Players Map X
	  Control Variables: [0002:Y] = Players Map Y
	  Conditional Branch: Player is Facing Down
			   Control Variables: [0002:Y] += 1
			   Get Location Info: [0003], Terrain Tag, Variable [0001][0002]
			   Conditional Branch: Variable [0003:Location Info} == 2
						 Set Move Route: Player (Wait)
								  Jump: +0,+2
								  SE: 'Jump1', 80, 100
			   Branch End
	  Branch End
	  Conditional Branch: Player is Facing Up
			   Control Variables: [0002:Y] += -1
			   Get Location Info: [0003], Terrain Tag, Variable [0001][0002]
			   Conditional Branch: Variable [0003:Location Info} == 3
						 Set Move Route: Player (Wait)
								  Jump: +0,-2
								  SE: 'Jump1', 80, 100
			   Branch End
	  Branch End
	  Conditional Branch: Player is Facing Right
			   Control Variables: [0002:X] += 1
			   Get Location Info: [0003], Terrain Tag, Variable [0001][0002]
			   Conditional Branch: Variable [0003:Location Info} == 4
						 Set Move Route: Player (Wait)
								  Jump: +2,+0
								  SE: 'Jump1', 80, 100
			   Branch End
	  Branch End
	  Conditional Branch: Player is Facing Left
			   Control Variables: [0002:X] += -1
			   Get Location Info: [0003], Terrain Tag, Variable [0001][0002]
			   Conditional Branch: Variable [0003:Location Info} == 5
						 Set Move Route: Player (Wait)
								  Jump: -2,+0
								  SE: 'Jump1', 80, 100
			   Branch End
	  Branch End
Branch End

 

And that's the entire code! Now you have two more steps. The first is to find a cliff sprite that is one tile in total such as the small cliffs made by Mack. This code does not work with the RTP cliffs, at best you can use it to jump down but not in the other directions. Once you have the new sprites, set them in any tab other than A of a tilesheet and go to Tileset -> Terrain Tag. Set the bottom tile as 2, the upper tile as 3, the leftmost tile as 4, and the rightmost tile as 5. Basically, make sure you set it as the direction the player is facing when they are jumping downhill. That's it! Now just place those tiles on a map and make sure Condition Switch: Jumping is set to on. One last word of advice though: make sure wherever you place these cliffs, that you actually want the player to jump down them! If a non-passable tile is set where a player can jump, they will get stuck, so map with care!

Edited by Reat

Share this post


Link to post
Share on other sites

For the random battles you could just use regions but that is a good idea.

 

True, but the big reason to write up this common event is so you don't have to click down regions on every map tile you want random battles on. With large/numerous maps, it would become ridiculously tedious, especially since you can't lay down regions in rectangles/flood like you can with the tiles themselves.

Share this post


Link to post
Share on other sites

I have a question for you Reat, if you don't mind me hijacking your thread to do so. :)

 

Is there any way to use that first script of yours to make certain tiles impassable? I'm trying to make a quicksand-ish tile for an RPG I'm working on, but I want the player to be able to cross said tiles if he/she owns a horse. Basically, if you have a horse, you can pass. Otherwise, you can't. I don't want to place 50+ events on the map just to pull it off, as that would be clunky and inefficient.

 

Thanks in advance for your time! :)

Share this post


Link to post
Share on other sites

I have a question for you Reat, if you don't mind me hijacking your thread to do so. :)

 

Is there any way to use that first script of yours to make certain tiles impassable? I'm trying to make a quicksand-ish tile for an RPG I'm working on, but I want the player to be able to cross said tiles if he/she owns a horse. Basically, if you have a horse, you can pass. Otherwise, you can't. I don't want to place 50+ events on the map just to pull it off, as that would be clunky and inefficient.

 

Thanks in advance for your time! :)

 

Unfortunately I don't see any way to change tileset passage settings directly through events, so hopefully this simple solution will work. I haven't tested it myself though:

 

Make a copy of the tileset of the map, but with the quicksand or whatever set as passable.

 

When you mount the horse, use the event change tileset to the duplicate - everything should look the same but the passage settings have changed. When you dismount the horse, have it change the tileset back to the original. Let me know if it works or not.

Share this post


Link to post
Share on other sites

 

Unfortunately I don't see any way to change tileset passage settings directly through events, so hopefully this simple solution will work. I haven't tested it myself though:

 

Make a copy of the tileset of the map, but with the quicksand or whatever set as passable.

 

When you mount the horse, use the event change tileset to the duplicate - everything should look the same but the passage settings have changed. When you dismount the horse, have it change the tileset back to the original. Let me know if it works or not.

 

Thanks a bunch Reat! It works like a charm. :)

 

Now, to switch my character's sprite with a horse every time he enters quicksand... :D

Share this post


Link to post
Share on other sites

 

I have a question for you Reat, if you don't mind me hijacking your thread to do so. :)

 

Is there any way to use that first script of yours to make certain tiles impassable? I'm trying to make a quicksand-ish tile for an RPG I'm working on, but I want the player to be able to cross said tiles if he/she owns a horse. Basically, if you have a horse, you can pass. Otherwise, you can't. I don't want to place 50+ events on the map just to pull it off, as that would be clunky and inefficient.

 

Thanks in advance for your time! :)

Unfortunately I don't see any way to change tileset passage settings directly through events, so hopefully this simple solution will work. I haven't tested it myself though:

 

Make a copy of the tileset of the map, but with the quicksand or whatever set as passable.

 

When you mount the horse, use the event change tileset to the duplicate - everything should look the same but the passage settings have changed. When you dismount the horse, have it change the tileset back to the original. Let me know if it works or not.

 

Umm....I don't really understand what do you mean by mount the horse,use the event change tileset to the duplicate.Please teach me how to do it.....................

Share this post


Link to post
Share on other sites

Great tutorial Reat.

 

 

Is there any way to use that first script of yours to make certain tiles impassable? I'm trying to make a quicksand-ish tile for an RPG I'm working on, but I want the player to be able to cross said tiles if he/she owns a horse. Basically, if you have a horse, you can pass. Otherwise, you can't. I don't want to place 50+ events on the map just to pull it off, as that would be clunky and inefficient.

 

How does the player mount the horse? Is it through an inventory item or an event?

If the horse is an item in the player's inventory then you can adjust a switch or a variable (depending on how you do things) and have an additional conditional branch that checks for the switch/variable before the branch for locations.

If it's through an event you could have a line in the event that does the same switch/variable change.

Share this post


Link to post
Share on other sites

Your content will need to be approved by a moderator

Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×