TP gain/loss based on party composition

PANCZASU

Villager
Member
Joined
May 10, 2015
Messages
10
Reaction score
1
First Language
Polish
Primarily Uses
Hello,

I'm currently working on a non-commercial game. One of its desired features is an insanity system. I have it set up in such a way that when insanity (TP) is too high for an actor, bad things happen. The most common consequence of high insanity is disobedience (character having a chance to attack a friend instead of doing a proper action) though there are some different effects too.

The request:

Currently the only way to gain/lose insanity (TP) is through skills and events. However, I would love to have a script which would include a passive TP gain/loss determined by your party composition. Here's an example:

Let's say we have actors A, B and C. A and B are good, C is evil. If you put all of them together during combat, C gains insanity (TP) every turn during combat. If you only put A and C together, nothing happens as they balance each other out.

Implementation idea:

My idea to achieve this was to have a variable, let's call it X for now, that changes depending on active party. It's 0 by default. Adding A or B increases the variable by 1. Adding C decreases it by 1.

Now, let's look at the actors. A and B both have if X < 0, then [TRG] + 5 (they slowly become insane). Meanwhile, C has the opposite, if X > 0, then [TRG] + 5 (he becomes insane instead).

I suppose you could use some clever tags like <ideology>evil</ideology> in actor list to show the script which characters are good or evil.

The above is just an idea though, I lack necessary experience to implement this and I could use some help :/

Extra functionality:

If such scipt was made, would it also be possible to include a "neutral" ideology? :) Where actor marked with <ideology>neutral</ideology> doesn't add anything to X but DOES gain insanity if X is really high or low (if X < -2 or X > 2, then [TRG] + 5)?

Compatibility:

I would be grateful if this script could work with the other ones I'm currently using. I understand that this list is pretty long but if the script works with at least battle symphony and victor engine then that's good enough for me.

Yanfly's Party system

Yanfly's battle system

Ace Message System

Battle Symphony

Skill cost Manager

SKill restrictions

TP manager

Equip Passive Skills

Victor Engine

Victor Engine State Auto Apply

Likely complication:

I'm worried that the script I requested might not play nice if the amount of actors you bring into battle is smaller then your current party size. It would be great if the X variable described above could be only influenced by the actors that are currently in battle, not all actors that the player has access to.

Conclusion:

In short, I want to force the player to make a choice: either have a party of consistent ideologies that is perhaps less effective in combat or have a party of conflicting ideologies that pulls no punches but becomes unreliable due to insanity.

Thank you to everyone who took their time to read my request! :)

And yes, I have searched the web for any scripts that could achieve the above effect but I wasn't able to find anything like that.
 

Kai Monkey

Veteran
Veteran
Joined
Apr 3, 2012
Messages
166
Reaction score
119
First Language
RGSS3
Primarily Uses
Would it be possible to compile a "demo" with all of the scripts you are using, with your configurations, which can be used as a starting point. This would save me (or another scripter) from having to download each script manually and hope that none of your configurations will interact with the functionality.

Cheers

/Kai ♫

EDIT: Okay, well, I got bored and put together this:

$Ideologies = {}#################CONFIG############### The follwing is the amount on insanity TP gained per turn, if the # conditions are met: $INSANITY_TP = 5### The following is a list of ideolgies in the follwing format# NAME  => [EFFECT ON X, CONDITION FOR INSANITY]## for example:##   Ideologies = {#      "Unaligned"  => [+0    ,"x <= -2 || x >= 2"],#      "Good"  => [+1   ,"x <= -1"],#      "Evil"  => [-1  ,"x >= 1"],#   }## Means Good actors add one to the "Party Aligment" (or 'x', in the # script request) and gain insanity TP when x is less than or equal to -1.# Evil actors gain insanity tp when x is greater than or equal to 1, and # decrease x by one. # Lastly, Neutral actors do not affect x, but take insanity# when x is greater or equal to 2 OR less than or eqaul to -2 # Note double bars like || mean "or", and double and like && means "and"    $Ideologies = {      "Unaligned"  => [+0    ,"x <= -2 || x >= 2"],      "Good"  => [+1   ,"x <= -1"],      "Evil"  => [-1  ,"x >= 1"],   } # the follwing is the name of the default ideoligy $Default_ideo = "Unaligned"## Finally, set this to "true" if you want the default battle systems to # not affect TP (Items, skills, and events still can, just not the # automatic from being taking damage  $disable_default_TP = false##################END CONFIG#####################   class Game_Actor < Game_Battler  attr_reader :actor_id  #--------------------------------------------------------------------------  # * Processing at End of Turn  #--------------------------------------------------------------------------  alias old_on_turn_end on_turn_end   def on_turn_end    old_on_turn_end    note = $data_actors[@actor_id].note    ideo = get_ideo(note)    x = get_party_ideo    if eval($Ideologies[ideo][1])      self.tp += $INSANITY_TP    end    #self.tp = 7  end    def get_ideo(note)    a = note.split("<ideology")    return $Default_ideo if a.length<2     return a[1].split(">")[0].strip!  end    def get_party_ideo    x = 0    for a in $game_party.members      note = $data_actors[a.actor_id].note      ideo = get_ideo(note)      x += $Ideologies[ideo][0]    end    return x  end    #--------------------------------------------------------------------------  # * Charge TP by Damage Suffered  #--------------------------------------------------------------------------  alias old_charge_tp charge_tp_by_damage  def charge_tp_by_damage(damage_rate)    old_charge_tp(damage_rate) unless $disable_default_TP  end    #--------------------------------------------------------------------------  # * Initialize TP  #--------------------------------------------------------------------------  alias old_init_tp init_tp  def init_tp    if $disable_default_TP      self_tp = 0    else      old_init_tp    end  endend
This is designed to use zero additional scripts, so whilst it was designed with compatibility in mind, it almost definitely will not work with the one-hundred-and-one scripts you have installed. Once you have compiled that "demo" I will be able to modify the script to work seamlessly

