//:://///////////////////////////////////////////// //:: Name: farm_mod_enter //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// /* OnEnter script for the module. This script will give gold to the PC if any of his/her farms were sold while he/she was offline. */ //::////////////////////////////////////////////// //:: Created By: Adam Walenga //:: Created On: September 7th, 2004 //::////////////////////////////////////////////// #include "mn_cliententer" #include "mn_i_calendar" void main() { // Kald -Seeker- onclient script // feedback("In farm_mod_enter calling mn_ClientEnter", GetEnteringObject()); mn_ClientEnter(); // Fortsaet med script // Store persistent time SaveCalendar(); object oPlayer = GetEnteringObject(); string sName = "FARM_" + GetPCPlayerName (oPlayer); //Determine variable name for gold storage. if (GetStringLength (sName) > 32) sName = GetStringLeft (sName, 32); int iGold = GetCampaignInt ("Farm_Main_Database", sName); //Check for any gold to give. if (iGold != 0) { //Give player gold from sold farms, and reset variable. SendMessageToPC (oPlayer, "One or more of your farmlands have been sold!"); GiveGoldToCreature (oPlayer, iGold); SetCampaignInt ("Farm_Main_Database", sName, 0); } // mit starter her object oPC = GetEnteringObject(); if (!GetIsPC(oPC)) return; object oTarget; location lTarget; oTarget = GetWaypointByTag("modulestart"); lTarget = GetLocation(oTarget); //only do the jump if the location is valid. //though not flawless, we just check if it is in a valid area. //the script will stop if the location isn't valid - meaning that //nothing put after the teleport will fire either. //the current location won't be stored, either if (GetAreaFromLocation(lTarget)==OBJECT_INVALID) return; AssignCommand(oPC, ClearAllActions()); AssignCommand(oPC, ActionJumpToLocation(lTarget)); }