Looking For A Pacifistic Battle System

give this script a try then,

this adds a variable for you to store numbers on each battler.

so you can easily set the pet count on each battler this way.

eg.

b.vn += 1; if b.vn >= 2; b.escape; b.animation_id = 31; end;i guess one variable should be enough?

might not work on old save files, just start a new game to give it a try.

Code:
#==============================================================================# ■ Meow Face Battler Variable#------------------------------------------------------------------------------# Add Extra Variable for Battler#==============================================================================# How to Use:# [1] Paste this below Material and above Main# [2] In battle formula, use a.vn or b.vn to control variable on the battler#==============================================================================class Game_Battler < Game_BattlerBase  attr_accessor :vn  alias meow_battler_variable_init initialize  def initialize    @vn = 0    meow_battler_variable_init  endend
Thank you so much x3. I'll try this when I get home tonight and see how it works. Current method is a bit messy

EDIT: It works really well, actually! If I need to add another variable, like for a different type of action (like if I want to have an enemy spared by petting and playing fetch or something), would I just add another accessor?

Also, if I want to make the spare a separate option, can I just call b.vn to see if it's equal? And will that keep the correct number for each battler?

EDIT AGAIN: The correct answer is yes to all of the above lol. Thank you so much x3 That script makes everything so much easier!

Except now that I think about it, I am running into a different problem. The goal is to have different types of enemies have different spare conditions. So, like a slime would need to be petted twice, and maybe a skeleton just needs a compliment or something. There doesn't seem to be a way to incorporate that without a different spare option for everyone. And if I have different enemies in the same troop, then that would get super confusing.

Because I can't seem to call the variable in a common event, would there be a way to code an index like that and it not get too out of hand?
glad the snippet help.

as for your question about individual enemy. there should be a way to check the enemy's name, umm or was it enemy's graphic name? can't remember. but the answer to that is yes, you can. just need to know which script call to use as condition check. but still.. you will have to do that for each type of enemy in the condition check, so yes again, you will need to make one condition for each enemy, or a least those not sharing the same pet counts.

the variable can be called from the common event, but you will require tsukihime's script to get the troop id of the target onto a game variable.

this code below should work for common event to read the vn of a certain troop member.

$game_troop.members[id].vnchange id to $game_variables[X] where X is the game variable you are using to get the target's id.

so the full code will be something like this:

$game_troop.members[$game_variables[1]].vnedit:

and by theory(not tested), you can check the enemy type id by using this

$game_troop.members[$game_variables[1]].enemy_idedit again:

I might be able to make you some shorter condition script calls to check on certain groups of enemy type ids like:

if b.can_pet?
Code:
if b.can_praise?
Give this script a try.

Code:
#==============================================================================# ■ Meow Face Battler Extra Condition Check#------------------------------------------------------------------------------# Add Extra Condition Check Script calls#==============================================================================# How to Use:# [1] Paste this below Material and above Main# [2] In battle formula, use a.can_pet? or b.can_pet? to check if it can be petted.# [3] In battle formula, use a.can_praise? or b.can_praise? to check if it can be praised.#==============================================================================module MeowExtraCheck #DO NOT REMOVE!!#==============================================================================# Settings Area#==============================================================================  PET = [1, 2, 3, 6] #Enter Enemy IDs for Pet-able Enemies  PRAISE = [2, 3, 5, 6] #Enter Enemy IDs for Praisable Enemies#==============================================================================# End of Settings Area# Edit anything past this line at your own risk!#==============================================================================endclass Game_Enemy < Game_Battler  def can_pet?    MeowExtraCheck::PET.include?(@enemy_id)  end  def can_praise?    MeowExtraCheck::PRAISE.include?(@enemy_id)  endend
That looks awesome. x3 I'll do some testing and see how it all works out. 
It's just another way to ease life for formula making. 😛

changing a few lines to just a short command.

if you are looking forward to call common event directly in the formula there are ways to shorten the default commands too. 😉
I might do that. I'm actually going through a ruby syntax tutorial so that i can get everything done through scripts as much as possible. The amount of if statements I'm going to need are absolutely ridiculous lol
I might do that. I'm actually going through a ruby syntax tutorial so that i can get everything done through scripts as much as possible. The amount of if statements I'm going to need are absolutely ridiculous lol
It depends actually. keeping your custom script short is a good way to keep your performance high.

But for something like additional conditional checks/a shortened method name shouldn't take up too much space i bet.

Now you know how to build variables and condition checks, the rest is easy.

eg, to turn some long codes into something short:

