How do you call actor.id in Window_MenuStatus, the game crashes when I try to call it like name and class_id. I just notice that it's not a variable like the latters so won't work the same as them.
Mind clarifying what you mean? What are you trying to accomplish?
You know how you can call the actors name and class in Window_MenuStatus or any other menu, well how do you call the actors id. I was trying to call it when using it to call the actors face image from the folder because, if someone was to rename their actor they would get an error due to the fact you changed the actors name. So I was just going to change it to id instead but I got an error.
It should be
.id. Maybe the object you were calling on wasn't even an actor? In other words
actor = SomethingWeird.new
.
.
.
print actor.id # Error
That wouldn't make any sense as I can call an image using actor.name.
For an example as you get the same error both ways, go to Window_Base and change actor.name to actor.id
def draw_actor_name(actor, x, y)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 120, 32, actor.name)
end
to
def draw_actor_name(actor, x, y)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 120, 32, actor.id)
end
The error I get when I change actor.name to actor.id from either draw_actor_name or from my draw_face method.
QuoteScript 'Window_Base' line 123: TypeError occurred.
cannot convert Fixnum into String
General rule of thumb. When trying to draw numbers as text/in a string format...use
.to_s
def draw_actor_name(actor, x, y)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 120, 32, actor.id.to_s)
end
You do understand what that error message means, right?
:facepalm: Sorry I had a brain fart. Thanks though :P
Sounds like a good place to use the $global reference...
x = 123
y = 123
for actor in $game_party.actors
self.contents.font.color = normal_color
# Don't forget Font Size!
self.contents.draw_text(x, y, 120, 32, actor.id.to_s)
# Increase Y value for next actor to position text correctly
y += 160
end