Jump to content


Photo

Make tile passable in-game using events.


This topic has been archived. This means that you cannot reply to this topic.
10 replies to this topic

#1 Zhek

Zhek

    Member

  • Members
  • 10 posts

Posted 10 November 2012 - 12:17 PM

I need your help here folks. I'm trying to make a path which is only passable if certain event is on its square. More specifically, there's a pool which contains no water, but there is a box that you can move. When you trigger a switch, the pool would get full and the path will become available for the player, by walking on the box that floated on the water (assuming the player moved the box to the correct position, of course).

Any ideas about how to do this? I need to make a tile passable only on certain conditions, but how? I swear I looked for any command that'd do this, but no luck. Any advices?

Thank you very much.

#2 Hotfirelegend

Hotfirelegend

    Advanced Member

  • Members
  • 1,141 posts

Posted 10 November 2012 - 01:15 PM

Set THROUGH to ON/OFF after the event switch plays or when the condition is met.

Edited by Hotfirelegend, 10 November 2012 - 01:15 PM.


#3 Zhek

Zhek

    Member

  • Members
  • 10 posts

Posted 10 November 2012 - 01:42 PM

Set THROUGH to ON/OFF after the event switch plays or when the condition is met.

I thought about this but I see a problem, how do I prevent the player from walking on top of other areas? If I set Through to ON, wouldn't it be possible to go through walls and everything?

Edited by Zhek, 10 November 2012 - 01:43 PM.


#4 CustomMagnum

CustomMagnum

    Member

  • Members
  • 10 posts

Posted 10 November 2012 - 02:21 PM

I thought about this but I see a problem, how do I prevent the player from walking on top of other areas? If I set Through to ON, wouldn't it be possible to go through walls and everything?


It would do that, yeah. The only way to stop that would be if you put an events around the path that turned through for the player back off once they were outside of the path that you want them to go through.

#5 Hotfirelegend

Hotfirelegend

    Advanced Member

  • Members
  • 1,141 posts

Posted 10 November 2012 - 03:23 PM

I was pretty sure that if you set the THROUGH to ON on the tile itself, it would only allow you to go through THAT tile? If you set it on the player, then they can go through everything else.

#6 Zhek

Zhek

    Member

  • Members
  • 10 posts

Posted 10 November 2012 - 03:30 PM

It would do that, yeah. The only way to stop that would be if you put an events around the path that turned through for the player back off once they were outside of the path that you want them to go through.

It's not possible to do that in this case because the event (the path) is movable. It could be anywhere within the map.

I was pretty sure that if you set the THROUGH to ON on the tile itself, it would only allow you to go through THAT tile? If you set it on the player, then they can go through everything else.

No. Through ON that event would affect the event itself, it doesn't do anything to the player.

Anyone got any more ideas? I'm really stuck on this one. :(

#7 CustomMagnum

CustomMagnum

    Member

  • Members
  • 10 posts

Posted 10 November 2012 - 03:54 PM

It's not possible to do that in this case because the event (the path) is movable. It could be anywhere within the map.


No. Through ON that event would affect the event itself, it doesn't do anything to the player.

Anyone got any more ideas? I'm really stuck on this one. :(


Well, if you wanted to, you could always move the events that would put the path back to being impassable using variables to place them where they need to be, though that'd be a bit complicated and unwieldy if you need to do it a lot.

#8 Lunarea

Lunarea

    Artist

  • Admin
  • 5,666 posts

User's Awards

     

Posted 10 November 2012 - 04:20 PM

You can make the water tile passable for that tileset, then use a blank X tile in B to cover areas where the player can't walk. :)

My blog:

DevBlogSig.png

My current projects:

TUAH-userbar.png

Userbar-ST.png


#9 Zhek

Zhek

    Member

  • Members
  • 10 posts

Posted 11 November 2012 - 04:35 AM

Thank you all for your replies.

Well, if you wanted to, you could always move the events that would put the path back to being impassable using variables to place them where they need to be, though that'd be a bit complicated and unwieldy if you need to do it a lot.

I understand yor point there but it seems too complicated to place everything where it should be.

You can make the water tile passable for that tileset, then use a blank X tile in B to cover areas where the player can't walk. :)

Is it possible to make changes to this approach in-game? Because I only want some tiles of water to be passable UNDER certain conditions.

