The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX => VX Scripts Database => Topic started by: modern algebra on August 19, 2009, 12:39:14 AM

Title: Terrain Types (2k3)
Post by: modern algebra on August 19, 2009, 12:39:14 AM
Terrain Types
Version: 1.0
Author: modern algebra
Date: August 18, 2009

Version History



Description


This script restores the Terrain Types of RM2k3. Not only does this include a restoration of terrain tags (from XP), but it gives special settings that apply to tiles with those IDs. See Features for details.

Features


Screenshots

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg19.imageshack.us%2Fimg19%2F6829%2Fterrainsscreen.png&hash=fac48195f795cb57d0c8aee63a6f4cbc727df396) (http://img19.imageshack.us/i/terrainsscreen.png/)

Instructions

Please see the header and the three editable regions for instructions. You MUST read them carefully, as configuration is quite tedious and may be difficult if you don't know what you're doing.

Script


Script is quite large. It is attached as a text document (http://rmrk.net/index.php?action=dlattach;topic=34410.0;attach=17564), but I suggest you retrieve it from the demo instead, so you can see how it works a little. Configuration is very difficult.

Credit



Thanks


Support


Post in this topic for Support on this script. Please do not PM me.

Known Compatibility Issues

No currently known compatibility problems.

Demo


See Attached: Terrain Types Demo (http://rmrk.net/index.php?action=dlattach;topic=34410.0;attach=17563)

Author's Notes

I wrote this script a long time ago and only recently remembered it. I'm hoping I didn't forget to add anything :P


Creative Commons License
This script by modern algebra is licensed under a Creative Commons Attribution-Non-Commercial-Share Alike 2.5 Canada License.
Title: Re: Terrain Types (2k3)
Post by: miget man12 on August 19, 2009, 01:08:01 AM
Well there goes the use for my footsteps script down the drain... ;) I kid, I kid...

Very nice script! This is very very useful!! This is like a battle backs script, footsteps script and some features of you advanced areas script(I believe, maybe not though :D) meshed together, along with all the other features!! :)

Just out of curiosity, what are tables used for(I noticed that the Tile constants are tables instead of arrays or hashes)? Are they similar to Arrays? Not to go too off topic or anything, just kind of curious ;D

In another(unrelated) question; why do you only post your scripts here? It's amazing how many times people request scripts that are here :D Just wondering, for all I know you may just not want to... Okay I don't know where I'm going with this, but I'm just kind of curious ^_^

~Miget man12
Title: Re: Terrain Types (2k3)
Post by: modern algebra on August 19, 2009, 01:30:00 AM
haha, don't count on anything going down the drain :P. The configuration on this script is so heavy I'll be surprised if anyone uses it. The original reason I didn't post it was because I wanted to make a tool to make configuration easy, but I never got around to it. Besides, your footsteps script is really nice and easy to use - anyone who doesn't want all of these features are way better off just going for the single feature scripts that are out there, rather than going through the pain of configuring this just for one of the features.

As for tables - tables are sort of multi-dimensional arrays. Ruby's Array class doesn't run efficiently when handling large amounts of data; partly this is because they are so dynamic. You can have a 5 element array. and then put in for a 785th element and it wouldn't throw an error. Tables are fixed-size however, and they only take integers as values. Tables can be resized, but they have to be resized through a specific command. And like I said, they are multidimensional, so instead of array = [[[5, 6], [6, 6]], [[4, 5], [7, 5]]], which you could access like: array[0][1][0], you could make a Table like:

table = Table.new (2, 2, 2), and it would be accessed like this: table[0, 1, 0]


In the case of this script, the tables likely have little to no benefit. I used it only because they were fixed size and I did not need any dynamic function to it. Also, because the elements default to 0.

(I am not sure about this, but I also think tables only save non-zero elements and default return 0, rather than an array which would have to save every 0. That would make tables better for arrays that mostly consist of 0s. I might be mixing it up with something else entirely though)

As for only posting here. I sometimes post elsewhere, but I find the demands of support on larger forums takes a lot more time. (see how many times I post Try putting it under x script in this topic: http://www.rpgmakervx.net/index.php?showtopic=14687. That being said, they helped me find a lot of errors, so there are benefits to posting on larger forums)

Also, I like the community here a lot and I think it is easier for me and better for everyone if I keep all my scripts in one place and provide swift support rather than going here there and everywhere. But yeah, itès not that I have anything against other forums, just this is my favourite one and it is easier to provide support for my scripts if they are all in one place.
Title: Re: Terrain Types (2k3)
Post by: Grafikal on August 29, 2009, 08:20:21 PM
Hey MA, if you're around I figure it's simpler to ask you than to search around in the script. Is it possible to change it so that the player can walk on shallow and deep water only and not on land at all. Basically, instead of using the Ship vehicle or any standard vehicles I was hoping to just change actor graphic and using this change the tiles' passability on a whim.
Title: Re: Terrain Types (2k3)
Post by: modern algebra on August 31, 2009, 02:00:56 PM
Hey MA, if you're around I figure it's simpler to ask you than to search around in the script. Is it possible to change it so that the player can walk on shallow and deep water only and not on land at all. Basically, instead of using the Ship vehicle or any standard vehicles I was hoping to just change actor graphic and using this change the tiles' passability on a whim.

Umm, I can't really remember. I don't think so though. If you find a script that allows for changing hero pasability to ship or boat though, then I imagine the two would be compatible.
Title: Re: Terrain Types (2k3)
Post by: sdanzo on October 05, 2009, 12:26:23 PM
MA, Great script.  I agree it is heavy on the customization, but I like having as few 'logics' going as I can, so the diversity here is well worth it.  Just one thing; is there a way to call this script through an event, or to change a specific tile_id's attributes from a script or switch?  I am using Bulletxt's tile swapper, mostly for autotiles.  Right now I have a couple of autotiles that load as "swamp", with the damage =5 attribute.  This tile in a swapped tileset is a normal wasteland autotile (I think it is either tile_id 24 or 32).  I would like to add a script_call either to bulletxt's script, or to run when the switch controlling bulletxt's script is turned on.
Title: Re: Terrain Types (2k3)
Post by: modern algebra on October 05, 2009, 01:53:03 PM
You can try this code in a call script as you enter a new map:

Code: [Select]
ModernAlgebra::TT_TILE_X[y] = z

where X is the tileset, A, B, C, D, or E
y is the ID of the tile, 0-256
z is the terrain ID

I'm not positive that will work, and you'd definitely need to switch it back for the maps that don't use the swap.
Title: Re: Terrain Types (2k3)
Post by: sdanzo on October 05, 2009, 03:31:49 PM
MA, Thanks.  That works when using a teleport into a map with a new tileset perfectly, as long as it is put in the event prior to the actual teleport. 

For anyone using this with bulletxt's tile swap; calling $game_map.tileset to have a new tileset load on the current map will rerun the 'Terrain Types' with the values set up in the script.  I was able to have tile A24 be a 'damage causing swamp' in one map and normal 'no damage desert' in another, as long as TT_TILE_x[y] = z is before the tile swap commands and the teleport event.

Great Script!
Title: Re: Terrain Types (2k3)
Post by: Fizzly on October 22, 2009, 09:19:47 PM
This is so cool! I see many uses for that, missed that option from old RMs. Anyway, Owyn (aka modern_algebra), can I make thing, that while stepped on terrain ID = 3 for example, then the game switch number 3 is on? If yes, can you help me? ^^
Title: Re: Terrain Types (2k3)
Post by: modern algebra on October 22, 2009, 09:24:17 PM
No, not so much, but what you can do is set the terrain tag of the tile the player is on to a variable, and then check if the variable is 3. So, to do that, you would just use the code in a call script:

terrain_tag (variable_id, character_id)
  variable_id : the ID of the variable you are setting it to
  character_id : -1 => Player, 0 => This Event, >1 => event with that ID.

So,

terrain_tag (5, -1)

would set to variable 5 the terrain tag the player is standing on.

You could also put in X and Y coordinates to get the terrain tag of a particular position.
Title: Re: Terrain Types (2k3)
Post by: Fizzly on October 22, 2009, 09:52:49 PM
Thank you.  :)
Title: Re: Terrain Types (2k3)
Post by: Fizzly on April 17, 2011, 11:00:37 PM
Sorry for double posting, but... I have a problem.
I tried, tried and tried, but the SelfTT tags won't work for me :( I've still got the lower terrain tag ID.
Could you please help me and check the script, modern?
Title: Re: Terrain Types (2k3)
Post by: modern algebra on April 18, 2011, 12:15:17 AM
Well, it's \SelfOnlyTT, so make sure that's what you're using and not \SelfTT
Title: Re: Terrain Types (2k3)
Post by: Fizzly on April 18, 2011, 02:25:52 PM
Well, it's \SelfOnlyTT, so make sure that's what you're using and not \SelfTT
Yeah, sorry for being not too precise, but I'm using the correct code for sure. Even in your demo this tag won't work for me, I mean your 'stones in tall grass' sample.
Title: Re: Terrain Types (2k3)
Post by: modern algebra on April 18, 2011, 04:27:18 PM
Well, it works for me in the demo; did you add some other script?

Also, keep in mind that SelfOnlyTT is meant to make it so that the terrain tag features only apply to that event, it isn't supposed to change the terrain tag of the tile under it. If you wanted the event to change the terrain tag of the tile under it when you get it (by x, y via variable for instance), then you would use the \TerrainTag code, not \SelfOnlyTT

But if you are having problems in the demo and the stones in tall grass aren't totally semi-transparent, then maybe you've added another script? IDK, upload it and share it I guess, because I'm not having that problem in the demo.