Face changing CE interfering with other events

Discussion in 'RPG Maker MV' started by asm_demon, Feb 19, 2019.

  1. asm_demon

    asm_demon Villager Member

    Messages:
    18
    Likes Received:
    4
    First Language:
    English
    Primarily Uses:
    RMMV
    I'm making a game in which player's HP level is illustrated with corresponding face picture in the ESC menu. For example, if player's HP is 70/100 there will be a normal protagonist's face in the menu but when HP falls below 30/100 the picture changes and now shows injured protagonist. This was easy to achieve with common event that constantly checks if the player's HP is lower than 30. The "else" branch changes the face back to normal (or, should I say, keeps changing it to normal). So far everything works. The problems starts when during the game I have to change character's menu face (or sprite) independently of that common event because it keeps setting the face back to "normal". What should I do to keep the functionality of the described CE while still being able to change character's menu face or sprite due to other events? Your help would be much appreciated.
     
    #1
  2. Eurritimia

    Eurritimia Villager Member

    Messages:
    22
    Likes Received:
    20
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    When using YEP Message Core, there's a option inside to use the actor's face: \af[x]
     
    #2
  3. asm_demon

    asm_demon Villager Member

    Messages:
    18
    Likes Received:
    4
    First Language:
    English
    Primarily Uses:
    RMMV
    Eurritimia, but that's not what I was asking about.
     
    #3
  4. Bex

    Bex Veteran Veteran

    Messages:
    1,168
    Likes Received:
    260
    First Language:
    German
    Primarily Uses:
    RMMV
    Can you show us Pictures of your involved Eventpages?
    Thatway we can see what your approach of creating is and how it relates to the thing you need. And we can maybe provide additional optimization.
     
    #4
    caethyril likes this.
  5. Shaz

    Shaz Veteran Veteran

    Messages:
    37,355
    Likes Received:
    11,146
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    If your common event is set up as a parallel process, then yes, it's going to keep changing the face based on the conditions you've set. A parallel process for something like that isn't a good design.

    Why do you have to change the face independent of that common event?

    Clearly, you've got multiple conditions that give more options for the face than what the common event can handle. So you've either got to incorporate the additional conditions into the common event, or make it stop running when you want to override it for whatever reason. Simply turning off the switch when you want manual control over the face, and turning the switch back on when you want to resume, will take care of that.

    But I'd look for a different option that doesn't require a parallel process common event that's always running, for something that might change every now and then. If the face only changes in the menu, then a small plugin that makes the menu show the correct face will remove the need for the CE completely.
     
    #5
    asm_demon likes this.
  6. asm_demon

    asm_demon Villager Member

    Messages:
    18
    Likes Received:
    4
    First Language:
    English
    Primarily Uses:
    RMMV
    Here's how the Common Event looks like in editor:

    [​IMG]

    Because I wanted to make other events in this game which will allow the character to change the hairstyle (for example) which also results in menu avatar change.

    How should I design this to make it better?

    Could you tell me which one?
     
    Last edited: Feb 20, 2019
    #6
  7. Bex

    Bex Veteran Veteran

    Messages:
    1,168
    Likes Received:
    260
    First Language:
    German
    Primarily Uses:
    RMMV
    I could help make that the command is executed only once when HP changes.

    Set Health Var6 = HP of Mako
    - If Var6 not equal Var100 (Var100 keeps track of previous/prior HP)
    - Set Var100 = Var6
    - All following code of your Picture comes in here, thatway the face changes only when the amount of HP changes.

    But with your second problem there is the Scripting Way or the Evented Way, if you got many Faces and many chars which use this, the workload increases much when you event it.

    if Health <= 30
    if Variable101 = 0 - Change Actor Image to Set1 Low Health
    if Variable101 = 1 - Change Actor Image to Set2 Low Health
    if Variable101 = 2 - Change Actor Image to Set3 Low Health
    else
    if Variable101 = 0 - Change Actor Image to Set1 Normal Health
    if Variable101 = 1 - Change Actor Image to Set2 Normal Health
    if Variable101 = 2 - Change Actor Image to Set3 Normal Health
    end

    Everytime you change your Actors appearance you need to adjust Variable101 accordingly.
    This would be one possible solution. I hope this helps you fix your problem.

    Extra Info:
    The Eventcommand Change Actor Image is one of the few commands which suck the most performance.
    A parallel event repeats up to 60 times per second.
    Its no problem to set hundrets of variables and have hundrets of conditional branches in a paralell event, but your
    code above is a performance overkill.
     
    #7
    asm_demon likes this.
  8. asm_demon

    asm_demon Villager Member

    Messages:
    18
    Likes Received:
    4
    First Language:
    English
    Primarily Uses:
    RMMV
    Bex, thanks so much for your help! You've shed some light on things I have not taken into account before.

    Now I'm going back to editor to experiment! :)
     
    #8
  9. TWings

    TWings The Dragon Whisperer Veteran

    Messages:
    308
    Likes Received:
    579
    Location:
    Kyoto
    First Language:
    French
    Primarily Uses:
    RMMV
    Depending on your game design, you could avoid the whole parallel process thing.
    If the player's HP only changes in battles and defined events (like staying at the inn), you could call your CE only in battles and those events without making it parallel.
    If you use some stuff like persistant poison states or map damages, then it won't work but I'd advise to add at least a wait 60 in your event (that way it only runs once every second).
     
    #9
  10. Shaz

    Shaz Veteran Veteran

    Messages:
    37,355
    Likes Received:
    11,146
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    As long as you're using that common event, it's going to override whatever the player wants to use. Anything that changes the face has to take into account ALL the possible images that could be used - not just based on HP, but based on hairstyle or colour or whatever other choices you're giving the player.
     
    #10
  11. asm_demon

    asm_demon Villager Member

    Messages:
    18
    Likes Received:
    4
    First Language:
    English
    Primarily Uses:
    RMMV
    There are no battles in this game. The only way a character can get HP reduced is when he steps on the damage floor or is poisoned. So I guess I have to stick with parallel event?

    But how to design this? Tips would be much appreciated.
     
    #11
  12. TWings

    TWings The Dragon Whisperer Veteran

    Messages:
    308
    Likes Received:
    579
    Location:
    Kyoto
    First Language:
    French
    Primarily Uses:
    RMMV
    In that case, yes. Either keep it parallel or use a plugin (but I don't know of such a plugin). You can still avoid it beeing call too much by adding a wait at the end of the CE. As I was suggesting even a wait 60 would still run it every second, but 60 times less often.


    As @Bex was saying use a variable and assign a number for every different "style" (in the event(s) where you change the player look) and put as mani IF statements as you need in your CE to cover every case.
     
    #12
    asm_demon likes this.

Share This Page