Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "sys_chargen_h"
- #include "nrt_2da_constants_h"
- #include "wrappers_h"
- #include "plt_gen00pt_backgrounds"
- #include "plt_newraces"
- void nrt_Chargen_SelectRace(object oChar,int nRace, int bUndo = FALSE)
- {
- Log_Chargen("Chargen_SelectRace","-- " + (bUndo?"Un":"") +"Selecting Race: " + ToString(nRace),oChar);
- if (!bUndo && nRace != GetCreatureRacialType(oChar))
- {
- // -------------------------------------------------------------------------
- // 1. SetAppearance
- // - Retrieve the appearance for the race from races.xls
- // - Set Appearance
- // - Set Racial Type
- // -------------------------------------------------------------------------
- if (nRace == RACE_HUMAN || nRace == RACE_DWARF || nRace == RACE_ELF || nRace == RACE_HURLOCK)
- {
- int nApp = GetM2DAInt(TABLE_RULES_RACES, "Appearance", nRace);
- if (GetCreatureRacialType(oChar) != nRace)
- {
- SetAppearanceType(oChar,nApp, TRUE);
- SetCreatureRacialType(oChar,nRace);
- }
- }
- }
- // Humanoids gain the 'humanoid' trait (prereq for skills)
- if (bUndo)
- {
- RemoveAbility(oChar,ABILITY_TALENT_TRAIT_HUMANOID);
- }
- else if (IsHumanoid(oChar))
- {
- AddAbility(oChar,ABILITY_TALENT_TRAIT_HUMANOID,FALSE);
- }
- // -------------------------------------------------------------------------
- // Dwaves gain dwarven resistance free.
- // -------------------------------------------------------------------------
- if (nRace == RACE_DWARF)
- {
- if (!bUndo)
- {
- AddAbility(oChar, ABILITY_SKILL_DWARVEN_RESISTANCE, FALSE);
- }
- else
- {
- RemoveAbility(oChar, ABILITY_SKILL_DWARVEN_RESISTANCE);
- }
- }
- Chargen_ApplyRaceModifiers(oChar, bUndo);
- }
- void nrt_Chargen_SelectBackground(object oChar, int nBackground, int bUnApply = FALSE)
- {
- Log_Chargen("nrt_Chargen_SelectBackground","-- " + (bUnApply?"Un":"") +"Selecting BG: " + ToString(nBackground),oChar);
- // -------------------------------------------------------------------------
- // 1. Set the background variable
- // - Create creature property (or check what we used so far
- // - We don't set backgrounds on non player generated chars.
- // -------------------------------------------------------------------------
- if (bUnApply)
- {
- SetCreatureProperty(oChar, PROPERTY_SIMPLE_BACKGROUND, 0.0, PROPERTY_VALUE_BASE);
- }
- else
- {
- SetCreatureProperty(oChar, PROPERTY_SIMPLE_BACKGROUND, IntToFloat(nBackground), PROPERTY_VALUE_BASE);
- }
- // -------------------------------------------------------------------------
- // 2. Give one skill
- // - retrieve the skill that is granted by the background from backgrounds.xls
- // - give it to the player.
- // -------------------------------------------------------------------------
- int nAbility = ChargenGetBackgroundSkill(GetCreatureRacialType(oChar), nBackground);
- if (nAbility)
- {
- _AddAbility (oChar, nAbility, bUnApply);
- }
- }
- void nrt_Chargen_SetupPlotFlags(object oChar)
- {
- int nRace = GetCreatureRacialType(oChar);
- int nBackground = GetPlayerBackground(oChar);
- Log_Trace(LOG_CHANNEL_CHARACTER,"nrt_sys_chargen_h","Setting plot flags, race: "
- + IntToString(nRace) + ", background: " + IntToString(nBackground));
- // First, init all flags (debug setup)
- WR_SetPlotFlag(PLT_GEN00PT_BACKGROUNDS, GEN_BACK_HUMAN_COMMONER,FALSE);
- WR_SetPlotFlag(PLT_GEN00PT_BACKGROUNDS, GEN_BACK_HUMAN_NOBLE,FALSE);
- WR_SetPlotFlag(PLT_GEN00PT_BACKGROUNDS, GEN_BACK_CIRCLE,FALSE);
- WR_SetPlotFlag(PLT_GEN00PT_BACKGROUNDS, GEN_BACK_DWARF_COMMONER,FALSE);
- WR_SetPlotFlag(PLT_GEN00PT_BACKGROUNDS, GEN_BACK_DWARF_NOBLE,FALSE);
- WR_SetPlotFlag(PLT_GEN00PT_BACKGROUNDS, GEN_BACK_ELF_CITY,FALSE);
- WR_SetPlotFlag(PLT_GEN00PT_BACKGROUNDS, GEN_BACK_ELF_DALISH,FALSE);
- WR_SetPlotFlag(PLT_GEN00PT_BACKGROUNDS, GEN_BACK_CIRCLE,FALSE);
- WR_SetPlotFlag(PLT_NEWRACES, RPT_GEN_BACK_DARKSPAWN,FALSE);
- switch (nRace)
- {
- case RACE_HUMAN:
- {
- switch(nBackground)
- {
- case BACKGROUND_COMMONER: WR_SetPlotFlag(PLT_GEN00PT_BACKGROUNDS, GEN_BACK_HUMAN_COMMONER,TRUE); break;
- case BACKGROUND_NOBLE: WR_SetPlotFlag(PLT_GEN00PT_BACKGROUNDS, GEN_BACK_HUMAN_NOBLE,TRUE); break;
- case BACKGROUND_MAGI: WR_SetPlotFlag(PLT_GEN00PT_BACKGROUNDS, GEN_BACK_CIRCLE,TRUE); break;
- }
- break;
- }
- case RACE_DWARF:
- {
- switch(nBackground)
- {
- case BACKGROUND_COMMONER: WR_SetPlotFlag(PLT_GEN00PT_BACKGROUNDS, GEN_BACK_DWARF_COMMONER,TRUE); break;
- case BACKGROUND_NOBLE: WR_SetPlotFlag(PLT_GEN00PT_BACKGROUNDS, GEN_BACK_DWARF_NOBLE,TRUE); break;
- }
- break;
- }
- case RACE_ELF:
- {
- switch(nBackground)
- {
- case BACKGROUND_CITY: WR_SetPlotFlag(PLT_GEN00PT_BACKGROUNDS, GEN_BACK_ELF_CITY,TRUE); break;
- case BACKGROUND_DALISH: WR_SetPlotFlag(PLT_GEN00PT_BACKGROUNDS, GEN_BACK_ELF_DALISH,TRUE); break;
- case BACKGROUND_MAGI: WR_SetPlotFlag(PLT_GEN00PT_BACKGROUNDS, GEN_BACK_CIRCLE,TRUE); break;
- }
- break;
- }
- case RACE_HURLOCK:
- {
- switch(nBackground)
- {
- case BACKGROUND_DARKSPAWN: WR_SetPlotFlag(PLT_NEWRACES, RPT_GEN_BACK_DARKSPAWN,TRUE); break;
- }
- break;
- }
- }
- }
Add Comment
Please, Sign In to add comment