设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 92|回复: 0

[制作教程] Easy tile swapping

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    前天 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    4446

    主题

    864

    回帖

    2万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    22899
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    28239

    灌水之王

    发表于 前天 10:18 | 显示全部楼层 |阅读模式
    This tutorial goes over the Tile Swap script that I have recently revised. Some new changes have been made that make the tile swapping process very intuitive and easy to use.

    Required

    Tile Swap

    Introduction

    There are some concepts and terminology that you would need to be familiar with

    before effectively using this script.

    Tilesets in Ace

    RMVX Ace's tileset design takes a single tileset and splits it into 5 different

    tileset pages (A, B, C, D, E). It then takes the A-page and breaks it down

    into 5 more parts (A1, A2, A3, A4, A5)

    Tile Layers

    There are three layers that tiles may be placed: 0, 1, and 2.

    0 is the bottom-most layer, while 2 is on the top.

    In general, pages A1, A2, A3, and A4 tiles are drawn on layer 0 and 1, while pages A5 B, C, D, and E tiles are drawn on layer 2.

    Depending on the draw-order, you may need to specify which

    layer a tile should be drawn on.

    Referencing Tiles

    This script uses a custom concept of a "tile ID", which is a special string

    that represents a particular tile on a tileset page.

    The format of a tile ID is a letter, followed by a number.


    • The letter is the tileset page.
    • The number is the position of the tile on that page.
    So for example, "A3″ would be the the third tile in tileset page A, whereas"B12″ would be the 12th tile of tileset page B.

    A fast way to calculate the position is to use the formula

                            ((row - 1) * 8) + column                
    Click to expand...

    It is very easy to look up the position of a tile: just look at your tileset page and number the top-left tile as 1. Then, numbering left-to-right, top-to-bottom, you would get something like this





    For page A, it is a little different. This is assuming you have all 5 parts.

    If you are missing any parts, you will need to skip them appropriately.

    To avoid all the unnecessary math, simply fill up the empty slots with dummy tilesets to make life easier.





    Example

    Now that you understand how tile ID's work, here is a working example.

    In the oasis map, I want to reveal a hidden staircase at the bottom of the oasis





    This means that I will need to swap the water tiles with some sand tiles, and then add some stairs.

    1. Get the tile ID of the water tile in (row 2, column 3, so ((2 - 1) * 8) + 3 = 11)

    2. Get the tile ID of the dark sand tile (row 4, column 1, so ((4 - 1) * 8) + 1 = 25)

    Both tiles are in tileset page A.





    The script call I want to use to swap all water tiles with sand tiles is

    tile_swap("A11", "A25")Now I want the staircase. It is in page B, near the bottom.



    I would need to specify where the stairs will appear. I can choose to use a region swap or a position swap. In this case, I will use a position swap

    If you read the documentation, you will notice that I have a "layer" parameter.

    Tiles on pages B, C, D, E should appear on layer 2. If you are not sure which layer things should be on, just remember that autotiles are usually on layer 0 or 1, and everything else is on layer 2. In fact this doesn't really matter THAT much but if you run into strange tile issues it might be a layer problem.

    I want the stairs to appear at (21, 27), so the script call would be

    pos_swap(21, 27, "B223", 2)Now I want to add some plants at the bottom of the oasis. I will use a region swap to swap in one of the plants in page B to any region 10 tiles.



    The plants I want to use are "B89", on layer 2, so the script call would be

    region_swap(10, "B89", 2) Finally, I create an NPC that will perform these script calls



    And now I can test the final results









    All tile properties are swapped, such as passage settings, terrain tags, damage floor, etc. so can walk across the sand.





    It might be nice to fill the oasis with water again. Since we made several changes, it would probably be easiest to just revert everything.

    revert_allA more appropriate method is to revert each specific change

                    Code:        
    1. tile_revert("A11", 0)    # we changed A11 to A25, so now we want to revert changes to A11 on layer 0pos_revert(21, 27, 2)    # reverting changes on position (21, 27) layer 2region_revert(10, 2)     # reverting changes to region 10, layer 2
    复制代码



    Talking to the NPC would "put" the water back into the oasis





    By combining all three different types of tile swapping modes (tile ID, region ID, position), you can make interesting changes to the map dynamically and easily.


    本贴来自国际rpgmaker官方论坛作者:Tsukihime处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/easy-tile-swapping.9396/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-7-14 14:28 , Processed in 0.147932 second(s), 56 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表