Author Topic: [RMXP] Changing Enemy HP[RESOLVED]  (Read 128 times)

Offline jayje

  • Trained Member
  • *
  • Posts: 41
  • LV: 2
    • View Profile
[RMXP] Changing Enemy HP[RESOLVED]
« on: November 15, 2017, 02:23:20 AM »
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?
« Last Edit: November 15, 2017, 06:22:56 AM by jayje »

Offline BoisterousHero

  • Awakened Visionist
  • **
  • Posts: 65
  • LV: 0
    • View Profile
Re: [RMXP] Changing Enemy HP
« Reply #1 on: November 15, 2017, 03:21:01 AM »
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.

Offline jayje

  • Trained Member
  • *
  • Posts: 41
  • LV: 2
    • View Profile
Re: [RMXP] Changing Enemy HP
« Reply #2 on: November 15, 2017, 03:46:20 AM »
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.

Offline BoisterousHero

  • Awakened Visionist
  • **
  • Posts: 65
  • LV: 0
    • View Profile
Re: [RMXP] Changing Enemy HP
« Reply #3 on: November 15, 2017, 03:54:06 AM »
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.



Offline jayje

  • Trained Member
  • *
  • Posts: 41
  • LV: 2
    • View Profile
Re: [RMXP] Changing Enemy HP
« Reply #4 on: November 15, 2017, 03:58:13 AM »
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'.

Offline BoisterousHero

  • Awakened Visionist
  • **
  • Posts: 65
  • LV: 0
    • View Profile
Re: [RMXP] Changing Enemy HP
« Reply #5 on: November 15, 2017, 04:07:42 AM »
Can you provide a screenshot of the event page? Still sounds good, but I need to see if the eventing makes sense.

Offline jayje

  • Trained Member
  • *
  • Posts: 41
  • LV: 2
    • View Profile
Re: [RMXP] Changing Enemy HP
« Reply #6 on: November 15, 2017, 04:20:35 AM »
This is the best I can do. It's a video of the event itself.
https://drive.google.com/open?id=1r4hkyY8n7SDlWQXfOhSUHaZqcpqf26Ic

Offline KK20

  • Master Scripter Fixer
  • Global Moderator
  • Guardian of Chaos
  • ****
  • Posts: 3038
  • LV: 372
  • Gender: Male
  • Bringer of Salt
    • View Profile
Re: [RMXP] Changing Enemy HP
« Reply #7 on: November 15, 2017, 05:19:22 AM »
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 AceUpgrade RMXP to RMVXA performance!
XPA TilemapTilemap rewrite with many features, including custom resolution!


NNID: KK20-CP
Discord: KK20 Tyler#8901
Join the CP Discord Server

Offline jayje

  • Trained Member
  • *
  • Posts: 41
  • LV: 2
    • View Profile
Re: [RMXP] Changing Enemy HP
« Reply #8 on: November 15, 2017, 05:22:34 AM »
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?

Offline KK20

  • Master Scripter Fixer
  • Global Moderator
  • Guardian of Chaos
  • ****
  • Posts: 3038
  • LV: 372
  • Gender: Male
  • Bringer of Salt
    • View Profile
Re: [RMXP] Changing Enemy HP
« Reply #9 on: November 15, 2017, 05:28:57 AM »
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 AceUpgrade RMXP to RMVXA performance!
XPA TilemapTilemap rewrite with many features, including custom resolution!


NNID: KK20-CP
Discord: KK20 Tyler#8901
Join the CP Discord Server

Offline jayje

  • Trained Member
  • *
  • Posts: 41
  • LV: 2
    • View Profile
Re: [RMXP] Changing Enemy HP
« Reply #10 on: November 15, 2017, 05:34:17 AM »
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.

Offline BoisterousHero

  • Awakened Visionist
  • **
  • Posts: 65
  • LV: 0
    • View Profile
Re: [RMXP] Changing Enemy HP
« Reply #11 on: November 15, 2017, 05:36:43 AM »
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.

Offline jayje

  • Trained Member
  • *
  • Posts: 41
  • LV: 2
    • View Profile
Re: [RMXP] Changing Enemy HP
« Reply #12 on: November 15, 2017, 05:47:31 AM »
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.

Online Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19929
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: [RMXP] Changing Enemy HP[RESOLVED]
« Reply #13 on: November 15, 2017, 09:43:27 AM »
That's the spirit. :)
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


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

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