Hi, I’m making a private module intended for local multiplayer. The quests I have scripted myself so far aren’t synced between me and the other players in my party.
How should I script my local tags or variables so that they take into account several people playing together?
Thanks in advance for your reply.
i’m not quite sure i understand the question, but [throws caution to the winds] i’ll try a reply anyway.
there are actually lots of viable approaches to variable management in a networked game. here are two of the most common that i know of.
you use the same quest variables as you would in single-player, w/the same approach : you store them on the pc.
advantages : easy to implement.
disadvantages : all players must be logged in at the same time in order to achieve a result that’s 100% coherent [i.e., you can’t tell if a quest has been completed by all pc’s if even one of the players hasn’t logged in yet].
your variables are created from references to the pc’s, but are actually stored on an object that will persist regardless of player state. for example, if you have a variable called
Quest1started, you’d construct a set of variables using it for each pc : prefix1_
Quest1started, etc., where the prefixes are different for each pc. one common way to generate the prefixes is e.g.,
string prefix = GetPCPublicCDKey(pc) + "_" + StringReplace(GetName(pc), " ", "_") + "_";
[technically speaking you don’t need to add the underscores, but it does improve reabality of the variables if you need that.]
you would then store the values on a persistent object in the module.
advantages : an accurate accounting of quest advancement regardless of whether or not all players are logged in.
disadvantages : more cumbersome to program.
depending on your needs, both of these may be viable.
Thank you xorbaxian for taking time to respond and offering a potential solution to my question.
Would these approaches cause every player, including players outside of my small party to also progress the same quest without even starting it?
no. your scripts decide where the variables get set and what they’re called, so it’s up to your scripts to decide who gets the quest and who doesn’t. if you want the quest to be reserved to a specific party, or a specific player [or any given set of conditions, for that matter] you’d write a check for the conditions in your script.