User:Sunjammer/Placeables with codex entries tutorial (draft)

From Dragon Age Toolset Wiki
Jump to: navigation, search
  • Create new a plot resource (because duplicating a plot duplicates the uneditable GUID)
    • Set the plot type to one with a "Codex - " prefix
    • Add a single Main Flag: remember the number (usually 0 as it is the only flag)
  • Create a placeable and place it in an area
  • Open the placeable's variables
  • Set PLC_CODEX_PLOT to the name of the plot resource
  • Set PLC_CODEX_FLAG to the number of the plot flag

When the Player examines the placeable it triggers EVENT_TYPE_USE event

The default behaviour (routed through the placeable_core script) is perfectly adequate.

When the Player clicks on the placeable the following script runs:

void Placeable_ShowCodexEntry(object oPlc)
{
    string sCodexPlot = GetLocalString(oPlc, PLC_CODEX_PLOT);
    int nCodexFlag    = GetLocalInt(oPlc, PLC_CODEX_FLAG);
 
    if (sCodexPlot != "" && nCodexFlag >= 0)
    {
        string sSummary = GetPlotSummary(sCodexPlot, nCodexFlag);
 
        // :
 
        if (!WR_GetPlotFlag(sCodexPlot, nCodexFlag))
        {
            WR_SetPlotFlag(sCodexPlot, nCodexFlag, TRUE, TRUE);
            RewardXPParty(XP_CODEX, XP_TYPE_CODEX, OBJECT_INVALID, GetHero());
        }
        UI_DisplayCodexMessage(oPlc, sSummary);
        SetObjectInteractive(oPlc, FALSE);
    }
}