Battlers
If it's a character in a battle, it's a battler!
Getting Started With Party Battlers
Party battlers represent the characters in your party. Your party is separate from your battlers, since your party gets used in the overworld, in shops, in battles, everywhere. Your battlers are only used in battles, as the name suggests.
Creating a Battler...?
To create a party battler, you'll need to... wait, what? It's already done? Yes, that's right, battlers use your character's actor data as a display.
But It's Invisible!
Since your battler is created using the actor data, you need to make sure the correct sprites exist. Battlers normally have the following:
battle/idle
battle/attack
battle/act
battle/spell
battle/item
battle/spare
battle/attack_ready
battle/act_ready
battle/spell_ready
battle/item_ready
battle/defend_ready
battle/act_end
battle/hurt
battle/defeat
battle/transition
battle/intro
battle/victory
Enemies
Like party battlers, enemy battlers are displayed using their actor. However, unlike party battlers, enemy battlers aren't tied to a party. Instead, the battlers themselves carry around their own data, like health, magic, attack damage, etc.
So, to create an enemy battler, you'll need to make one.
local Dummy, super = Class(EnemyBattler)
function Dummy:init()
super.init(self)
end
return Dummy
As always, we start out with some pretty simple boilerplate.
Let's set a few properties:
-- Enemy name
self.name = "Dummy"
-- Sets the actor, which handles the enemy's sprites (see scripts/data/actors/dummy.lua)
self:setActor("dummy")
-- Enemy health
self.max_health = 450
self.health = 450
-- Enemy attack (determines bullet damage)
self.attack = 4
-- Enemy defense (usually 0)
self.defense = 0
-- Enemy reward
self.money = 100
-- Mercy given when sparing this enemy before its spareable (20% for basic enemies)
self.spare_points = 20
-- Check text (automatically has "ENEMY NAME - " at the start)
self.check = "AT 4 DF 0\n* Cotton heart and button eye\n* Looks just like a fluffy guy."
-- Text randomly displayed at the bottom of the screen each turn
self.text = {
"* The dummy gives you a soft\nsmile.",
"* The power of fluffy boys is\nin the air.",
"* Smells like cardboard.",
}
-- Text displayed at the bottom of the screen when the enemy has low health
self.low_health_text = "* The dummy looks like it's\nabout to fall over."
Now for some special tables, which take a bit more time to make:
-- List of possible wave ids, randomly picked each turn
self.waves = {
"basic",
"aiming",
"movingarena"
}
-- Dialogue randomly displayed in the enemy's speech bubble
self.dialogue = {
"..."
}
And finally, registering acts:
-- Register act called "Smile"
self:registerAct("Smile")
-- Register party act with Ralsei called "Tell Story"
-- (second argument is description, usually empty)
self:registerAct("Tell Story", "", {"ralsei"})
Making ACTs Work
Example acts:
function Dummy:onAct(battler, name)
if name == "Smile" then
-- Give the enemy 100% mercy
self:addMercy(100)
-- Change this enemy's dialogue for 1 turn
self.dialogue_override = "... ^^"
-- Act text (since it's a list, multiple textboxes)
return {
"* You smile.[wait:5]\n* The dummy smiles back.",
"* It seems the dummy just wanted\nto see you happy."
}
elseif name == "Tell Story" then
-- Loop through all enemies
for _, enemy in ipairs(Game.battle.enemies) do
-- Make the enemy tired
enemy:setTired(true)
end
return "* You and Ralsei told the dummy\na bedtime story.\n* The enemies became [color:blue]TIRED[color:reset]..."
elseif name == "Standard" then --X-Action
-- Give the enemy 50% mercy
self:addMercy(50)
if battler.chara.id == "ralsei" then
-- R-Action text
return "* Ralsei bowed politely.\n* The dummy spiritually bowed\nin return."
elseif battler.chara.id == "susie" then
-- S-Action: start a cutscene (see scripts/battle/cutscenes/dummy.lua)
Game.battle:startActCutscene("dummy", "susie_punch")
return
else
-- Text for any other character (like Noelle)
return "* "..battler.chara:getName().." straightened the\ndummy's hat."
end
end
-- If the act is none of the above, run the base onAct function
-- (this handles the Check act)
return super.onAct(self, battler, name)
end