onPlayerHit

Hello, I'm looking for a onPlayerHit command, comming from the Skyrim Modding community it's hard to do much on anything without onPlayerHit or onTick.


To my knowledge, this engine does not have the capability of onTick however if it does please mention it!


Thanks VERY much to anyone that can help!


PS I know Ruby as well so don't shy away from anything in the Ruby direction.


EDIT: I realise I'm being fairly vague, I'll flowgraph it.


Player hit


Check health


if (health < 50) { player.status = Unstable }


    while (player.status = Unstable){


        if (player.hit){


            random #


            if (random# <50){


                dropWeapon


            } else {


            }


        }


    }


}


Edit2: Probably important to mention I'm using SASIV


I hope this helps a tad (my background is Cpp so it's more formated that way :I)
I honestly don't know what onplayerhit or ontick even means, maybe those are defined functions somewhere else? Maybe tell us what you wish to do in a paragraph or two, and we can find similar functions?


As it is, if you mean how to tell when the player is hit, most of that occurs in the class Game_Battler, def item_hit, as that definition is where the system decides if the item you used actually hits something or not. It then returns something to the function that called it, which then decides what to do with it.


I myself find it best to implement changes that are to occur when someone is hit either in the item_hit class or the make_damage_value class, as all damage calculation occurs in the make_damage_value class. Alias the old method, then after the aliased method is called do whatever you want to do based on if damage occurred or not. I was able to implement a shield system for players in my game by doing just that.
I've moved this thread to Script Support. Please be sure to post your threads in the correct forum next time. Thank you.



That edit about you using an ABS script is the key - you don't need any "onhit" for regular RM Games because only ABS-scripts have battles on the map.


You won't find anything about such a condition anywhere on the boards, because it has to be specific to the ABS script used.


And if the ABS doesn't give that option, then you're mostly out of luck - ABS scripts are much too complex to be edited by casual scripters, in 99% of all cases only the original scripter of the ABS knows its structure well enoug to add such triggers.


There are four or five different ABS scripts for Ace - I suggest checking them out to see if any of those scripts have such an option.


Alternatively, you might be able to add such options into the events used depending on how the script handle the combat.
And if the ABS doesn't give that option, then you're mostly out of luck - ABS scripts are much too complex to be edited by casual scripters, in 99% of all cases only the original scripter of the ABS knows its structure well enoug to add such triggers.

Any scripter who knows how scripts work can check for something easy as this, provided that the script we are talking about uses method names which make sense.


Ohh, and it wouldn't be bad to not get frightened about the size of the script before even starting to look for what we need.


In this case, skimming through the method names is enough to get the ones which ProfessorChill needs.


In the "Sapphire Action System IV" script, you can find these methods:


For the player (in the Game_Player class):


- damage_hero (this is for weapon damage)


- skill_damage_hero (this is for skills)


For the enemies (In the Game_Event class):


- damage_enemy (for weapon damage)


- skill_damage_enemy (this is for skills)


Weapon damage attacks only use DEF to calculate resistance against them, while skill damage attacks only use MDF for resistance.


The damage_hero and damage_enemy methods trigger when the player and the enemies are hit with a weapon attack.


The skill_damage_hero and skill_damage_enemy methods trigger when the player and the enemies are hit with a skill attack.


So, you can use these methods to trigger something when the target is hit.

Original thread: https://forums.rpgmakerweb.com/threads/onplayerhit.55837/