Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Help with player's terrain tag. (XP)

Alright so I'm having issues storing the player's terrain tag into a variable and I'm confused about where it gets the tag information from.

So I want the player to change graphics depending on terrain.
(example: player steps onto a ladder, changes into "climbing" graphic)
I have a common event that stores the player's terrain tag into a variable.
Then some more code changes the player's graphic based on the variable.

I set the terrain tag of the ladder tile to "1".
However, when the player walks onto this tile the variable remains at "0" and I'm positive the common event is processing.
Even when I make every layer on that tile a "1", the variable is still "0".
There are no other events affecting the variable in question.

So frustrated... anyone have any ideas?
 

Jason

Awesome Bro

I'm a little baffled about your explanation, but try this;

In your database, go to the tileset tab, and click on "Terain tag", and click all the tiles you want, to 1 (Or whatever)

Now, make a common event, inside the common event do this;

Control Variable, call it "Terrain ID" or something, click "Character" and click Terrain Tag

Now, under that, make a conditional branch;
If "Terrain ID" (The variable" is equal to 1

Then click OK

Then inside this conditional branch make it change character graphic to your climbing graphic.

In the "Else" put the normal character moving graphic. (Tried it and if not, your character will be climbing.. NOTHING)

Now somewhere on the map, make an event, make it parallel process, and call common event, and call the one you just made. (I called it Terrain ID same as the variable)

Hope that helped.
 
That's pretty close to how I have it. The problem isn't that the graphic isn't changing... the problem is that the variable isn't changing even though the player is on a different terrain tag. I have a common event that is constantly storing the player's tag into a variable but it seems to remain "0" even if the player walks onto a tile with a tag other than "0".

What's funny is that I'll change the terrain tag of the top-left tile (normally reserved for the "empty space" tile) and it will always be that tag.
 

Jason

Awesome Bro

CapnMuffin":12qw953c said:
That's pretty close to how I have it. The problem isn't that the graphic isn't changing... the problem is that the variable isn't changing even though the player is on a different terrain tag. I have a common event that is constantly storing the player's tag into a variable but it seems to remain "0" even if the player walks onto a tile with a tag other than "0".

What's funny is that I'll change the terrain tag of the top-left tile (normally reserved for the "empty space" tile) and it will always be that tag.

Then I have NO idea what you're doing, because it works fine for me, could you send me a demo and I'll take a look for you ?
 
Update: Weird... it seems the game is getting the player's terrain tag from the top-left most tile on the map.

If I change the top-left square of the map to a tile with a terrain tag of "1" then the player's terrain tag is always "1".

Could fotz' pixel movement script be causing this?
 
Quite likely-- a pixel movement script allows the characters to stand on more than one square at a time, after all, so it's bound to cause some interactions with this kind of thing.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top