SetCampaignInt and GetCampaignInt will store a variable to a database file on the player's local \\Database directory with the desired name you give it.
It's good to clear the database at the start of your first module, in the event the player replays it, so particular quests like these aren't stored from a previous play through.
For checking in the second module from the NPC via a conversation, you'd use something like this -
int StartingConditional()
{
// Inspect local variables
if(!(GetCampaignInt("Database_Name_here", "variable_stored_name_here") == 25))
return FALSE;
return TRUE;
}
So if the variable you've set in your first module, read from the database file it created, is equal to 25 - meaning they took the quest and advanced it - the NPC in the second module will know this and can react accordingly.
In your first module, you'll want to store the variable at the last stage of the uncompleted quest to the database file at the very end of the module (* see below for an explination as to why*) -
SetCampaignInt("Database_Name_here", "variable_stored_name_here", 25);
That's pretty much it.
A word of note as well. Only save the variable to the database at the very end of your module. If you store the variable to the database when the quest has reached its end in the first module before the player is finished the module, and they suddenly decide to reload a saved game for whatever reason, and then not bother with said quest, the variable in the database will be stored as if they HAD completed the quest and HAD NOT reloaded.
I suggest storing and checking a local variable set on the PC or the MODULE for the quest, then at the end of your module, before you load up the second module for the player, it checks the stored variable for a match. If it matches, you save it to the database.
if (GetLocalInt(GetModule(), "quest_variable_here") == 25)
{
SetCampaignInt("Database_Name_here", "variable_stored_name_here", 25);
}
Here's a detailed example.
Our quest takes the player along to a few places, killing and finding a few things. This quest we'll name "wander_q" and will be the variable name used to advance this quest through each stage.
SetLocalInt(GetModule(), "wander_q", 5);
The player has accepted the quest and the variable is updated to 5.
Slashing, dashing, cutting and slicing their way along, the quest in the first module comes to an end, due to the next location the player has to travel being in the second module, and the variable is finally updated to reflect that.
SetLocalInt(GetModule(), "wander_q", 25);
So far, the "wander_q" variable is only being stored to the MODULE.
Another four hours of game time pass and the player completes the first module, arriving or speaking with an NPC. It is here the particular quest variable is checked and stored to the DATABASE.
if (GetLocalInt(GetModule(), "wander_q") == 25)
{
SetCampaignInt("UnrealJ", "wander_q", 25);
}
FP!
Modifié par Fester Pot, 26 juin 2013 - 02:55 .