[RMXP] Changing Enemy HP[RESOLVED]

Started by jayje, November 14, 2017, 07:23:20 pm

Previous topic - Next topic

jayje

November 14, 2017, 07:23:20 pm Last Edit: November 14, 2017, 11:22:56 pm by jayje
I've trying to increase the enemy's HP (I can change the MAXHP) but for some reason when I try to change just HP (ie: $game_troop.enemies[0].hp += 12) nothing happens. Is there something I'm missing?


Jaiden

Do you have a little more context as to what you're doing? That line by itself seems fine to me, but we probably need to see the whole thing in the context of a script so we can better understand why it isn't working for you.

jayje

Thing is, I'm trying to do this in a Call Script function. As I said earlier this worked on the MAXHP, but not the HP. I tried to use the "== " to try and make the HP and MAXHP equal, but that failed as well.


Jaiden

Context would still be helpful. Even a screenshot of the event page.

I'm curious why you are using a script call for this in the first place. Are you calling this during an evented battle? If so, there is a "Change Enemy HP" event that works just as well. It's possible something else could be causing the problem.

Also, "==" is only for checking whether or not something is equal, such as in a conditional statement. You would use "=" to assign the HP to the MAXHP or visa versa.



jayje

My bad. I'm enacting a battle event where the Enemy's stats increase based on the party's level. It checks the variable then adds it to the enemy's stats. (HP, SP, MAXSP, MAXHP, Etc). All of this activates turn '0'.


Jaiden

Can you provide a screenshot of the event page? Still sounds good, but I need to see if the eventing makes sense.

jayje



KK20

You need to increase the MaxHP/SP stat first, then you can change the HP/SP stat.
But why are you torturing yourself with this when you can just edit this script:
http://forum.chaos-project.com/index.php/topic,10545.0.html

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

jayje

I was trying to to avoid adding any more scripts, if possible. I have changed the MAXSP/HP tho. What would I need to change the HP/SP?


KK20

I don't understand your logic with minimizing the use of scripts when that event code alone is
1) Painful to read through, making it harder to modify and
2) Slower than a script

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

jayje

I'm more used to eventing than scripting, plus I'd like to get this demo asap. Plus I only want leveling enemies in certain situations, not every battle.


Jaiden

I definitely suggest using that or another script, this is pretty bad and will cause you a lot of grief and hours in the future.

But, if you are adamant, then yeah, the first problem is you're setting the HP equal to the MaxHP, then changing MaxHP, which will do nothing.
Then, you're setting the HP before the MaxHP, which means there's no maximum value to hold what you're trying to add to it. You'll need to set the MaxHP first, then the HP.

jayje

That seems to have worked. Thanks for your patience, guys. I'm going to be working hard to learn rgss as best I can going into the next year.


Blizzard

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.