Yanfly's Skill Cost Manager HP Reduction problem

TicklishWasabi

Veteran
Veteran
Joined
Nov 7, 2017
Messages
151
Reaction score
15
First Language
English
Primarily Uses
N/A
I'm trying to create a skill that does damage to all enemies but kills the user. I was going to have these exploding enemies essentially. So I tried to use Yanfly's Skill Cost Manager, but it doesn't seem to do any damage to the user. I've tried the hp percentage at 100%, and it didn't work, so I thought maybe the script can't handle killing the user. So I lowered it to 99% just to see if it would work then, and it didn't. So I tried a number value, 200 the max hp of the enemy, and that didn't work. So then I figured maybe the tags don't work on enemies. But it didn't work when I assigned the skill to a class and then played as that class and used it in battle either. The skill plays out, but no damage is done to the user. I also tried adding a minus sign in front of the number in the skill note tag, with no success.pic 1.PNG pic 2.PNG

-Thanks
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
12,599
Reaction score
12,916
First Language
English
Primarily Uses
RMVXA

I've moved this thread to RGSSx Support. Please be sure to post your threads in the correct forum next time. Thank you.



In my project it works just fine as that, though note you cannot use a skill if it will cost you all of your HP. In other words, the engine will refuse to let you use the skill if it would KO you.

You'll need another script to do that, I think Yanfly has a Lunatic script where you can set skills to KO users after the skill is over.
 

GGZiron

Veteran
Veteran
Joined
Nov 6, 2016
Messages
75
Reaction score
25
First Language
Bulgarian
Primarily Uses
RMVXA
I think the solution of this is very simple.
In the damage formula, after everything else you want there to be calculated, add this:
Code:
 <the rest of damage formula here> + a.hp = 0
Example: 200 + a.hp = 0
That should kill the user, as his hp go down to zero.
 
Last edited:

Tiamat-86

old jrpg gamer
Veteran
Joined
Dec 5, 2017
Messages
312
Reaction score
122
First Language
english
Primarily Uses
RMMV
there should be a formula that just kills. for rmmv its
a.die(); formula
 

GGZiron

Veteran
Veteran
Joined
Nov 6, 2016
Messages
75
Reaction score
25
First Language
Bulgarian
Primarily Uses
RMVXA
Well, exact same formula works in Ace too, only that brackets in Ace can be omitted, to become something like:
a.die; formula
Example use:
a.die; 200
I like your solution more than mine.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
1,878
Reaction score
410
First Language
English
Primarily Uses
RMVXA
I attempted to do this in my own project. It worked but the skill was set to all enemies and it only damaged one.
I found a way around it by using a script to get the actor id into a variable in a common event, then running a common event to have that actor be inflicted with death state.
 

GGZiron

Veteran
Veteran
Joined
Nov 6, 2016
Messages
75
Reaction score
25
First Language
Bulgarian
Primarily Uses
RMVXA
Yeah, as @Roninator2 said, there are issues using that in formula. In my end, it worked, but the Death state was applied right after the first attack.

My idea was to be done with very simple means. But seems it won't happen.
I made one snippet myself, idk if it will work as you want:
Code:
class Game_Battler < Game_BattlerBase

#================================================================
#                           Settings
#================================================================
  GGZ_MATCH_PATERN =  /<SUICIDE SKILL>/
  #Between those / / you set the desired format.
  #Add that note tag for all items or skills that you
  #want to kill the user on use.
  #As is set by default, the tag it will look for is this one:
  #<SUICIDE SKILL>
#================================================================
#                         End of settings
#================================================================
  alias_method :ggz_remove_current_action_old, :remove_current_action

  def remove_current_action(*args)
    self.hp = 0 if ggz_check_for_suicide_skill
    ggz_remove_current_action_old(*args)
  end

  def ggz_check_for_suicide_skill
    return unless current_action
    item = current_action.item
    return false unless item
    item.note.each_line do |line|
      return true if line =~GGZ_MATCH_PATERN
    end
    return false
  end

  def on_action_end
    @result.clear
    remove_states_auto(1)
    remove_buffs_auto
  end

end
With that snippet, no more changes in the skill formula. Only the skill must have the <SUICIDE SKILL> tag, or the tag you set in settings.

You may also want to check Yanfly's Lunatic script as suggested by @bgillisp, there maybe is better option.
 
Last edited:

TicklishWasabi

Veteran
Veteran
Joined
Nov 7, 2017
Messages
151
Reaction score
15
First Language
English
Primarily Uses
N/A
I think the solution of this is very simple.
In the damage formula, after everything else you want there to be calculated, add this:
Code:
 <the rest of damage formula here> + a.hp = 0
Example: 200 + a.hp = 0
That should kill the user, as his hp go down to zero.
This is the first thing I tried actually, the only problem is that the enemy doesn't disappear. The death state is applied and the battle continues as normal otherwise.

Edit: I also tried to circumvent this by changing the collapse effect to instant in the enemies features. It didn't work.
 
Last edited:

GGZiron

Veteran
Veteran
Joined
Nov 6, 2016
Messages
75
Reaction score
25
First Language
Bulgarian
Primarily Uses
RMVXA
Yeah, I tested that for player user only. That same issue you mention will stay with my snippet as well.
 

