Set Follower to face a specific direction

● ARCHIVED · READ-ONLY
Started by joket 5 posts View original ↗
  1. I haven't tested it, but I think you can just use the following script:
    JavaScript:
    $gamePlayer.followers().follower(f).setDirection(d);

    where f is a number representing the follower's position (0 being the first follower, 1 being the second, etc.) and d is a number representing the direction:
    • 2: Down
    • 4: Left
    • 6: Right
    • 8: Up
    If you want all followers to face the same direction, you can also do this instead:
    JavaScript:
    $gamePlayer.followers().forEach(follower => follower.setDirection(d));
  2. Nice! It works. What about make a follower to move 1 step aside?
  3. joket said:
    Nice! It works. What about make a follower to move 1 step aside?

    In this case you would probably use moveStraight(d) instead of setDirection(d)

    And if you want them to maintain their current direction (making them move sideways or backwards), you'd need to call setDirectionFix(true) first (then setDirectionFix(false) to allow them to turn again, otherwise they'll keep facing the same direction forever even when the event is over).

    For example:
    JavaScript:
    $gamePlayer.followers().follower(0).setDirectionFix(true);
    $gamePlayer.followers().follower(0).moveStraight(2);
    $gamePlayer.followers().follower(0).setDirectionFix(false);
    will make the first follower (0) move down (2) while retaining their current direction.
    Alternative code (does the same thing, but requires less typing):
    JavaScript:
    const follower = $gamePlayer.followers().follower(0);
    follower.setDirectionFix(true);
    follower.moveStraight(2);
    follower.setDirectionFix(false);

    Here's the equivalent for all followers:
    JavaScript:
    $gamePlayer.followers().forEach(follower => {
        follower.setDirectionFix(true);
        follower.moveStraight(2);
        follower.setDirectionFix(false);
    });

    Again, this is untested code.
  4. So... Here's what you can do, or hack... Hehe...
    1642537998664.png
    If you do this, you'd create a global variable called gameEvent, would probably be good to use another variable name for that to avoid any conflict. I've tried it and I did not run into any issues, granted I tried it for five minutes :p

    And after you're done, the follower will return to you as soon as you move :p