Chaos Project

RPG Maker => RPG Maker Scripts => Script Troubleshooting => Topic started by: jayje on November 14, 2017, 07:23:20 pm

Title: [RMXP] Changing Enemy HP[RESOLVED]
Post by: jayje on November 14, 2017, 07:23:20 pm
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?
Title: Re: [RMXP] Changing Enemy HP
Post by: Jaiden on November 14, 2017, 08:21:01 pm
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.
Title: Re: [RMXP] Changing Enemy HP
Post by: jayje on November 14, 2017, 08:46:20 pm
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.
Title: Re: [RMXP] Changing Enemy HP
Post by: Jaiden on November 14, 2017, 08:54:06 pm
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.


Title: Re: [RMXP] Changing Enemy HP
Post by: jayje on November 14, 2017, 08:58:13 pm
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'.
Title: Re: [RMXP] Changing Enemy HP
Post by: Jaiden on November 14, 2017, 09:07:42 pm
Can you provide a screenshot of the event page? Still sounds good, but I need to see if the eventing makes sense.
Title: Re: [RMXP] Changing Enemy HP
Post by: jayje on November 14, 2017, 09:20:35 pm
This is the best I can do. It's a video of the event itself.
https://drive.google.com/open?id=1r4hkyY8n7SDlWQXfOhSUHaZqcpqf26Ic (https://drive.google.com/open?id=1r4hkyY8n7SDlWQXfOhSUHaZqcpqf26Ic)
Title: Re: [RMXP] Changing Enemy HP
Post by: KK20 on November 14, 2017, 10:19:22 pm
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
Title: Re: [RMXP] Changing Enemy HP
Post by: jayje on November 14, 2017, 10:22:34 pm
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?
Title: Re: [RMXP] Changing Enemy HP
Post by: KK20 on November 14, 2017, 10:28:57 pm
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
Title: Re: [RMXP] Changing Enemy HP
Post by: jayje on November 14, 2017, 10:34:17 pm
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.
Title: Re: [RMXP] Changing Enemy HP
Post by: Jaiden on November 14, 2017, 10:36:43 pm
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.
Title: Re: [RMXP] Changing Enemy HP
Post by: jayje on November 14, 2017, 10:47:31 pm
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.
Title: Re: [RMXP] Changing Enemy HP[RESOLVED]
Post by: Blizzard on November 15, 2017, 02:43:27 am
That's the spirit. :)