I'm starting to think this simple thing isn't possible to do in Maker Ace. :(

#10 Firgof

Firgof

    Advanced Member

  • Members
  • 99 posts

Posted 11 November 2012 - 04:51 AM

Edit 5: Got the whole thing rigged up and have an interactive demonstration for you. https://dl.dropbox.c...yr/BoxFlood.zip

Edit 6: Whoops; made some logical typos in the event code. Uploading the fixes and a few more demos in just a bit. Fixes are up, trying to figure out how to do this fire puzzle but the first demonstration is functional. :P

Does this satisfy what you need, Zhek?


With this system, creating a box puzzle (after the initial setup) should be as simple as calling two common events, some page setup for the box, and drawing two regions. I think it's a pretty user-friendly solution, despite the slightly long setup and some confusing switch/variable/tileset naming. I hope you can get some use out of this thing. I'm so satisfied with it, in fact, that I might clean it up some time and submit it to the tutorials section.

Instructions
Alright, so here are the instructions for using this system. First, copy-paste my pages into your box in your game. Ideally, you'll use the same variable slots I did but since I'm using the ones at the beginning of the list it's likely you're already using them. So correct the variables to the variables that you want to use. (e.g. PlayerX is at 0006 but you'd like it to be 0500, so reassign everything in the script that references 0006 with 0500; et cetera)

Step two is setting up the states of the tileset. I'm using two tilesets in my example (even though nothing graphically changes) -- one where the Dirt Field tile (you can mouse over a tile on the map and its name will be displayed in the bottom left of RMVXA's status bar) is passable and one where it's impassable. To properly represent the change, you'll want to make a quick edit to the tileset you're using to show that area being filled with water/lava/etc. In my example the passable version is tileset 0002 and the nonpassable is tileset 0001; you'll probably need to adjust this to fit the tileset you're using.

And finally, step three is creating the regions that the box is bound to and the regions that the player can walk off onto from the box. I'm using Regions 1 and 2 in my example. Region 1 governs where the box can move around in. If the player tries to shove it into a region that isn't 1 it'll refuse to budge. Region 2 is the offboarding: If the player is on the box and wants to move off it, they can only move to a region 2 area (though they can change their facing)

Some Quick Notes
First: Boxes don't check for collision with anything else but the region settings. This means your boxes can interpenetrate on the code-end but fail to penetrate on the movement end -- this might lead to 'phantom boxes' but I'm fairly confident that the way I coded it will safely escape that potential scenario.

Second: Don't make a billion boxes. The solution I'm using isn't very optimal and it's doing a lot of data manipulation and condition branching. If you're not using any 'heavy' scripts like a light and shadow rendering system, post-processing effects, and so forth you should be fine. If you are, watch your usage.

Third: The way I've set this up only supports one area being flooded per map If you need multiple bodies of what-have-you you'll have to modify the events so that each box gets assigned a 'body' and is only allowed to move when the flood switch for that body of water is active or, for a variable approach, when the flooded body's ID matches the ID that that box is allowed to float in.

Fourth: This method doesn't support differing 'levels' of flooding. It's on/off. The system can theoretically support it and I believe that regions can be reassigned at runtime (don't quote me on that) but I'm not sure how I'd advise you go about doing that.

Edited by Firgof, 11 November 2012 - 11:29 AM.

My posts are not endorsed by Blind Mind Studios and my opinions are not reflective of Blind Mind Studios'..

#11 Zhek

Zhek

    Member

  • Members
  • 10 posts

Posted 11 November 2012 - 01:01 PM

Edit 5: Got the whole thing rigged up and have an interactive demonstration for you. https://dl.dropbox.c...yr/BoxFlood.zip

Edit 6: Whoops; made some logical typos in the event code. Uploading the fixes and a few more demos in just a bit. Fixes are up, trying to figure out how to do this fire puzzle but the first demonstration is functional. :P

Does this satisfy what you need, Zhek?


With this system, creating a box puzzle (after the initial setup) should be as simple as calling two common events, some page setup for the box, and drawing two regions. I think it's a pretty user-friendly solution, despite the slightly long setup and some confusing switch/variable/tileset naming. I hope you can get some use out of this thing. I'm so satisfied with it, in fact, that I might clean it up some time and submit it to the tutorials section.

Instructions
Alright, so here are the instructions for using this system. First, copy-paste my pages into your box in your game. Ideally, you'll use the same variable slots I did but since I'm using the ones at the beginning of the list it's likely you're already using them. So correct the variables to the variables that you want to use. (e.g. PlayerX is at 0006 but you'd like it to be 0500, so reassign everything in the script that references 0006 with 0500; et cetera)

Step two is setting up the states of the tileset. I'm using two tilesets in my example (even though nothing graphically changes) -- one where the Dirt Field tile (you can mouse over a tile on the map and its name will be displayed in the bottom left of RMVXA's status bar) is passable and one where it's impassable. To properly represent the change, you'll want to make a quick edit to the tileset you're using to show that area being filled with water/lava/etc. In my example the passable version is tileset 0002 and the nonpassable is tileset 0001; you'll probably need to adjust this to fit the tileset you're using.

And finally, step three is creating the regions that the box is bound to and the regions that the player can walk off onto from the box. I'm using Regions 1 and 2 in my example. Region 1 governs where the box can move around in. If the player tries to shove it into a region that isn't 1 it'll refuse to budge. Region 2 is the offboarding: If the player is on the box and wants to move off it, they can only move to a region 2 area (though they can change their facing)

Some Quick Notes
First: Boxes don't check for collision with anything else but the region settings. This means your boxes can interpenetrate on the code-end but fail to penetrate on the movement end -- this might lead to 'phantom boxes' but I'm fairly confident that the way I coded it will safely escape that potential scenario.

Second: Don't make a billion boxes. The solution I'm using isn't very optimal and it's doing a lot of data manipulation and condition branching. If you're not using any 'heavy' scripts like a light and shadow rendering system, post-processing effects, and so forth you should be fine. If you are, watch your usage.

Third: The way I've set this up only supports one area being flooded per map If you need multiple bodies of what-have-you you'll have to modify the events so that each box gets assigned a 'body' and is only allowed to move when the flood switch for that body of water is active or, for a variable approach, when the flooded body's ID matches the ID that that box is allowed to float in.

Fourth: This method doesn't support differing 'levels' of flooding. It's on/off. The system can theoretically support it and I believe that regions can be reassigned at runtime (don't quote me on that) but I'm not sure how I'd advise you go about doing that.


Wow, very nice demo game you've made there. :D I'll be testing and trying to get this into my game. Thank you very much for your time, you don't know how much you've helped me. If I manage to improve it in some way, I'll post it so you can take advantage of it as well.

By the way, you should definately upload this to the Tutorials section because I'm pretty sure this could be useful for many people. :P