Code:
#==============================================================================# ■ Meow Face Useful Short Cuts#------------------------------------------------------------------------------# Add Extra Short Script Calls#==============================================================================# How to Use:# [1] Paste this below Material and above Main# [2] To run a common event, use below in script calls#      c_event(id)# [3] To teleport player on map, use below in script calls#      tele(x, y)#==============================================================================class Game_Interpreter  def c_event(id)    $game_temp.reserve_common_event(id)  end  def tele(x, y)    $game_player.moveto(x, y)  endend
Neat. Also, I finally managed to get it to store the variables:

#-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(index, enemy_id) super() @index = index @enemy_id = enemy_id if index == 0 $game_variables[1] = enemy_id end if index == 1 $game_variables[2] = enemy_id end if index == 2 $game_variables[3] = enemy_id end enemy = $data_enemies[@enemy_id] @original_name = enemy.name @letter = "" @plural = false @screen_x = 0 @screen_y = 0 @battler_name = enemy.battler_name @battler_hue = enemy.battler_hue @hp = mhp @mp = mmp endI had to modify the Game_Enemy script, but now when the creatures are generated, their IDs are stored in the first 3 variables. With that, and your Battler variables script, I should be able to craft it all up. I'll probably put up a proof of concept when it's done, in case you want to see it.

Seriously, thank you so much for your help x3

EDIT: So, everything is going awesome, except when I use a common event to change the game variable for the Battler Variables, they are 1 turn behind. (First turn, pet adds nothing, then the second time, pet adds one, etc.) Am I just putting the information in incorrectly? This is what I have:

Script: $game_variables[4] = $game_troop.members[0].vn $game_variables[5] = $game_troop.members[0].vn $game_variables[6] = $game_troop.members[0].vnConditional Branch: variable[0001] == 1; #Checks if the first enemy is a slime Conditional Branch: variable[0004] == 2 #Checks if I've used pet twice on Slime Text: -,-,Normal,Bottom "Is Sparable!" else branch endelsebranch endLike, it works. It's just one turn behind, and I'm pretty sure it's my fault somewhere, because it worked fine before I was transferring it to a variable.
if you are doing it via script, you should put the whole calculation + condition there.

and only output the result as final true/false check for the battle formula to proceed the rest of the skill.

eg.

when everything is true, make enemy escape from battle and play an animation.

the reason for adding scripts is to make the other part of the game making shorter. if you still have to do the same long code both sides it's not worth it.

if you want to use common event as message showing.

something like this might work for a formula with all those scripts above:

Code:
if b.can_pet? && b.vn >= 2; c_event(1); else; c_event(2); end;
Cool, I didn't know I could do that. Thanks again x3
Cool, I didn't know I could do that. Thanks again x3
The formula box can actually do lots of wonders, control switch/variable even exp and level up can be done there.

The only problem is it being too short for a long complex version. That's why i suggest Tsukihime's extension script in my previous post. 😉

Or use script examples like i've shown you above to shorten things to make the final formula code short. 😛
The code shortening script doesn't seem to be working. I moved everything into the project exactly as you have it, but the attack isn't running the common events. About to test with the longer version of the common event call.

EDIT: It doesn't work with $game_temp.reserve_common_event(1) either. D: I need to play around with it more. My old file crashed, so I'll re-enable the debug function and make sure that it's storing the variable correctly. Maybe I'm just messing the call up...

EDIT AGAIN: So, what I'm getting now is weird. I added back in my debug (Just set the vn's to variables like before, and print out the variables at the end of turn), and now when the turn ends I get this error:

Script 'Game_interpreter' line 1411: NoMethodError occured.

 

undefined method 'vn' for nil:NilClass

 

My debug event is just this script:

Script: $game_variables[4] = $game_troop.members[0].vn
$game_variables[5] = $game_troop.members[0].vn
$game_variables[6] = $game_troop.members[0].vn

 

and a textbox with

 

\v[1], \v[2], \v[3], \v[4], \v[5], \[v6]
for the vn error, did you happened to remove the vn variable script?
 
as for the common event, i might need to give it a check later.
are you running more than one common event there? i mean, is the skill itself calling another common event other than the one you called in the formula?
 
edit:
found the problem, thought the formula can run interpreter commands but i was wrong.
 
i simply move that to the battler class and it works.
 
Formula used:

b.vn += 1; if b.can_pet? && b.vn >= 2; b.c_event(1); b.escape; else; b.c_event(2); end;Scripts Used:

