changing dialogue based on the party leader

so ive already tried making a variable for it. i made a variable that checks for the actor id of the party leader, and im pretty sure it used to work, but it no longer works and will display the same piece of text no matter who the party leader is. is there another method i could use or a way to fix this? 😅
I don't know what you tried, but a simple approach is to:
  1. Store the ID of the leader in a variable:
    • Control Variables -> Game Data -> Party -> Member #1.
  2. Then do different things depending on the value of that variable:
    • Conditional Branch -> Variable
E.g.

◆Control Variables:#0001 Check = Actor ID of the party member #1 ◆If:Check = 1 ◆Text:None, Window, Bottom : :\N[1], you're just in time! ◆ :Else ◆Text:None, Window, Bottom : :I'm waiting for \N[1]. ◆ :End
You should be able to do something like
If: Script: $gameParty.leader() ==1
Do stuff

No need to store the leader id in a variable
You should be able to do something like
If: Script: $gameParty.leader() ==1
You could use one of these in Conditional Branch -> Script:
  1. var a = $gameParty.leader(); a && a.actorId() === 1 - check actor ID.
  2. $gameParty.leader() === $gameActors.actor(1) - check Game_Actor instance.
Without context I would still recommend the approach I described, because it:
  • Reduces the risk of getting things wrong (as here),
  • Provides a persistent value for later reference (e.g. multi-case checks), and
  • Avoids an unnecessary eval.
Yes, changing a variable queues a map refresh for this frame. If that's a big deal, you might want to review how you've designed your events.
thank you! this fixed the problem 😂

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/changing-dialogue-based-on-the-party-leader.166402/