Continuity of Party Members

Discuss IB/IBx engine ideas, bugs, etc.
Post Reply
cartons
Posts: 68
Joined: Mon Jan 11, 2021 5:38 pm

Continuity of Party Members

Post by cartons »

Part of my game concept right now is having recruitable party members that can be sent back to a hub but who can rejoin later.

Doing some testing, it looks like when I remove a party member, and then add them again, they don't retain the changes applied to the them while they were in the party (xp, levels gained, equipment, etc). Is there anyway to ensure the character data is saved, so there is a continuity to their development, regardless of whether they leave or stay in the party, or will they always be reset when they leave?
User avatar
slowdive
Site Admin
Posts: 485
Joined: Wed Jan 15, 2020 4:37 am

Re: Continuity of Party Members

Post by slowdive »

There is a Party Roster that holds PCs not currently in the party and they are saved in the save games. So move a PC to the roster and they are out of the party, but everything is kept for when you bring them back.

Code: Select all

                    else if (filename.Equals("gaMovePartyMemberToRoster.cs"))
                    {
                        MoveCharacterToRoster(prm1, p2);
                    }
                    else if (filename.Equals("gaMoveRosterMemberToParty.cs"))
                    {
                        MoveCharacterToPartyFromRoster(prm1, p2);
                    }

Code: Select all

public void MoveCharacterToRoster(string PCtag, string index)
        {
            try
            {
                Player pc = gv.mod.playerList[0];
                if ((PCtag != null) && (!PCtag.Equals("")))
                {
                    pc = gv.mod.getPlayerByNameOrTag(PCtag);
                    if (pc == null)
                    {
                        if (mod.debugMode) //SD_20131102
                        {
                            gv.cc.addLogText("<font color='yellow'>Could not find PC: " + PCtag + ", aborting</font><BR>");
                        }
                        return;
                    }
                }
                else if ((index != null) && (!index.Equals("")))
                {
                    int parm2 = Convert.ToInt32(index);
                    if ((parm2 >= 0) && (parm2 < gv.mod.playerList.Count))
                    {
                        pc = gv.mod.playerList[parm2];
                    }
                    else
                    {
                        if (mod.debugMode) //SD_20131102
                        {
                            gv.cc.addLogText("<font color='yellow'>index outside range of playerList size, aborting</font><BR>");
                        }
                        return;
                    }
                }
                //remove selected from partyList and add to pcList
                if (mod.playerList.Count > 0)
                {
                    Player copyPC = pc.DeepCopy();
                    //copyPC.token = gv.cc.LoadBitmap(copyPC.tokenFilename);
                    copyPC.playerClass = gv.cc.getPlayerClass(copyPC.classTag);
                    copyPC.race = gv.cc.getRace(copyPC.raceTag);
                    mod.partyRosterList.Add(copyPC);
                    mod.playerList.Remove(pc);
                }
                mod.selectedPartyLeader = 0;
                gv.cc.partyScreenPcIndex = 0;
            }
            catch (Exception ex)
            {
                if (mod.debugMode) //SD_20131102
                {
                    gv.cc.addLogText("<font color='yellow'>" + "failed to remove character from party" + "</font><BR>");
                }
                gv.errorLog(ex.ToString());
            }
        }
        public void MoveCharacterToPartyFromRoster(string PCtag, string index)
        {
            try
            {
                if (gv.mod.partyRosterList.Count < 1)
                {
                    if (mod.debugMode) //SD_20131102
                    {
                        gv.cc.addLogText("<font color='yellow'>Party Roster is empty, aborting</font><BR>");
                    }
                    return;
                }

                Player pc = null;
                if ((PCtag != null) && (!PCtag.Equals("")))
                {
                    foreach (Player plr in gv.mod.partyRosterList)
                    {
                        if (plr.name.Equals(PCtag))
                        {
                            pc = plr;
                        }
                    }
                    if (pc == null)
                    {
                        if (mod.debugMode) //SD_20131102
                        {
                            gv.cc.addLogText("<font color='yellow'>Could not find PC: " + PCtag + ", aborting</font><BR>");
                        }
                        return;
                    }
                }
                else if ((index != null) && (!index.Equals("")))
                {
                    int parm2 = Convert.ToInt32(index);
                    if ((parm2 >= 0) && (parm2 < gv.mod.partyRosterList.Count))
                    {
                        pc = gv.mod.partyRosterList[parm2];
                    }
                    else
                    {
                        if (mod.debugMode) //SD_20131102
                        {
                            gv.cc.addLogText("<font color='yellow'>index outside range of playerList size, aborting</font><BR>");
                        }
                        return;
                    }
                }
                if ((mod.partyRosterList.Count > 0) && (mod.playerList.Count < mod.MaxPartySize))
                {
                    Player copyPC = pc.DeepCopy();
                    //copyPC.token = gv.cc.LoadBitmap(copyPC.tokenFilename);
                    copyPC.playerClass = gv.cc.getPlayerClass(copyPC.classTag);
                    copyPC.race = gv.cc.getRace(copyPC.raceTag);
                    mod.playerList.Add(copyPC);
                    mod.partyRosterList.Remove(pc);
                }
                mod.selectedPartyLeader = 0;
                gv.cc.partyScreenPcIndex = 0;
            }
            catch (Exception ex)
            {
                if (mod.debugMode) //SD_20131102
                {
                    gv.cc.addLogText("<font color='yellow'>" + "failed to remove character from party" + "</font><BR>");
                }
                gv.errorLog(ex.ToString());
            }
        }
There was also this from Karl's notes on the old forums:
"1. Roster: Besides gaMovePartyMemberToRoster.cs and gaMoveRosterMemberToParty.cs the roster functionality would benefit greatly from a bool property in the module properties: alwaysAccessibleRoster true/false. When set to true, it would look like it does right now, i.e. roster can always be accessed from party screen. When set to off, that roster button would miss in the party screen. Instead, the roster menu would be opened via the new script openRosterScreen.cs. This would allow selective roster screen calling, like only in a special inn, hideaway or party castle."

https://www.iceblinkengine.com/forums/v ... ster#p5271
cartons
Posts: 68
Joined: Mon Jan 11, 2021 5:38 pm

Re: Continuity of Party Members

Post by cartons »

Ah, thank you. Working with Rosters has solved this entirely.
Post Reply