Passive Skills

AuronAD

Villager
Member
Joined
May 21, 2014
Messages
15
Reaction score
1
First Language
German
Primarily Uses
Hello everyone!

Now before you close this thread and redirect me to Neonblacks "CP Passive Skills script" or Yanflys "Passive States" let me explain my issue:
I need a way to apply buffs/debuffs to characters in battle in a way, that the skill can be learned by leveling and affect the target with custom formulars. So it isn't enough to simply use the named scripts to assign states to skills, because if I do so the following example can't be achieved.
Example: The buff strengthens ATK by 1% for each 2% of health the char has lost. 100% health = 100% ATK, 1% health = 150% ATK, for example. That can only be achieved by using custom formulars, which isn't possible for states.
I thought about calling a common event at the beginning of every battle, that tests each skill of every character on Skilltype "Passive" (which i created) and applies the skill every turn, if it isn't active yet. That is neccessery, because buffs vanish with death. But there are a few problems and it's very complicated for a ruby/rgssx noob like me. For example to test, if the skill was already applied, so that the effect doesn't stack, without having to create a complicated hashmap, etc.
Is there an easy way to do what i wish for? Or maybe a script? I searched for nearly an hour, because i didn't believe, that nobody had the same issue.

Please help me and excuse my bad english, I'm no native speaker :)
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
I'm not sure exactly how you are using the description  "the skill can be learned by leveling".  I am going to assume that you mean that the character learns it in the normal way when s/he reaches a particular level.

If you want to increase damage in the way you describe, you could do this through the damage formula of that skill.  It would be something like this:

[SIZE=10.5pt](original damage formula) * (a.mhp - a.hp) / a.mhp[/SIZE]

[SIZE=10.5pt]where (original damage formula) is the ordinary base damage that you want the character to deal out, so effectively 100%.  Then the rest of the formula as written.  It will, therefore, take into account whatever the maximum HP is at whatever level the character then levels up to.[/SIZE]

[SIZE=10.5pt]EDIT[/SIZE]

[SIZE=10.5pt]Looking at my formula, I sense that there may be something there not quite right.  This needs testing further.[/SIZE]

EDIT AGAIN

Okay, the first formulation only gives the amount which needs to be added to the value of the attack.  So the formula would need to read like this: (I am using the default damage formula)

a.atk *4 - b.def * 2 + ((a.atk*4 - b.def * 2) * (a.mhp - a.hp)/a.mhp)

So a worked example would be

