ff_u_pc_subrace
Remove the subrace of PCs and DMs on first login.
If subraces are handled via another system, or not used at all, this removes the subrace chosen at character creation, the first time a PC or DM enters the module.
Variables
ENABLE__FF_U_PC_LVL1_RACE: (string) (opt-in) Set to "Y" on module to enable the unit.
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";
// -----------------------------------------------------------------------------
//! @brief Clear the subrace of the entering PC or DM, once.
void OnClientEnter()
{
object oPC = GetEnteringObject();
if (!GetIsPCorDM(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) + " subrace set to blank");
SetSubRace(oPC, "");
}
// -----------------------------------------------------------------------------
void main()
{
if (!GetModuleFlag(ENABLE__FF_U_PC_LVL1_RACE, FALSE))
return;
string sEvent = NWNX_Events_GetCurrentEvent();
if (sEvent == ON_REGISTER)
SubscribeToEvent(ON_DEFAULT_CLIENT_ENTER, __FILE__);
else if (sEvent == ON_DEFAULT_CLIENT_ENTER)
OnClientEnter();
}