I probably should have noted I was writing my post blind.
Because I had no idea where this code was being written, it's was impossible for me to know if I was inside the Game_Actor class - in which case @actor_id would work - or somewhere else - in which case I need to access the right property from the right object; where @actor.id is what would work.
module LFQF
ACTORRACE = { #Do Not Remove
#Actor ID => Race of this actor in quotes
0 => "Human", #default in cases where actor is not specified
1 => "Human",
2 => "Fairy",
3 => "Elf",
4 => "Dwarf",
} #Do Not Remove
end
class Window_Status < Window_Base
alias :lfqf_refresh_af3k :refresh
def refresh(*args)
#run original
lfqf_refresh_af3k(*args)
#do extra
race = LFQF::ACTORRACE[0] #set variable as default race
if LFQF::ACTORRACE.include?(@actor.id)
#change race only if actor id is included in LFQF::ACTORRACE
race = LFQF::ACTORRACE[@actor.id]
end
self.contents.draw_text (0, 124, 100, 32, race)
end
end
Just copy/paste this into an empty slot above Main (and below Scene_Debug) where other custom scripts live.
That little bit of code will do the trick, as well as use a default value should an actor not be given a specific race. You may want to change this line:
self.contents.draw_text (0, 124, 100, 32, race) #line 27 in the editor
to draw the text in the correct place. You may also want to add a draw_text line to write "Race" as a label too. Do feel free to make those changes, or whatever changes you see fit.
It also gets rid of the need to use $game_variables which I think is part, if not all, of the reasons why you got problems in the first place.
I could have made it less repetitive (not having to set Human more than once) but considering it'll only take a minute to set up for all your actors - unless you have a lot of actors where it might take 5 minutes - I didn't figure it too much of a hassle. It can be done though if preferred.
Also, if there's a possibility of an actor changing their race, I will have to make changes to the code - having race actually part of the actor class would make this easier to do.