void NWNXFuncs_SetBonusAC(object oCreature, int iValue, int iACType = AC_ARMOUR_ENCHANTMENT_BONUS) {
SetLocalString(oCreature, "NWNX!FUNCS!SETBONUSAC", IntToString(iValue)+" "+IntToString(iACType));
DeleteLocalString(oCreature, "NWNX!FUNCS!SETBONUSAC");
}
int NWNXFuncs_GetBonusAC(object oCreature, int iACType = AC_ARMOUR_ENCHANTMENT_BONUS) {
SetLocalString(oCreature, "NWNX!FUNCS!GETBONUSAC", IntToString(iACType));
int iRet = StringToInt(GetLocalString(oCreature, "NWNX!FUNCS!GETBONUSAC"));
DeleteLocalString(oCreature, "NWNX!FUNCS!GETBONUSAC");
return iRet;
}
void NWNXFuncs_SetPenaltyAC(object oCreature, int iValue, int iACType = AC_ARMOUR_ENCHANTMENT_BONUS) {
SetLocalString(oCreature, "NWNX!FUNCS!SETPENALTYAC", IntToString(iValue)+" "+IntToString(iACType));
DeleteLocalString(oCreature, "NWNX!FUNCS!SETPENALTYAC");
}
int NWNXFuncs_GetPenaltyAC(object oCreature, int iACType = AC_ARMOUR_ENCHANTMENT_BONUS) {
SetLocalString(oCreature, "NWNX!FUNCS!GETPENALTYAC", IntToString(iACType));
int iRet = StringToInt(GetLocalString(oCreature, "NWNX!FUNCS!GETPENALTYAC"));
DeleteLocalString(oCreature, "NWNX!FUNCS!GETPENALTYAC");
return iRet;
}
void NWNXFuncs_SetSavedSkillPoints(object oPC, int iSkillPoints, int nLevel=0) {
SetLocalString(oPC, "NWNX!FUNCS!SETSAVEDSKILLPOINTS", IntToString(iSkillPoints)+" 0 " +IntToString(nLevel));
DeleteLocalString(oPC, "NWNX!FUNCS!SETSAVEDSKILLPOINTS");
}
int NWNXFuncs_GetSavedSkillPoints(object oPC, int nLevel=0) {
SetLocalString(oPC, "NWNX!FUNCS!GETSAVEDSKILLPOINTS", IntToString(nLevel));
int iRet = StringToInt(GetLocalString(oPC, "NWNX!FUNCS!GETSAVEDSKILLPOINTS"));
DeleteLocalString(oPC, "NWNX!FUNCS!GETSAVEDSKILLPOINTS");
return iRet;
}
void NWNXFuncs_SetArmorCheckPenalty(object oCreature, int iPenalty, int iShield_Armor = AC_ARMOUR_ENCHANTMENT_BONUS) {
SetLocalString(oCreature, "NWNX!FUNCS!SETARMORCHECKPENALTY", IntToString(iPenalty)+" "+IntToString(iShield_Armor));
DeleteLocalString(oCreature, "NWNX!FUNCS!SETARMORCHECKPENALTY");
}
int NWNXFuncs_GetArmorCheckPenalty(object oCreature, int iShield_Armor = AC_ARMOUR_ENCHANTMENT_BONUS) {
SetLocalString(oCreature, "NWNX!FUNCS!GETARMORCHECKPENALTY", IntToString(iShield_Armor));
int iRet = StringToInt(GetLocalString(oCreature, "NWNX!FUNCS!GETARMORCHECKPENALTY"));
DeleteLocalString(oCreature, "NWNX!FUNCS!GETARMORCHECKPENALTY");
return iRet;
}
int NWNXFuncs_GetMovementRate(object oCreature) {
SetLocalString(oCreature, "NWNX!FUNCS!GETMOVEMENTRATE", "-");
int iRet = StringToInt(GetLocalString(oCreature, "NWNX!FUNCS!GETMOVEMENTRATE"));
DeleteLocalString(oCreature, "NWNX!FUNCS!GETMOVEMENTRATE");
return iRet;
}
void NWNXFuncs_SetFamiliarType(object oCreature, int iFamiliarType) {
SetLocalString(oCreature, "NWNX!FUNCS!SETFAMILIARTYPE", IntToString(iFamiliarType));
DeleteLocalString(oCreature, "NWNX!FUNCS!SETFAMILIARTYPE");
}
void NWNXFuncs_SetAnimalCompanion(object oCreature, int iAnimalCompanionType) {
SetLocalString(oCreature, "NWNX!FUNCS!SETCOMPANIONTYPE", IntToString(iAnimalCompanionType));
DeleteLocalString(oCreature, "NWNX!FUNCS!SETCOMPANIONTYPE");
}
void NWNXFuncs_SetHitPointsByLevel(object oCreature, int iHP, int iLevel) {
SetLocalString(oCreature, "NWNX!FUNCS!SETHITPOINTSBYLEVEL", IntToString(iHP)+" "+IntToString(iLevel)+" 0");
DeleteLocalString(oCreature, "NWNX!FUNCS!SETHITPOINTSBYLEVEL");
}
void NWNXFuncs_ModHitPointsByLevel(object oCreature, int iHPMod, int iLevel) {
SetLocalString(oCreature, "NWNX!FUNCS!SETHITPOINTSBYLEVEL", IntToString(iHPMod)+" "+IntToString(iLevel)+" 1");
DeleteLocalString(oCreature, "NWNX!FUNCS!SETHITPOINTSBYLEVEL");
}
void NWNXFuncs_SetCurrentHitPoints(object oCreature, int iHP) {
SetLocalString(oCreature, "NWNX!FUNCS!SETCURRENTHITPOINTS", IntToString(iHP));
DeleteLocalString(oCreature, "NWNX!FUNCS!SETCURRENTHITPOINTS");
}
void NWNXFuncs_SetMaxHitPoints(object oCreature, int iHP) {
SetLocalString(oCreature, "NWNX!FUNCS!SETMAXHITPOINTS", IntToString(iHP));
DeleteLocalString(oCreature, "NWNX!FUNCS!SETMAXHITPOINTS");
}
void NWNXFuncs_SetSavingThrowBonus(object oCreature, int iSavingThrow, int iValue) {
SetLocalString(oCreature, "NWNX!FUNCS!SETSAVINGTHROWBONUS", IntToString(iSavingThrow)+" "+IntToString(iValue)+" 0");
DeleteLocalString(oCreature, "NWNX!FUNCS!SETSAVINGTHROWBONUS");
}
void NWNXFuncs_ModSavingThrowBonus(object oCreature, int iSavingThrow, int iValue) {
SetLocalString(oCreature, "NWNX!FUNCS!SETSAVINGTHROWBONUS", IntToString(iSavingThrow)+" "+IntToString(iValue)+" 1");
DeleteLocalString(oCreature, "NWNX!FUNCS!SETSAVINGTHROWBONUS");
}
void NWNXFuncs_SetSkill(object oCreature, int iSkill, int iValue) {
SetLocalString(oCreature, "NWNX!FUNCS!SETSKILL", IntToString(iSkill)+" "+IntToString(iValue)+" 0");
DeleteLocalString(oCreature, "NWNX!FUNCS!SETSKILL");
}
void NWNXFuncs_ModSkill(object oCreature, int iSkill, int iValue) {
SetLocalString(oCreature, "NWNX!FUNCS!SETSKILL", IntToString(iSkill)+" "+IntToString(iValue)+" 1");
DeleteLocalString(oCreature, "NWNX!FUNCS!SETSKILL");
}
void NWNXFuncs_SetSkillByLevel(object oCreature, int iSkill, int iValue, int iLevel) {
SetLocalString(oCreature, "NWNX!FUNCS!SETSKILLBYLEVEL", IntToString(iSkill)+" "+IntToString(iValue)+" "+IntToString(iLevel)+" 0");
DeleteLocalString(oCreature, "NWNX!FUNCS!SETSKILLBYLEVEL");
}
void NWNXFuncs_ModSkillByLevel(object oCreature, int iSkill, int iValue, int iLevel) {
SetLocalString(oCreature, "NWNX!FUNCS!SETSKILLBYLEVEL", IntToString(iSkill)+" "+IntToString(iValue)+" "+IntToString(iLevel)+" 1");
DeleteLocalString(oCreature, "NWNX!FUNCS!SETSKILLBYLEVEL");
}
int NWNXFuncs_GetAreaCount() {
object oObject = GetModule();
SetLocalString(oObject, "NWNX!FUNCS!GETAREACOUNT", "-");
int iRet = StringToInt(GetLocalString(oObject, "NWNX!FUNCS!GETAREACOUNT"));
DeleteLocalString(oObject, "NWNX!FUNCS!GETAREACOUNT");
return iRet;
}
int NWNXFuncs_GetLocalVariableCount(object oObject) {
SetLocalString(oObject, "NWNX!FUNCS!GETLOCALVARIABLECOUNT", "-");
int iRet = StringToInt(GetLocalString(oObject, "NWNX!FUNCS!GETLOCALVARIABLECOUNT"));
DeleteLocalString(oObject, "NWNX!FUNCS!GETLOCALVARIABLECOUNT");
return iRet;
}
int NWNXFuncs_GetHasLocalVariable(object oObject, string sVarName, int iVarType = 0) {
SetLocalString(oObject, "NWNX!FUNCS!GETHASLOCALVARIABLE", sVarName+ " " +IntToString(iVarType));
int iRet = StringToInt(GetLocalString(oObject, "NWNX!FUNCS!GETHASLOCALVARIABLE"));
DeleteLocalString(oObject, "NWNX!FUNCS!GETHASLOCALVARIABLE");
return iRet;
}
void NWNXFuncs_SetCreatureSize(object oCreature, int iSize = CREATURE_SIZE_MEDIUM) {
SetLocalString(oCreature, "NWNX!FUNCS!SETCREATURESIZE", IntToString(iSize));
DeleteLocalString(oCreature, "NWNX!FUNCS!SETCREATURESIZE");
}
int NWNXFuncs_GetEquippedWeight(object oCreature) {
SetLocalString(oCreature, "NWNX!FUNCS!GETEQUIPPEDWEIGHT", "-");
int iRet = StringToInt(GetLocalString(oCreature, "NWNX!FUNCS!GETEQUIPPEDWEIGHT"));
DeleteLocalString(oCreature, "NWNX!FUNCS!GETEQUIPPEDWEIGHT");
return iRet;
}
void NWNXFuncs_ModSavedSkillPoints(object oPC, int iSkillPoints, int nLevel=0) {
SetLocalString(oPC, "NWNX!FUNCS!SETSAVEDSKILLPOINTS", IntToString(iSkillPoints)+" 1 "+IntToString(nLevel));
DeleteLocalString(oPC, "NWNX!FUNCS!SETSAVEDSKILLPOINTS");
}
int NWNXFuncs_RemoveFeat(object oCreature, int iFeat, int bRemoveFromLevel=TRUE) {
SetLocalString(oCreature, "NWNX!FUNCS!REMOVEFEAT", IntToString(iFeat)+" "+IntToString(bRemoveFromLevel));
int iRet = StringToInt(GetLocalString(oCreature, "NWNX!FUNCS!REMOVEFEAT"));
DeleteLocalString(oCreature, "NWNX!FUNCS!REMOVEFEAT");
return iRet;
}
int NWNXFuncs_GetFeatKnown(object oCreature, int iFeat) {
SetLocalString(oCreature, "NWNX!FUNCS!GETFEATKNOWN", IntToString(iFeat));
int iRet = StringToInt(GetLocalString(oCreature, "NWNX!FUNCS!GETFEATKNOWN"));
DeleteLocalString(oCreature, "NWNX!FUNCS!GETFEATKNOWN");
return iRet;
}
string NWNXFuncs_GetAllKnownFeats(object oCreature, string sDelimiter=",") {
// reserve enough space for the return string
// spacer = 256 bytes
string sSpacer;
int iCount = NWNXFuncs_GetFeatCount(oCreature);
iCount = (iCount*5+(iCount-1)*GetStringLength(sDelimiter))+1;
iCount = iCount / 256 +1;
for (iCount; iCount>0; iCount--) {
sSpacer += " ";
}
SetLocalString(oCreature, "NWNX!FUNCS!GETALLKNOWNFEATS", sDelimiter+GetStringLeft(sSpacer, GetStringLength(sSpacer)-GetStringLength(sDelimiter)));
string sRet = GetLocalString(oCreature, "NWNX!FUNCS!GETALLKNOWNFEATS");
DeleteLocalString(oCreature, "NWNX!FUNCS!GETALLKNOWNFEATS");
return sRet;
}
void NWNXFuncs_RemoveAllFeats(object oCreature, int bClearLevelFeatLists=1) {
SetLocalString(oCreature, "NWNX!FUNCS!CLEARFEATLIST", IntToString(bClearLevelFeatLists));
DeleteLocalString(oCreature, "NWNX!FUNCS!CLEARFEATLIST");
}
void NWNXFuncs_SetAllSkillsToZero(object oCreature) {
SetLocalString(oCreature, "NWNX!FUNCS!ZEROALLSKILLS", "-");
DeleteLocalString(oCreature, "NWNX!FUNCS!ZEROALLSKILLS");
}
void NWNXFuncs_AddKnownSpell(object oCreature, int iClass, int iSpellLevel, int iSpell, int iCharacterLevel=0) {
SetLocalString(oCreature, "NWNX!FUNCS!ADDKNOWNSPELL", IntToString(iClass)+" "+IntToString(iSpellLevel)+" "+IntToString(iSpell)+" "+IntToString(iCharacterLevel));
DeleteLocalString(oCreature, "NWNX!FUNCS!ADDKNOWNSPELL");
}
void NWNXFuncs_RemoveKnownSpell(object oCreature, int iClass, int iSpell, int bRemoveFromLevel=TRUE) {
SetLocalString(oCreature, "NWNX!FUNCS!REMOVEKNOWNSPELL", IntToString(iClass)+" "+IntToString(iSpell)+" "+IntToString(bRemoveFromLevel));
DeleteLocalString(oCreature, "NWNX!FUNCS!REMOVEKNOWNSPELL");
}
//fix by Flutterby
void NWNXFuncs_RemoveAllSpells(object oCreature, int iClass, int iMinLevel = 0, int iMaxLevel = 9, int bFreeMemory=FALSE) {
SetLocalString(oCreature, "NWNX!FUNCS!REMOVEALLSPELLS", IntToString(iClass)+" "+IntToString(iMinLevel)+" "+IntToString(iMaxLevel)+" "+IntToString(bFreeMemory));
DeleteLocalString(oCreature, "NWNX!FUNCS!REMOVEALLSPELLS");
}
int NWNXFuncs_GetKnowsSpell(object oCreature, int iClass, int iSpell, int iSpellLevel=-1) {
SetLocalString(oCreature, "NWNX!FUNCS!GETKNOWSSPELL", IntToString(iClass)+" "+IntToString(iSpell)+" "+IntToString(iSpellLevel));
int iRet = StringToInt(GetLocalString(oCreature, "NWNX!FUNCS!GETKNOWSSPELL"));
DeleteLocalString(oCreature, "NWNX!FUNCS!GETKNOWSSPELL");
return iRet;
}
void NWNXFuncs_SetItemWeight(object oItem, int iWeight) {
SetLocalString(oItem, "NWNX!FUNCS!SETITEMWEIGHT", IntToString(iWeight));
DeleteLocalString(oItem, "NWNX!FUNCS!SETITEMWEIGHT");
}
void NWNXFuncs_SetItemValue(object oItem, int iValue, int iType = ITEM_VALUE_IDENTIFIED, int bZeroAdditionalCost = TRUE) {
SetLocalString(oItem, "NWNX!FUNCS!SETITEMVALUE", IntToString(iValue)+" "+IntToString(iType)+" "+IntToString(bZeroAdditionalCost));
DeleteLocalString(oItem, "NWNX!FUNCS!SETITEMVALUE");
}
int NWNXFuncs_GetItemValue(object oItem, int iType = ITEM_VALUE_ADDITIONAL) {
SetLocalString(oItem, "NWNX!FUNCS!GETITEMVALUE", IntToString(iType));
int iRet = StringToInt(GetLocalString(oItem, "NWNX!FUNCS!GETITEMVALUE"));
DeleteLocalString(oItem, "NWNX!FUNCS!GETITEMVALUE");
return iRet;
}
void NWNXFuncs_SetItemCharges(object oItem, int iCharges) {
SetLocalString(oItem, "NWNX!FUNCS!SETITEMCHARGES", IntToString(iCharges));
DeleteLocalString(oItem, "NWNX!FUNCS!SETITEMCHARGES");
}
void NWNXFuncs_SetDomain(object oCreature, int iDomain_1_2, int iDomain) {
SetLocalString(oCreature, "NWNX!FUNCS!SETDOMAIN", IntToString(iDomain_1_2)+" "+IntToString(iDomain));
DeleteLocalString(oCreature, "NWNX!FUNCS!SETDOMAIN");
}
int NWNXFuncs_GetDomain(object oCreature, int iDomain_1_2) {
SetLocalString(oCreature, "NWNX!FUNCS!GETDOMAIN", IntToString(iDomain_1_2));
int iRet = StringToInt(GetLocalString(oCreature, "NWNX!FUNCS!GETDOMAIN"));
DeleteLocalString(oCreature, "NWNX!FUNCS!GETDOMAIN");
return iRet;
}
void NWNXFuncs_SetWizardSpecialization(object oCreature, int iSpecialization) {
SetLocalString(oCreature, "NWNX!FUNCS!SETWIZARDSPECIALIZATION", IntToString(iSpecialization));
DeleteLocalString(oCreature, "NWNX!FUNCS!SETWIZARDSPECIALIZATION");
}
int NWNXFuncs_GetWizardSpecialization(object oCreature) {
SetLocalString(oCreature, "NWNX!FUNCS!GETWIZARDSPECIALIZATION", "-");
int iRet = StringToInt(GetLocalString(oCreature, "NWNX!FUNCS!GETWIZARDSPECIALIZATION"));
DeleteLocalString(oCreature, "NWNX!FUNCS!GETWIZARDSPECIALIZATION");
return iRet;
}
void NWNXFuncs_ReplaceKnownSpell(object oCreature, int iClass, int iOldSpell, int iNewSpell) {
SetLocalString(oCreature, "NWNX!FUNCS!REPLACEKNOWNSPELL", IntToString(iClass)+" "+IntToString(iOldSpell)+" "+IntToString(iNewSpell));
DeleteLocalString(oCreature, "NWNX!FUNCS!REPLACEKNOWNSPELL");
}
int NWNXFuncs_GetRemainingSpellSlots(object oCreature, int iClass, int iSpellLevel) {
SetLocalString(oCreature, "NWNX!FUNCS!GETREMAININGSPELLSLOTS", IntToString(iClass)+" "+IntToString(iSpellLevel));
int iRet = StringToInt(GetLocalString(oCreature, "NWNX!FUNCS!GETREMAININGSPELLSLOTS"));
DeleteLocalString(oCreature, "NWNX!FUNCS!GETREMAININGSPELLSLOTS");
return iRet;
}
void NWNXFuncs_SetRemainingSpellSlots(object oCreature, int iClass, int iSpellLevel, int nSlots) {
SetLocalString(oCreature, "NWNX!FUNCS!SETREMAININGSPELLSLOTS", IntToString(iClass)+" "+IntToString(iSpellLevel)+" "+IntToString(nSlots));
DeleteLocalString(oCreature, "NWNX!FUNCS!SETREMAININGSPELLSLOTS");
}
int NWNXFuncs_GetMaxSpellSlots(object oCreature, int iClass, int iSpellLevel) {
SetLocalString(oCreature, "NWNX!FUNCS!GETMAXSPELLSLOTS", IntToString(iClass)+" "+IntToString(iSpellLevel));
int iRet = StringToInt(GetLocalString(oCreature, "NWNX!FUNCS!GETMAXSPELLSLOTS"));
DeleteLocalString(oCreature, "NWNX!FUNCS!GETMAXSPELLSLOTS");
return iRet;
}
int NWNXFuncs_GetBonusSpellSlots(object oCreature, int iClass, int iSpellLevel) {
SetLocalString(oCreature, "NWNX!FUNCS!GETBONUSSPELLSLOTS", IntToString(iClass)+" "+IntToString(iSpellLevel));
int iRet = StringToInt(GetLocalString(oCreature, "NWNX!FUNCS!GETBONUSSPELLSLOTS"));
DeleteLocalString(oCreature, "NWNX!FUNCS!GETBONUSSPELLSLOTS");
return iRet;
}
struct MemorizedSpellSlot NWNXFuncs_GetMemorizedSpellSlot(object oCreature, int iClass, int iSpellLevel, int iIndex) {
SetLocalString(oCreature, "NWNX!FUNCS!GETMEMORIZEDSPELLSLOT", IntToString(iClass)+" "+IntToString(iSpellLevel)+" "+IntToString(iIndex));
int nSpell = StringToInt(GetLocalString(oCreature, "NWNX!FUNCS!GETMEMORIZEDSPELLSLOT"));
DeleteLocalString(oCreature, "NWNX!FUNCS!GETMEMORIZEDSPELLSLOT");
struct MemorizedSpellSlot iRet;
if (nSpell >= 0) {
iRet.id = nSpell & 0xFFFF;
iRet.meta = (nSpell >> 16) & 0x7F;
iRet.ready = (nSpell >> 24) & 1;
} else
iRet.id = -1;
return iRet;
}
void NWNXFuncs_SetMemorizedSpellSlot(object oCreature, int iClass, int iSpellLevel, int iIndex, struct MemorizedSpellSlot spell) {
int P4 = (spell.id & 0xFFFF) | ((spell.meta& 0xFF) << 16) | (spell.ready << 24);
SetLocalString(oCreature, "NWNX!FUNCS!SETMEMORIZEDSPELLSLOT", IntToString(iClass)+" "+IntToString(iSpellLevel)+" "+IntToString(iIndex)+" "+IntToString(P4));
DeleteLocalString(oCreature, "NWNX!FUNCS!SETMEMORIZEDSPELLSLOT");
}
void NWNXFuncs_RestoreMemorizedSpells(object oCreature, int iClass, int iFromSpellLevel = 0, int iToSpellLevel = 9) {
SetLocalString(oCreature, "NWNX!FUNCS!RESTOREMEMORIZEDSPELLS", IntToString(iClass)+" "+IntToString(iFromSpellLevel)+" "+IntToString(iToSpellLevel));
DeleteLocalString(oCreature, "NWNX!FUNCS!RESTOREMEMORIZEDSPELLS");
}
int NWNXFuncs_GetFeatCount(object oCreature) {
SetLocalString(oCreature, "NWNX!FUNCS!GETFEATCOUNT", " ");
int iRet = StringToInt(GetLocalString(oCreature, "NWNX!FUNCS!GETFEATCOUNT"));
DeleteLocalString(oCreature, "NWNX!FUNCS!GETFEATCOUNT");
return iRet;
}
string NWNXFuncs_GetKnownSpells(object oCreature, int iClass, int iSpellLevel, string sDelimiter=",") {
if (GetStringLength(sDelimiter) > 9) return "-1";
// reserve enough space for the return string
// spacer = 256 bytes
string sSpacer;
int iCount = NWNXFuncs_GetKnownSpellCount(oCreature, iClass, iSpellLevel);
iCount = (iCount*5+(iCount-1)*GetStringLength(sDelimiter))+1;
iCount = iCount / 256 +1;
for (iCount; iCount>0; iCount--) {
sSpacer += " ";
}
SetLocalString(oCreature, "NWNX!FUNCS!GETKNOWNSPELLS", IntToString(iClass)+" "+IntToString(iSpellLevel)+" "+sDelimiter+" "+sSpacer);
string sRet = GetLocalString(oCreature, "NWNX!FUNCS!GETKNOWNSPELLS");
DeleteLocalString(oCreature, "NWNX!FUNCS!GETKNOWNSPELLS");
return sRet;
}
int NWNXFuncs_GetKnownSpellCount(object oCreature, int iClass, int iSpellLevel) {
SetLocalString(oCreature, "NWNX!FUNCS!GETKNOWNSPELLCOUNT", IntToString(iClass)+ " " +IntToString(iSpellLevel));
int iRet = StringToInt(GetLocalString(oCreature, "NWNX!FUNCS!GETKNOWNSPELLCOUNT"));
DeleteLocalString(oCreature, "NWNX!FUNCS!GETKNOWNSPELLCOUNT");
return iRet;
}
void NWNXFuncs_SetConversation(object oObject, string sConvo) {
SetLocalString(oObject, "NWNX!FUNCS!SETCONVERSATION", sConvo);
DeleteLocalString(oObject, "NWNX!FUNCS!SETCONVERSATION");
}
string NWNXFuncs_GetConversation(object oObject) {
SetLocalString(oObject, "NWNX!FUNCS!GETCONVERSATION", " ");
string sRet = GetLocalString(oObject, "NWNX!FUNCS!GETCONVERSATION");
DeleteLocalString(oObject, "NWNX!FUNCS!GETCONVERSATION");
return sRet;
}
void NWNXFuncs_SetBodyBag(object oObject, int iBodyBag) {
SetLocalString(oObject, "NWNX!FUNCS!SETBODYBAG", IntToString(iBodyBag));
DeleteLocalString(oObject, "NWNX!FUNCS!SETBODYBAG");
}
int NWNXFuncs_GetBodyBag(object oObject) {
SetLocalString(oObject, "NWNX!FUNCS!SETBODYBAG", "-");
int iRet = StringToInt(GetLocalString(oObject, "NWNX!FUNCS!SETBODYBAG"));
DeleteLocalString(oObject, "NWNX!FUNCS!SETBODYBAG");
return iRet;
}
string NWNXFuncs_GetFeatsGainedAtLevel(object oCreature, int iLevel) {
int i=0;
string sSpacer;
for (i; i<4; i++) {
sSpacer += "----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------";
}
SetLocalString(oCreature, "NWNX!FUNCS!GETFEATSGAINEDATLEVEL", IntToString(iLevel)+" "+sSpacer);
string sRet = (GetLocalString(oCreature, "NWNX!FUNCS!GETFEATSGAINEDATLEVEL"));
DeleteLocalString(oCreature, "NWNX!FUNCS!GETFEATSGAINEDATLEVEL");
return sRet;
}
string NWNXFuncs_GetSkillRanksGainedAtLevel(object oCreature, int iLevel) {
string sSpacer = "----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------";
SetLocalString(oCreature, "NWNX!FUNCS!GETSKILLRANKSGAINEDATLEVEL", IntToString(iLevel)+" "+sSpacer);
string sRet = GetLocalString(oCreature, "NWNX!FUNCS!GETSKILLRANKSGAINEDATLEVEL");
DeleteLocalString(oCreature, "NWNX!FUNCS!GETSKILLRANKSGAINEDATLEVEL");
return sRet;
}
string NWNXFuncs_GetSpellsGainedAtLevel(object oCreature, int iSpellLevel, int iLevel) {
string sSpacer = "----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------";
SetLocalString(oCreature, "NWNX!FUNCS!GETSPELLSGAINEDATLEVEL", IntToString(iLevel)+" "+IntToString(iSpellLevel)+" "+sSpacer);
string sRet = GetLocalString(oCreature, "NWNX!FUNCS!GETSPELLSGAINEDATLEVEL");
DeleteLocalString(oCreature, "NWNX!FUNCS!GETSPELLSGAINEDATLEVEL");
return sRet;
}
struct levelstats_s NWNXFuncs_GetStatsGainedAtLevel(object oCreature, int iLevel) {
string sSpacer = "----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------";
SetLocalString(oCreature, "NWNX!FUNCS!GETSTATSGAINEDATLEVEL", IntToString(iLevel)+" "+sSpacer);
string sRet = GetLocalString(oCreature, "NWNX!FUNCS!GETSTATSGAINEDATLEVEL");
DeleteLocalString(oCreature, "NWNX!FUNCS!GETSTATSGAINEDATLEVEL");
struct levelstats_s ls;
int iP, iStart=0;
iP = FindSubString(sRet, "|", iStart); ls.iAbility = StringToInt(GetSubString(sRet, iStart, iP-iStart)); iStart = iP+1;
iP = FindSubString(sRet, "|", iStart); ls.iClass = StringToInt(GetSubString(sRet, iStart, iP-iStart)); iStart = iP+1;
iP = FindSubString(sRet, "|", iStart); ls.iHP = StringToInt(GetSubString(sRet, iStart, iP-iStart)); iStart = iP+1;
iP = FindSubString(sRet, "|", iStart); ls.iSkillPoints = StringToInt(GetSubString(sRet, iStart, iP-iStart));
return ls;
}
struct quickslot_s NWNXFuncs_GetQuickSlot(object oPC, int iSlot) {
SetLocalString(oPC, "NWNX!FUNCS!GETQUICKSLOT", IntToString(iSlot)+" --------------------------------------------------------------------------------------------------------------------------------");
string sRet = GetLocalString(oPC, "NWNX!FUNCS!GETQUICKSLOT");
PrintString(sRet);
DeleteLocalString(oPC, "NWNX!FUNCS!GETQUICKSLOT");
struct quickslot_s qs;
int iP, iStart=0;
iP = FindSubString(sRet, "¬", iStart); iStart = iP+1;
iP = FindSubString(sRet, "¬", iStart); qs.iType = StringToInt(GetSubString(sRet, iStart, iP-iStart)); iStart = iP+1;
iP = FindSubString(sRet, "¬", iStart); qs.iClass = StringToInt(GetSubString(sRet, iStart, iP-iStart)); iStart = iP+1;
iP = FindSubString(sRet, "¬", iStart); qs.iParam1 = StringToInt(GetSubString(sRet, iStart, iP-iStart)); iStart = iP+1;
iP = FindSubString(sRet, "¬", iStart); qs.iMetaMagic = StringToInt(GetSubString(sRet, iStart, iP-iStart)); iStart = iP+1;
iP = FindSubString(sRet, "¬", iStart);
if (iP < 0) return qs;
qs.sS1 = GetSubString(sRet, iStart, iP-iStart) ; iStart = iP+1;
iP = FindSubString(sRet, "¬", iStart); qs.sS2 = GetSubString(sRet, iStart, iP-iStart) ; iStart = iP+1;
return qs;
}
void NWNXFuncs_SetQuickSlot(object oPC, int iSlot, struct quickslot_s slotData, int bUpdateGUI=TRUE) {
string sQuickSlot = IntToString(iSlot)+" "+IntToString(slotData.iType)+" "+IntToString(slotData.iClass) +" "+IntToString(slotData.iParam1)+" "+IntToString(slotData.iMetaMagic)+" "+IntToString(bUpdateGUI);
switch(slotData.iType) {
case 11: case 12: case 13: case 14: case 15: case 16: case 17: case 18: sQuickSlot += "¬"+ slotData.sS1 +"¬"+ slotData.sS2; break;
}
PrintString(sQuickSlot);
SetLocalString(oPC, "NWNX!FUNCS!SETQUICKSLOT", sQuickSlot);
DeleteLocalString(oPC, "NWNX!FUNCS!SETQUICKSLOT");
}
void NWNXFuncs_UpdateQuickbarGUI(object oPC) {
SetLocalString(oPC, "NWNX!FUNCS!UPDATEQUICKBAR", "-");
DeleteLocalString(oPC, "NWNX!FUNCS!UPDATEQUICKBAR");
}
void NWNXFuncs_SetClassByPosition(object oCreature, int iPosition, int iClass) {
SetLocalString(oCreature, "NWNX!FUNCS!SETCLASSBYPOSITION", IntToString(iPosition)+" "+IntToString(iClass));
DeleteLocalString(oCreature, "NWNX!FUNCS!SETCLASSBYPOSITION");
}
void NWNXFuncs_SetGender(object oCreature, int iGender) {
SetLocalString(oCreature, "NWNX!FUNCS!SETGENDER", IntToString(iGender));
DeleteLocalString(oCreature, "NWNX!FUNCS!SETGENDER");
}
void NWNXFuncs_SetWorldDateTime(int wtDate, int wtTime, int P3=0) {
SetLocalString(OBJECT_SELF, "NWNX!FUNCS!SETWORLDTIME", IntToString(wtDate)+" "+IntToString(wtTime)+" "+IntToString(P3));
DeleteLocalString(OBJECT_SELF, "NWNX!FUNCS!SETWORLDTIME");
}
int NWNXFuncs_GetWorldDate() {
SetLocalString(OBJECT_SELF, "NWNX!FUNCS!GETWORLDTIME", "1");
int ret = StringToInt(GetLocalString(OBJECT_SELF, "NWNX!FUNCS!GETWORLDTIME"));
DeleteLocalString(OBJECT_SELF, "NWNX!FUNCS!GETWORLDTIME");
return ret;
}
int NWNXFuncs_GetWorldTime() {
SetLocalString(OBJECT_SELF, "NWNX!FUNCS!GETWORLDTIME", "0");
int ret = StringToInt(GetLocalString(OBJECT_SELF, "NWNX!FUNCS!GETWORLDTIME"));
DeleteLocalString(OBJECT_SELF, "NWNX!FUNCS!GETWORLDTIME");
return ret;
}
int NWNXFuncs_GetFactionID(object oCreature) {
SetLocalString(oCreature, "NWNX!FUNCS!GETFACTIONID", "-");
int ret = StringToInt(GetLocalString(oCreature, "NWNX!FUNCS!GETFACTIONID"));
DeleteLocalString(oCreature, "NWNX!FUNCS!GETFACTIONID");
return ret;
}
void NWNXFuncs_SetFactionID(object oCreature, int iFactionID) {
SetLocalString(oCreature, "NWNX!FUNCS!SETFACTIONID", IntToString(iFactionID));
DeleteLocalString(oCreature, "NWNX!FUNCS!SETFACTIONID");
}
int NWNXFuncs_GetSoundSetID(object oCreature) {
SetLocalString(oCreature, "NWNX!FUNCS!GETSOUNDSETID", "-");
int ret = StringToInt(GetLocalString(oCreature, "NWNX!FUNCS!GETSOUNDSETID"));
DeleteLocalString(oCreature, "NWNX!FUNCS!GETSOUNDSETID");
return ret;
}
void NWNXFuncs_SetSoundSetID(object oCreature, int iSoundSetID) {
SetLocalString(oCreature, "NWNX!FUNCS!SETSOUNDSETID", IntToString(iSoundSetID));
DeleteLocalString(oCreature, "NWNX!FUNCS!SETSOUNDSETID");
}
int NWNXFuncs_GetSavingThrowBonus(object oCreature, int iSavingThrow = SAVING_THROW_FORT) {
SetLocalString(oCreature, "NWNX!FUNCS!GETSAVINGTHROWBONUS", IntToString(iSavingThrow));
int ret = StringToInt(GetLocalString(oCreature, "NWNX!FUNCS!GETSAVINGTHROWBONUS"));
DeleteLocalString(oCreature, "NWNX!FUNCS!GETSAVINGTHROWBONUS");
return ret;
}
void NWNXFuncs_JumpCreatureToLimbo(object oCreature) {
SetLocalString(oCreature, "NWNX!FUNCS!JUMPTOLIMBO", "-");
DeleteLocalString(oCreature, "NWNX!FUNCS!JUMPTOLIMBO");
}
void NWNXFuncs_SetClassLevel(object oCreature, int iClassPos, int iLevel) {
SetLocalString(oCreature, "NWNX!FUNCS!SETCLASSLEVEL", IntToString(iClassPos)+" "+IntToString(iLevel));
DeleteLocalString(oCreature, "NWNX!FUNCS!SETCLASSLEVEL");
}
int NWNXFuncs_GetDamageImmunity(object oCreature, int iDamageType=DAMAGE_TYPE_BLUDGEONING) {
SetLocalString(oCreature, "NWNX!FUNCS!GETDAMAGEIMMUNITY", IntToString(iDamageType));
int iRet = StringToInt(GetLocalString(oCreature, "NWNX!FUNCS!GETDAMAGEIMMUNITY"));
DeleteLocalString(oCreature, "NWNX!FUNCS!GETDAMAGEIMMUNITY");
return iRet;
}
int NWNXFuncs_GetHighestEffectID(object oObject) {
SetLocalString(oObject, "NWNX!FUNCS!GETHIGHESTEFFECTID", "-");
int iRet = StringToInt(GetLocalString(oObject, "NWNX!FUNCS!GETHIGHESTEFFECTID"));
DeleteLocalString(oObject, "NWNX!FUNCS!GETHIGHESTEFFECTID");
return iRet;
}
void NWNXFuncs_SetEffectCreatorByEffectID(object oObject, int iEffectID, string sNewCreatorID) {
SetLocalString(oObject, "NWNX!FUNCS!SETEFFECTCREATORBYEFFECTID", IntToString(iEffectID)+" "+sNewCreatorID);
DeleteLocalString(oObject, "NWNX!FUNCS!SETEFFECTCREATORBYEFFECTID");
}
void NWNXFuncs_SetEffectSpellIDByEffectID(object oObject, int iEffectID, int iNewSpellID) {
SetLocalString(oObject, "NWNX!FUNCS!SETEFFECTSPELLIDBYEFFECTID", IntToString(iEffectID)+" "+IntToString(iNewSpellID));
DeleteLocalString(oObject, "NWNX!FUNCS!SETEFFECTSPELLIDBYEFFECTID");
}
int NWNXFuncs_GetFirstEffectInternal(object oObject, int bExposedOnly = FALSE) {
SetLocalString(oObject, "NWNX!FUNCS!GETFIRSTALLEFFECT", IntToString(bExposedOnly));
int iRet = StringToInt(GetLocalString(oObject, "NWNX!FUNCS!GETFIRSTALLEFFECT"));
DeleteLocalString(oObject, "NWNX!FUNCS!GETFIRSTALLEFFECT");
return iRet;
}
int NWNXFuncs_GetNextEffectInternal(object oObject) {
SetLocalString(oObject, "NWNX!FUNCS!GETNEXTALLEFFECT", "-");
int iRet = StringToInt(GetLocalString(oObject, "NWNX!FUNCS!GETNEXTALLEFFECT"));
DeleteLocalString(oObject, "NWNX!FUNCS!GETNEXTALLEFFECT");
return iRet;
}
int NWNXFuncs_GetEffectRemainingDurationInternal() {
SetLocalString(OBJECT_SELF, "NWNX!FUNCS!GETALLEFFECTREMAININGDURATION", "-");
int sRet = StringToInt(GetLocalString(OBJECT_SELF, "NWNX!FUNCS!GETALLEFFECTREMAININGDURATION"));
DeleteLocalString(OBJECT_SELF, "NWNX!FUNCS!GETALLEFFECTREMAININGDURATION");
return sRet;
}
string NWNXFuncs_GetEffectIntegersInternal() {
SetLocalString(OBJECT_SELF, "NWNX!FUNCS!GETALLEFFECTINTEGERS", "-1 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------");
string sRet = GetLocalString(OBJECT_SELF, "NWNX!FUNCS!GETALLEFFECTINTEGERS");
DeleteLocalString(OBJECT_SELF, "NWNX!FUNCS!GETALLEFFECTINTEGERS");
return sRet;
}
int NWNXFuncs_GetEffectIntegerInternal(int nNthInteger) {
SetLocalString(OBJECT_SELF, "NWNX!FUNCS!GETALLEFFECTINTEGERS", IntToString(nNthInteger));
string sRet = GetLocalString(OBJECT_SELF, "NWNX!FUNCS!GETALLEFFECTINTEGERS");
DeleteLocalString(OBJECT_SELF, "NWNX!FUNCS!GETALLEFFECTINTEGERS");
if (GetStringLength(sRet) == 0) return -1;
return StringToInt(sRet);
}
void NWNXFuncs_SetEffectIntegerInternal(int nNthInteger, int iIntValue) {
SetLocalString(OBJECT_SELF, "NWNX!FUNCS!SETALLEFFECTINTEGERS", IntToString(nNthInteger)+" "+IntToString(iIntValue));
DeleteLocalString(OBJECT_SELF, "NWNX!FUNCS!SETALLEFFECTINTEGERS");
}
int NWNXFuncs_GetEffectIDInternal() {
SetLocalString(OBJECT_SELF, "NWNX!FUNCS!GETALLEFFECTID", "-");
int iRet = StringToInt(GetLocalString(OBJECT_SELF, "NWNX!FUNCS!GETALLEFFECTID"));
DeleteLocalString(OBJECT_SELF, "NWNX!FUNCS!GETALLEFFECTID");
return iRet;
}
int NWNXFuncs_GetEffectTypeInternal(int bRealType = TRUE) {
SetLocalString(OBJECT_SELF, "NWNX!FUNCS!GETALLEFFECTTYPE", IntToString(bRealType));
int iRet = StringToInt(GetLocalString(OBJECT_SELF, "NWNX!FUNCS!GETALLEFFECTTYPE"));
DeleteLocalString(OBJECT_SELF, "NWNX!FUNCS!GETALLEFFECTTYPE");
return iRet;
}
int NWNXFuncs_GetEffectSubTypeInternal() {
SetLocalString(OBJECT_SELF, "NWNX!FUNCS!GETALLEFFECTSUBTYPE", "-");
int iRet = StringToInt(GetLocalString(OBJECT_SELF, "NWNX!FUNCS!GETALLEFFECTSUBTYPE"));
DeleteLocalString(OBJECT_SELF, "NWNX!FUNCS!GETALLEFFECTSUBTYPE");
return iRet;
}
string NWNXFuncs_GetEffectCreatorInternal() {
SetLocalString(OBJECT_SELF, "NWNX!FUNCS!GETALLEFFECTCREATOR", "-");
string sRet = GetLocalString(OBJECT_SELF, "NWNX!FUNCS!GETALLEFFECTCREATOR");
DeleteLocalString(OBJECT_SELF, "NWNX!FUNCS!GETALLEFFECTCREATOR");
return sRet;
}
int NWNXFuncs_GetEffectSpellIdInternal() {
SetLocalString(OBJECT_SELF, "NWNX!FUNCS!GETALLEFFECTSPELLID", "-");
int iRet = StringToInt(GetLocalString(OBJECT_SELF, "NWNX!FUNCS!GETALLEFFECTSPELLID"));
DeleteLocalString(OBJECT_SELF, "NWNX!FUNCS!GETALLEFFECTSPELLID");
return iRet;
}
int NWNXFuncs_GetEffectDurationTypeInternal() {
SetLocalString(OBJECT_SELF, "NWNX!FUNCS!GETALLEFFECTDURATIONTYPE", "-");
int iRet = StringToInt(GetLocalString(OBJECT_SELF, "NWNX!FUNCS!GETALLEFFECTDURATIONTYPE"));
DeleteLocalString(OBJECT_SELF, "NWNX!FUNCS!GETALLEFFECTDURATIONTYPE");
return iRet;
}
void NWNXFuncs_QueueRemoveEffectInternal() {
SetLocalString(OBJECT_SELF, "NWNX!FUNCS!QUEUEREMOVEEFFECT", "-");
DeleteLocalString(OBJECT_SELF, "NWNX!FUNCS!QUEUEREMOVEEFFECT");
}
void NWNXFuncs_RemoveQueuedEffectsInternal(object oObject) {
SetLocalString(oObject, "NWNX!FUNCS!REMOVEQUEUEDEFFECTS", "-");
DeleteLocalString(oObject, "NWNX!FUNCS!REMOVEQUEUEDEFFECTS");
}
void NWNXFuncs_ApplyVisualEffectForPC(object oPC, int nVFX, vector vPos) {
SetLocalString(oPC, "NWNX!FUNCS!APPLYVFXFORPC", IntToString(nVFX)+" "+FloatToString(vPos.x)+" "+FloatToString(vPos.y)+" "+FloatToString(vPos.z));
DeleteLocalString(oPC, "NWNX!FUNCS!APPLYVFXFORPC");
}
string NWNXFuncs_GetEffectIntegers(object oObject) {
SetLocalString(oObject, "NWNX!FUNCS!GETEFFECTINTEGERS", "-1 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------");
string sRet = GetLocalString(oObject, "NWNX!FUNCS!GETEFFECTINTEGERS");
DeleteLocalString(oObject, "NWNX!FUNCS!GETEFFECTINTEGERS");
return sRet;
}
int NWNXFuncs_GetEffectInteger(object oObject, int nNthInteger) {
SetLocalString(oObject, "NWNX!FUNCS!GETEFFECTINTEGERS", IntToString(nNthInteger));
string sRet = GetLocalString(oObject, "NWNX!FUNCS!GETEFFECTINTEGERS");
DeleteLocalString(oObject, "NWNX!FUNCS!GETEFFECTINTEGERS");
if (GetStringLength(sRet) == 0) return -1;
return StringToInt(sRet);
}
void NWNXFuncs_SetEffectInteger(object oObject, int nNthInteger, int iIntValue) {
SetLocalString(oObject, "NWNX!FUNCS!SETEFFECTINTEGERS", IntToString(nNthInteger)+" "+IntToString(iIntValue));
DeleteLocalString(oObject, "NWNX!FUNCS!SETEFFECTINTEGERS");
}
float NWNXFuncs_GetEffectRemainingDuration(object oObject) {
SetLocalString(oObject, "NWNX!FUNCS!GETEFFECTREMAININGDURATION", "------------------------------");
float sRet = StringToFloat(GetLocalString(oObject, "NWNX!FUNCS!GETEFFECTREMAININGDURATION"));
DeleteLocalString(oObject, "NWNX!FUNCS!GETEFFECTREMAININGDURATION");
return sRet;
}
int NWNXFuncs_GetEffectID(object oObject) {
SetLocalString(oObject, "NWNX!FUNCS!GETEFFECTID", "-");
int iRet = StringToInt(GetLocalString(oObject, "NWNX!FUNCS!GETEFFECTID"));
DeleteLocalString(oObject, "NWNX!FUNCS!GETEFFECTID");
return iRet;
}
int NWNXFuncs_GetEffectRealType(object oObject) {
SetLocalString(oObject, "NWNX!FUNCS!GETEFFECTREALTYPE", "-");
int iRet = StringToInt(GetLocalString(oObject, "NWNX!FUNCS!GETEFFECTREALTYPE"));
DeleteLocalString(oObject, "NWNX!FUNCS!GETEFFECTREALTYPE");
return iRet;
}
void NWNXFuncs_SetCustomTrapGeometry(string sGeometry, int bAbsolute=FALSE) {
sGeometry = IntToString(bAbsolute)+"¬"+sGeometry;
SetLocalString(OBJECT_SELF, "NWNX!FUNCS!SETCUSTOMGEOMETRY", sGeometry);
DeleteLocalString(OBJECT_SELF, "NWNX!FUNCS!SETCUSTOMGEOMETRY");
}
void NWNXFuncs_RotateCustomTrapGeometry(float fAngle) {
SetLocalString(OBJECT_SELF, "NWNX!FUNCS!ROTATECUSTOMGEOMETRY", FloatToString(fAngle));
DeleteLocalString(OBJECT_SELF, "NWNX!FUNCS!SETCUSTOMGEOMETRY");
}
string NWNXFuncs_GetTrapGeometry(object oTrap) {
string sSpacer = "--------------------------------------------------------------------------------------------------------------------------------";
sSpacer += sSpacer + sSpacer + sSpacer;
SetLocalString(OBJECT_SELF, "NWNX!FUNCS!GETTRIGGERGEOMETRY", sSpacer);
string sRet = GetLocalString(OBJECT_SELF, "NWNX!FUNCS!GETTRIGGERGEOMETRY");
DeleteLocalString(OBJECT_SELF, "NWNX!FUNCS!GETTRIGGERGEOMETRY");
return sRet;
}
int NWNXFuncs_GetSurfaceMaterial(location lLoc) {
vector v = GetPositionFromLocation(lLoc);
object oArea = GetAreaFromLocation(lLoc);
SetLocalString(oArea, "NWNX!FUNCS!GETSURFACEMATERIAL", ObjectToString(oArea)+" "+FloatToString(v.x)+" "+FloatToString(v.y)+" "+FloatToString(v.z));
int iRet = StringToInt(GetLocalString(oArea, "NWNX!FUNCS!GETSURFACEMATERIAL"));
DeleteLocalString(oArea, "NWNX!FUNCS!GETSURFACEMATERIAL");
return iRet;
}
void NWNXFuncs_StartTimingbar(object oPC, int iDuration, int iLabel) {
SetLocalString(oPC, "NWNX!FUNCS!TIMEBARSTART", IntToString(iDuration)+" "+IntToString(iLabel));
DeleteLocalString(oPC, "NWNX!FUNCS!TIMEBARSTART");
}
void NWNXFuncs_StopTimingbar(object oPC) {
SetLocalString(oPC, "NWNX!FUNCS!TIMEBARSTOP", "-");
DeleteLocalString(oPC, "NWNX!FUNCS!TIMEBARSTOP");
}
void NWNXFuncs_SetAge(object oCreature, int iAge) {
SetLocalString(oCreature, "NWNX!FUNCS!SETAGE", IntToString(iAge));
DeleteLocalString(oCreature, "NWNX!FUNCS!SETAGE");
}
void NWNXFuncs_SetTag(object oObject, string sTag) {
SetLocalString(oObject, "NWNX!FUNCS!SETTAG", sTag);
DeleteLocalString(oObject, "NWNX!FUNCS!SETTAG");
}
void NWNXFuncs_SetEventScript(object oObject, string sScript, int iEvent) {
SetLocalString(oObject, "NWNX!FUNCS!SETEVENT", IntToString(iEvent)+" "+sScript);
DeleteLocalString(oObject, "NWNX!FUNCS!SETEVENT");
}
string NWNXFuncs_GetEventScript(object oObject, int iEvent) {
SetLocalString(oObject, "NWNX!FUNCS!GETEVENT", IntToString(iEvent)+" -----------------");
string sRet = GetLocalString(oObject, "NWNX!FUNCS!GETEVENT");
DeleteLocalString(oObject, "NWNX!FUNCS!GETEVENT");
return sRet;
}
void NWNXFuncs_ClearPlayerTURDs() {
SetLocalString(OBJECT_SELF, "NWNX!FUNCS!CLEARTURDLIST", "-");
DeleteLocalString(OBJECT_SELF, "NWNX!FUNCS!CLEARTURDLIST");
}
void NWNXFuncs_SetClassByLevel(object oCreature, int iClass, int iLevel) {
SetLocalString(oCreature, "NWNX!FUNCS!SETCLASSBYLEVEL", IntToString(iClass)+" "+IntToString(iLevel));
DeleteLocalString(oCreature, "NWNX!FUNCS!SETCLASSBYLEVEL");
}
void NWNXFuncs_ReplaceClass(object oCreature, int iOldClass, int iNewClass) {
SetLocalString(oCreature, "NWNX!FUNCS!REPLACECLASS", IntToString(iOldClass)+" "+IntToString(iNewClass));
DeleteLocalString(oCreature, "NWNX!FUNCS!REPLACECLASS");
}
void NWNXFuncs_UpdateCharacterSheet(object oPC) {
SetLocalString(oPC, "NWNX!FUNCS!UPDATECHARSHEET", ObjectToString(oPC));
DeleteLocalString(oPC, "NWNX!FUNCS!UPDATECHARSHEET");
}
/*
struct gameeffect_s {
int Type;
string Creator;
int SpellID;
int NumInts;
string Ints;
};
*/
effect NWNXFuncs_EffectCustomEffect(struct gameeffect_s e) {
object o = GetModule();
SetLocalInt(o, "NWNXFUNCS_CE", 1);
SetLocalInt(o, "NWNXFUNCS_CE_NUMINTS", e.NumInts);
SetLocalString(o, "NWNXFUNCS_CE_INTS", e.Ints);
SetLocalString(o, "NWNXFUNCS_CE_EFFECT", IntToString(e.Type)+" "+e.Creator+" "+IntToString(e.SpellID));
effect Eff = EffectAppear();
DeleteLocalInt(o, "NWNXFUNCS_CE");
DeleteLocalInt(o, "NWNXFUNCS_CE_NUMINTS");
DeleteLocalString(o, "NWNXFUNCS_CE_INTS");
DeleteLocalString(o, "NWNXFUNCS_CE_EFFECT");
return Eff;
}
int NWNXFuncs_GetEffectSubType(object oObject) {
SetLocalString(oObject, "NWNX!FUNCS!GETEFFECTDURATIONSUBTYPE", "-");
int iRet = StringToInt(GetLocalString(oObject, "NWNX!FUNCS!GETEFFECTDURATIONSUBTYPE"));
DeleteLocalString(oObject, "NWNX!FUNCS!GETEFFECTDURATIONSUBTYPE");
return iRet;
}
void NWNXFuncs_BootPCWithMessage(object oPC, int iTlkEntry) {
SetLocalString(oPC, "NWNX!FUNCS!BOOTPCWITHMESSAGE", IntToString(iTlkEntry));
DeleteLocalString(oPC, "NWNX!FUNCS!BOOTPCWITHMESSAGE");
}
float NWNXFuncs_GetItemPropertyDuration(itemproperty ip) {
object oModule = GetModule();
SetLocalString(oModule, "NWNX_FUNCS_IPRP", "1 0 0");
GetItemPropertyType(ip);
float fRet = GetLocalFloat(oModule, "NWNX_FUNCS_IPRP");
DeleteLocalString(oModule, "NWNX_FUNCS_IPRP");
DeleteLocalFloat(oModule, "NWNX_FUNCS_IPRP");
return fRet;
}
float NWNXFuncs_GetItemPropertyDurationRemaining(itemproperty ip) {
object oModule = GetModule();
SetLocalString(oModule, "NWNX_FUNCS_IPRP", "6 0 0");
GetItemPropertyType(ip);
float fRet = GetLocalFloat(oModule, "NWNX_FUNCS_IPRP");
DeleteLocalString(oModule, "NWNX_FUNCS_IPRP");
DeleteLocalFloat(oModule, "NWNX_FUNCS_IPRP");
return fRet;
}
int NWNXFuncs_GetItemPropertyInteger(itemproperty ip, int nInt) {
object oModule = GetModule();
SetLocalString(oModule, "NWNX_FUNCS_IPRP", "3 "+IntToString(nInt)+" 0");
int iRet = GetItemPropertyType(ip);
DeleteLocalString(oModule, "NWNX_FUNCS_IPRP");
return iRet;
}
void NWNXFuncs_SetItemPropertyInteger(itemproperty ip, int nInt, int iValue) {
object oModule = GetModule();
SetLocalString(oModule, "NWNX_FUNCS_IPRP", "4 "+IntToString(nInt)+" "+IntToString(iValue));
GetItemPropertyType(ip);
DeleteLocalString(oModule, "NWNX_FUNCS_IPRP");
}
int NWNXFuncs_GetItemPropertySpellId(itemproperty ip) {
object oModule = GetModule();
SetLocalString(oModule, "NWNX_FUNCS_IPRP", "2 0 0");
int iRet = GetItemPropertyType(ip);
DeleteLocalString(oModule, "NWNX_FUNCS_IPRP");
return iRet;
}
void NWNXFuncs_SetItemPropertySpellId(itemproperty ip, int iSpellID) {
object oModule = GetModule();
SetLocalString(oModule, "NWNX_FUNCS_IPRP", "5 "+IntToString(iSpellID)+" 0");
GetItemPropertyType(ip);
DeleteLocalString(oModule, "NWNX_FUNCS_IPRP");
}
itemproperty NWNXFuncs_ItemPropertyCustom(int iType, int iSubType, int iCostTableValue, int iParam1Value) {
object oModule = GetModule();
SetLocalString(oModule, "NWNX_FUNCS_IPRP", IntToString(iType)+ " " +IntToString(iSubType)+ " " +IntToString(iCostTableValue)+ " " +IntToString(iParam1Value));
itemproperty ip = ItemPropertyNoDamage();
DeleteLocalString(oModule, "NWNX_FUNCS_IPRP");
return ip;
}
void NWNXFuncs_SetVisibilityOverride(object oObject, int nVisibilityType) {
SetLocalString(oObject, "NWNX!FUNCS!SET_VISIBILITY_OVERRIDE", IntToString(nVisibilityType));
DeleteLocalString(oObject, "NWNX!FUNCS!SET_VISIBILITY_OVERRIDE");
}
void NWNXFuncs_SetVisibility(object oObject1, object oObject2, int nVisibility) {
SetLocalString(oObject1, "NWNX!FUNCS!SET_VISIBILITY", ObjectToString(oObject2)+" "+IntToString(nVisibility));
DeleteLocalString(oObject1, "NWNX!FUNCS!SET_VISIBILITY");
}
int NWNXFuncs_GetVisibilityOverride(object oObject) {
SetLocalString(oObject, "NWNX!FUNCS!GET_VISIBILITY_OVERRIDE", "'-");
int iRet = StringToInt(GetLocalString(oObject, "NWNX!FUNCS!GET_VISIBILITY_OVERRIDE"));
DeleteLocalString(oObject, "NWNX!FUNCS!GET_VISIBILITY_OVERRIDE");
return iRet;
}
int NWNXFuncs_GetVisibility(object oObject1, object oObject2) {
SetLocalString(oObject1, "NWNX!FUNCS!GET_VISIBILITY", ObjectToString(oObject2));
int iRet = StringToInt(GetLocalString(oObject1, "NWNX!FUNCS!GET_VISIBILITY"));
DeleteLocalString(oObject1, "NWNX!FUNCS!GET_VISIBILITY");
return iRet;
}
int NWNXFuncs_GetRegeneration(object oCreature, int nType=REGENERATION_ALL) {
SetLocalString(oCreature, "NWNX!FUNCS!GETREGENERATION", IntToString(nType));
int iRet = StringToInt(GetLocalString(oCreature, "NWNX!FUNCS!GETREGENERATION"));
DeleteLocalString(oCreature, "NWNX!FUNCS!GETREGENERATION");
return iRet;
}
int NWNXFuncs_ImmunityOverride(int Overrides, int iImmunity) {
if (iImmunity == 0 ) return Overrides | 1;
return Overrides | (2 << (iImmunity -1));
}
void NWNXFuncs_SetImmunityOverride(object oCreature, int Override) {
SetLocalInt(oCreature, "NWNXFUNCS_IMMOVERRIDE", Override);
}
void NWNXFuncs_RemoveAllImmunityOverrides(object oCreature) {
DeleteLocalInt(oCreature, "NWNXFUNCS_IMMOVERRIDE");
}
void NWNXFuncs_AddImmunityOverride(object oCreature, int iImmunity) {
int Override = GetLocalInt(oCreature, "NWNXFUNCS_IMMOVERRIDE");
if (iImmunity == 0) Override |= 1;
else Override |= 2 << (iImmunity-1);
SetLocalInt(oCreature, "NWNXFUNCS_IMMOVERRIDE", Override);
}
// for some reason my prc compiler doesn't like the NOT operator
void NWNXFuncs_RemoveImmunityOverride(object oCreature, int iImmunity) {
int Override = GetLocalInt(oCreature, "NWNXFUNCS_IMMOVERRIDE");
if (iImmunity == 0) {
//Override = Override ~ 1;
Override -= 1;
}
else {
//Override = Override ~ (2 << (iImmunity-1));
Override -= (2 << (iImmunity-1));
}
SetLocalInt(oCreature, "NWNXFUNCS_IMMOVERRIDE", Override);
}
int NWNXFuncs_GetAutoRemoveKeyFlag(object oObject) {
SetLocalString(oObject, "NWNX!FUNCS!GETAUTOREMOVEKEY", "-");
int iRet = StringToInt(GetLocalString(oObject, "NWNX!FUNCS!GETAUTOREMOVEKEY"));
DeleteLocalString(oObject, "NWNX!FUNCS!GETAUTOREMOVEKEY");
return iRet;
}
void NWNXFuncs_SetAutoRemoveKeyFlag(object oObject, int iFlag) {
SetLocalString(oObject, "NWNX!FUNCS!SETAUTOREMOVEKEY", IntToString(iFlag));
DeleteLocalString(oObject, "NWNX!FUNCS!SETAUTOREMOVEKEY");
}
string NWNXFuncs_GetDestinationTag(object oObject) {
SetLocalString(oObject, "NWNX!FUNCS!GETDESTINATIONTAG", "---------------------------------");
string sTag = GetLocalString(oObject, "NWNX!FUNCS!GETDESTINATIONTAG");
DeleteLocalString(oObject, "NWNX!FUNCS!GETDESTINATIONTAG");
return sTag;
}
void NWNXFuncs_SetDestinationTag(object oObject, string sTag) {
SetLocalString(oObject, "NWNX!FUNCS!SETDESTINATIONTAG", sTag);
DeleteLocalString(oObject, "NWNX!FUNCS!SETDESTINATIONTAG");
}
int NWNXFuncs_GetNoRestFlag(object oArea) {
SetLocalString(oArea, "NWNX!FUNCS!GETNORESTFLAG", "-");
int Ret = StringToInt(GetLocalString(oArea, "NWNX!FUNCS!GETNORESTFLAG"));
DeleteLocalString(oArea, "NWNX!FUNCS!GETNORESTFLAG");
return Ret;
}
void NWNXFuncs_SetNoRestFlag(object oArea, int bNoRest) {
SetLocalString(oArea, "NWNX!FUNCS!SETNORESTFLAG", IntToString(bNoRest));
DeleteLocalString(oArea, "NWNX!FUNCS!SETNORESTFLAG");
}
int NWNXFuncs_GetTimeOfDay() {
SetLocalString(OBJECT_SELF, "NWNX!FUNCS!GETTIMEOFDAY", "-");
int Ret = StringToInt(GetLocalString(OBJECT_SELF, "NWNX!FUNCS!GETTIMEOFDAY"));
DeleteLocalString(OBJECT_SELF, "NWNX!FUNCS!GETTIMEOFDAY");
return Ret;
}
void NWNXFuncs_PopupMessage(object oPlayer, string sMessage) {
SetLocalString(oPlayer, "NWNX!FUNCS!POPUPMESSAGE", sMessage);
DeleteLocalString(oPlayer, "NWNX!FUNCS!POPUPMESSAGE");
}
int NWNXFuncs_GetAttackModifierVersus(object oDefender, int bOffHand, int bRanged) {
SetLocalString(OBJECT_SELF, "NWNX!FUNCS!GETATTACKMODIFIERVERSUS", ObjectToString(oDefender)+" "+IntToString(bOffHand)+" "+IntToString(bRanged));
int Ret = StringToInt(GetLocalString(OBJECT_SELF, "NWNX!FUNCS!GETATTACKMODIFIERVERSUS"));
DeleteLocalString(OBJECT_SELF, "NWNX!FUNCS!GETATTACKMODIFIERVERSUS");
return Ret;
}