Chucksaint 2 Report post Posted February 3 (edited) Hi all, can you help me please? how to show next_actor face? Is it possible? thank youu Edited February 3 by Chucksaint Share this post Link to post Share on other sites
Rikifive 3,083 Report post Posted February 3 Hey there, Hmm if you want to draw faces of all party members in their current order (formation), you could put something like this: $game_party.members.size.times do |i| draw_actor_face($game_party.members[i], 100*i, 0) end This will draw faces for all party members, starting with the leader - exactly like in the image you've posted I assume. Share this post Link to post Share on other sites
Chucksaint 2 Report post Posted February 3 (edited) 5 hours ago, Rikifive said: Hey there, Hmm if you want to draw faces of all party members in their current order (formation), you could put something like this: $game_party.members.size.times do |i| draw_actor_face($game_party.members[i], 100*i, 0) end This will draw faces for all party members, starting with the leader - exactly like in the image you've posted I assume. OMG thank you so much!!!! sorry to bother you but is there a way to: draw custom faces in cache indicate current actor status in those faces with image? thank you soo much *.* #update - So I already did the face part Last thing indicator *.* Edited February 3 by Chucksaint update Share this post Link to post Share on other sites
Rikifive 3,083 Report post Posted February 4 (edited) On 2/3/2019 at 10:59 PM, Chucksaint said: sorry to bother you but is there a way to: draw custom faces in cache There totally is a way to do so, you could even draw the faces as standalone sprites (and for example move them around :: doing that in windows would require refreshing their parts each frame, which would cause lags), rather than drawing in windows. It all is possible, as long as you know how. Sorry for a lame example, but this is what I did in my project: Though configuring these as sprites requires some work, so yeah, but I just gave an example that you can do more than you think. Either way I see you've mentioned, that you got this to work, so feel free to disregard what I said. On 2/3/2019 at 10:59 PM, Chucksaint said: indicate current actor status in those faces with image? You could approach that in multiple ways. For example, you could draw a different face depending on if the actor is currently selected or not. Like, add outline around the selected faces or something. You could simply check, if the face, that is about to be drawn matches the currently selected member. Modifying what you had above, you could do this: $game_party.members.size.times do |i| if $game_party.members[i] == $game_party.menu_actor draw_actor_face($game_party.members[i], 100*i, 0) else draw_actor_face($game_party.members[i], 100*i, -60) end end if $game_party.members[i] == $game_party.menu_actor ^- checks, if the drawn face belongs to currently selected actor. As you may know, it cycles through all party members (that "i") here, so each one will be checked - in this case only one will return true. I didn't have graphic, nor that stuff prepared, so I just modified the y position in the example above. The result is: So you could just use different graphics, something like face.png and face_selected.png and put these in the if conditional respectively. Also, I used $game_party.menu_actor, but I assume putting just @actor instead should work, as that global variable ($...) is stored in the instance variable (@...) in these scenes. I wrote a custom window for testing and I didn't configure that variable, so just called it from the global. So yeah, I believe it would be better to put if $game_party.members[i] == @actor Other than that, you could draw an another image below the face, something like this: $game_party.members.size.times do |i| #draw highlight behind the face of selected actor if $game_party.members[i] == @actor draw_image(file, 100*i-10, 0) end #then draw all faces draw_actor_face($game_party.members[i], 100*i, 10) end Of course there's no such a method as draw_image, I just put that as an example, to give you a general idea. So let's assume that image would be the circle - it would be drawn in the same spot ( 100*i ) as the selected actor's face, but I also subtracted 10 from X and moved the faces down also by 10 to give it some offset. Pretty much basic stuff, you get the idea. You could also do this that way: #get the selected actor's index and draw a highlight i = $game_party.members.index(@actor) draw_image(file, 100*i-10, 0) #and then cycle through members to draw face for each $game_party.members.size.times do |i| draw_actor_face($game_party.members[i], 100*i, 10) end So instead of checking if the selected actor is the one currently drawn -- and doing that for each member (loop/cycle or whatever you'd like to call it) --- you can just assign the selected actor's index to let's say i and draw the highlight in specific place ~ that would be a neater approach. But welp, it all depends on your needs, so feel free to toy with this. Hope that helps! Good luck! Edited February 5 by Rikifive corrected some derps 1 PhoenixSoul reacted to this Share this post Link to post Share on other sites
Chucksaint 2 Report post Posted February 4 (edited) 25 minutes ago, Rikifive said: There totally is a way to do so, you could even draw the faces as standalone sprites (and for example move them around), rather than drawing in windows. It all is possible, as long as you know how. Sorry for a lame example, but this is what I did in my project: Though configuring these as sprites requires some work, so yeah, but I just gave an example that you can do more than you think. Either way I see you've mentioned, that you got this so work, so feel free to disregard what I said. You could approach that in multiple ways. For example, you could draw a different face depending on if the actor is currently selected or not. Like, add outline around the selected faces or something. You could simply check, if the face, that is about to be drawn matches the currently selected member. Modifying what you had above, you could do this: $game_party.members.size.times do |i| if $game_party.members[i] == $game_party.menu_actor draw_actor_face($game_party.members[i], 100*i, 0) else draw_actor_face($game_party.members[i], 100*i, -60) end end if $game_party.members == $game_party.menu_actor checks, if the drawn face belongs to currently selected actor. As you may know, it cycles through all party members (that "i") here, so each one will be checked - in this case only one will return true. I didn't have graphic, nor that stuff prepared, so I just modified the y position in the example above. The result is: So you could just use different graphics, something like face.png and face_selected.png and put these in the if conditional respectively. Also, I used $game_party.menu_actor, but I assume putting just @actor instead should work, as that global variable ($...) is stored in the instance variable (@...) in these scenes. I wrote a custom window for testing and I didn't configure that variable, so just called it from the global. So yeah, I believe it would be better to put if $game_party.members == @actor Other than that, you could draw an another image below the face, something like this: $game_party.members.size.times do |i| #draw highlight behind the face of selected actor if $game_party.members[i] == $game_party.menu_actor draw_image(file, 100*i-10, 0) end #then draw all faces draw_actor_face($game_party.members[i], 100*i, 10) end Of course there's no such a method as draw_image, I just put that as an example, to give you a general idea. So let's assume that image would be the circle - it would be drawn in the same spot ( 100*i ) as the selected actor's face, but I also subtracted 10 from X and moved the faces down also by 10 to give it some offset. Pretty much basic stuff, you get the idea. You could also do this that way: #get the selected actor's index and draw a highlight i = $game_party.members.index(@actor) draw_actor_face($game_party.members[0], 100*i, -60) #and then cycle through members to draw face for each $game_party.members.size.times do |i| draw_actor_face($game_party.members[i], 100*i, 0) end So instead of checking if the selected actor is the one currently drawn -- and doing that for each member (loop/cycle or whatever you'd like to call it) --- you can just assign the selected actor's index to let's say i and draw the highlight in specific place ~ that would be a neater approach. But welp, it all depends on your needs, so feel free to toy with this. Hope that helps! Good luck! Niceeeeeee *.* Hahahah it's not lame, it's very unicorn xD last question and the I let you off the hook (I hope) lolz My image doesn't update when I change to next_actor Edited February 4 by Chucksaint Share this post Link to post Share on other sites
Rikifive 3,083 Report post Posted February 4 Hah, no worries. Hmm.. it depends on which window are you using. Windows aren't refreshed unless you tell them to do so. These are refreshed only when needed to avoid performance drops. Seems like the window you're using isn't refreshed when changing actors, but it's not hard to configure that. Which window are you using? Existing one? A custom one? Share this post Link to post Share on other sites
Chucksaint 2 Report post Posted February 4 (edited) 11 hours ago, Rikifive said: Hah, no worries. Hmm.. it depends on which window are you using. Windows aren't refreshed unless you tell them to do so. These are refreshed only when needed to avoid performance drops. Seems like the window you're using isn't refreshed when changing actors, but it's not hard to configure that. Which window are you using? Existing one? A custom one? i'm Trying (try and error) in scene_status/equip/skill and every one that has next_actor sorry for the trouble Edited February 4 by Chucksaint Share this post Link to post Share on other sites
Rikifive 3,083 Report post Posted February 4 As you can see in your window, things are cleaned, then drawn in the refresh method, so you need to run that method again to update stuff. You don't even have the update method defined in your window, so it calls the one from superclass it refers to - Window_Base. So in the end, the update method is basically this: #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super update_tone update_open if @opening update_close if @closing end --which is already run every single frame by the way. All scenes refer to Scene_Base superclass, which updates every single window: Spoiler So all windows will have their update method run every single frame. Putting commands like @draw_actor_next.update will basically update the window twice, as it's already being updated by scene. So to update the contents of the window, you need to put @draw_actor_next.refresh instead of @draw_actor_next.update. From what I see, you're trying to update your window in scene updates, so that means, that the things will be redrawn every single frame, which may drastically reduce performance (also known as "cause lags"). Avoid updating windows when not needed, these are demanding. Look how disastrous my little window is when I'll make it update the faces every single frame. In the bottom right corner you can see FPS - it drops from 60 to about 9 just because of that window! You totally don't want that. These scenes have a method called on_actor_change, which is run when you're switching the actor. This is a perfect time to update the window. So instead of aliasing update methods in the scenes, alias on_actor_change instead. For example you have this: alias actor_face_on_equip_update update def update actor_face_on_equip_update @draw_actor_next.update end Change it to this: alias :actor_face_on_actor_change :on_actor_change def on_actor_change actor_face_on_actor_change @draw_actor_next.refresh end ~And that should do the trick. No worries, you're welcome; Hope that helps! 1 PhoenixSoul reacted to this Share this post Link to post Share on other sites
Chucksaint 2 Report post Posted February 4 9 hours ago, Rikifive said: As you can see in your window, things are cleaned, then drawn in the refresh method, so you need to run that method again to update stuff. You don't even have the update method defined in your window, so it calls the one from superclass it refers to - Window_Base. So in the end, the update method is basically this: #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super update_tone update_open if @opening update_close if @closing end --which is already run every single frame by the way. All scenes refer to Scene_Base superclass, which updates every single window: Hide contents So all windows will have their update method run every single frame. Putting commands like @draw_actor_next.update will basically update the window twice, as it's already being updated by scene. So to update the contents of the window, you need to put @draw_actor_next.refresh instead of @draw_actor_next.update. From what I see, you're trying to update your window in scene updates, so that means, that the things will be redrawn every single frame, which may drastically reduce performance (also known as "cause lags"). Avoid updating windows when not needed, these are demanding. Look how disastrous my little window is when I'll make it update the faces every single frame. In the bottom right corner you can see FPS - it drops from 60 to about 9 just because of that window! You totally don't want that. These scenes have a method called on_actor_change, which is run when you're switching the actor. This is a perfect time to update the window. So instead of aliasing update methods in the scenes, alias on_actor_change instead. For example you have this: alias actor_face_on_equip_update update def update actor_face_on_equip_update @draw_actor_next.update end Change it to this: alias :actor_face_on_actor_change :on_actor_change def on_actor_change actor_face_on_actor_change @draw_actor_next.refresh end ~And that should do the trick. No worries, you're welcome; Hope that helps! Yayyyyy I think it's done, FPS is good too *.* thank you so much @Rikifive!!! This thread can be closed now 1 Rikifive reacted to this Share this post Link to post Share on other sites
Rikifive 3,083 Report post Posted February 4 That's great! You're welcome. Okay then, closing thread. If you'd like to reopen it, report the first post in this thread or just poke me. Thank you! 1 PhoenixSoul reacted to this Share this post Link to post Share on other sites
Rikifive 3,083 Report post Posted February 8 That escalated quickly Reopening on request. @Chucksaint you can continue. Share this post Link to post Share on other sites
Chucksaint 2 Report post Posted February 8 Yeah... sorry, I think that's the last of it! (I really hope so) How can I animate a sprite by frames? for instance this one? def draw_actor_next(actor, x, y, enabled = true) bitmap = Cache.picture(actor.name + "_bg") rect = Rect.new(0, 0, 640,480) self.contents.blt( x , y + 3, bitmap, rect, 255) bitmap.dispose self.z = 999 end Thank youu Share this post Link to post Share on other sites