SelectOkay

Villager
Member
Joined
Oct 16, 2022
Messages
5
Reaction score
0
First Language
English
Primarily Uses
RMVXA
Hi, I'm having an issue where the window status menu keeps giving me a NoMethodError when I remove a party member. It's telling me that "undefined method 'hp' for nil:NilClass". I think that means that "hp" is an undefined variable but I don't know how to fix it. Here's what I did...
Screenshot 2022-10-15 113736.png
As you can see, everything works perfectly when there's two actors in the party. But when there's only one, I get this error.
The Error.png
I'm not sure how to fix this. Here's the code that I changed.
What I changed.png
And here's what the game is taking issue with.
The Issue.png
I'm very new to RGSS3 and I don't know if I'm making some sort of rookie mistake so feel free to call me a moron all you want. But I just don't understand what I'm doing wrong.
 

Roninator2

Gamer
Regular
Joined
May 22, 2016
Messages
5,237
Reaction score
1,568
First Language
English
Primarily Uses
RMVXA
I'm making some sort of rookie mistake
I don't know, is this a script you made yourself for showing the actors hud on the map?

It's not a problem with the base script unless you changed something there.

Tell us what scripts you have added on?
If you do not have any extra scripts added in, tell us about the event that add actors and shows the images and data and removing the actors.
 

Trihan

Speedy Scripter
Regular
Joined
Apr 12, 2012
Messages
6,840
Reaction score
7,854
First Language
English
Primarily Uses
RMMZ
Hi, I'm having an issue where the window status menu keeps giving me a NoMethodError when I remove a party member. It's telling me that "undefined method 'hp' for nil:NilClass". I think that means that "hp" is an undefined variable but I don't know how to fix it. Here's what I did...
View attachment 242808
As you can see, everything works perfectly when there's two actors in the party. But when there's only one, I get this error.
View attachment 242809
I'm not sure how to fix this. Here's the code that I changed.
View attachment 242811
And here's what the game is taking issue with.
View attachment 242810
I'm very new to RGSS3 and I don't know if I'm making some sort of rookie mistake so feel free to call me a moron all you want. But I just don't understand what I'm doing wrong.
Your problem is the line

actor2 = $game_party.members[1]

You're then calling draw_actor_hp passing in actor2 for the actor but when you only have one party member, there is no actor at index 1 of $game_party, so actor2 is nil.
 

SelectOkay

Villager
Member
Joined
Oct 16, 2022
Messages
5
Reaction score
0
First Language
English
Primarily Uses
RMVXA
I don't know, is this a script you made yourself for showing the actors hud on the map?

It's not a problem with the base script unless you changed something there.

Tell us what scripts you have added on?
If you do not have any extra scripts added in, tell us about the event that add actors and shows the images and data and removing the actors.
No, I changed the base script. The only outside script I added was to give me window names if I hold ctrl
Your problem is the line

actor2 = $game_party.members[1]

You're then calling draw_actor_hp passing in actor2 for the actor but when you only have one party member, there is no actor at index 1 of $game_party, so actor2 is nil.
Ohhh! Now I see. I'll find a different way to do that then, thank you!
 

SelectOkay

Villager
Member
Joined
Oct 16, 2022
Messages
5
Reaction score
0
First Language
English
Primarily Uses
RMVXA
If you do not have any extra scripts added in, tell us about the event that add actors and shows the images and data and removing the actors.
Sorry, I didn't respond to this part.
The event I made was a simple add and remove actors from the party command I made in a minute.
1665932887494.png
Any other change I made is in the image above of the code I edited.
 

TheoAllen

Self-proclaimed jack of all trades
Regular
Joined
Mar 16, 2012
Messages
7,534
Reaction score
11,996
First Language
Indonesian
Primarily Uses
N/A
Ohhh! Now I see. I'll find a different way to do that then, thank you!
Insert return unless actor2 between line 70 ~ 71 in Window_MenuStatus
 

Latest Threads

Latest Posts

Latest Profile Posts

Behold, our jam game's main character!1701683080788.png
Uh... Forum test, forum test. Am I live?
New but not so new here. (Like, been lurking around as a guest). I hope to change my destiny.
That is, to make friends and learn from the community. I hope we all have fun and create memories worth keeping. :ptea:
made a face sprite for the little guy using default cat for comparison, I'm rather pleased with how it turned out!

image.png
Playing arounnd with NUUN's Battle Result as a VS Victory Aftermath alternative. Loving it so far despite the learning curve (there are a LOT of parameters)

1701665328725.png

Just have to figure out how to addin sub class progress.

Forum statistics

Threads
136,730
Messages
1,269,278
Members
180,453
Latest member
Gfvasd
Top