RE: What's up, RMers? - DerVVulfman - 02-26-2021
(02-25-2021, 12:00 AM)DerVVulfman Wrote: I'm working on another Half Kaiser resource. I'm working on Short shorts! First the ladies's shorts first, with the men's later. I'm almost halfway done, but when you have a base sheet that holds frames for ALL possible poses, that is a lotta work.
Yay! I got done with a 'preliminary' edit to the ladies' shorts. Nothing as to extra border work where the shorts are cut... no solid matching border or semi-fuzzy cotton border as if they were actually 'cut' from a pair of jeans. But the 190+ frames for female jeans have been properly sliced and the animation appears just fine.
Now back to the instructions writing.
RE: What's up, RMers? - Remi-chan - 03-14-2021
Just remastering more of these cutscenes, now I've actually gotta get my composer to redo track number 02 "Playthings No More!" due to this being too long for the original. Though it also needs more intensity and different syncing now... so it would probably have been asked of him regardless.
Voice acting for Yasondre and most of Sacreblu is placeholder at the moment.
For context's sake, I'll put the old version in the spoilers below.
RE: What's up, RMers? - kyonides - 04-03-2021
Well, I've been further developing KSkillRunes XP but prefered not to post anything there because it's still in beta stage. To be honest with you, I had to overwrite some code in order to make it easy to search for any given rune skill. This also means that any previously saved game won't work any longer if you ever managed to give a rune gem stone to any hero.
Every run gem stone will cost you some gold in order to activate it or some rune points (rp) to level up its skills.
Right, now you can just open the item menu and offer it to... I dunno... Aluxes alias Alex!
RE: What's up, RMers? - DerVVulfman - 04-04-2021
It seems there isn't a time I don't have something in the works. And yeah, I get plenty of requests.
Currently, I am working on a custom hybrid menu per a request. A custom job of course, so it requires interaction with the requester. Complex requests require interaction. So if you wanna help someone on a project, be prepared to talk to them as much as possible during each stage. And if you ask for help, be ready to give your helper advice and updates.
Of course after this, I have a few others...
RE: What's up, RMers? - kyonides - 04-25-2021
Just in the very hypothetical case you have been wondering what the hell have I been doing as of late, here you can find the answer to your silly question.
I have been playing Lords of the Realms 2 and got an idea for a game or mini game so I started crafting the barebones of a new script. Here it is for you to check it out and get an idea on what it might do in the (not so near) future.
Code: # * KLords of XP
# Scripter : Kyonides Arkanthes
# 2021-04
# This is a free adaptation of Lords of the Realm 2 game for RMXP. The goal of
# this script is to partially replicate some of its features.
# * Script Calls * #
# $scene = KLordsMapScene.new(MapID)
# $game_system.lords
# $game_system.lord(LordID)
# $game_system.lord_name(LordID)
# $game_system.lord_cities(LordID)
# $game_system.lord_allies(LordID)
# $game_system.lord_lands(LordID)
# $game_system.cities
# $game_system.city(MapID)
# $game_system.city_land(MapID)
# $game_party.set_leader_as_lord
# # #MapData.change_lord(MapID, RulerID)
module KLords
# List of Icons representing the player and the rest of the nobles
NOBLE_ICONS = ["",""]
BUILDING_ICONS = ["keep01","keep03","castle01","castle01"]
DEFENSE_ICONS = ["keep02", "keep04", "castle02","castle03"]
ENV_ICONS = ["tree01","tree02","wood"]
LABELS = {}
LABELS[:title] = "Stockpiles"
LABELS[:wood] = "Wood"
LABELS[:stone] = "Stone"
LABELS[:gold] = "Gold"
LABELS[:iron] = "Iron"
# MapID => "Backdrop Filename", etc.
BACKDROPS = { 2 => "" }
module Font
MAP_NAME = "Arial"
MAP_SIZE = 24
LORD_NAME = "Arial"
LORD_SIZE = 22
end
end
module MapData
@infos = load_data("MapInfos.rxdata")
def map(mid) @infos[mid] || RPG::MapInfo.new end
end
module KLords
class MapObject
def initialize
@id = 0
@name = "Unknown"
@resources = { :wood => 0, :stone => 0, :iron => 0,
:gold => 0, :medicines => 0 }
end
attr_accessor :id, :name
attr_reader :resources
end
class Lord < MapObject
def initialize
@cities = 0
@lands = 0
@allies = []
end
attr_accessor :cities, :lands, :allies
end
class City < MapObject
def initialize
@land = 0
@tax_percent = 0
@happiness = 0
@health = 50
@population = 0
end
attr_accessor :land, :tax_percent, :happiness, :health, :population
end
end
class Game_System
alias :kyon_lords_gm_sys_init :initialize
def initialize
kyon_lords_gm_sys_init
@lords = Hash.new{ KLords::Lord.new }
@cities = Hash.new{ KLords::City.new }
end
def lord(lid) @lords[lid] end
def lord_name(lid) @lords[lid].name end
def lord_cities(lid) @lords[lid].cities end
def lord_lands(lid) @lords[lid].lands end
def lord_allies(lid) @lords[lid].allies end
def lord_resources(lid) @lords[lid].resources end
def city(mid) @cities[mid] end
def city_land(mid) @cities[mid].land end
attr_reader :lords, :cities
#def change_lord(lid, rid) @lords[mid] = rid end
end
class Game_Party
alias :kyon_lords_gm_pty_init :initialize
def initialize
kyon_lords_gm_pty_init
set_leader_as_lord unless @actors.empty?
end
def set_player_as_lord
$game_system.lord(1).name = @actors[0].name
end
end
class KLordsSpriteset
include KLords::Font
def initialize
map_id = $game_map.map_id
map = MapData.map(map_id).name
lord = MapData.lord(map_id).name
@name = Sprite.new
@name.x = 4
@name.y = 8
@name.bitmap = b = Bitmap.new(180, 24)
b.font.name = MAP_NAME
b.font.size = MAP_SIZE
b.draw_text(0, 0, b.width, 24, map, 1)
@lord_name = Sprite.new
@lord_name.x = 4
@lord_name.y = 36
@lord_name.bitmap = b = Bitmap.new(180, 24)
b.font.name = LORD_NAME
b.font.size = LORD_SIZE
b.draw_text(0, 0, b.width, 24, lord, 1)
end
def dispose
@lord_name.dispose
@name.dispose
end
end
class KLordsMapScene < Scene_Map
def initialize(pos) @index = pos end
def main
@running = true
@backdrop = Sprite.new
@backdrop.bitmap = RPG::Cache.title(KLords::BACKDROPS[@index])
@tileset = Spriteset_Map.new
@spriteset = KLordsSpriteset.new
Graphics.transition
while @running
Graphics.update
Input.update
update
end
Graphics.freeze
@spriteset.dispose
@tileset.dispose
@backdrop.dispose
end
def update
if Input.trigger?(Input::B)
$game_sytem.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return @running = nil
elsif Input.trigger?(Input::C)
$game_sytem.se_play($data_system.decision_se)
end
end
end
RE: What's up, RMers? - kyonides - 05-03-2021
Lately I didn't improve the KLords of XP script code because I got busy watching some anime and a DC animated movie.
I know, I've been slacking but you know me, I'm lazy after all!
Besides I noticed that I wasn't achieving my goal to let the menu look as Lords-ish as it should have been so I replaced labels with icons and I saved a lot of space on the GUI thanks to this design change. You won't notice how much the code has changed for there were few minimal cosmetic changes being implemented there. Most of the rewritten lines of code belong to "low level" code that had the purpose of making the script as modular as possible. Yeah, you're right. That's not impressive at all but it proved to be quite helpful indeed. Still, I do think encapsulation makes things more confusing every so often. Even so you'd get bored of analyzing code if I pushed it all into the menu's main scene script.
Code: # * KLords of XP
# Scripter : Kyonides Arkanthes
# 2021-05
# This is a free adaptation of Lords of the Realm 2 game for RMXP. The goal of
# this script is to partially replicate some of its features.
# * Script Calls * #
# $scene = KLords::MapScene.new(MapID)
# $game_system.lords
# $game_system.lord(LordID)
# $game_system.lord_name(LordID)
# $game_system.lord_shires(LordID)
# $game_system.lord_allies(LordID)
# $game_system.lord_lands(LordID)
# $game_system.shires
# $game_system.shire(MapID)
# $game_system.shire_land_id(MapID)
# $game_system.shire_lord_id(MapID)
# $game_party.set_leader_as_lord
# # #MapData.change_lord(MapID, RulerID)
module KLords
# List of Icons representing the player and the rest of the nobles
NOBLE_ICONS = ["",""]
BUILDING_ICONS = ["keep01","keep03","castle01","castle01"]
DEFENSE_ICONS = ["keep02", "keep04", "castle02","castle03"]
ENV_ICONS = ["tree01","tree02","wood"]
BGM = ["menu01","menu02"]
class Texts
attr_accessor :lord, :title, :wood, :stone, :gold, :iron
attr_accessor :population, :tax, :happiness
end
LABELS = Texts.new
LABELS.lord = "Current Lord"
LABELS.title = "Stockpiles"
LABELS.wood = "Wood"
LABELS.stone = "Stone"
LABELS.gold = "Gold"
LABELS.iron = "Iron"
LABELS.population = "Pop."
LABELS.tax = "Tax"
LABELS.happiness = "Happy"
SHIRES = {}
# MapID => ["Land Backdrop", Lord's ID, "Lord's Name"], etc.
DATA = { 2 => ["",0,"Independent"] }
DATA.default = ["",0,"Independent"]
module FontSetup
# [ "Font Name", Size, Bold ]
SHIRE = ["Arial", 24, false]
SHIRE_LABELS = ["Arial", 20, true]
SHIRE_STATS = ["Arial", 22, false]
MAP = ["Arial", 20, true]
WHICH_LORD = ["Arial", 22, false]
THIS_LORD = ["Arial", 22, false]
end
end
module MapData
@infos = load_data("Data/MapInfos.rxdata")
@infos.default = RPG::MapInfo.new
def self.map(mid) @infos[mid] end
end
module KLords
class Acre
def initialize() @usage = :fallow end
attr_accessor :usage
end
class Resources
def initialize
@acres = []
@wood = 0
@stone = 0
@iron = 0
@gold = 0
@ale = 0
@medicines = 0
end
def resize_acres(total) @acres = Array.new(total){ Acre.new } end
def acres_total() @acres.size end
def land_usage(pos) @acres[pos].usage end
def change_land_usage(pos, mode) @acres[pos].usage = mode end
attr_accessor :acres, :wood, :stone, :iron, :gold, :ale, :medicines
end
class MapObject
def initialize(moid)
@id = moid
@resources = Resources.new
end
attr_accessor :id, :name
attr_reader :resources
end
class Lord < MapObject
def initialize(lid)
super(lid)
@name = "Unknown"
@shires = 0
@lands = 0
@title = "Civil Servant"
@gold = 0
@allies = []
end
attr_accessor :shires, :lands, :title, :gold, :allies
end
class Shire < MapObject
def initialize(sid)
super(sid)
@name = "Lost Shire"
@land_id = 0
@lord_id = 0
@tax = 0
@happiness = 50
@health = 50
@population = 10
@threats = []
end
attr_accessor :land_id, :lord_id, :tax, :happiness, :health, :population
attr_reader :threats
end
class IconLabel
def initialize(nx, ny, type)
filename = case type
when :popul then "population"
when :tax then ""
when :happy then "heart"
end
@icon = Sprite.new
@icon.set_xy(nx, ny)
@icon.bitmap = RPG::Cache.icon(filename)
@label = Sprite.new
@label.set_xy(nx + 28, ny)
@label.bitmap = Bitmap.new(60, 24)
end
def set_text(text)
b = @label.bitmap
b.clear
b.font.set FontSetup::SHIRE_LABELS
b.draw_text(0, 0, b.width, 24, text, 1)
end
def dispose
@icon.bitmap.dispose
@icon.dispose
@label.bitmap.dispose
@label.dispose
end
end
extend self
attr_accessor :lord, :shire
end
class Font
def set(ary)
self.name = ary[0]
self.size = ary[1] || 22
self.bold = ary[2] || false
end
end
class Sprite
def set_xy(nx, ny) self.x, self.y = nx, ny end
end
class Game_System
alias :kyon_lords_gm_sys_init :initialize
def initialize
kyon_lords_gm_sys_init
@lords = {}
@shires = {}
data = KLords::DATA
data.keys.each do |k|
bd, lid, lname = data[k]
@shires[k] = shire = KLords::Shire.new(k)
shire.lord_id = lid
@lords[lid] = lord = KLords::Lord.new(lid)
lord.name = lname
end
end
def bgm_replay() bgm_play(@playing_bgm) end
def lord(lid) @lords[lid] end
def lord_name(lid) @lords[lid].name end
def lord_shires(lid) @lords[lid].shires end
def lord_lands(lid) @lords[lid].lands end
def lord_allies(lid) @lords[lid].allies end
def lord_resources(lid) @lords[lid].resources end
def shire(mid) @shires[mid] end
def shire_land_id(mid) @shires[mid].land_id end
def shire_lord_id(mid) @shires[mid].lord_id end
def shire_tax(mid) @shires[mid].tax end
attr_reader :lords, :shires
#def change_lord(lid, rid) @lords[mid] = rid end
end
class Game_Party
alias :kyon_lords_gm_pty_init :initialize
def initialize
kyon_lords_gm_pty_init
set_leader_as_lord unless @actors.empty?
end
def set_player_as_lord
$game_system.lord(1).name = @actors[0].name
end
end
class KLords::MapSpriteset < Spriteset_Map
def initialize
@viewport1 = Viewport.new(0, 0, 640, 480)
@viewport2 = Viewport.new(0, 0, 640, 480)
@viewport3 = Viewport.new(0, 0, 640, 480)
@viewport2.z = 200
@viewport3.z = 5000
@tilemap = Tilemap.new(@viewport1)
@tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name)
7.times do |i|
autotile_name = $game_map.autotile_names[i]
@tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
end
@tilemap.map_data = $game_map.data
@tilemap.priorities = $game_map.priorities
@panorama = Plane.new(@viewport1)
@panorama.z = -1000
backdrop = KLords::DATA[$game_map.map_id][0]
@panorama.bitmap = RPG::Cache.panorama(backdrop, 0)
@character_sprites = []
$game_map.events.keys.sort.each do |i|
sprite = Sprite_Character.new(@viewport1, $game_map.events[i])
@character_sprites << sprite
end
@picture_sprites = []
for i in 1..50
sprite = Sprite_Picture.new(@viewport2, $game_screen.pictures[i])
@picture_sprites << sprite
end
end
def dispose
@tilemap.tileset.dispose
7.times{|i| @tilemap.autotiles[i].dispose }
@tilemap.dispose
@panorama.dispose
@character_sprites.each{|sprite| sprite.dispose }
@picture_sprites.each{|sprite| sprite.dispose }
@viewport1.dispose
@viewport2.dispose
@viewport3.dispose
end
end
class KLords::Spriteset
include KLords
def initialize(map_id)
@map_id = map_id
@shire = $game_system.shire(@map_id)
KLords.lord = $game_system.lord(@shire.lord_id)
make_shire_name
make_stats
refresh_shire_name
refresh_stats
@sprites = [@shire_name]
end
def make_shire_name
@shire_name = Sprite.new
@shire_name.set_xy(4, 4)
@shire_name.bitmap = Bitmap.new(180, 24)
end
def make_stats
@population = IconLabel.new(4, 32, :popul)
@tax = IconLabel.new(4, 60, :tax)
@happy = IconLabel.new(92, 32, :happy)
end
def refresh_shire_name
b = @shire_name.bitmap
b.clear
b.font.set FontSetup::SHIRE
b.draw_text(0, 0, b.width, 24, @shire.name, 1)
end
def refresh_stats
@population.set_text(@shire.population.to_s)
@tax.set_text(@shire.tax.to_s + "%")
@happy.set_text(@shire.happiness.to_s + "%")
end
#make_map_name make_which_lord make_lord_name@name@which_lord@lord_name
def make_map_name
map = MapData.map(@map_id).name
@name = Sprite.new
@name.set_xy(4, 8)
@name.bitmap = b = Bitmap.new(180, 24)
b.font.set MAP
b.draw_text(0, 0, b.width, 24, map, 1)
end
def make_which_lord
@which_lord = Sprite.new
@which_lord.set_xy(4, 64)
@which_lord.bitmap = b = Bitmap.new(180, 24)
b.font.set WHICH_LORD
b.draw_text(0, 0, b.width, 24, LABELS.lord)
end
def make_lord_name
@lord_name = Sprite.new
@lord_name.set_xy(4, 92)
@lord_name.bitmap = b = Bitmap.new(180, 24)
b.font.set THIS_LORD
b.draw_text(0, 0, b.width, 24, KLords.lord.name, 1)
end
def dispose
@sprites.each do |s|
s.bitmap.dispose
s.dispose
end
@population.dispose
@tax.dispose
@happy.dispose
end
attr_reader :shire
end
class KLords::MapScene < Scene_Map
include KLords
def initialize(map_id) @map_id = map_id end
def main
old_map_id = $game_map.map_id
different_map = old_map_id != @map_id
$game_map.setup(@map_id) if different_map
Audio.bgm_stop
path = "Audio/BGM/" + BGM[0]
Audio.bgm_play(path)
@running = true
@tileset = MapSpriteset.new
@spriteset = Spriteset.new(@map_id)
Graphics.transition
while @running
Graphics.update
Input.update
update
end
Graphics.freeze
@spriteset.dispose
@tileset.dispose
$game_system.bgm_replay
$game_map.setup(old_map_id) if different_map
end
def update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return @running = nil
elsif Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
end
end
end
RE: What's up, RMers? - DerVVulfman - 05-04-2021
Still working on a ' custom hybrid menu request' , and its means of choosing or removal of equipment required a completely different item-equiping scenario. The old equip method in the Game_Actor class is basically moot. I was working on both it and the stats display system in tandem, but found the current means to show stat increase/decreases caused issue with the actual item-equiping system.
I just rewrote the item-equiping system, fresh and clean and devoid of the stats display. Soon, I will begin working on the stats next.
The requester is liking that he can now show as many stats he would like, not the default three of just ATK, MDEF, PDEF.
RE: What's up, RMers? - kyonides - 05-06-2021
I've attached a recent screenshot of my reinterpretation of Lords of the Realm 2 for XP. I know, it looks quite empty right now because I've only recently begun working on the GUI instead of the API exposed to the game developers.
To be honest with you guys, you're supposed to use the map as you would do with any other map. You still can use some sort of panorama if you like to represent the actual territory that comprises a given shire or region.
P.S.
Crowns is the so called medieval term for money there.
The icon sporting "ten pounds" written on it is a symbol of taxes not
RE: What's up, RMers? - kyonides - 05-13-2021
Yeap, I've come back with another report on the development stage of KLords of XP!
This time I've changed lots of lines of code that you'd rarely use in game and I had to rewrite lots of methods and add a few methods or even a new class like the Spy class!
So if you don't own that shire or pretend you do that's not a problem, you'd just send a spy to get as much info as possible!
That doesn't mean the spy isn't some sort of double agent like ninjas might be!
Of course, that's just the button. Its API isn't finished, yet.
Code: # * KLords of XP - Alpha Release
# Scripter : Kyonides Arkanthes
# 2021-05-12
=begin
This is a free adaptation of Lords of the Realm 2 game for RMXP. The goal of
this script is to partially replicate some of its features.
The king is dead! The war of succession has just begun!
This game places you as a feudal lord or knight in charge of a shire or county
and you are a candidate to become the next king. The game is divided by turns
corresponding to the annual seasons.
* Reserved Lord ID's
0 - Independent Shires
1 - The Player!
# * Script Calls * #
* Open the KLords of XP Scene OR the Player's Name Scene if needed
- Later on it will automatically open the KLords of XP Scene
open_klords_map
* Open the KLords of XP Scene (No Player's Name Setup Needed)
$scene = KLords::MapScene.new
* Set Current Party Leader as Lord (alias the Player) - In Game
$game_party.leader_as_lord
* Select the Next Map of Shires to be ruled by the lords - In Game
$game_system.next_shires_map
* Set a New Season and Year - In Game
$game_system.new_calendar(season, year)
* Retrieve All Lords You Have Configured
$game_system.lords
$game_system.lord(LordID)
$game_system.lord_name(LordID)
$game_system.lord_shires(LordID)
$game_system.lord_allies(LordID)
* Retrieve How Many Crowns (Gold) a given Lord has earned so far
$game_system.lord_crowns(LordID)
$game_system.lord_gain_crowns(LordID)
$game_system.lord_lose_crowns(LordID)
* Retrieve All Shires (Regions) You Have Configured
$game_system.shires
$game_system.shire(ShireID)
$game_system.shire_land_id(ShireID)
$game_system.shire_lord_id(ShireID)
$game_system.shire_change_lord(ShireID, LordID)
=end
module KLords
# Include an * asterisk at the end of the base filename
SHIRES_TEMP_BASENAME = "KLords/ShiresMap*"
SHIRES_DATA_FILENAME = "Data/ShiresMapInfos.rxdata"
BASIC_DATA_FILENAME = "Data/KLordsXP.rxdata"
# Initial Player's Options
# :need_name - true (open name scene) or false
# :name - "Name" or nil if not using it
# :no_lord_name - "Name" If the shire has no ruler, pick this label instead
# :chars - Character Limit
PLAYER_SETUP = {
:need_name => true,
:name => "Gawain",
:no_lord_name => "Independent",
:chars => 16
}
# Initial Mini Game Date Setup: seasons 1 through 4
DATE = { :season => 1, :year => 750 }
TROOP_TYPE_MAX = 8
# Picture used as some sort of Menu Bar
RIBBON = "ribbon"
# List of Icons representing the player and the rest of the nobles
NOBLE_ICONS = ["",""]
BUILDING_ICONS = ["keep01","keep03","castle01","castle01"]
DEFENSE_ICONS = ["keep02", "keep04", "castle02","castle03"]
ENV_ICONS = ["tree01","tree02","woodstock"]
# KLords Main Menu BGM
BGM = ["menu01","menu02"]
class Texts
attr_accessor :winter, :spring, :summer, :autumn, :lord, :title
attr_accessor :crowns, :not_ruler, :autonomous, :send_spy
attr_accessor :wood, :stone, :gold, :iron, :population, :tax
end
LABELS = Texts.new
LABELS.winter = "Winter"
LABELS.spring = "Spring"
LABELS.summer = "Summer"
LABELS.autumn = "Autumn"
LABELS.lord = "Current Lord"
LABELS.title = "Stockpiles"
LABELS.crowns = "Crowns"
LABELS.not_ruler = "Sovereign land of"
LABELS.autonomous = "Self Governed"
LABELS.send_spy = "Send Spy"
LABELS.wood = "Wood"
LABELS.stone = "Stone"
LABELS.gold = "Gold"
LABELS.iron = "Iron"
LABELS.population = "Pop."
LABELS.tax = "Tax"
ICONS = {
:people => "population", :tax => "tax",
:happy => "heart", :health => "health",
:cattle => "cattle", :grain => "wheat", :wood => "wood"
}
ICONS.default = "" # Do Not Edit This Line!
# MapID => "Land Backdrop", etc.
MAPDATA = { 2 => "" }
MAPDATA.default = ""
module SpyData
BASIC_INCOME = 250
INCOME_INCREASE_STEP = 50
# SpyID => { :vary => Percent, :quality => Integer }, etc.
# Integer can be 0+, the higher the better the pay the spy will get
FEATURES = { 1 => { :vary => 50, :quality => 1 } }
FEATURES.default = { :vary => 0, :quality => 0 }
def self.salary(spy_id)
BASIC_INCOME + FEATURES[spy_id][:quality] * INCOME_INCREASE_STEP
end
end
module FontSetup
# Font Color is optional, Options: none - white, :black, :gray or some
# R,G,B or R,G,B,A list of Integers 0..255
# SECTION = [ "Font Name", Size, Bold, Color ]
SEASON = ["Blackwood Castle", 20, false, :black]
SHIRE = ["Blackwood Castle", 30, false, :gray]
NOT_SAME_LORD = ["Blackwood Castle", 26, false]
SEND_SPY = ["Blackwood Castle", 25, false]
SHIRE_LABELS = ["Arial", 20, true, 40, 255, 60]
SHIRE_STATS = ["Arial", 22, false, 40, 255, 60]
MAP = ["Arial", 20, true, 0, 255, 60]
WHICH_LORD = ["Arial", 22, false]
THIS_LORD = ["Arial", 22, false]
end
end
class Array
def to_color
Color.new(shift, shift || 255, shift || 255, shift || 255)
end
end
class String
def scan_int() scan(/\d+/)[0].to_i end
end
class Font
def self.find_color(sym)
case sym
when :black
Color.new(0, 0, 0, 255)
when :gray
Color.new(60, 60, 60, 255)
else
Color.new(255, 255, 255)
end
end
def set(ary)
ary = ary.dup
self.name = ary.shift
self.size = ary.shift || 22
self.bold = ary.shift || false
return if ary.empty?
self.color = ary.size == 1 ? Font.find_color(ary.shift) : ary.to_color
end
end
class Sprite
def set_xy(nx, ny)
self.x = nx
self.y = ny
end
end
module KLords
extend self
attr_accessor :lord, :shire
module MapData
@infos = load_data("Data/MapInfos.rxdata")
@infos[0] = RPG::MapInfo.new
extend self
attr_accessor :map_list, :shires_infos
def map(mid) @infos[mid] end
def shires_map(mid) @shires_infos[mid] end
def load_shires_map_infos
@map_list = load_data(BASIC_DATA_FILENAME)
@shires_infos = load_data(SHIRES_DATA_FILENAME)
end
def create_shire(map_id, lines)
map = @shires_infos[map_id]
shire_id = map.shires.size + 1
shire = Shire.new(shire_id)
@shires_infos[map_id].shires << shire
shire.name = lines.shift.sub(/name: /i, "").chomp
shire.lord_id = lines.shift.scan_int
shire.size = lines.shift.sub(/size: /i, "").downcase.to_sym
stats = shire.stats
stats.population = lines.shift.scan_int
stats.tax = lines.shift.scan_int
stats.health = lines.shift.scan_int
stats.happiness = lines.shift.scan_int
n, f, c, g = lines.shift.scan(/\d+/).map{|d| d.to_i }
shire.resources.change_acres_usage(n, f, c, g)
lines.shift
end
def parse_shires(filename)
lines = File.readlines(filename)
map_id = filename.scan_int
emap_id = lines.shift.scan_int
@map_list << emap_id
@shires_infos[map_id] = Map.new(map_id, emap_id)
lines.shift
shires_max = lines.size / 8
shires_max.times{ create_shire(map_id, lines) }
end
def parse_shires_map_data
unless $DEBUG
load_shires_map_infos
return
end
@map_list = [nil]
@shires_infos = [nil]
files = Dir[SHIRES_TEMP_BASENAME].sort
if files.empty?
dir = SHIRES_TEMP_BASENAME.split("/")[0]
raise IOError, "No temporal file was found at " + dir + " directory!"
end
files.each{|file| parse_shires(file) }
save_data(@map_list, BASIC_DATA_FILENAME)
save_data(@shires_infos, SHIRES_DATA_FILENAME)
end
end
class Setup
def initialize
@need_name = PLAYER_SETUP[:need_name]
@temp_name = PLAYER_SETUP[:name]
@pos = 0
end
attr_accessor :need_name, :temp_name, :pos
end
class Kalender
def initialize(pos, year)
self.season = pos
@year = year
end
def next_season() @season = (@season + 1) % 4 end
def season=(ns) @season = (ns - 1) % 4 end
def season() @season end
attr_accessor :year
end
class Acre
def initialize
@usage = :fallow
@results = 0
end
def fallow?() @usage == :fallow end
def producing?() @usage == :cattle or @usage == :grain end
attr_accessor :usage, :results
end
class Resources
def initialize
@cattle = 0
@grain = 0
@wood = 0
@stone = 0
@iron = 0
@gold = 0
@ale = 0
@medicines = 0
end
def change_acres_usage(n, f, c, g)
setup_acres(n + f + c + g)
pos = 0
n.times do
@acres[pos].usage = nil
pos += 1
end
f.times do
@acres[pos].usage = :fallow
pos += 1
end
c.times do
@acres[pos].usage = :cattle
pos += 1
end
g.times do
@acres[pos].usage = :grain
pos += 1
end
end
def setup_acres(total)
@acres_max = total
@acres = Array.new(total){ Acre.new }
end
def acres_fallow() @acres.select{|a| a.fallow? }.size end
def acres_used() @acres.select{|a| a.producing? }.size end
def land_usage(pos) @acres[pos].usage end
def change_land_usage(pos, mode) @acres[pos].usage = mode end
attr_accessor :acres, :acres_max, :cattle, :grain, :wood, :stone
attr_accessor :iron, :gold, :ale, :medicines
end
class MapObject
def initialize(moid) @id = moid end
attr_accessor :id, :name
end
class Lord < MapObject
def initialize(lid)
super(lid)
@name = "Unknown"
@shires = []
@lands = 0
@title = "Civil Servant"
@crowns = 0
@allies = []
@armies = []
@victories = -1
end
def add_shire(sid)
@shires << sid
@shires = @shires.uniq.sort
end
def lose_shire(sid)
@shires.delete(sid)
end
def join_armies(t1, t2)
@armies[t1].join_army(@armies[t2])
@armies.delete_at(t2)
@armies[t1]
end
attr_accessor :shires, :lands, :title, :crowns, :allies, :armies, :victories
end
class ShireStats
def initialize
@tax = 0
@happiness = 50
@health = 50
@population = 10
end
attr_accessor :tax, :happiness, :health, :population
end
class Shire < MapObject
def initialize(sid)
super(sid)
@name = "Lost Shire"
@land_id = 0
@lord_id = 0
@stats = ShireStats.new
@resources = Resources.new
@size = :medium
@has_spies = false
@threats = []
end
attr_accessor :land_id, :lord_id, :stats, :size, :has_spies
attr_reader :resources, :threats
end
class Army
def initialize
@name = ""
@troops = Array.new(TROOP_TYPE_MAX, 0)
end
def join_army(army)
TROOP_TYPE_MAX.times{|n| @troops[n] += army.troops[n] }
end
attr_accessor :name
attr_reader :troops
end
class Map
def initialize(mid, editor_map_id)
@id = mid
@editor_map_id = editor_map_id
@shires = []
end
attr_accessor :shires
attr_reader :id, :editor_map_id
end
class Spy
include SpyData
def initialize(spy_id, shire)
features = FEATURES[spy_id]
@variance = FEATURES[spy_id][:vary]
@shire_id = shire
@wage = SpyData.salary(spy_id)
@data = Resources.new
@stats = ShireStats.new
@armies = []
@targets = []
end
attr_accessor :shire_id, :variance, :wage, :data, :stats, :armies, :targets
end
# * End of Data Classes #
class NameEditWindow < Window_NameEdit
def initialize(actor, max_char)
super
self.contents = Bitmap.new(width - 32, height - 32)
@actor = actor
name = actor.name
@max_char = max_char
name_array = name.split(//)[0...@max_char]
@name = ""
name_array.size.times{|i| @name += name_array[i] }
@default_name = @name
@index = name_array.size
refresh
update_cursor_rect
end
def refresh
self.contents.clear
name_array = @name.split(//)
@max_char.times do |i|
c = name_array[i] || " "
x = 320 - @max_char * 14 + i * 28
self.contents.draw_text(x, 32, 28, 32, c, 1)
end
#draw_actor_graphic(@actor, 320 - @max_char * 14 - 40, 80)
end
end
class NameScene < Scene_Name
def main
@actor = $game_system.lords[1]
@edit_window = NameEditWindow.new(@actor, PLAYER_SETUP[:chars])
@input_window = Window_NameInput.new
Graphics.transition
loop do
Graphics.update
Input.update
update
break if $scene != self
end
Graphics.freeze
@edit_window.dispose
@input_window.dispose
end
def check_name
@edit_window.restore_default
no_name = @edit_window.name.empty?
se = no_name ? $data_system.decision_se : $data_system.buzzer_se
$game_system.se_play(se)
end
def update
@edit_window.update
@input_window.update
if Input.repeat?(Input::B)
return if @edit_window.index == 0
$game_system.se_play($data_system.cancel_se)
@edit_window.back
return
elsif Input.trigger?(Input::C)
if @input_window.character == nil
return check_name if @edit_window.name == ""
@actor.name = @edit_window.name
$game_system.se_play($data_system.decision_se)
return $scene = KLords::MapScene.new
end
if @edit_window.index == $game_temp.name_max_char or
@input_window.character == ""
return $game_system.se_play($data_system.buzzer_se)
end
$game_system.se_play($data_system.decision_se)
@edit_window.add(@input_window.character)
end
end
end
class IconLabel
def initialize(nx, ny, type, w=68)
@icon = Sprite.new
@icon.set_xy(nx, ny)
@icon.bitmap = RPG::Cache.icon(ICONS[type])
@label = Sprite.new
@label.set_xy(nx + 28, ny + 2)
@label.bitmap = Bitmap.new(w, 24)
end
def set_text(text)
b = @label.bitmap
b.clear
b.font.set FontSetup::SHIRE_LABELS
b.draw_text(0, 0, b.width, 24, text, 1)
end
def visible=(bool)
@icon.visible = bool
@label.visible = bool
end
def dispose
@icon.bitmap.dispose
@icon.dispose
@label.bitmap.dispose
@label.dispose
end
end
def season_name(season)
case season
when 0 then LABELS.winter
when 1 then LABELS.spring
when 2 then LABELS.summer
when 3 then LABELS.autumn
end
end
class MapSpriteset < Spriteset_Map
def initialize
@viewport1 = Viewport.new(0, 0, 640, 480)
@viewport2 = Viewport.new(0, 0, 640, 480)
@viewport2.z = 200
@tilemap = Tilemap.new(@viewport1)
@tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name)
7.times do |i|
autotile_name = $game_map.autotile_names[i]
@tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
end
@tilemap.map_data = $game_map.data
@tilemap.priorities = $game_map.priorities
@panorama = Plane.new(@viewport1)
@panorama.z = -1000
backdrop = MAPDATA[$game_map.map_id][0]
#@panorama.bitmap = RPG::Cache.panorama(backdrop, 0)
@character_sprites = []
$game_map.events.keys.sort.each do |i|
sprite = Sprite_Character.new(@viewport1, $game_map.events[i])
@character_sprites << sprite
end
@picture_sprites = []
for i in 1..50
sprite = Sprite_Picture.new(@viewport2, $game_screen.pictures[i])
@picture_sprites << sprite
end
end
def dispose
@tilemap.tileset.dispose
7.times{|i| @tilemap.autotiles[i].dispose }
@tilemap.dispose
#@panorama.dispose
@character_sprites.each{|sprite| sprite.dispose }
@picture_sprites.each{|sprite| sprite.dispose }
@viewport1.dispose
@viewport2.dispose
end
end
class Spriteset
BAR_WIDTH = 200
def initialize
@map_id = MapData.map_list[$game_system.map_id]
@shire = $game_system.last_shire
@lord = $game_system.lord(@shire.lord_id)
@baseh = 4 + @shire.lord_id == 1 ? 0 : 48
@lineh = 28
@ribbon = Sprite.new
@ribbon.bitmap = RPG::Cache.picture(RIBBON)
make_general_data
make_not_same_lord
make_stats
make_send_spy
refresh_calendar
refresh_crowns
refresh_shire_name
if @shire.lord_id == 1
@not_lord.visible = false
refresh_stats
else
show_icon_labels(false)
refresh_not_ruler
@send_spy.visible = !@shire.has_spies
end
end
def make_general_data
@calendar = Sprite.new
@calendar.set_xy(4, 2)
@calendar.bitmap = Bitmap.new(120, 24)
@crowns = Sprite.new
@crowns.set_xy(132, 2)
@crowns.bitmap = Bitmap.new(BAR_WIDTH, 24)
@shire_name = Sprite.new
@shire_name.set_xy(4, 2 + @lineh)
@shire_name.bitmap = Bitmap.new(BAR_WIDTH, 24)
end
def make_not_same_lord
@not_lord = Sprite.new
@not_lord.set_xy(4, 64)
@not_lord.bitmap = Bitmap.new(BAR_WIDTH, 48)
end
def make_stats
@people = IconLabel.new(4, @baseh + @lineh * 2, :people)
@happy = IconLabel.new(104, @baseh + @lineh * 2, :happy)
@tax = IconLabel.new(4, @baseh + @lineh * 3, :tax)
@health = IconLabel.new(104, @baseh + @lineh * 3, :health)
@cattle = IconLabel.new(4, @baseh + @lineh * 4, :cattle)
@grain = IconLabel.new(4, @baseh + @lineh * 5, :grain)
@wood = IconLabel.new(104, @baseh + @lineh * 4, :wood)
@icon_labels = [@people, @happy, @tax, @health, @cattle, @grain, @wood]
end
def make_send_spy
@send_spy = Sprite.new
@send_spy.visible = false
@send_spy.set_xy(20, 148)
@send_spy.bitmap = b = Bitmap.new(160, 32)
b.font.set FontSetup::SEND_SPY
b.fill_rect(b.rect, Font.find_color(:gray))
b.draw_text(0, 0, b.width, 32, LABELS.send_spy, 1)
@sprites = [@ribbon, @calendar, @crowns, @shire_name, @send_spy]
end
def refresh_calendar
calendar = $game_system.calendar
year = calendar.year.to_s
season = KLords.season_name(calendar.season)
b = @calendar.bitmap
b.clear
yw = b.text_size(year).width
b.font.set FontSetup::SEASON
b.draw_text(0, 0, yw, 24, year)
b.draw_text(yw + 8, 0, b.width - yw - 8, 24, season)
end
def refresh_crowns
gold = @lord.crowns.to_s
b = @crowns.bitmap
b.clear
gw = b.text_size(gold).width
b.font.set FontSetup::SEASON
b.draw_text(0, 0, b.width, 24, gold)
b.draw_text(gw + 4, 0, b.width - gw - 4, 24, LABELS.crowns)
end
def refresh_shire_name
b = @shire_name.bitmap
b.clear
b.font.set FontSetup::SHIRE
b.draw_text(0, 0, b.width, 24, @shire.name, 1)
end
def refresh_not_ruler
b = @not_lord.bitmap
b.clear
b.font.set FontSetup::NOT_SAME_LORD
text = @shire.lord_id == 0 ? LABELS.autonomous : LABELS.not_ruler
b.draw_text(0, 0, b.width, 24, text, 1)
@not_lord.visible = true
end
def refresh_stats
stats = @shire.stats
res = @shire.resources
@people.set_text(stats.population.to_s)
@happy.set_text(stats.happiness.to_s + "%")
@tax.set_text(stats.tax.to_s + "%")
@health.set_text(stats.health.to_s + "%")
@cattle.set_text(res.cattle.to_s)
@grain.set_text(res.grain.to_s)
@wood.set_text(res.wood.to_s)
end
#make_map_name make_which_lord make_lord_name@name@which_lord@lord_name
def make_map_name
map = MapData.map(@map_id).name
@name = Sprite.new
@name.y = 8
@name.bitmap = b = Bitmap.new(BAR_WIDTH, 24)
b.font.set MAP
b.draw_text(0, 0, b.width, 24, map, 1)
end
def make_which_lord
@which_lord = Sprite.new
@which_lord.y = 64
@which_lord.bitmap = b = Bitmap.new(BAR_WIDTH, 24)
b.font.set WHICH_LORD
b.draw_text(0, 0, b.width, 24, LABELS.lord)
end
def make_lord_name
@lord_name = Sprite.new
@lord_name.y = 92
@lord_name.bitmap = b = Bitmap.new(BAR_WIDTH, 24)
b.font.set THIS_LORD
b.draw_text(0, 0, b.width, 24, KLords.lord.name, 1)
end
def dispose
@not_lord.bitmap.dispose
@not_lord.dispose
@sprites.each do |s|
s.bitmap.dispose
s.dispose
end
@icon_labels.each{|s| s.dispose }
@sprites.clear
@icon_labels.clear
end
def show_icon_labels(bool) @icon_labels.each{|lbl| lbl.visible = bool } end
attr_reader :shire, :lord
end
class MapScene < Scene_Map
def main
KLords.lord = $game_system.lord(1)
map_id = MapData.map_list[$game_system.map_id]
old_map_id = $game_map.map_id
different_map = old_map_id != map_id
$game_map.setup(map_id) if different_map
Audio.bgm_stop
path = "Audio/BGM/" + BGM[0]
Audio.bgm_play(path)
@open = true
@tileset = MapSpriteset.new
@spriteset = Spriteset.new
Graphics.transition
while @open
Graphics.update
Input.update
update
end
Graphics.freeze
@spriteset.dispose
@tileset.dispose
$game_system.bgm_replay
$game_map.setup(old_map_id) if different_map
end
def update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return @open = nil
elsif Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
end
end
end
MapData.parse_shires_map_data
end
class Game_System
alias :kyon_lords_gm_sys_init :initialize
def initialize
kyon_lords_gm_sys_init
setup_klords
next_shires_map
end
def setup_klords
@klords_setup = KLords::Setup.new
@lords = { 0 => KLords::Lord.new(0), 1 => KLords::Lord.new(1) }
@lords[1].name = @klords_setup.temp_name if @klords_setup.need_name
data = KLords::DATE
new_calendar(data[:season], data[:year])
end
def next_shires_map
@last_shire_id = nil
@klords_setup.pos += 1
@shires_map = KLords::MapData.shires_map(@klords_setup.pos)
@shires = @shires_map.shires.dup
end
def new_calendar(season, year)
@calendar = KLords::Kalender.new(season, year)
end
def shire_change_lord(sid, lid)
@shires[sid].lord_id = lid
@lords[lid].add_shire(sid)
end
def last_shire() @last_shire_id ? @shires[@last_shire_id] : @shires[0] end
def bgm_replay() bgm_play(@playing_bgm) end
def map_id() @klords_setup.pos end
def lord(lid) @lords[lid] end
def lord_name(lid) @lords[lid].name end
def lord_shires(lid) @lords[lid].shires end
def lord_allies(lid) @lords[lid].allies end
def lord_crowns(lid) @lords[lid].crowns end
def lord_gain_crowns(lid, n) @lords[lid].crowns += n end
def lord_lose_crowns(lid, n) @lords[lid].crowns -= n end
def lord_resources(lid) @lords[lid].resources end
def lord_player_victory!() @lords[1].victories += 1 end
def shire(sid) @shires[sid] end
def shire_land_id(sid) @shires[sid].land_id end
def shire_lord_id(sid) @shires[sid].lord_id end
def shire_tax(sid) @shires[sid].tax end
def need_player_name?() @klords_setup.need_name end
def has_player_name!() @klords_setup.need_name = nil end
attr_reader :calendar, :lords, :shires, :shire_id, :last_shire_id
#def change_lord(lid, rid) @lords[mid] = rid end
end
class Game_Party
def leader_as_lord() $game_system.lord(1).name = @actors[0].name end
end
class Interpreter
def open_klords_map(map_id)
if $game_system.need_player_name?
$game_system.has_player_name!
$scene = KLords::NameScene.new
else
$scene = KLords::MapScene.new
end
end
end
RE: What's on your mind? - Mel - 05-15-2021
I'm currently playing Divinity: Original Sin II and it's possible to save the game in the middle of a battle there.
So I'm thinking if it's possible to have such a feature in a RPG Maker XP game. I think it would require a massive revision of the save and loading processes.
What do you think?
|