じ☆ve冰风 发表于 2026-7-15 09:55:38

Troop ID based battlebacks

Troop ID based Battlebacks

Tpasmall

Features

Allows you to set battle backgrounds based on troop ID.

How to Use

Pretty self explanatory, just make sure you go to "game_troop" line 29 and insert "attr_accessor :troop_id" or the script won't work. Let me know if there are any bugs (I don't use VX anymore, but I thought this might be useful for those of you that do). Put your battle backgrounds (in .png format) in the 'Pictures' folder (Graphics/Pictures). The rest of the instructions are in the script. (If there is any confusion, just ask here).

Script

Spoiler                 Code:        
#--------------------------------------------------------------------------------
# Battle backgrounds go in the 'Pictures' folder (Graphics/Pictures)
# in the script "game_troop" go to line 29 and insert "attr_accessor :troop_id"
# Script written by tpasmall
#--------------------------------------------------------------------------------

module TroopBB
#------------------------------------------------------------------------------
# To set the background put the troop ID number followed by the file name
# ex. Slime x 2 is troop 001
# 1 => "grassland" will make grassland.png as the battleback for slime x2 troop
# make sure to put a "," after each battleback name
#------------------------------------------------------------------------------
BattleBackground =
{
1 => "grassland",
2 => "forest",
}
#-----------------------------------------------------------------------------
# Create the battlefloor?
#-----------------------------------------------------------------------------
Create_battlefloor = true
end
#-------------------------------------------------------------------------------
# Spriteset_Battle
#-------------------------------------------------------------------------------
class Spriteset_Battle
alias crbattlefloor create_battlefloor
#-----------------------------------------------------------------------------
# Create Battleback
#-----------------------------------------------------------------------------
def create_battleback
image = TroopBB::BattleBackground[$game_troop.troop_id]
@battleback_sprite = Sprite.new(@viewport1)
@battleback_sprite.bitmap = Cache.picture(image)
end
def create_battlefloor
@battlefloor_sprite = Sprite.new(@viewport1)
crbattlefloor if TroopBB::Create_battlefloor == true
end
end





Credit and Thanks

- None needed, it you want to though, credit tpasmall


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