ATK = 60, DEF = 40, MHP = 500, HP = 200     Therefore the character has lost 60% of HP, so you want to increase the damage by 60% (if you want a different percentage, we'll come to that at the end) which would mean an increase of 96HP

240 - 80 + ((240 - 80) * (500 - 200)/500)    equals

160 + (160 * (300/500)  equals

160 + (160 * 0.6)  equals

160 + 96  = 256

If you want it to apply a different percentage then you need to alter the final part of the formula.  So for 1% increase for every 2% HP loss, it would read:

a.atk *4 - b.def * 2 + ((a.atk*4 - b.def * 2) * (a.mhp - a.hp)/(a.mhp/0.5))
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
You can possibly use passive states in conjunction with my State Apply Extension so that you can make them run a formula to modify the params upon application.


I'm not sure if they're compatible though.


@Kjsp - I think he wants the "passive state" to affect the stats, so it affects all skills that he will use. So it's not a specific skill only.


You can still use ksjp's suggestion, you can modify all damage formula's to check for the states for example and give a different damage.


If you have lots of states though, you might wanna put the custom formula on a method on a custom script then just make your damage formula use that method
 

AuronAD

Villager
Member
Joined
May 21, 2014
Messages
15
Reaction score
1
First Language
German
Primarily Uses
@ksjp17 Thank you for the formular, but as Engr. Adiktuzmiko already mentioned, I was looking mainly for a way, to apply passive skils. So that a warrior for example learns the passive skill "Bloodlust" at Lvl 5 and deals more base damage as the hp decreases. 

@Engr. Adiktuzmiko Interesting script, though i don't seem to understand the given example... but I'll try it and will give you feedback :)
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
using it requires knowledge of which script calls to make.. so it might be quite tricky to use unless you're used to scripting.


Also, since it might need to update every time, using my script might not even be a viable solution.


I'd suggest trying out my second suggestion of using a customized formula which checks for the presence of the state and modifying the damage value in relation to the state present
 
Last edited by a moderator:

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
Here's an overwrite of the "param" method in Game_BattlerBase, which upon initial testing, seems to do exactly what you want.

Replace "37" with whatever State you want to have this "berserking" effect.  Don't use traditional "buffs" to apply berserking - it would get really messy to try to separate "berserk buffs" from "ordinary attack buffs".  It is okay, however, to have both the Berserk state and an ordinary attack buff on the same character, if you want.

I think there's potential here for me to expand this idea a little and turn it into a customizable script that game makers can use to modify any parameter based on all different conditions.  Would it be okay with you if I decided to do so sometime in the future?

class Game_BattlerBase #-------------------------------------------------------------------------- # * Get Parameter - modified for "Berserker" state #-------------------------------------------------------------------------- def param(param_id) value = param_base(param_id) + param_plus(param_id) value *= param_rate(param_id) * param_buff_rate(param_id) if (state?(37) and param_id == 2) value *= (1.00 + (0.50 * (1.00 - hp_rate))) end [[value, param_max(param_id)].min, param_min(param_id)].max.to_i end endEDIT: Everything I posted above still works, but upon a second reading of your post, it looks like you didn't mean "buffs" literally and were looking for a way to permanently apply something like a "berserk" trait to actors.  Well, depending on how you want to do this, you could either create new attributes (such as a true/false variable called "berserk_available") for the Game_BattlerBase class (this is slightly complicated, but more flexible; I'm sure you can do a forum search and find ways to do this), or replace the "if" line - for example, if only one class (6) learns the Passive and they always learn it at level 20, then replace it with nested if branches: "if actor?" on the first line and then "if (class_id == 6 and level >= 20)" and then make sure to add one more "end" after the "value *=..." line.
 
Last edited by a moderator:

AuronAD

Villager
Member
Joined
May 21, 2014
Messages
15
Reaction score
1
First Language
German
Primarily Uses
Thank you for all the constructive answers they'll help me a lot, after i solved my newest problem.

It's been caused by Engr. Adiktuzmikos "State Extension" script. When I try using following code in a state it tells me "wrong number of arguments 0 for 1" and the game crashes. Apperently it's caused by the 128th line of your script. I checked every method I'm using in here, if i missed any parameter, but it seems, that my code is correct.

<start_state_ext>hpDmg = 0i = 0; actors = $game_party.all_members;while i<actors.length && hpDmg == 0 doif actors.state?[27]self.change_hp(-actors.hp, true)self.perform_collapse_effect if self.dead?endi += 1end<end_state_ext>The 128th line of your code is:

eval($data_states[state_id].state_extension_formula)Any ideas? Could it be because of compatibility issues with Neonblacks "Passive Skills" Script? I'm using it to link a state to a skill and then apply the state to the enemy, when i use the skill on him. 
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
this:

if actors.state?[27]it should be

Code:
if actors[i].state?(27)
You used brackets instead of parentheses. That is the most probable reason why the error was Wrong Number of arguments 0 for 1.Btw, instead of iterating using an integer, why not just do it via

$game_party.all_members.each do |actor| if hpDmg == 0 if actor.state?(27) self.change_hp(-actors.hp, true) self.perform_collapse_effect if self.dead? end endendRemove the spaces in case it doesn't fit. Or make it as a method inside a certain custom module then use that method call insteadPS: Btw, reading your code, hpDmg will never be not zero as you've set it to zero at the start and never modified it anyways.

PS 2: IDK if .state?(id) reads Neon Black's Passive States. If he adds it to the states array, then it would work. If not, then it won't.
 
Last edited by a moderator:

AuronAD

Villager
Member
Joined
May 21, 2014
Messages
15
Reaction score
1
First Language
German
Primarily Uses
Thank you for the quick reply, but now that i replaced my code and deleted the needless hpDmg variable it gives me another error saying "undefined local variable of method 'a' for Game_Enemy" in line 137 of your code.
Here is the line:

eval(a.enemy.state_extension_formula)Still a problem with my code?
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
On my copy that was

eval(self.enemy.state_extension_formula)modify any line that uses a. into self.
Updated the script on pastebin, seems like I uploaded the one that still used a instead of self. Sorry for that.
 
Last edited by a moderator:

AuronAD

Villager
Member
Joined
May 21, 2014
Messages
15
Reaction score
1
First Language
German
Primarily Uses
No problem :)

It seems i rechead my limits at this problem. Needs some time to solve it, so thank all of you for the help, I think you will find some more threads from me in the next time, because I'm currently working on a project.

See ya :D
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
I gave you a customized script a few posts up that does exactly what you want to do. Why not try that?
 

AuronAD

Villager
Member
Joined
May 21, 2014
Messages
15
Reaction score
1
First Language
German
Primarily Uses
I gave you a customized script a few posts up that does exactly what you want to do. Why not try that?
Sorry that I didn't reply to your post there, here is the reason:

I think it would be really messy to overwrite the param-method for every skill, that is slightly complicated. For example there is also a skill, that chains the hp of a character to the hp of an enemy, so that whenever this char get's damage, the "chained" enemy get's the same amount of damage. Something like this would require to overwrite the hp damage method (or whatever it is called) to look for this stat and so on. I dislike such a system and would prefer for a more simple and clean way. Like a script, which allows states to run scripts and allows to customize the time, when the script is running, by notetags. AdiktuzMikos "State Extension" is nearly perfect fpr this, but sadly it runs the script only, when the state is applied or removed. So I have no choice other than requesting something, because my scripting sucks^^

