DecoyJackal

Villager
Member
Joined
Jun 24, 2020
Messages
11
Reaction score
0
First Language
English
Primarily Uses
RMMV
Basically in a another game I'm working on, I'm trying to to make a skill call "Mend" that has 20% to fail, but I don't want to see the "There was no effect on %1!" message at all, so I've figured a good way to get around it is to code it in Lunatic Mode, but despite reading all the tips & tricks tutorials I'm still deeply confused by what "evals" I should use?

All I know is that it is gonna involve Yanfly's Battle Engine Core, Skill Core, and maybe Damage Core?

The skill goes a little something like this:
  • A message is sent to the battlelog saying: "(User) tries to mend its wounds..."
  • A selected animation plays.
  • A random number is generated between 1 and 0.
  • If the random number is below 0.8, then it "succeeds".
  • Then the user recovers 2.5 * MAT of HP with 10% variance.
  • And if possible, then a additional message is added saying: "...and recovers (HP Recovered) HP."
  • However if the random numbers passes 0.8, then it "fails", saying: "...but failed to."
So... is it possible to recreate? For the record it's my first time using Lunatic Mode, and once you guys showed me how to do it, I think I may able to comprehend it.
 

Drakkonis

Veteran
Veteran
Joined
Mar 5, 2021
Messages
210
Reaction score
160
First Language
English
Primarily Uses
RMMZ
It should be possible. Been awhile since I've used SkillCore, so I'm rusty. It involves javascript coding though, if you didn't already know that.

I think the easiest method would be in the pre-damage eval, since that's where the split will happen for success/failure. There's a variable defined for that section for the resulting "damage"(healing if the skill is set up correctly). I BELIEVE it's "value". Anyway, set up the skill, with the formula you want. Then in the skill notes area, create a temporary variable in the correct notetag set, and set it to your random number. (Math.round()) Then check if the number is below 0.8. If it is not, set the value equal to zero.

For the battle log message... I don't know offhand how to set that. It's in the code somewhere but I've never bothered to look for it before. But if you figure that part out, set the message to your fail message if your number was above 0.8, and the success message if it was below.
 

DecoyJackal

Villager
Member
Joined
Jun 24, 2020
Messages
11
Reaction score
0
First Language
English
Primarily Uses
RMMV
Alright so... I think I managed to get working, while I'm not new to coding, I'm still quite new JavaScript and to Lunatic Mode as a entirely. I'm just leaving this here for future reference.

Code:
<setup action>
display action
</setup action>

<target action>
action animation
wait for animation
if (Math.random() < 0.80)
   action effect: target
else
   eval: BattleManager.addText("...but fails to.", 60)
end
</target action>

<finish action>
clear battle log
</finish action>

So if there is anyone else who is reading this... is there any sort way I could get the resulting number of HP Recovered for so I could use it for future battle text messages?
 

Drakkonis

Veteran
Veteran
Joined
Mar 5, 2021
Messages
210
Reaction score
160
First Language
English
Primarily Uses
RMMZ
So if there is anyone else who is reading this... is there any sort way I could get the resulting number of HP Recovered for so I could use it for future battle text messages?
If you're using SkillCore, yes. Post-damage eval contains the resulting damage/healing. You could set a game variable to that value to reuse later.
 

Latest Threads

Latest Posts

Latest Profile Posts

Still alive! Totally did not finish in time for the Jam (boy that's late) but tl;dr of the last half a year is Work term -> Covid Lockdown -> Sick... again -> Full time Employment. Game stuff has been on hiatus but got a new graphics tablet so hopefully updates again soon. =D
Going on hiatus. Won't be back until mid October.:LZSoops:
Just read the English lyrics for Despacito. Ramen aint innocent no more! :kaodes:
Well today was blown away with nothing to show for it. I made a new character to my game who I was going to have a protection mechanic where he protects my main character randomly unless it's a critical, and no matter what, to check if an attack received will be critical, means checking the apply method. This means rewriting the entire method and I refused to do that.

Forum statistics

Threads
115,313
Messages
1,088,877
Members
149,961
Latest member
MrSunshine
Top