ff_u_pc_race

Remove subrace from PC on first login.

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

Variables

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

Source code

// @code

#include "ff_i_core"

const string ENABLE__FF_U_PC_LVL1_RACE = "ENABLE__FF_U_PC_LVL1_RACE";
const string FF_U_PC_LVL1_RACE = "FF_U_PC_LVL1_RACE";


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

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

  if (NWNX_Object_GetInt(oPC, FF_U_PC_LVL1_RACE))
    return;
  NWNX_Object_SetInt(oPC, FF_U_PC_LVL1_RACE, 1, TRUE);

  LogDebug(__FILE__ + ": " + GetPCInfo(oPC) + " race set to blank");
  SetSubRace(oPC, "");
}


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

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

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