This script uses tags like

<ideology Good>but otherwise works more or less as you described./Kai

EDIT 2:

I just thought I would note something interesting about my implementation (Mostly because I can't sleep). In the config, you actually write tiny amounts of code. If you have any experience writing custom damage formulas, you should be able to manage this, as it be very powerful if you want to add additional ideologies with unique effects, such as

"Chaotic" => [-1 ,"x >= 1 && self.hp < self.mhp"], "Selfless" => [+1 ,"x <= 1 || $game_party.dead_members.size > 0"]Chaotic which counts as evil. but doesn't gain insanity if it is at full health, or Selfless which counts as good, but gains insanity both in evil parties AND if there is a dead member in the party.
Of course, you do not have to include things like this, but as the implementation already included the functionality, I thought it would be a waste not to bring it to your attention.
 
Last edited by a moderator:

PANCZASU

Villager
Member
Joined
May 10, 2015
Messages
10
Reaction score
1
First Language
Polish
Primarily Uses
WOW, you are fast! Many, many thanks for your work! <3

I gave it a try in a random encounter and it seemed to work fine after setting $disable_default_TP to true. I'll test it properly soon but I just wanted to thank you first and let you know that the script works :)

Below is a demo with all the scripts that I use (including yours):

https://www.dropbox.com/s/d2j8vt917qd0obg/demo.exe?dl=0

Again, many thanks, you are great!

EDIT: Haha, I was so slow getting that demo to dropbox that you made an edit before I finished writing this post. Again, I'm amazed by what your script allows, I'm already drooling at all the possibilites :D
 
Last edited by a moderator:

Kai Monkey

Veteran
Veteran
Joined
Apr 3, 2012
Messages
166
Reaction score
119
First Language
RGSS3
Primarily Uses
It does? Well, sometimes I surprise even myself! :')

Let me know if you run into any bugs, otherwise I'll assume there's no need to modify anything .

I just want to say that this was ond if the clearest and well thought through script requests I have ever encountered, and it was a pleasure to work on! If there are any additional features (in battle messages? States called based on ideology?) just let me know!

Don't forget to credit Kaimonkry and to PM me to keep me up to date as your game develops!
 

PANCZASU

Villager
Member
Joined
May 10, 2015
Messages
10
Reaction score
1
First Language
Polish
Primarily Uses
Aww, thanks :3

And don't worry, there's no way I could forget to credit you! ^_^ The game still has ways to go though so it won't be released for a while.

As for extra features - I'll definitely let you know if I think of something else to add :)

I actually made a small modification myself today. I don't know Ruby but your code was so clear that I decided to give it a bash and... well, it didn't blow up my PC yet so I think it went ok.

I made it possible to customise the amount of TP each ideology gains/loses. Here are the bits that I changed, along with two examples

$Ideologies = {
"Saint" => [+2 ,"1" ,-5],
"Zealous"  => [-1  ,"x != 0 || $game_party.dead_members.size > 0"  ,15],
}
alias old_on_turn_end on_turn_end
def on_turn_end
old_on_turn_end
note = $data_actors[@actor_id].note
ideo = get_ideo(note)
x = get_party_ideo
if eval($Ideologies[ideo][1])
self.tp += $Ideologies[ideo][2]
end
#self.tp = 7
end
And because I never know when to stop, I'm wondering if somthing like that is doable:

"Egocentric" => [+0 ,"(x < -1 || x > 1) && self.hp < self.mhp" ,2 +
"self.tp / 2".to_f],
I want this ideology to get progressively harsher as the actor builds up TP. Right now it doesn't work, only adds 2 TP per turn and ignores any bits added later. However, if you can make it work (and if it's easy; you've already done enough for me! <3 ) then I'll be grateful! :D

EDIT: Did I say that I don't know when to stop? Yeah, I meant it.

Is it possible to change actor's ideology mid-game via events?
 
Last edited by a moderator:

Kai Monkey

Veteran
Veteran
Joined
Apr 3, 2012
Messages
166
Reaction score
119
First Language
RGSS3
Primarily Uses
Ah, yes, I thought that was coming hahaha!
I'm on a train right now so i'll have that done by the time I'm at my home stop!

$Ideologies = {}#################CONFIG############### The following is a list of ideolgies in the follwing format# NAME => [EFFECT ON X, CONDITION FOR INSANITY, AMOUNT]## for example:## Ideologies = {# "Unaligned" => [+0 ,"x <= -2 || x >= 2", "abs(x)"],# "Good" => [+1 ,"x <= -1"],"3",# "Evil" => [-1 ,"x >= 1"],"2",# "Chaotic" => [-1 ,"x >= 1 && self.hp<self.mhp","rand(5)"]# }## Means Neutral actors do not affect x, but take insanity# when x is greater or equal to 2 OR less than or eqaul to -2. The amount# they gain is equaly to absolute x (The more aligned the party, # the more insanity)# Good actors add one to the "Party Aligment" (or 'x', in the # script request) and gain insanity 3 TP when x is less than or equal to -1.# Evil actors gain 2 insanity tp when x is greater than or equal to 1, and # decrease x by one. # Lastly Chaotic actors count as evil, but never gain insanity if they# are at full health. The amount of insanity they gain is a random number from# 0 to 4# Note double bars like || mean "or", and double and like && means "and"# $Ideologies = { "Unaligned" => [+0 ,"x <= -2 || x >= 2", "x.abs"], "Good" => [+1 ,"x <= -1","3"], "Evil" => [-1 ,"x >= 1","2"], "Chaotic" => [-1 ,"x >= 1 && self.hp<self.mhp","rand(5)"] } # the follwing is the name of the default ideoligy $Default_ideo = "Unaligned"## Finally, set this to "true" if you want the default battle systems to # not affect TP (Items, skills, and events still can, just not the # automatic from being taking damage $disable_default_TP = true##################END CONFIG#####################class Game_Actor < Game_Battler attr_reader :actor_id attr_accessor :ideoligy #-------------------------------------------------------------------------- # * Processing at End of Turn #-------------------------------------------------------------------------- alias old_on_turn_end on_turn_end def on_turn_end old_on_turn_end ideo = get_ideo(self,$data_actors[@actor_id]) x = get_party_ideo if eval($Ideologies[ideo][1]) self.tp += eval($Ideologies[ideo][2]) end end def get_ideo(actor,data) if actor.ideoligy return actor.ideoligy end note = data.note a = note.split("<ideology") actor.ideoligy = a.length < 2 ? $Default_ideo : a[1].split(">")[0].strip! return actor.ideoligy end def get_party_ideo x = 0 for a in $game_party.members ideo = get_ideo(a,$data_actors[a.actor_id]) x += $Ideologies[ideo][0] end return x end #-------------------------------------------------------------------------- # * Charge TP by Damage Suffered #-------------------------------------------------------------------------- alias old_charge_tp charge_tp_by_damage def charge_tp_by_damage(damage_rate) old_charge_tp(damage_rate) unless $disable_default_TP end #-------------------------------------------------------------------------- # * Initialize TP #-------------------------------------------------------------------------- alias old_init_tp init_tp def init_tp if $disable_default_TP self_tp = 0 else old_init_tp end end alias old_setup setup def setup(actor_id) old_setup(actor_id) get_ideo(self,$data_actors[actor_id]) end def set_ideo(ideo) return msgbox(ideo+"is not a valid ideoligy!") unless $Ideologies[ideo] self.ideoligy = ideo endend
There we go! This version has:
  • Dynamic Insanity TP amounts (Allowing you to do the whole "self.tp / 2" thing)
  • Actors Ideology (My Dungeons and Dragons mind keeps telling me to say "Alignment") can be changed dynamically using
    Code:
    some_actor.set_ideo("Good")
If you want to change an actor with a specific name use

$game_party.members.each{|a|a.set_ideo("Good") if a.name == "Sarah"}
or a specific id:

$game_party.members.each{|a|a.set_ideo("Good") if a.actor_id == 2}
Finally, feel free to look through my implementation to see why your "Some Code here".to_f didn't work ;)
 
Last edited by a moderator:

PANCZASU

Villager
Member
Joined
May 10, 2015
Messages
10
Reaction score
1
First Language
Polish
Primarily Uses
Again, you are amazing and I can't thank you enough for your work!

I put the code in and everything is working just fine, even after adding some of the weirder ideologies in :) Also, I totally get what you say about alignment. I was actually looking for that word when posting this thread but for the life of me I couldn't remember it haha.

I'll have a better look at your code tomorrow to see what you've done ^_^ Right now I desperately need to go to sleep
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,859
Messages
1,017,030
Members
137,566
Latest member
Fl0shVS
Top