May I ask a question about enemies...?
I have a question about them which is mainly how to access them via script?
Say for example I wanna get enemy 1's hp, mp... or other stats...
can someone guide me about them?
I was planning on making a small window that draws their stats but I don't really know how.
if you have an enemy object: enemy.hp
if you have only the game troop object, you can do
$game_troop.members[id].hp
It also depends where you're accessing them from...
like if for example on the make_damage_value of Game_Battler class, the actor/enemy to be damaged is noted by self, so you can do like self.hp, damage cause is noted by user, so you can use user.hp for that...
You could also just use $data_enemies[id] and you don't have to have them instantiated yet.
If you're in a battle and you just want "the first enemy's" HP/stats, you can do that with Control Variables.
Say for example I wanted to access an enemy hp through id's... would it be $game_enemies[1].hp?
Another question, say I am in a battle and the ID number of the enemy I want to show its HP and MP is undefined or random, how can I access that enemy's certain hp and mp?
This I think is quite important since, in a battle where you still don't know who you're fighting with and the battle sequence comes up, the enemy shows up...
you would be able to determine which enemy that was.
you use the $game_troop.members[id] for that... where id is the position on the troops...
PS: A correction on your above post... it is $data_enemies not $game_enemies... XD
PS 2: Read the default scripts that handles battles and the classes for battlers,actors and enemies... you can learn a lot from those...
I see, I'll look on to that. I have made a small hud, the problem I am having is about the changes that happens.
Here's a small bit of my code that handles drawing the face:
@hud_face.draw_face(m.character_name, m.character_index, char_x, char_y) if char_show_charthe problem I am having is:
whenever I change the face of the character, it would still draw the character's face with the matching number.
Say for example I am going to show Ryoma's Hud.
Basically, Ryoma is on Actor 4, Sprite #7, Face 4, Face #7.
If I ever changed Ryoma's face into Face 1...
my hud still draws Face 7 for Ryoma.
What seems to be the problem?
Either the value is not the value it is supposed to be or you are not redrawing the face when you think you are. I'm leaning toward the latter, but we need context to see which.
Shana: I'll just make a new thread for it then. I'll just have to reconnect this for my enemy hud...since my problem occurs with the hp, enemies, faces and almost everything.
@Mithran - Hi! I am creating a script where in, I wanted to show the actor's face on it, but it keeps rolling to the same face of the same sprite match. I am actually modifying an existent script by Reino.
Here's the one:
def hud_real_update_function a = $game_party.members[@id] @wind.contents.clear @wind.draw_face(a.character_name, a.character_index, Character_X, Character_Y) if Character_Show if Name_Show @wind.contents.font.name = Name_Font if Name_Font != nil @wind.contents.font.color = Name_Color @wind.contents.font.size = Name_Size_of_Font @wind.contents.draw_text(Name_X, Name_Y, Name_Width, Name_Size_of_Font, a.name, Name_Alignment) endendi just created a new function to base it, where I changed it to a face rather than a sprite. but...
the problem I have is that it basically doesn't draw the right face when I change it.
That doesn't tell us when and where the hud is actually being updated. Also, this is getting pretty far off topic, so it would be best to make a new thread if this is not related to your previous issue.
Uhm, Isn't character_name for the spritesheet? face is obtained from Game_Actor class' face_name and face_index
I'll do a new thread for this when I got it working or see new problems. Thanks both of you.