So, I had an idea for a boss battle, but I have no idea how to go about scripting the mechanic it uses.
Basically, the boss will periodically use a skill called Bloodletter (which does not ignore armor) to inflict damage and a status ailment called Bleed. Not only does Bleed drain stats every turn, but if the boss inflicts it, he will smell blood and gain an attack boost.
In the boss' case, his version of the ailment can be stacked, creating multiple instances of Bleed on the party, and as such, further increasing his attack boost until the player deals with the ailment.
If the amount of stacks on a single character equals 3 or more, the boss will use a skill called Bloodbath that does a hefty amount of damage that ignores armor.
I don't want this mechanic for just the boss, though. I want a version of Bleed for random encounters, too, so that I can have scenarios like, say, Vampire Bats or Sharks using skills to inflict it for an attack or speed boost, except this version of Bleed will not stack.
Your help with this is much appreciated.
Need Help Scripting a Battle Mechanic
● ARCHIVED · READ-ONLY
-
-
Well, firstly, you'll need a script that allows you to have states stack (with or without the effects stacking as well).
Secondly, I'd make three skills for this boss.
One skill acts as his regular attack (more on that in a bit)
The second one adds the Bleed state.
And the third one is your Bloodbath move.
Now, the second skill should be easy; damage formula and add state.
The first one will have to somehow count each actor's bleed state(s) and pop the number into a variable.
Once you have your variable, you can easily use it as a multiplier for the attack.
You don't make this the regular attack skill because it might cause issues if everyone could do it.
Again, the third skill will have to count states; this time on only one character.
That skill may require a targeting script as well.
It would be far easier to have the boss require the skill just be on an actor, but if you need it there 3 times, you'll have to find a script.
An alternate way to handle this would be to make the second skill inflict different versions of the bleed state.
Lgt Bleed at first.
If the actor has Lgt Bleed, the skill will cure it while inflicting Md Bleed.
And the same for Hvy Bleed (no menstruation jokes!)
Then you can have the attacks add to a variable based on precisely which version of Bleed an actor has.
It's complicated either way, but the second may be easier in the long run. -
Well, that kinda helps, but what I need are actual scripts that I can use, or at least the bases for them. ^^;
-
Ok...
I doubt too many people will help with a script knowing there's a non-scripting solution.
My idea is cumbersome, but it WILL work.
But if you must have a script, then I hope someone makes one (them) for you.
Good luck. -
What do you mean by SCRIPT? Do you actually want a script that you put into your script editor via F11? Or do you just want to know how to set up your battler and troop events to make certain things happen?
New users commonly say "script" when they don't mean script at all, and it's confusing. If you are not certain of the difference, then you should not attempt to use a (real) script until you've investigated the non-scripting alternatives. -
So... I wrote out a very long explanation, then I accidentally closed the browser when I meant to close RPG Maker and lost it all. I'll try and remember everything I had written.
Anyway, you'll just need one script for this: Hime's Common Event Variables.
I'm assuming a few things about your ability, by the way, so let me know if any of this is incorrect: I'm assuming it's a single-target ability, not a group attack. I'm also assuming that you want the boss to be able to use bloodbath whenever anyone in the party has 3 stacks of bleed on them.
The first thing you want to do is make it so that the bloodletter skill will properly apply stacks of bleed. So you'll need to make 3 bleed states, we'll make them states 2, 3, and 4. You can name them whatever you want, but just make sure you know which is which. In the bloodletter skill window, set it up to do whatever you'd like it to do in terms of animation, damage, etc. etc. Since you want it to not ignore armor, make sure somewhere in the damage formula that b.def is used to subtract some damage. Then, in the effects section of the skill, have it call a common event, Bloodletter.
The common event will contain the following script call:
b = $game_temp.common_event_targetif b.state?(2)b.remove_state(2); b.add_state(3)else if b.state?(3)b.remove_state(3); b.add_state(4)else if b.state?(4)elseb.add_state(2)endendendIt will look like this screenshot:
What this will do is, after the damage has been done, it will check if the targeted actor has state 2 (or, the first stack of bleed) on them. If it does, it will remove it and add state 3 (the second stack of bleed). If they have state 3 (the second stack of bleed), then it will remove it and add state 4 (the third stack of bleed). If they have state 4, it does nothing, and if they don't have any of the bleed stacks, then it will add state 2 (the first stack of bleed).Spoiler
For each state, you can setup the various parameters for what each stack does. Perhaps state 2 lowers DEF to 80% and causes 1% HP damage every turn, state 3 lowers DEF to 60% and causes 3% HP damage every turn, and state 4 lowers DEF to 40% and causes 5% HP damage every turn. Whatever you want it to do.
So now the stacking bleed is taken care of.
Now you want to make states where the boss gets more powerful depending on what the highest number of bleed stacks in the party is. So we'll need to make 3 more states - states 5, 6, and 7. Call them whatever you want - for example, let's say SmellBlood1, SmellBlood2, and SmellBlood3. Perhaps SB1 raises ATK to 200%, SB2 raises ATK to 400%, and SB3 raises ATK to 600% (that's probably a bit much, but you get the idea). So you'll need to check what the highest stack of bleed in the party is.
There are a few ways you could do this, but let's make an event page on the boss's troop. Let's set it to "When the end of the turn" for a condition and a span of "Turn." This means, at the end of every turn, this page will be checked. Let's also make some variables, variables 1, 2, and 3. Let's call them Bleed1?, Bleed2?, and Bleed3?. What they will do is let us know what the highest stack of bleed currently active in the party is. So let's initially set them to Bleed1=0, Bleed2=0, Bleed3=0, which means, "There are no stacks of bleed currently in the party."
Then we'll do a script call that will run through each actor in the party and check their states. It will look like this:
$game_party.battle_members.each {|actor|if actor.state?(2)$game_variables[1]=1else if actor.state?(3)$game_variables[2]=1else if actor.state?(4)$game_variables[3]=1elseendendend}This will ensure that if anybody in the party has a 3rd stack of bleed, then Bleed3 will be equal to 1. If anybody has a 2nd stack, Bleed2 will be equal to 1. If anybody has 1 stack, Bleed1 will be equal to 1. Otherwise, nothing happens and all 3 variables remain at 0.
So, using this information, we can make a series of conditional branches that will check what the highest stack of bleed in the party is using these variables. The whole troop page will look like the following screenshot:

So the whole series of branches basically goes like this: "Is Bleed3 equal to 1? If so, it means somebody in the party has 3 stacks of bleed. So, let's remove SmellBlood1 and SmellBlood2 (because otherwise the boss will get the benefits of all 3 states and do way too much damage) and add SmellBlood3. If Bleed3 is not equal to 1 (meaning it's equal to 0), then it means nobody in the party has 3 stacks of bleed. So we can remove SmellBlood3. Is Bleed2 equal to 1? If so, it means somebody in the party has 2 stacks of bleed. So let's remove SmellBlood1 (because 3 has already been removed) and add SmellBlood2. If Bleed2 is not equal to 1 (meaning it's equal to 0), then it means nobody in the party has 2 stacks of bleed. So we can remove SmellBlood2, as well. Is Bleed1 equal to 1? If so, somebody in the party has a stack of bleed. So let's add SmellBlood1 (because 2 and 3 have already been removed). If none of those three variables are equal to 1, then let's also remove SmellBlood1."
So now, you have a bleed that will properly stack 3 times, and you have a buff for the boss that will properly stack 3 times according to whatever the highest stack of bleed in the party is. All that's left is giving the boss access to the Bloodbath ability.
On the enemies page, you can set their behavior patterns to only use certain skills when certain conditions are met. In this case, you want the enemy to only use bloodbath when he has 3 stacks of SmellBlood. So, you can set the enemy pattern to prioritize bloodbath, but only if the state "SmellBlood3" is active, like so:

So now you have a boss that will use bloodletter, which will properly stack up bleeds, that checks each turn what level of SmellBlood he should have based on the highest number of bleed stacks in the party, who will switch to using bloodbath if anyone in the party has 3 stacks of bleed.
EDIT: For the regular enemies, just have their skills inflict the Bleed1 state (state 2), then in the damage formula box, do something like:
a.add_state(15);a.atk-b.def
What that will do is add state 15 to the attacker (the enemy) whenever they use the skill, then deal damage equal to their attack minus their target's defense. In the effects box, you'd have "add state [bleed1]" so that the attack will also apply that state. -
Thank you so much, this is amazing!
Please, everyone, if you feel like using this mechanic, go right on ahead. More awesome and unique skills for people to use!
And Shaz, by script, I meant exactly what Zevia just posted (which would be the latter of your guesses, I assume?) I apologize for the confusion.
Edit: One question. Do I put the second script call in the same common event (named Bloodletter)? Stupid question, I know. -
Not a stupid question - actually, my original solution was to put the second script call as part of the Bloodletter common event. It will apply the SmellBlood states (or whatever you name them) more immediately, instead of at the end of each turn.Edit: One question. Do I put the second script call in the same common event (named Bloodletter)? Stupid question, I know.
The only problem is, if you have a way to remove bleeds from your party, then the boss won't check their bleed stacks again unless he uses Bloodletter - which, since he's probably using Bloodbath, he won't do. So you'll need a troop event anyway that's going to check everyone's bleeds periodically (presumably every turn), which would just require having the second script call as part of the troop event, anyhow, which will end up being redundant.
So you do the first script call as part of the common event, then do the second script call as part of the troop event, like I have it in the troop event screenshot. -
That makes sense.
Thank you. I'll try it out and post any issues that come up. -
Okay, I absolutely hate to both necro and double-post, but I had to vanish for a long while and have only now implemented the assets given to me.
The overall script works well, just...One issue. And it's not that big of a deal, I think I got the problem pinned down, I just need to show what happened and ask a quick question.
Basically, instead of changing from Bleed1 to Bleed2, Bloodletter would cause Bleed1 and then inflict Blind and finally Silence.
So, I was initially confused, then I thought to check the script, and I began to piece together what was happening.
Take note of where the status ailments are. Because this is where I think I fouled up.
See that script call? If I'm not mistaken, the numbers indicate calls for States in the list. And Blind and Silence happen to be 3 and 4, the numbers in the script.
If I'm correct, please tell me; Do I replace Poison, Blind and Silence with Bleed1/2/3, respectively, in the states list? Is it just a matter of moving things around? -
Yeah, you need to ensure that whatever states are being checked in your script calls are the ones corresponding to your bleed states. So instead of using 2, 3, and 4 in the script call (which, in your game, are poison, blind, and silence), change the numbers to 28, 29, and 30 (Bleed, Bleed II, and Bleed III).
So you want:
$game_party.battle_members.each {|actor|if actor.state?(28)$game_variables[1]=1else if actor.state?(29)$game_variables[2]=1else if actor.state?(30)$game_variables[3]=1elseendendend}
Your common event will also need to be changed, like so:
Code:b = $game_temp.common_event_targetif b.state?(28)b.remove_state(28); b.add_state(29)else if b.state?(29)b.remove_state(29); b.add_state(30)else if b.state?(30)elseb.add_state(28)endendend -
Okay, so went and changed it, everything works fine and dandy...Until my brain kicked in and I realized that, as this is an early boss, there won't be many party members.
In fact, at most, I have planned for this boss two party members to face him. The issue with this is that it means that, if they heal Bleed every round, Bloodletter will never build the stacks required for Bloodbath.
Why? Bloodletter attacks only one target each turn.
This means the challenge, and the stacking mechanic, are rendered moot because the one stack can be removed each turn. Bad design, negates the entire script.
So I've decided to give the Boss, Zulbuzeek, multiple actions per turn (allowing for multiple stacks of Bleed per turn), and I'd like to have it so this one item made for removing Bleed (which can be bought in town and found in the dungeon) only removes it stack by stack. Is there a way to script this?
I apologize for using you as a workhorse, but you do quality work, man, and i'm learning a lot about scripts in the process. ^^;
Allow me to take a guess that it similarly to the script for Smellblood, checking which Bleed state is in effect, and removing the right states while adding the appropriate one (state=Bleed3, removes states 1/2/3 and adds Bleed1 to the target). Am I close? -
Yeah, it sounds like a pretty simple reversal of the boss's ability - make your bleed removal item (let's say "Bandage") call a common event that checks the target's current state and changes it appropriately, except you'll start with the highest one, then work your way down to the lowest one. So go to the effects of your item and have it call a common event that performs this script call:
b = $game_temp.common_event_targetif b.state?(30)b.remove_state(30); b.add_state(29)else if b.state?(29)b.remove_state(29); b.add_state(28)elseb.remove_state(28)endendI'm not currently at home where I can double check this code in my own project, but I believe what it will do is check if the target has Bleed III on - if so, it will remove Bleed III and add Bleed II. If not, it checks if the target has Bleed II - if so, it will remove Bleed II and add Bleed I. If not, it will remove Bleed I. You'll notice the code is slightly shorter than adding the bleeds because you need one less if check - you do the same thing if the target has Bleed I or no bleeds (remove state 28).
The reason I want to check this code at home is because I removed an else if line and an end, and while I believe that's correct, I always like to make sure my formatting is good.
EDIT: Yep, should work just fine for you - let me know if you have any issues.

