I need help with changing the position the actor faces

Discussion in 'Javascript/Plugin Support' started by SupeRPG1270, Jan 5, 2019.

  1. SupeRPG1270

    SupeRPG1270 Villager Member

    Messages:
    5
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMMV
    Hi,

    As the title says, I need help changing the position the actor faces when moving to the front of the enemy. I'm using Yanfly's Battle Engine Core, and all 3 of his Action Sequence Plugins. I did edit some of his scripts a little bit though because in my game I wanted actors on the left and enemies on the right. After I edited the scripts it was all fine at first. But then when it came to editing Yanfly's Action Sequence Pack 2 plugin I couldn't figure out how to change the direction the actor faced.
    In the first spoiler, I put the code I edited in the Action Sequence Pack 2 plugin:
    Code:
    if (actors > 0 && enemies === 0) {
                return (value === 'front') ? 'right' : 'left';
            } else if (actors === 0 && enemies > 0) {
                return (value === 'front') ? 'left' : 'right';
            } else {
                if (mover.isActor()) {
                    return (value === 'front') ? 'left' : 'right';
                } else { // enemy
                    return (value === 'front') ? 'right' : 'left';
                }
    
    In this next spoiler is the code I think is what I need to edit to fix my problem. But I don't know what to change:
    Code:
    if (['BASE', 'FOOT', 'FEET'].contains(type)) {
                var destX = this.actionMoveX(mover, targets, 'center');
                var destY = this.actionMoveY(mover, targets, 'foot');
              } else if (['CENTER', 'MIDDLE'].contains(type)) {
                var destX = this.actionMoveX(mover, targets, 'center');
                var destY = this.actionMoveY(mover, targets, 'center');
              } else if (['HEAD', 'TOP'].contains(type)) {
                var destX = this.actionMoveX(mover, targets, 'center');
                var destY = this.actionMoveY(mover, targets, 'head');
              } else if (['FRONT BASE', 'FRONT FOOT', 'FRONT FEET',
              'FRONT'].contains(type)) {
                var destX = this.actionMoveX(mover, targets, 'front');
                var destY = this.actionMoveY(mover, targets, 'foot');
              } else if (['BACK BASE', 'BACK FOOT', 'BACK FEET',
              'BACK'].contains(type)) {
                  var destX = this.actionMoveX(mover, targets, 'back');
                  var destY = this.actionMoveY(mover, targets, 'foot');
              } else if (['FRONT CENTER', 'FRONT MIDDLE'].contains(type)) {
                var destX = this.actionMoveX(mover, targets, 'front');
                var destY = this.actionMoveY(mover, targets, 'center');
              } else if (['BACK CENTER', 'BACK MIDDLE',].contains(type)) {
                var destX = this.actionMoveX(mover, targets, 'back');
                var destY = this.actionMoveY(mover, targets, 'center');
              } else if (['FRONT HEAD', 'FRONT TOP'].contains(type)) {
                var destX = this.actionMoveX(mover, targets, 'front');
                var destY = this.actionMoveY(mover, targets, 'head');
              } else if (['BACK HEAD', 'BACK TOP'].contains(type)) {
                var destX = this.actionMoveX(mover, targets, 'back');
                var destY = this.actionMoveY(mover, targets, 'head');
              }
            var offsetX = this.actionMoveOffsetX(actionArgs, mover, targets[0]);
            var offsetY = this.actionMoveOffsetY(actionArgs, mover, targets[0]);
              mover.battler().moveToPoint(destX + offsetX, destY + offsetY, frames);
            mover.spriteFacePoint(destX, destY);
          }
        }
        return true;
    

    Also, I should probably point out that I flipped my actor's battler sprites using an image editor so it doesn't look reversed(I did this before my problem occurred).
    In this last spoiler is my actor performing an attack with the note tags included:

    <setup action>
    display action
    immortal: targets, true
    </setup action>
    <target action>
    move user: targets, front, 20
    zoom: 125%, 30
    camera screen: target, front center, 30
    camera focus: target, front center, 30
    wait for movement
    motion attack: user
    wait: 10
    attack animation: target
    wait for animation
    action effect
    </target action>

    If anybody knows what I should do, please let me know. Thank you for reading.

    -SupeRPG

    Update: I found out that the 'front' note tag does make my actor face forward, but it only works if my actor moves to the 'back' of the enemy.
    For example, if I use these note tags...

    move user: targets, back, 19
    wait for movement
    move user: targets, front, 1
    wait for movement

    ...my actor moves to the back of the enemy facing towards it. Then, it moves quickly to the front of the enemy facing the right way, which is forward. I don't understand why my actor doesn't face forward when I use the 'front' tag first.
     
    Last edited: Jan 6, 2019
    #1
  2. SupeRPG1270

    SupeRPG1270 Villager Member

    Messages:
    5
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMMV
    Bump

    Update: I figured out how to fix my problem on my own, so this thread can be closed now.
     
    Last edited: Jan 9, 2019
    #2
  3. Zevia

    Zevia Veteran Veteran

    Messages:
    580
    Likes Received:
    273
    First Language:
    English
    Primarily Uses:
    RMMV
    Before the thread is closed, I'd recommend posting what your solution was. There may be someone in the future who has the same problem and it can be frustrating if they experience some hope finding your thread discussing it, only to discover that the answer is now a secret.
     
    #3
    Aloe Guvner likes this.
  4. SupeRPG1270

    SupeRPG1270 Villager Member

    Messages:
    5
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMMV
    Ok, fine I'll post the solution. By the way at the time I was really frustrated that nobody said anything to help. That's why my last comment sounded like that.


    Anyways the solution is this:

    Find this line of code ---> mover.spriteFacePoint(destX, destY);
    It should be under what I said in my second spoiler on my first post (which is a chunk of code from Yanfly's Action Sequence Pack 2 Plugin).

    Then replace that code with this one I made:
    Code:
    if (['BACK BASE', 'BACK FOOT', 'BACK FEET', 'BACK', 'BACK CENTER',
        'BACK MIDDLE', 'BACK HEAD', 'BACK TOP'].contains(type)) {
            mover.spriteFaceBackward();
            } else {
                mover.spriteFaceForward();
            }
    
    It should be able to make the actor face forward when moving it to the front and/or center of the enemy.
     
    Last edited: Jan 11, 2019
    #4
  5. Zevia

    Zevia Veteran Veteran

    Messages:
    580
    Likes Received:
    273
    First Language:
    English
    Primarily Uses:
    RMMV
    I totally understand. Especially if you feel like your issue is blocking you from continuing to work on your project, it can feel incredibly frustrating if nobody has an answer for you.

    Unfortunately, since everyone's time is volunteered around here, it could be a number of factors that led to no response. Maybe nobody knows the answer, maybe someone could figure out the answer, but doesn't want to invest the time, maybe the person who knows the answer just didn't happen to see your thread because they were busy or looking at other threads or solving other problems. Who knows?

    But if you can save someone else the same frustration that you felt, you're improving the community by posting your solution. Even if nobody posts anything or says anything explicitly saying so, it's certainly appreciated.
     
    #5
  6. SupeRPG1270

    SupeRPG1270 Villager Member

    Messages:
    5
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMMV
    Thanks for the advice man.
     
    #6

Share This Page