tilesets

Status
Not open for further replies.

FodasticoMan

Veteran
Veteran
Joined
Oct 11, 2015
Messages
41
Reaction score
3
First Language
Portuguese
<<English>>

Tilesets we can change the type of lock manually.
But if I want to change this lock through script?

For example, if I want to change the lock of the first tileset. The object that is in column five, line three. How to be? Something like:

$data_tilesets[1].block[3,5]=false;

$data_tilesets[1].block[3,5]=true;

<<Português Brasil>>

Tilesets no podemos alterar o tipo de bloqueio manualmente.
Mas se eu desejar alterar este bloqueio por meio de script?

Por exemplo, se eu desejo alterar o bloqueio do primeiro tilesets. O objeto que se encontra na coluna cinco, linha três. Como ficaria? Algo como:

$data_tilesets[1].block[3,5]=false;

$data_tilesets[1].block[3,5]=true;
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
I've moved this thread to RGSS3 Script Requests. Please be sure to post your threads in the correct forum next time. Thank you.

I think you mean passability? Normally you can't change that, because tileset data is static - it is set in the editor, and is not saved with the game data when you are playing.

This is the method that checks for passage settings:

#-------------------------------------------------------------------------- # * Check Passage # bit: Inhibit passage check bit #-------------------------------------------------------------------------- def check_passage(x, y, bit) all_tiles(x, y).each do |tile_id| flag = tileset.flags[tile_id] next if flag & 0x10 != 0 # [☆]: No effect on passage return true if flag & bit == 0 # [○] : Passable return false if flag & bit == bit # [×] : Impassable end return false # Impassable endTo change them during the game, you would need to have a script that will change tileset.flags[tile_id] (and calculate what the tile_id is based on your row/column) and set that bit to true or false. Then you would need to make sure if you closed the game and relaunched after the change, that the change is reapplied. And that if you save the game after the change, return to the menu and start a new game, that the change is not in effect in the new game, as you are changing data that is shared between all games.How many tiles do you need to change? If it's just one location on one map, you would normally just use events on those tiles that are either set to THROUGH or not. If it is quite a few tiles that are used a lot on a map or several maps, you could just have two versions of the tileset - one with the tiles passable and one without, and then use the Change Tileset command to switch between them (you would have to do this each time the map is loaded).
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
Presetting certain tile to become obstacles/pass-able is do-able in the script.

Similar to what Shaz said, it's in the passage check setting in game_map.

The way how the passage check works, it's impossible to pair switches with the 3 ready made checks. we will need to add "extra" checks to that method to make things work. (not only that, there will be boat/ship passage too).

The problem with that is, it's based on the tile id. and each autotile can end up with 9 ids. so depending on the blocks you need, it can be a big list to make. PLUS, when you change to a map with a different tileset, the tile ids are STILL the SAME. eg, world map & dungeon map actually shares the same tile ids. This will lead to lots of problems like when you block a tile in the world map, you might block a tile in dungeon map too. Though it can be overcome with switches(eg, switch 1 on = world map), it will still require the script user to at least understand a bit of coding to be able to add more than one set of blocks.

So instead of working the solution on tiles, why not try something like terrain tags or region ids?

Terrain Tag type check:

#==============================================================================# Meow Face's Passage Block with Switch (Terrain Version)#==============================================================================module MEOWCHECK#==============================================================================# Settings Area#==============================================================================  TERRAIN = [1,2,3] #Change this to terrain tag numbers you want to block  TSWITCH = 1 #Switch number to turn the block on/off#==============================================================================# End of Setting Area#==============================================================================endclass Game_CharacterBase  alias meowtpass? passable?  def passable?(x, y, d)    meow = MEOWCHECK::TERRAIN    x2 = $game_map.round_x_with_direction(x, d)    y2 = $game_map.round_y_with_direction(y, d)    if $game_switches[MEOWCHECK::TSWITCH]      meow.each do |m|        return false if $game_map.terrain_tag(x2, y2) == m      end    end    meowtpass?(x, y, d)  endend

Region type check:

#==============================================================================# Meow Face's Passage Block with Switch (Region Version)#==============================================================================module MEOWCHECK#==============================================================================# Settings Area#==============================================================================  REGION = [1,2,3] #Change this to region id numbers you want to block  RSWITCH = 1 #Switch number to turn the block on/off#==============================================================================# End of Setting Area#==============================================================================endclass Game_CharacterBase  alias meowrpass? passable?  def passable?(x, y, d)    meow = MEOWCHECK::REGION    x2 = $game_map.round_x_with_direction(x, d)    y2 = $game_map.round_y_with_direction(y, d)    if $game_switches[MEOWCHECK::RSWITCH]      meow.each do |m|        return false if $game_map.region_id(x2, y2) == m      end    end    meowrpass?(x, y, d)  endendedit:

