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

[转载发布] KSteps2Doom XP

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

    连续签到: 2 天

    [LV.7]常住居民III

    9015

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 2026-7-26 10:16:44 | 显示全部楼层 |阅读模式
    KSteps2Doom XP

    by Kyonides


    Introduction

    This script turns the map's encounter steps as a fixed number.
    It features a simple HUD to let you know when you are about to trigger a random encounter on the current map.
    The HUD will disappear if you leave any of the terrain tags belonging to a specific troop group.
    You have set no such troop groups on that map via script call?

    Well, that means you will just fight the same old random troops of yore.






    Spoiler: The Script
                    Ruby:       
    1. # * KSteps2Doom XP * #
    2. #   Scripter : Kyonides Arkanthes
    3. #   2024-03-19
    4. # This script turns the map's encounter steps as a fixed number.
    5. # It features a simple HUD to let you know when you are about to trigger a
    6. # random encounter on the current map.
    7. # Terrain Tags can be used to set separate Troop groups in game via script call.
    8. # * Script Calls * #
    9. # - Define a Terrain Tag for 1+ Enemy Troops
    10. # $game_map.troop_terrains[TroopID] = [Index0, etc.]
    11. # troop_terrains(TroopID, Index0, etc.)
    12. module KSteps2Doom
    13.   BACKDROP       = ""
    14.   BATTLE_ICON    = "046-Skill03"
    15.   ICON_OFFSET_X  = 32
    16.   COUNTER_X      = 4
    17.   COUNTER_Y      = 4
    18.   VIEWPORT_WH    = [640, 480]
    19.   # The rest of the Constants will be ignored if the BACKDROP exists.
    20.   COUNTER_WH     = [104, 26]
    21.   # [Red, Green, Blue, Alpha] # Alpha is Optional!
    22.   BACKDROP_COLOR = [0, 0, 0, 128]
    23. end
    24. class Game_Map
    25.   alias :kyon_steps2doom_gm_map_setup :setup
    26.   def setup(map_id)
    27.     kyon_steps2doom_gm_map_setup(map_id)
    28.     @troop_terrains = {}
    29.   end
    30.   def bottom_terrain_tag(x, y)
    31.     return 0 if @map_id == 0
    32.     tile_id = data[x, y, 0]
    33.     return 0 unless tile_id
    34.     @terrain_tags[tile_id] > 0 ? @terrain_tags[tile_id] : 0
    35.   end
    36.   attr_reader :troop_terrains
    37. end
    38. class Game_Player
    39.   alias :kyon_steps2doom_gm_plyr_up :update
    40.   attr_reader :encounter_steps
    41.   def make_encounter_count
    42.     @encounter_steps = $game_map.encounter_step
    43.     @encounter_count = @encounter_steps
    44.   end
    45.   def encounter_steps
    46.     @encounter_steps - @encounter_count
    47.   end
    48.   def terrain_tag
    49.     $game_map.bottom_terrain_tag(@x, @y)
    50.   end
    51.   def encounter_changed?
    52.     terrain_tag == 0 and @last_count != @encounter_count
    53.   end
    54.   def update
    55.     @last_count = @encounter_count
    56.     last_moving = moving?
    57.     kyon_steps2doom_gm_plyr_up
    58.     update_encounter(last_moving)
    59.   end
    60.    
    61.   def update_encounter(moved)
    62.     @encounter_count += 1 if !moving? and moved and encounter_changed?
    63.   end
    64. end
    65. class Interpreter
    66.   def troop_terrains(troop_id, *indexes)
    67.     $game_map.troop_terrains[troop_id] = indexes
    68.   end
    69. end
    70. class EncounterSprite < Sprite
    71.   include KSteps2Doom
    72.   def initialize(vp=nil)
    73.     super(vp)
    74.     self.x = COUNTER_X
    75.     self.y = COUNTER_Y
    76.     @color = Color.new(*BACKDROP_COLOR)
    77.     make_bitmap
    78.     make_rect
    79.   end
    80.   def make_bitmap
    81.     if BACKDROP.nil? or BACKDROP.empty?
    82.       self.bitmap = Bitmap.new(*COUNTER_WH)
    83.       bitmap.fill_rect(bitmap.rect, @color)
    84.     else
    85.       self.bitmap = RPG::Cache.picture(BACKDROP)
    86.     end
    87.     icon = RPG::Cache.icon(BATTLE_ICON)
    88.     bitmap.blt(8, 0, icon, icon.rect)
    89.   end
    90.   def make_rect
    91.     iox = ICON_OFFSET_X
    92.     @text_rect = Rect.new(iox, 0, bitmap.width - iox - 4, bitmap.height)
    93.     @one_time = true
    94.   end
    95.   def refresh
    96.     self.visible = $game_player.terrain_tag > 0
    97.     steps = $game_player.encounter_steps
    98.     return if @last_steps == steps
    99.     @last_steps = steps
    100.     self.bitmap.clear
    101.     make_bitmap
    102.     counter = sprintf("%02d/%02d", @last_steps, $game_map.encounter_step)
    103.     bitmap.draw_text(@text_rect, counter)
    104.   end
    105.   def dispose_all
    106.     bitmap.dispose
    107.     dispose
    108.   end
    109. end
    110. class Spriteset_Map
    111.   alias :kyon_steps2doom_sprtst_map_init :initialize
    112.   alias :kyon_steps2doom_sprtst_map_up :update
    113.   alias :kyon_steps2doom_sprtst_map_disp :dispose
    114.   def initialize
    115.     make_encounter_counter
    116.     kyon_steps2doom_sprtst_map_init
    117.   end
    118.   def make_encounter_counter
    119.     @encounter_vp = Viewport.new(0, 0, *KSteps2Doom::VIEWPORT_WH)
    120.     @encounter_vp.z = 10000
    121.     @encounter_sprite = EncounterSprite.new(@encounter_vp)
    122.   end
    123.   def update
    124.     kyon_steps2doom_sprtst_map_up
    125.     update_encounter_bitmap
    126.   end
    127.   def update_encounter_bitmap
    128.     @encounter_sprite.refresh
    129.   end
    130.   def dispose
    131.     kyon_steps2doom_sprtst_map_disp
    132.     @encounter_sprite.dispose_all
    133.     @encounter_vp.dispose
    134.   end
    135. end
    136. class Scene_Map
    137.   alias :kyon_steps2doom_gm_map_cl_btl :call_battle
    138.   def call_battle
    139.     process_troop_terrains
    140.     kyon_steps2doom_gm_map_cl_btl
    141.   end
    142.   def process_troop_terrains
    143.     terrains = $game_map.troop_terrains
    144.     return if terrains.empty?
    145.     Graphics.update
    146.     tag = $game_player.terrain_tag
    147.     list = terrains[tag]
    148.     n = rand(list.size)
    149.     n = list[n]
    150.     troop_id = $game_map.encounter_list[n]
    151.     return unless $data_troops[troop_id]
    152.     $game_temp.battle_troop_id = troop_id
    153.     $game_player.straighten
    154.   end
    155. end
    复制代码




    Terms & Conditions

    Free for use in ANY game.
    Due credit is mandatory.
    Mention this forum in your game credits.
    That's it!



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

    本帖子中包含更多资源

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

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

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-8-4 12:48 , Processed in 0.067047 second(s), 56 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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