ff_u_pc_deity

Remove deity from PC on first login.

If deities are handled via another system, or not used at all, then it may be useful to remove chargen deity in PC character sheet.

Variables

ENABLE__FF_U_PC_LVL1_DEITY: (string) (opt-in) Set to “Y” on module to enable.

Source code

// @code

#include "ff_i_core"

const string ENABLE__FF_U_PC_LVL1_DEITY = "ENABLE__FF_U_PC_LVL1_DEITY";
const string FF_U_PC_LVL1_DEITY = "FF_U_PC_LVL1_DEITY";

// -----------------------------------------------------------------------------

void OnClientEnter()
{
  object oPC = GetEnteringObject();
  if (!GetIsPC(oPC))
    return;

  if (NWNX_Object_GetInt(oPC, GetCacheVar(FF_U_PC_LVL1_DEITY)))
    return;
  NWNX_Object_SetInt(oPC, GetCacheVar(FF_U_PC_LVL1_DEITY), 1, TRUE);

  LogDebug(__FILE__ + ": " + GetPCInfo(oPC) + " deity set to blank");
  SetDeity(oPC, "");
}


// -----------------------------------------------------------------------------

void main()
{
  if (!GetModuleFlag(ENABLE__FF_U_PC_LVL1_DEITY, FALSE))
    return;

  string sEvent = GetCurrentEvent();
  if (sEvent == ON_REGISTER)
    SubscribeToEvent(ON_DEFAULT_CLIENT_ENTER, __FILE__);
  else if (sEvent == ON_DEFAULT_CLIENT_ENTER)
    OnClientEnter();
}