ELI'S PROFILE

Search

[VX Ace] Minor Window_BattleLog Issue

Hey guys, I'm trying to determine which type of object (enemy or actor) a combatant is and what their ID is whenever they use a skill (the idea's to determine those things and then use them to access a note tag that defines them as male, female or neutral, so their battle messages can be properly personalized - "Alex fires his pistol" rather than "Alex fires their pistol" or simply "Alex attacks").

I've run into somewhat of a problem here, though. The code below tells me that enemy objects are of the Game_Enemy type when I print subject.class, though the if clause doesn't return true. It does return true whenever an actor uses a skill but only because it detects their class as being of the RPG::Class variety - apparently, class functions differently for actors than it does for everybody else.

Any idea on how I can properly distinguish between friend and foe? Hope you'll be willing to bear with me and help me out. I've got some experience with Lua and C but I'm bloody new to Ruby and the VX Ace's pre-existing code in general.


class Window_BattleLog < Window_Selectable

#--------------------------------------------------------------------------
# * (Title)
#--------------------------------------------------------------------------

def display_use_item(subject, item)
if item.is_a?(RPG::Skill)
print "subject.class: "
puts subject.class
if subject.class.is_a?(Game_Enemy)
puts "Enemy object detected."
end
if subject.class.is_a?(RPG::Class)
puts "Class object detected."
end
$game_variables[2] = "placeholder"
$game_variables[3] = "placeholder"
$game_variables[4] = "placeholder"
add_text(subject.name + item.message1)
unless item.message2.empty?
wait
add_text(item.message2)
end
else
add_text(sprintf(Vocab::UseItem, item.name, subject.name))
end
end

end
Pages: 1