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,459
Reaction score
944
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,459
Reaction score
944
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,293
Reaction score
3,617
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

Coffee + Silk Coconut Milk + Splenda Zero = Not ..... awful :/ .
My new RPG Maker music pack, Emotional: Redemption, is now in progress and will be coming to RPG Maker soon. It is an album that focuses on emotional themes including the darker forms of sorrow and despair. Below is a demo of a composition from the album.

Please watch out for your hands when handling chests! XD Did this a few days ago, it was fun to animate

Apparently, it's illegal to be drunk on licensed premises: pubs, etc. It's illegal for keepers of public houses to permit drunkenness and disorderly conduct. lol.
Pillow Hero - A 16-bit arcade styled puzzle game, update 0.5 is live now on Itch.io! --> https://bifrost09.itch.io/pillow-hero

Forum statistics

Threads
94,437
Messages
920,906
Members
124,241
Latest member
toanbeokame
Top