Not-a-killer Actors

Ksi

~RTP Princess~
Restaff
Joined
Mar 13, 2012
Messages
2,083
Reaction score
1,674
First Language
English
Okay, so this one might be a little tricky!


I've got a game where one of the characters does not believe in killing. It goes against their ideals. They will still attack enemies and use skills against them, but any enemy they attack will not be KO'd by them.


I've looked around for any other plug-ins that might fit the bill but can't seem to find any, and eventing it is proving to be troublesome and more than a bit confusing.


Ultimately, I'm looking for a plugin that will allow me to tag a particular actor as someone whose attacks and skills will not deal the last 1pt of damage necessary to defeat any enemies. Help is highly appreciated!


To clarify even more, an example.


Enemy has 5 HP left.


Tagged actor attacks and does 30 damage, (either with skill or normal attack) and the enemy would still be alive after taking the damage, down to just 1 HP.


If another actor attacks, then the enemy would just die as normal, but for the tagged actor any attack or skill would not kill the enemy, but still remove the amount of damage from it (bar the last point that would cause death).
 
Last edited by a moderator:

Purzelkater

cat as cat can
Veteran
Joined
Feb 20, 2016
Messages
86
Reaction score
69
First Language
German
Primarily Uses
Just to understand... This actor should not be allowed to attack an enemy on a battle if this attack would probably kill the enemy, right?


Maybe it would possible to trigger on the actor's battle command window and disable the attack command if the attack could kill the enemy. But it would be better to use this on the target select, because an attack could kill the one enemy but only harm the others. Just an idea.
 

Sarlecc

Veteran
Veteran
Joined
Sep 16, 2012
Messages
453
Reaction score
211
First Language
English
Primarily Uses
RMMV
Easiest method I can think of would be to do this in the damage formula box. Something like dmg = 5; dmg > b.hp ? b.hp - 1 : dmg;


So with the above example lets say the enemy had 4 current hit points well 5 is higher than 4 so the damage that gets applied would be 3 (4 - 1).


If the enemy had say 6 current hit points instead then 5 damage would get applied. Of course with this you still have to take into account the default attack command.
 

Ksi

~RTP Princess~
Restaff
Joined
Mar 13, 2012
Messages
2,083
Reaction score
1,674
First Language
English
Just to understand... This actor should not be allowed to attack an enemy on a battle if this attack would probably kill the enemy, right?


Maybe it would possible to trigger on the actor's battle command window and disable the attack command if the attack could kill the enemy. But it would be better to use this on the target select, because an attack could kill the one enemy but only harm the others. Just an idea.


They can attack, just their damage output won't kill, even if they'd normally overkill. So if the enemy has 20 HP left and they do 50 damage, the enemy would still be alive.

Easiest method I can think of would be to do this in the damage formula box. Something like dmg = 5; dmg > b.hp ? b.hp - 1 : dmg;


So with the above example lets say the enemy had 4 current hit points well 5 is higher than 4 so the damage that gets applied would be 3 (4 - 1).


If the enemy had say 6 current hit points instead then 5 damage would get applied. Of course with this you still have to take into account the default attack command.


Also, would it work with an attack that was incredibly overpowered? So like I said above, if the enemy has 2 HP left and the actor uses a skill or attack that deals, say 200 damage, would the enemy still be alive after that? That's what I'm aiming for. And yes, for normal attacks or skills.
 
Last edited by a moderator:

Ghost of Christmas Kloe

The Icecream Princess
Veteran
Joined
Nov 15, 2015
Messages
1,548
Reaction score
957
First Language
English
Primarily Uses
RMMZ
Oh! That's pretty interesting actually! It's like False Swipe from Pokémon!


I think this is actually a really cool mechanic! Just thinking aloud, maybe if the plugin did a check whether the attack would kill, and if so, does the damage so the enemy has 1hp left or does no damage.
 

izyees

My Secret Santa
Veteran
Joined
Oct 24, 2015
Messages
248
Reaction score
67
First Language
english
using yanfly buff state core, auto passive state.


first, make 2 state for all enemy and actor that does not killing.


please make sure it's activated automatically (using auto passive state).


in the state (for all enemy) put this in the notetag:


<Custom React Effect>
if (user.isStateAffected(x)) {
if (value > target._hp) {
value = target._hp - 1;
} else if (target._hp <= 1) {
value = 0;
}
}
</Custom React Effect>


x is the state id of the actor that does not killing.
 
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
This is a partial solution to what you're requesting.  I really hope someone comes along and gives you something better because this is a really hack-job approach and you deserve better.  I've got relatively little talent at making JS plug-ins and even less energy at 6am.  But just in case no one comes through, here's something you can use to at least make the core functionality work.  Copy it into a .js file and place it at the very top of your Plugins list (so that other files can alias it if they need to).  Make sure to enter the list of "Non Killer" Actor IDs into the script itself on line 7 (it's commented to show you where).

Code:
// For Ksi - allows for actors that can't deal the final blow to enemies

Game_Action.prototype.executeHpDamage = function(target, value) {
    if (this.isDrain()) {
        value = Math.min(target.hp, value);
    }
    var non_killers_array = [2, 9]; // Enter all Non-Killer Actor IDs here, separated by commas!
    var non_killer_found = false;
    if (this.subject().isActor()) {
    	for (i = 0; i < non_killers_array.length; i++) {
    		if (non_killers_array[i] == this.subject()._actorId) {
    			non_killer_found = true;
    		}
    	}
    }
    this.makeSuccess(target);
    if (non_killer_found == true) {
    	target.gainHp(-1 * Math.min(target.hp - 1, value));
    } else {
    	target.gainHp(-value);
    }
    if (value > 0) {
        target.onDamage(value);
    }
    this.gainDrainedHp(value);
};