And to your question in the first post: It's perfectly fine with me, after all, it's your script and your work, so why not expand the idea? I'm glad, that i could give you some creative input :)

Thank you for your reply and sorry for the delayed answer!
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
So you also need it to run scripts during turn ends or when you get damaged for example?


Yanfly's Lunatic States can do that..
 
Last edited by a moderator:

AuronAD

Villager
Member
Joined
May 21, 2014
Messages
15
Reaction score
1
First Language
German
Primarily Uses
Thank you very much Engr. Adiktuzmiko, that's is exactly what I was looking for. I heard about that script, but didn't know what it did exactly, so I haven't considered to use that.

With this new Script I'm facing new problems however. First the code in yanfly's script I thought of (the state "Berserk gets the tag <shock effect: berserk>", so that the script triggers on recieving damage):

when /BERSERK/i x = user.atk*((1-(user.hp / user.mhp))/2) user.add_param(2, x)Upon working my way into all of this param() stuff I deduced, that my script wouldn't do what i want. Instead it would increase the parameter atk permanently. I however want a buff-like increase, that vanishes with the ending of a battle.
Also my script doesn't decrease the "buff" when the actor gains hp. Like if the actor has only 1 hp left, the atk would be buffed with 150%, but if he gains 50% health in the next round, it would increase atk by another 25%. But that's a problem I think I can handle on my own through trial and error with different formulars.
Another problem i have to handle is increasing atk by X% of the base-atk value. In the current formular it gets increased by X% of the current atk value, I hope you understand the difference^^ I thought of saving the base-atk value when applying the berserk state into a variable and using this for determining the increase ratio. For that I thought of using another tag within the "Berserk"-state, something like this: <apply effect: berserk_start> with following code:

when /BERSERK_START/i$game_variables[50] = user.atkBut there however is another problem which i can't solve on my own. I'm using Neonblacks "Passive States" Script to apply the berserk effect upon learning the skill "berserk" at a certain level, but does the state get applied at the moment of learning and thus trigger "berserk_start"? Or would it be applied at the beginning of every battle?

EDIT: I replaced Neonblacks Script with the "Passive States" script from Victor, I'll let you know how it's going :)

EDIT 2: Seems that Victors script did the job, the states get applied at the beginning of a battle through the notetag:

<passive state: 50>SceneManager.scene_is?(Scene_Battle);</passive state>So I'm starting my next test for the berserk-skill :D
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
Well, to remove it at the end of the battle, you might want to make the berserk lunatic call to save all attack bonus due to it into a variable (probably use an instance variable for the actor), then using my script, make it reduce that same amount of value to the attack upon state removal.
 
Last edited by a moderator:

AuronAD

Villager
Member
Joined
May 21, 2014
Messages
15
Reaction score
1
First Language
German
Primarily Uses
Well, to remove it at the end of the battle, you might want to make the berserk lunatic call to save all attack bonus due to it into a variable (probably use an instance variable for the actor), then using my script, make it reduce that same amount of value to the attack upon state removal.
I thought about this too, but it seems easier to just save the base atk value into a game variable when the script first executes (I'll post my code later on) and then subtracting all of atk at state removal and adding the saved atk amount again.

However there is a problem. I use the following notetags in the notebox of the berserk skill:

<erase effect: berserk_erase><shock effect: berserk_schock>And here the lunatic code:

when /BERSERK_SCHOCK/i if $game_variables[10] == 0 $game_variables[10] = user.atk end #x = user.atk*((1-(user.hp / user.mhp))/2) x = 10 user.add_param(2, x) when /BERSERK_ERASE/i if $game_variables[10] > 0 user.add_param(2, -100) user.add_param(2, $game_variables[10]) $game_variables[10] = 0 endIt's only a test, so the right formula ist replaced by x=10, which adds 10 to ATK whenever the actor is the target of an attack.

The problem is, that it seems, it doesn't execute the berserk_erase script. At the end of the test battle the variable 10 is still on 130 (the Erics base ATK value) and his ATK is 210. I also tried using <leave effect: berserk_erase> but it doesnt help. Neither in combination with the erase tag, nor replacing the erase tag. The berserk state has also the box "Remove at Battle End" checked.

Could you show to me, what i did wrong please?
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
I never really used that script so... It might be a problem between lunatic and victor's script, after all Victor's is known to have quite the incompatibility with others...


So unless you try my method, I cannot really help. Sorry
 

AuronAD

Villager
Member
Joined
May 21, 2014
Messages
15
Reaction score
1
First Language
German
Primarily Uses
On topic of the incompatibility between Victors "Passive States" and Yanflys "Lunatic States" :
I solved it by putting Yanlfys script above Victors and underneath Victors "Basic Module". It looks like it solves everything, but I think it needs some testing, so if I find issues in this method I'll post it in here :)

So the issue should be solved, thanks to each and every one of you for answering and helping me out, you guys are awesome!! :D
 

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

Latest Threads

Latest Posts

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,860
Messages
1,017,038
Members
137,567
Latest member
sashalag
Top