#==============================================================================# ■ Meow Face Battler Variable#------------------------------------------------------------------------------# Add Extra Variable for Battler#==============================================================================# How to Use:# [1] Paste this below Material and above Main# [2] In battle formula, use a.vn or b.vn to control variable on the battler#==============================================================================class Game_Battler < Game_BattlerBase  attr_accessor :vn  alias meow_battler_variable_init initialize  def initialize    @vn = 0    meow_battler_variable_init  endend
Code:
#==============================================================================# ■ Meow Face Battler Common Event#------------------------------------------------------------------------------# Add shortened common event script call in formula#==============================================================================# How to Use:# [1] Paste this below Material and above Main# [2] To run a common event, use below in script calls#      a.c_event(id) or b.c_event(id)#==============================================================================class Game_Battler < Game_BattlerBase  def c_event(id)    $game_temp.reserve_common_event(id)  endend
Code:
#==============================================================================# ■ Meow Face Battler Extra Condition Check#------------------------------------------------------------------------------# Add Extra Condition Check Script calls#==============================================================================# How to Use:# [1] Paste this below Material and above Main# [2] In battle formula, use a.can_pet? or b.can_pet? to check if it can be petted.# [3] In battle formula, use a.can_praise? or b.can_praise? to check if it can be praised.#==============================================================================module MeowExtraCheck #DO NOT REMOVE!!#==============================================================================# Settings Area#==============================================================================  PET = [1, 2, 3, 5] #Enter Enemy IDs for Pet-able Enemies  PRAISE = [2, 3, 5, 6] #Enter Enemy IDs for Praisable Enemies#==============================================================================# End of Settings Area# Edit anything past this line at your own risk!#==============================================================================endclass Game_Enemy < Game_Battler  def can_pet?    MeowExtraCheck::PET.include?(@enemy_id)  end  def can_praise?    MeowExtraCheck::PRAISE.include?(@enemy_id)  endend
Code:
#==============================================================================# ■ Meow Face Battle Log Canceller#------------------------------------------------------------------------------# Remove certain log message from skill#==============================================================================# How to Use:# [1] Paste this below Material and above Main#==============================================================================module MeowBLC #DO NOT REMOVE!!#==============================================================================# Settings Area#==============================================================================  SKILL = [129, 130] #Enter Skill IDs to remove log message in battle#==============================================================================# End of Settings Area# Edit anything past this line at your own risk!#==============================================================================endclass Window_BattleLog < Window_Selectable  alias meow_battle_log_hijack display_action_results  def display_action_results(target, item)    return if item.is_a?(RPG::Skill) && MeowBLC::SKILL.include?(item.id)    meow_battle_log_hijack(target, item)  endend
inside common event 1:
message:
"The monster looks happy and run off somewhere"
 
inside common event 2:
message:
"You pet the monster but nothing happened"
Awesome, now it works. The last common event runs after the battle, but i think Hime has a script that fixes that. 

Now I just have to go through and make the rest of it lol

Thanks so much for your help x3
You're welcome!

Normal common event will run at turn's end. But if you set it to parallel it will only run after the battle.
That makes sense. Cool beans x3

EDIT: Now I just have to figure out how I want battles to work. I want to still use the standard battle system, but I do want some kind of minigame on an enemy attack. The battles are a little stale still, because it's still back and forth. I've been playing around with Galv's Timed Hits script, and it's interesting, but I think I want something more. Something that evokes a need to dodge the attacks the enemies are throwing at you.

But, with the issues you brought up with the GPU, that would probably be an issue. I do have a bullet-hell style battle script, but it's not what I need, and it seems that it uses it's own battle system, negating the work you did. Unless I can call those variables in there, but I still have no idea how to go through and call it then go back to the regular battle D:

Even just something like DDR would spice it up a bit. 

I was thinking I could run a common event based on a script for the base attack, but that doesn't seem to be working, and I don't want to waste all the help you've given me. 

This is what I get for trying to be different 😛  

I need to read up more. I'm going to make this really fun ^^
Well, you don't have to follow another game 100%, so it's time to do some brainstorming and come up with something original 😉

You can check my script list(link in my signature) for ideas too, some of those script might just give you the spark of ideas. 😉
Very valid point. Gonna do that when I get home x3
Very valid point. Gonna do that when I get home x3
Since you are giving your player the pacifistic point of view, you might just want to give them an option to "bribe" themselves out of a battle.

So instead of using random encounter, you can use event encounter with "options" / "choices", and depends on how the players choose their answers, it can lead to battle or peace. 😉

A smart conversation pattern with questions and answers for enemies that can "talk". (Can be bribed using gold?)

And a way to bribe enemies with "items" for enemies that can't "talk". (bribe using meat bones? 🙂 )

And if they can't avoid battle, that's when the pet/praise come in line. 😛
That does actually sound interesting. I'll have to see what I can do with that. 

Original thread: https://forums.rpgmakerweb.com/threads/looking-for-a-pacifistic-battle-system.54530/