ff_c_act_store

Open a store.

Scripts

TextAppearsWhen: ff_c_act_store

Variables

STORE: (string) Name of the store.

Source code

// @code
#include "ff_i_core"


void main()
{
  object oPC = GetPCSpeaker();

  string sStore = GetScriptParam("STORE");
  object oStore = GetObjectByTag(sStore);

  if (GetObjectType(oStore) != OBJECT_TYPE_STORE)
  {
    string sLog = "could not find store " + (sStore != "" ? ("'" + sStore + "'") : "<unnamed>");
    LogError(sLog + " from " + GetObjectInfo(OBJECT_SELF));
    return;
  }

  // Appraise check vs charisma
  int nMarkUp = NWNX_Store_GetMarkUp(oStore);
  int nCha = GetAbilityModifier(ABILITY_CHARISMA, oPC);
  nCha = min(nCha, 3);
  nCha = max(nCha, -3);
  nCha *= -10;
  nMarkUp += nCha;
  LogDebug(GetObjectInfo(oStore) + " opened for " + GetPCInfo(oPC) + " with a price modifier of " + IntToString(nMarkUp));

  OpenStore(oStore, oPC, nCha);
}