//:://///////////////////////////////////////////// //:: Name: farm_mod_load //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// /* OnModuleLoad script. This script will loop through each farm, creating all the crops that have been planted over time (persistency). */ //::////////////////////////////////////////////// //:: Created By: Adam Walenga //:: Created On: September 4th, 2004 //::////////////////////////////////////////////// #include "farm_include" #include "eds_include" #include "mn_i_calendar" void Farm_BuildCrops (int iFarmNumber) { int iCount = 1; int iMaxPlant = Farm_GetMaxPlantNumber (iFarmNumber); object oPlant; for (; iCount <= iMaxPlant; iCount++) { oPlant = CreateObject (OBJECT_TYPE_PLACEABLE, Farm_GetPlantResRef (iFarmNumber, iCount), Farm_GetPlantLocation (iFarmNumber, iCount), FALSE, IntToString (iFarmNumber) + "_" + IntToString (iCount)); //Allow plant to be looted. EDS_SetDelay (oPlant, "Is_Lootable", IntToFloat (GetMaxHitPoints (oPlant) * 60)); } } void main() { // Restore stored time LoadCalendar(); int iFarm = 1; int iMaxFarm = Farm_GetMaxFarm(); object oModule = GetModule(); //Loop through each farm and build all the crops. // Note: We use AssignCommand on the module to prevent TMI errors. for (; iFarm <= iMaxFarm; iFarm++) AssignCommand (oModule, Farm_BuildCrops (iFarm)); }