Have each enemy spawned in troop spawn with different % value of his HP

Status
Not open for further replies.

RedFoxGaming

Veteran
Veteran
Joined
Jan 14, 2018
Messages
88
Reaction score
16
First Language
English
Primarily Uses
RMMV
So, what I am wanting to do here is I am trying to actually complete a game for once, before I work on my main project so I know if I can actually stay persistent enough with developing by myself to finish something. I am currently making a "fangame" in a sense or a game heavily based off of the Dragon Warrior/Quest games, since they are one of my favorite RPG series.

I am using OcRam's Battle EX to spawn my enemy troops and I am using a parallel event to handle random encounters. What happens in DW3 for example, when you get into a fight, each enemy that is in this specific encounter can spawn with anywhere between 75% of his MaxHP to 100% of his MaxHP. So when you fight slimes, who have 8 HP in DW3. They can spawn with either 6HP, 7HP, or 8HP. A crow has 10 I believe, so it's more like 8HP to 10HP (They may spawn with 7, I can't remember if it rounds down or up).

This is what I want to figure out how to replicate.
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
1,463
Reaction score
952
First Language
EN
Primarily Uses
RMMV
You may be able to simply have a Turn 0, Span Battle troop event with something like this for each enemy:
Code:
◆Control Variables:#0008 Temporary = Max HP of #1 Bat
◆Control Variables:#0008 Temporary *= Random 0..25
◆Control Variables:#0008 Temporary /= 100
◆Change Enemy HP:#1 Bat, - {Temporary}
I.e. remove a random 0~25% of each enemy's HP at the start of the battle. :)

Just tested quickly (without plugins) and it doesn't seem to cause an error if you try to get the Max HP of a non-existent enemy, or decrease a non-existent enemy's HP. So it looks like you could have enough of those four-line commands to cover a full troop, stick that in a common event, and just call that event each battle. You may be interested in Yanfly's Base Troop Events plugin~
 

RedFoxGaming

Veteran
Veteran
Joined
Jan 14, 2018
Messages
88
Reaction score
16
First Language
English
Primarily Uses
RMMV
Okay, this does work, but using an enemy HP bar plugin just to verify it, their HP won't change until the end of the enemy's first turn, which is really strange. It may go unnoticed because I won't be using any HP plugins, but it's still really weird.

I can watch it happen. The slime has 8 HP, as soon as the slime attacks, his HP is then recalculated.
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
1,463
Reaction score
952
First Language
EN
Primarily Uses
RMMV
I think that's a display issue associated with the HP bar plugin you're using. Try opening the console (F8 during test) and entering the following line during the input phase:
JavaScript:
$gameTroop.members()[0].hp
Press Enter and a number should appear: the HP of enemy #1 (i.e. index 0). It seems to update correctly for me! :)
 

RedFoxGaming

Veteran
Veteran
Joined
Jan 14, 2018
Messages
88
Reaction score
16
First Language
English
Primarily Uses
RMMV
Okay, it does work properly. I keep forgetting that debug console exists XD Thank you for the help!
 

RedFoxGaming

Veteran
Veteran
Joined
Jan 14, 2018
Messages
88
Reaction score
16
First Language
English
Primarily Uses
RMMV
Yeah this thread is answered. I was able to use what was posted above repeated 8 times for each "possible" enemy and it works whether the enemy is spawned in the troop or not.
 

MushroomCake28

KAMO Studio
Global Mod
Joined
Nov 18, 2015
Messages
2,347
Reaction score
3,652
First Language
English
Primarily Uses
RMMV

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

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

Latest Threads

Latest Posts

Latest Profile Posts

Here's a sample of some pixel edits I made.

Maybe for use as sidewalks.
If there are any mods or admins online, could you please see about the re-translation pages for RPG Maker MV? They are all down :rsad:
Werewolf cons: you lose control of yourself once a month and could accidentally kill your friends. Vampire cons: no garlic bread. The choice is simple. Werewolf for sure.
2 huge market drops in 2 days. So glad I sold my non-dividend stocks about 2 weeks ago. And if the dividend ones drop heavily, hey more cheap stocks for me!
My tutorial is live! It covers using Yanfly's weapon unleash to replace the basic attack skill with a more dynamic version depending on which weapon type the actor has equipped. It also includes how to import a custom function used to generate a random number within supplied minimum and maximum values, used in the replaced skills, to give weapons a set damage range.

Forum statistics

Threads
94,524
Messages
921,600
Members
124,377
Latest member
Darkyyy
Top