both snippets are free for commercial/non-commercial games.
 
Last edited by a moderator:

FodasticoMan

Veteran
Veteran
Joined
Oct 11, 2015
Messages
41
Reaction score
3
First Language
Portuguese
Sorry, I am a little busy.
What I wanted was to do just that by script

 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,675
First Language
German
Primarily Uses
RMMV
If you want to change the passability for the entire tileset and not only for specific map position, why bother with a script at all?

Copy the tileset, make the changes you want and use the change tileset event command when you need that change.
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
Like what Shaz above that is impossible. Because the data are only read once at game loads.

And the passage check only provide checks for ☆ ○ ×, so if you want to change it via script, you will effect EVERYTHING else in the game that uses the same tile setting. And like i said above, the way to do it via script will be adding a list of tile id you want to block and turn it on/off with a switch. But it's not an easy task for someone who doesn't know how to script.

That's why i suggest you use either terrain tag block or region block.

http://forums.rpgmakerweb.com/index.php?/topic/45822-tilesets/#entry458918

You can do what Andar said for a non-script solution.

Prepare 2 sets of tilesets and swap them in game. one with × the other with ○
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Yep, do what Andar said. Two tilesets, two passability settings. Use the Change Tileset command when you want to switch between them.
 

FodasticoMan

Veteran
Veteran
Joined
Oct 11, 2015
Messages
41
Reaction score
3
First Language
Portuguese
<<English>>

I want to place or remove the blocking of the first titleset. I know the command to access the first titleset is:
$ data_tilesets [1]

But I do not know the rest. I figured it would look something like:
$ data_tilesets [1] .block [3,5] = false;
$ data_tilesets [1] .block [3,5] = true;

To change the lock object to free passage. As shown image above.

<<Português Brasil>>

Eu quero colocar ou remover o bloqueio do primeiro titleset. Sei que o comando para acessa o primeiro titleset é:
$data_tilesets[1]

Porém não sei o restante. Eu deduzi que seria parecido com algo como:
$data_tilesets[1].block[3,5]=false;
$data_tilesets[1].block[3,5]=true;

Para mudar o objeto de bloqueado para passagem livre. Conforme o exemplo acima
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,675
First Language
German
Primarily Uses
RMMV
<<English>>


I want to place or remove the blocking of the first titleset. I know the command to access the first titleset is:


$ data_tilesets [1]


But I do not know the rest. I figured it would look something like:
That is nothing as a repeat of the original post.
Unfortunately that is IMPOSSIBLE - tilesets are read-only and you need to use a workaround.


Why can't you use one of the workarounds given above?


Why do you want to change the tileset passability? can you tell us that?


We can't help you if you only tell us what you want to do, we need to know why you wan tto do that - what the use in your game is. Because only then we can give you a direct workaround that will fit.
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
If you don't want to make 2 tilesets.

Use the script i provided above and turning on/off a switch will allow you to change the forest block.



If you do not understand how to use a script. Click the link in Andar's signature.
 

FodasticoMan

Veteran
Veteran
Joined
Oct 11, 2015
Messages
41
Reaction score
3
First Language
Portuguese
I will give an example of how it would be helpful if it could be done.


When Bo, character Breath of Fire was ahead of the other characters. he can cross all map forests.

If the option that i spoke existed it would be incredibly easy to do.

[Off Topic]
I analyzing the RPG Maker, I see that a lot needs to be done. should add the option -> Options from the main menu. And within options: Screen resolution, >>>language<<<, volume of sounds ...

>>>Language<<< would have a basis for the developer to implement or remove it from easily options menu, If you were not using

This should be standard in the RPG Maker. In fact, the screen resolution should automatically adjust the user's screen resolution.

Should have this battle option also in RPG Maker:


The person choose when creating the game:
RPG with turn-based battle.
RPG with real-time battle.

I know there are ready scripts. But it should also be standard in RPG Maker.

I'll stop here.
[End of off topic]

Thanks again to all. You can close the topic
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,675
First Language
German
Primarily Uses
RMMV
I will give an example of how it would be helpful if it could be done.


When Bo, character Breath of Fire was ahead of the other characters. he can cross all map forests.


If the option that i spoke existed it would be incredibly easy to do.
No, it would be even easier to do with the event command to change the tilesets.


1) you make one tileset with general passability


2) you copy that tileset, rename it into "Bo version" and change the passability on that special tileset to allow passability for bo


3) at any place where the order of the party can be changed, you place a command to change the tileset based on who is the leader.


You might even do a parallel process checking that without any need of a script if you don't want to block or change formation menu access.


Next time you want something closed, simply report your topic. Closing
 
Status
Not open for further replies.

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

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,863
Messages
1,017,053
Members
137,571
Latest member
grr
Top