Initial Commit
Initial Commit
This commit is contained in:
61
_module/nss/house_onenter.nss
Normal file
61
_module/nss/house_onenter.nss
Normal file
@@ -0,0 +1,61 @@
|
||||
#include "nwnx_files"
|
||||
#include "x4_inc_functions"
|
||||
|
||||
void BuffInform(int nTimeEntered, object oPC)
|
||||
{
|
||||
if (GetLocalInt(oPC, "TimeEntered") != nTimeEntered) return; //return if the PC left the house in the meantime
|
||||
if (GetArea(oPC) != OBJECT_SELF) return; //return if the PC is not in the house area
|
||||
FloatingTextStringOnCreature("You have had some good rest!", oPC, FALSE);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = GetEnteringObject();
|
||||
object oModule = GetModule();
|
||||
string sDatabase = GetLocalString(oModule, "DB");
|
||||
|
||||
if (!GetIsPC(oPC)) return;
|
||||
ExploreAreaForPlayer(GetArea(oPC), oPC);
|
||||
|
||||
string sHouse = GetLocalString(OBJECT_SELF, "House");
|
||||
string sHouseOwnership = "H_"+sHouse+"_OWNER";
|
||||
string sEntering = CharacterDB(oPC);
|
||||
|
||||
//This part only runs if the module is set to ONLINE mode
|
||||
if (GetLocalString(oModule, "MODE") == "ONLINE")
|
||||
{
|
||||
SetLocalInt(oModule, "TIME_"+sHouse, GetSystemTime());
|
||||
SetLocalInt(oModule, "UpdateHouses", TRUE);
|
||||
}
|
||||
|
||||
string sOwner = GetCampaignString(sDatabase, sHouseOwnership);
|
||||
string sAuth1 = GetCampaignString(sDatabase, "H_"+sHouse+"_AUTH_1");
|
||||
string sAuth2 = GetCampaignString(sDatabase, "H_"+sHouse+"_AUTH_2");
|
||||
string sAuth3 = GetCampaignString(sDatabase, "H_"+sHouse+"_AUTH_3");
|
||||
string sAuth4 = GetCampaignString(sDatabase, "H_"+sHouse+"_AUTH_4");
|
||||
string sAuth5 = GetCampaignString(sDatabase, "H_"+sHouse+"_AUTH_5");
|
||||
string sAuth6 = GetCampaignString(sDatabase, "H_"+sHouse+"_AUTH_6");
|
||||
string sAuth7 = GetCampaignString(sDatabase, "H_"+sHouse+"_AUTH_7");
|
||||
string sAuth8 = GetCampaignString(sDatabase, "H_"+sHouse+"_AUTH_8");
|
||||
string sAuth9 = GetCampaignString(sDatabase, "H_"+sHouse+"_AUTH_9");
|
||||
string sAuth10 = GetCampaignString(sDatabase, "H_"+sHouse+"_AUTH_10");
|
||||
|
||||
object oTarget = GetWaypointByTag("WP_AREA_"+sHouse+"_OUT");
|
||||
|
||||
if(sOwner != sEntering && sAuth1 != sEntering && sAuth2 != sEntering && sAuth3 != sEntering
|
||||
&& sAuth4 != sEntering && sAuth5 != sEntering && sAuth6 != sEntering && sAuth7 != sEntering
|
||||
&& sAuth8 != sEntering && sAuth9 != sEntering && sAuth10 != sEntering )
|
||||
{
|
||||
AssignCommand(oPC, ClearAllActions());
|
||||
AssignCommand(oPC, JumpToObject(oTarget));
|
||||
FloatingTextStringOnCreature("It's not your house!", oPC);
|
||||
return;
|
||||
}
|
||||
|
||||
//record the time of entering the area to compare OnExit
|
||||
int nTimeEntered = CurrentDateTime();
|
||||
SetLocalInt(oPC, "TimeEntered", nTimeEntered);
|
||||
|
||||
//start the counter to inform the PC of the awaiting buff once they exit
|
||||
DelayCommand(HoursToSeconds(2), BuffInform(nTimeEntered, oPC));
|
||||
}
|
||||
Reference in New Issue
Block a user