Hello, I'm looking/asking for a specific script that works with variables and displays them in combat. What I need is an script that counts the number of hits in an attack, adds the number to a variable and display them in a simple box. Here is a list of options that I would like to have in the script:
-Attacks add to the hit counter depending on the number of hits dilivered to the enemy.
-When certain attacks are used they can either take a few numbers from the variable to use
in the attack. I.E. Player has 10 hits in the count box. He can use 3 of those points to
deliver a stronger then average attack.
-When there are not enough hit counts skills cannot be used.
-The enemy can use attacks that take away hits from the counter.
-The hit counter resets after every battle.
-A way to have equipment add to the variable when worn.
I've looked all over the vast land of the internet and I haven't been able to find anything that works like this. I would deeply appricate it if any kind hearted person could make this or direct me in the right direction. Thank you in advance.
Hit Count System
● ARCHIVED · READ-ONLY
-
-
in some way a tp system but work for Sp (special point) ?
-
Something like that, but on a smaller scale. I want this to be a bit more dynamic then what the TP system offers. Each hit will add 1 to a variable and from that variable I can work the battle formula to my liking.
-
If you know a bit of scripting, you can use Yami's Combo Counter script for this.
It stores the amount of hits and damage done in a variable automatically.
You can use script calls to reduce the hit number in the middle of battle (not so obvious script calls, mind you!).
And you can incorporate the hit numbers into your damage formulas too.
I am using this script the same way, and it works for me.
That is, if I understood what you want to do with it. -
Actually that would work great, but I'm horrible with scripting. If anyone could show me how to optimize the script to do the above I would greatly appreciated.
-
Well, aside from the equip stuff (haven't tried it yet, but it is a nice idea), here is how I did it:
Scripts needed for this:
- Yami's Combo Counter
- Yanfly's Skill Cost Manager
The script calls you can use with Yami's script are:
SceneManager.scene.combo_countThis returns the current number of combo hits.
Code:SceneManager.scene.combo_damage
And this one returns the current amount of combo damage.
Knowing this, we can make quite a lot of things with it.
Make a skill.
Set the custom requirements for it like this:
Code:<custom cost: Hits x2><custom cost colour: 2><custom cost size: 20><custom cost icon: 0><custom cost requirement>if SceneManager.scene.combo_count == nil;return false;else SceneManager.scene.combo_count >= 2; end;</custom cost requirement>
A few notes from the above note-tags:
The most important tag is the custom cost requirement! Never remove anything from that note-tag which is above the 'else' part or else the game will crash as soon as you open the skill list!
Aside from this, everything can be modified, of course.
The above example skill would only be usable if the player has accumulated at least 2 hit count.
The other things listed above are purely for the looks.
Now, if you don't want to use the current hit numbers in a damage formula, you can add this extra note-tag:
Code:<custom cost perform>SceneManager.scene.combo_count -= 2</custom cost perform>
This will remove 2 from the hit count before the damage calculation. Note, before!
This is important if you want to make a skill which scales in damage when there are more hits accumulated, so if you want to do that, do not add this line!
We are done with the note-tagging.
Next, if you wanted to make a skill with variable damage depending on the number of hits, you can use the first script call I showed you here from Yami's script. For example:
Code:a.atk * SceneManager.scene.combo_count
This would multiply whatever attack the user has with the number of current hit count.
Experiment with formulas to make really unique ones. :)
And the last important step...
If you made a damage formula with the hit count, you shouldn't use the 'custom cost perform' note-tag, as already mentioned above. This will make us do a common event which looks exactly what that note-tag would look like:
Code:SceneManager.scene.combo_count -= 2
This will do the same as that note-tag, but this will happen only after the skill is performed, which is important for our damage formula with the hit count.
Set a common event like this for each of your skills.
To reduce the number of common events needed, there should be a way to determine what skill is currently being used with a script call, and we could use that to identify which skill the player is using, so by making lot of conditional branches, we can pack all of our "hit count" skill cost perform methods into a single common event.
I actually found this out before, but I lost that part of my project, and I can't seem to find the correct script call again. >.>
Ohh, well, will keep trying. Until then, just make a common event for each skill and you should be fine.
This is it, in a nutshell.
If you got any questions, feel free to ask! :)
I'm off to work now, will be back later. -
This makes a whole bunch of sense! The only problem I have is this:
Spoiler
-
No idea what causes that issue. I guess, it is a placement or incompatibility issue.
And when do you get it? Right at the start-up or in the game after some things happening?
Make sure you put the Combo Counter script below all of your battle systems (like Yami's Symphony or any ATB system, etc), but above Yanfly's Skill Cost Requirements script.
I also made a little snippet for making the setup easier. The below snippet eliminates the need of common events completely. It also reserves one variable.
Here it is:
Put it below Yami's Combo Counter and Yanfly's Skill Cost Manager scripts.Spoilermodule HitCount HCountVar = 30 # the variable used to track the current hit count amountend class Game_BattlerBase alias sixth_pay_custom_cost121 pay_custom_cost def pay_custom_cost(skill) custom_hit_count_save sixth_pay_custom_cost121(skill) end def custom_hit_count_save if SceneManager.scene.combo_count == nil $game_variables[HitCount::HCountVar] = 0 else $game_variables[HitCount::HCountVar] = SceneManager.scene.combo_count end # the 2 lines below is purely for debugging purposes # you can delete them if you want # these will print the value of the variable we are using and the hit count # number to the console p $game_variables[HitCount::HCountVar] p SceneManager.scene.combo_count endend
With this, you can use the 'custom perform cost' note-tag even if you want to use the combo counter in your damage formulas.
Just use the variable which you set up in the snippet in your damage formulas and the number of hits accumulated will affect the damage done without any flaw.
I also forgot to mention a very useful script call:
SceneManager.scene.combo_count = nil# orSceneManager.scene.combo_damage = nilThis will make your hit counter or your damage counter to zero, regardless of how many you had accumulated.What is the difference between manually setting them to zero instead of setting them to 'nil'?
Well, setting them to zero will still show the hit and damage counter indicator, while setting them to nil will make them disappear completely. They will show up again if the player makes a successful hit after, of course.
It might look better if you are using 'nil' for skills which consume all your hit count/damage count. -
It happens after I attack. I've done this in a blank project with only Yami's Basic Module, Yami's Combo Counter, and Yanfly's Skill cost scripts. I still get that one error.
-
Hmm, no idea then...
Upload the Data folder of that blank project and I will see if I can troubleshoot the issue.
Btw, does this happen with every single attack, or just with the attacks which got some connection to the combo counter? -
Here ya go:
https://www.dropbox.com/s/21udxif4ylbeyav/Data.rar?dl=0
And it happens when I pick anything that does damage. -
This is weird...
I used Yanfly's Battle Engine from the start, so I didn't even think about it as a requirement for the Combo Count script, especially because Yami did not mention any requirements in his script.
Turns out it does require Yanfly's Battle Engine to work, to be more specific, it requires the popups from it.
So, install that script and you will be fine. -
This is double weird, because Yanfly's scripts are usually the first to go into my projects. Guess I over looked that one. It's working like a charm! Is there a way we can put a box around it so it's not just hanging in midair?
-
Yeah, it is possible to make some kind of background for it, even pictures.
But I kinda suck with pictures. :p
Making a simple background for it is easy enough thou.
I will make that for you tomorrow. But I need to check for Yami's terms, because I am not sure if posting modified versions of his scripts is allowed for anyone or not.
Okay, bed time for me now. *-*