#include "x4_inc_functions" #include "nwnx_files" void main() { object oPC = GetPCSpeaker(); object oModule = GetModule(); string sDatabase = GetLocalString(oModule, "DB"); string sHouseName = GetLocalString(oPC, "HouseToSell"); int nPrice = GetLocalInt(oPC, "HouseToSell_p"); //Prepare the name of the variable that stores ownership and its value in a form of a string string sHouseOwnership = "H_"+sHouseName+"_OWNER"; string sBuyer = CharacterDB(oPC); //Do the transaction between the agency and the player string sHouseSeller = "H_"+sHouseName+"_SELLER"; string nSellerAgencyGold = GetStringLowerCase(GetCampaignString(sDatabase, sHouseSeller))+"_agencygold"; int nSellerAgencyBalance = GetCampaignInt(sDatabase, nSellerAgencyGold); SetCampaignString(sDatabase, sHouseOwnership, sBuyer); TakeGoldFromCreature(nPrice, oPC, TRUE); SetCampaignInt(sDatabase, nSellerAgencyGold, nSellerAgencyBalance+nPrice); //Delete the variable that stores the previous owner and demanded price string sHousePrice = "H_"+sHouseName+"_PRICE"; DeleteCampaignVariable(sDatabase, sHouseSeller); DeleteCampaignVariable(sDatabase, sHousePrice); //In ONLINE mode, register the current date if (GetLocalString(oModule, "MODE") == "ONLINE") SetCampaignInt(sDatabase, "TIME_"+sHouseName, GetSystemTime()); }