Hello,
I am looking for some help in implementing code that will temporarily change an actor's image when they are "hit" or when they are "attacking."
I am able to make an actor's face image change (e.g., when hit, or HP = 0) and even change back after turn end, but the issue is nothing I've tried has been able to make the image change fast (i.e., 1000 - 1500ms).
Currently, what I am doing is using Yanfly's Skill Core (in the skill tags) to implement the face image change before the enemy uses a skill and attempting to change the image back to default after (i.e., post-damage) the skill is complete.
If I comment out the target.setFaceImage in the post damage eval then I can get the "hit" face change with application of the skill from the enemy. When not commented out, the image remains static. Though my console successfully logs that the faceIndex is changing.
I have read through a large number of different threads on this topic and have tried
WAY_CustomFaceImageEval.js in several configurations to make this work, but haven't been successful. I currently find it hard to justify using dummy states, common events, and timers, if there is a more direct route. I suspect the issue may lie in how RMMV "refreshes" actors and other objects during battle, and that the time between skill beginning and end is insufficient for an image change, but I can't say for certain.
I would be grateful if anyone had insight on how to solve this issue. I know this has been asked before but, like I said, the solutions have not fixed my issue. I am quite familiar with a variety of codes, but new to RPG maker, so there may be another Yanfly lunatic code out there that would time the face change exactly as I want it.
Again, many thanks in advance for a suggestion! Please let me know if I missed any code/information that would be helpful.
I am looking for some help in implementing code that will temporarily change an actor's image when they are "hit" or when they are "attacking."
I am able to make an actor's face image change (e.g., when hit, or HP = 0) and even change back after turn end, but the issue is nothing I've tried has been able to make the image change fast (i.e., 1000 - 1500ms).
Currently, what I am doing is using Yanfly's Skill Core (in the skill tags) to implement the face image change before the enemy uses a skill and attempting to change the image back to default after (i.e., post-damage) the skill is complete.
JavaScript:
<Before Eval>
target._baseFace = [target._faceName, target._faceIndex];
target.setFaceImage("Battle_icons_test_DM", 2); //make this more dynamic with more actors
</Before Eval>
<Post-Damage Eval>
target.setFaceImage(target._baseFace[0], target._baseFace[1]);
delete target._baseFace;
</Post-Damage Eval>
If I comment out the target.setFaceImage in the post damage eval then I can get the "hit" face change with application of the skill from the enemy. When not commented out, the image remains static. Though my console successfully logs that the faceIndex is changing.
I have read through a large number of different threads on this topic and have tried
WAY_CustomFaceImageEval.js in several configurations to make this work, but haven't been successful. I currently find it hard to justify using dummy states, common events, and timers, if there is a more direct route. I suspect the issue may lie in how RMMV "refreshes" actors and other objects during battle, and that the time between skill beginning and end is insufficient for an image change, but I can't say for certain.
I would be grateful if anyone had insight on how to solve this issue. I know this has been asked before but, like I said, the solutions have not fixed my issue. I am quite familiar with a variety of codes, but new to RPG maker, so there may be another Yanfly lunatic code out there that would time the face change exactly as I want it.
Again, many thanks in advance for a suggestion! Please let me know if I missed any code/information that would be helpful.