One downside of this approach is that the damage popups reflect the actual amount of damage done to the battler (never more than their remaining HP), rather than the amount of damage that would be done by the attack (which is what it sounded like you ideally wanted).  This is really frustrating me, but I can't find where the damage popups are actually drawing their values from.  I tried  ;_;


Please, someone give Ksi a better plugin than this!
 

Warpmind

Twisted Genius
Veteran
Joined
Mar 13, 2012
Messages
936
Reaction score
578
First Language
Norwegian
Primarily Uses
As a thought - perhaps you could make an "Unconscious" state, as opposed to "Dead", which is just as combat-ending as death? Seems to me that could be used by enemies, as well - the party, if they lose, just wake up a little later, possibly missing a few coins and items?
 

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
863
First Language
German
Primarily Uses
Having the actual damage being displayed would be a bit harder, since that value is set in Game_Battler.gainHp:


Game_Battler.prototype.gainHp = function(value) {
this._result.hpDamage = -value;
this._result.hpAffected = true;
this.setHp(this.hp + value);
};


So, you'll need to actually apply the real damage and extend the "setHp" (or "refresh") method to leave at least 1 hp, if an action was used by a marked actor. Though the target itself doesn't know about the actor, since that information is kept by the Game_Action instance and would need to be cached.


Though you need to be careful, since the above method is invoked every time, an actor's or enemy's hp changes, so you need to make sure it doesn't fail, if there's no actor cached and clear the cache afterwards, so it doesn't carry over.


If you are fine with the displayed damage being lower (capped at target's hp - 1), you can do that in a couple of lines, like this (untested):


(function() {
"use strict";

var alias_executeHpDamage = Game_Action.prototype.executeHpDamage;

Game_Action.prototype.executeHpDamage = function(target, value) {
var bool = (this._subjectActorId > 0 ? this.subject().actor() : this.subject().enemy()).note.contains('<not-a-killer>');
alias_executeHpDamage.call(this, target, bool ? Math.min(value, target.hp - 1) : value);
};

})();


This will cause every actor (or enemy) with the notetag "<not-a-killer>" to do damage capped at the target's hp - 1.
 
Last edited by a moderator:

Sarlecc

Veteran
Veteran
Joined
Sep 16, 2012
Messages
453
Reaction score
211
First Language
English
Primarily Uses
RMMV
Also, would it work with an attack that was incredibly overpowered? So like I said above, if the enemy has 2 HP left and the actor uses a skill or attack that deals, say 200 damage, would the enemy still be alive after that? That's what I'm aiming for. And yes, for normal attacks or skills.
Yes it would work for all damage greater than the enemies current hp. However I should have said dmg = damage; dmg >= b.hp ? b.hp - 1 : dmg. (this accounts for scenarios in which damage is equal to the current hit points as well)


What this is basically doing is this:


If damage is greater or equal to enemies current hit points; then damage will be the enemies current hit points minus one; otherwise deal the full amount of damage.


Though considering that this doesn't take into account the default attack one of the above plug-ins should be able to work for all scenarios. :)
 

Ksi

~RTP Princess~
Restaff
Joined
Mar 13, 2012
Messages
2,083
Reaction score
1,674
First Language
English
Since there's no way of knowing the enemy's HP I'm a-okay with just showing the damage amount they'd usually take.


@Wavelength That is a pimpin' piece of plug-in and it works exactly as I wanted. Just one last question - is it possible to have it turn on/off with a switch? If not, that's okay - I'll make up a dummy character - otherwise, this is perfect for what I had in mind. Thank you very much!


And thank you also to everyone who popped in to help. I really appreciate it!
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
@Wavelength That is a pimpin' piece of plug-in and it works exactly as I wanted. Just one last question - is it possible to have it turn on/off with a switch? If not, that's okay - I'll make up a dummy character - otherwise, this is perfect for what I had in mind. Thank you very much!

I'm glad (and shocked) that you think it's good!  Sure, it's possible to control behavior with a switch.  Here's an update to do so - the switch you designate turns off the No Kill functionality when the switch is on.

Code:
// For Ksi - allows for actors that can't deal the final blow to enemies

Game_Action.prototype.executeHpDamage = function(target, value) {
    if (this.isDrain()) {
        value = Math.min(target.hp, value);
    }
    var non_killers_array = [2, 9]; // Enter all Non-Killer Actor IDs here, separated by commas!
    var no_kill_switch = 13         // Enter which Switch you'd like to use to SUPPRESS Non-Killer functionality.
    							    //		Set to 0 if you want Non-Killer functionality to always be on.
    var non_killer_found = false;
    if (no_kill_switch === 0 || $gameSwitches.value(no_kill_switch) === false)
	    if (this.subject().isActor()) {
	    	for (i = 0; i < non_killers_array.length; i++) {
	    		if (non_killers_array[i] === this.subject()._actorId) {
	    			non_killer_found = true;
	    		}
	    	}
	    }
    this.makeSuccess(target);
    if (non_killer_found === true) {
    	target.gainHp(-1 * Math.min(target.hp - 1, value));
    } else {
    	target.gainHp(-value);
    }
    if (value > 0) {
        target.onDamage(value);
    }
    this.gainDrainedHp(value);
};



If you need multiple actors to have their own separate No Kill switches, this would require a change to the script but it's something that would be very little trouble to do.
 
  • Like
Reactions: Ksi

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

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
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.

Forum statistics

Threads
105,868
Messages
1,017,088
Members
137,585
Latest member
Reversinator
Top