TicklishWasabi

Veteran
Veteran
Joined
Nov 7, 2017
Messages
151
Reaction score
15
First Language
English
Primarily Uses
N/A
Yeah, I tested that for player user only. That same issue you mention will stay with my snippet as well.
It's definitely interesting if nothing else, I tried Yanfly's Lunatic recoil script with the same results.

So far my only "fix" is to set the enemy to transform into another nameless enemy with no sprite attached to it once it's HP reaches 0. Since hp is carried over from transformations it will remain dead and the enemy will disappear. But that also means I need to script each troop that has a self-destructing enemy in it.

Edit: Although the problem with this is that if the self-destructing enemy is the last enemy to die, it will stay on screen as the battle will end before the transformation has a chance to take place.
 
Last edited:

GGZiron

Veteran
Veteran
Joined
Nov 6, 2016
Messages
75
Reaction score
25
First Language
Bulgarian
Primarily Uses
RMVXA
Another edit of my snippet:
Code:
class Game_Battler < Game_BattlerBase

#================================================================
#                           Settings
#================================================================
  GGZ_MATCH_PATERN =  /<SUICIDE SKILL>/
   #Between those / / you set the desired format.
   #Add that note tag for all items or skills that you
   #want to kill the user on use.
   #As is set by default, the tag it will look for is this one:
   #<SUICIDE SKILL>
 #================================================================
 #                         End of settings
 #================================================================
  alias_method :ggz_remove_current_action_old, :remove_current_action

  def remove_current_action(*args)
    if ggz_check_for_suicide_skill
      self.hp = 0
      self.perform_collapse_effect if enemy?
    end
    ggz_remove_current_action_old(*args)
  end

  def ggz_check_for_suicide_skill
    return false unless current_action
    item = current_action.item
    return false unless item
    return item.note =~ GGZ_MATCH_PATERN ? true : false
  end

end
See if it works now. Basically, just added self.perform_collapse_effect if the battler is instance of Game Enemy.
Also, removed method that is no needed, as I removed all edits on it(unneeded), but forgot to remove the method itself.

Edit: Edited a little the note tag reading, so I don't break it on lines anymore, as I do not see the need to do that.
 
Last edited:

TicklishWasabi

Veteran
Veteran
Joined
Nov 7, 2017
Messages
151
Reaction score
15
First Language
English
Primarily Uses
N/A
This is probably a dumb question but where do I put your code? Under materials like other scripts? If so, I think I might have another script interfering with it, i made sure to put the note tag in the notebox for the skill.
 

GGZiron

Veteran
Veteran
Joined
Nov 6, 2016
Messages
75
Reaction score
25
First Language
Bulgarian
Primarily Uses
RMVXA
Yes, under materials.
Check if it work on clean project.

The tag is <SUICIDE SKILL>, with the <> brackets, unless you
modified it in the settings.
 

TicklishWasabi

Veteran
Veteran
Joined
Nov 7, 2017
Messages
151
Reaction score
15
First Language
English
Primarily Uses
N/A
It doesn't seem to work in a clean project either, although I appreciate your trying.
 

GGZiron

Veteran
Veteran
Joined
Nov 6, 2016
Messages
75
Reaction score
25
First Language
Bulgarian
Primarily Uses
RMVXA
It works on mine, unless there is some confusion what you want.
The enemy dissapear after action end, if it used suicide skill on me. It works on project with Yanfly Battle Engine as well.
Are you sure everything is set?

The enemy have to use the suicide skill. The skill have to have that notetag. The snippet must be down on contents.
Sure there is no typo in the tag? The tag is case sensetive.
 

TicklishWasabi

Veteran
Veteran
Joined
Nov 7, 2017
Messages
151
Reaction score
15
First Language
English
Primarily Uses
N/A
The snippet must be down on contents.
What do you mean by this?

This is how I have it set up:
pic 1.PNG pic 2.PNG pic 3.PNG

EDIT: I just realized that in order for the script to work I might need to open a playtest window before testing it in the database. And it worked. Thank you so much for your help. Can I ask what your terms of use are for this script?
 

GGZiron

Veteran
Veteran
Joined
Nov 6, 2016
Messages
75
Reaction score
25
First Language
Bulgarian
Primarily Uses
RMVXA
I was just starting to worry if you actually use other RPG maker :D.
Ok, hope it works for you now.

Snippet is free to use in any type of project. Crediting is optional.
 

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

Latest Threads

Latest Profile Posts

Person: "Taxes are bs and money is, too! Anarchy!!" *Literally anything goes wrong* Same Person: "Why hasn't the government fixed this???"
Stream will be live shortly with a session of Haunting Ground! Feel free to drop by!
As for the Coronavirus? Well: "People that spend their life avoiding death are already dead (they're also rich, and I like to spend my life with their money.)"
- R. Sanchez, "Edge of Tomorty: Rick, Die, Repeat"
making pierogi and corrupting my game files wbu

Forum statistics

Threads
94,345
Messages
920,111
Members
124,105
Latest member
acelaces
Top