rorqock Guild Archon
Posts : 112 Join date : 2008-04-14 Age : 50 Location : France
| Subject: REST WITH TENT AND FIRECAMP Fri Apr 18, 2008 10:20 am | |
| - Code:
-
//:://///////////////////////////////////////////// //:: Name: rest_anim //::////////////////////////////////////////////// /* The generic wandering monster system with animations */ //::////////////////////////////////////////////// //:: Created By: -MeteZ- //:: Created On: 08/31/06 //:://////////////////////////////////////////////#include "x0_i0_henchman" #include "x2_inc_restsys" #include "x2_inc_banter"// * returns true if its time to say another romance lineint GetPlotProgress(); // Clear the local variables and the objects use for the finished or // canceled rest if the area isn't an interior area // // (if area is interior, no variable was created, so, this script // is not necessary)void clearRest(object oPC, object oArea, string sVariable); void clearRest(object oPC, object oArea, string sVariable) { if (GetIsAreaInterior(oArea) == FALSE) { DestroyObject(GetLocalObject(oPC, sVariable)); DeleteLocalObject(oPC, sVariable); } } void main() { object oPC = GetLastPCRested(); /* Georg, August 11, 2003 Added this code to allow the designer to specify a variable on the module Instead of using a OnAreaEnter script. Nice new toolset feature!
Basically, the first time a player rests, the area is scanned for the encounter table string and will set it up. */ object oArea = GetArea (oPC); // Do not allow to rest during the seige if(GetLocalInt(GetModule(), "X2_StartSeerSiegeSpeech") == 2) { FloatingTextStrRefOnCreature( 84142 ,oPC); AssignCommand(oPC, ClearAllActions()); return; } string sTable = GetLocalString(oArea, "X2_WM_ENCOUNTERTABLE") ; if (sTable != "" ) { int nDoors = GetLocalInt(oArea, "X2_WM_AREA_USEDOORS"); int nDC = GetLocalInt(oArea, "X2_WM_AREA_LISTENCHECK"); WMSetAreaTable(oArea,sTable,nDoors,nDC); //remove string to indicate we are set up DeleteLocalString(oArea, "X2_WM_ENCOUNTERTABLE"); } /* Brent, July 2 2003 - If you rest and are a low level character at the beginning of the module. You will trigger the first dream cutscene
if (GetLocalInt(GetModule(), "X2_G_LOWLEVELSTART") == 10) { AssignCommand(oPC, ClearAllActions()); if (GetHitDice(oPC) >= 12) { ExecuteScript("bk_sleep", oPC); return; } else { FloatingTextStrRefOnCreature(84141 , oPC); return; } } */ if (GetLastRestEventType()==REST_EVENTTYPE_REST_STARTED) { // If the area of oPC is an interior area for install the tent and // the firecamp if (GetIsAreaInterior(oArea) == FALSE) { // Create the tent near the PC CreateObject(OBJECT_TYPE_PLACEABLE, "X2_PLC_TENT_B", GetLocation(oPC), FALSE, "rt_"+GetName(oPC)); SetLocalObject(oPC, "TENT_REST", GetNearestObjectByTag( "rt_"+GetName(oPC), oPC)); // Turn the tent face the PC AssignCommand(GetLocalObject(oPC, "TENT_REST"), SetFacingPoint(GetPosition(oPC))); AssignCommand(GetLocalObject(oPC, "TENT_REST"), SetFacing(GetFacing (GetLocalObject(oPC, "TENT_REST"))+ 180.0)); vector vTent = GetPosition(GetLocalObject(oPC, "TENT_REST")); vector vPC = GetPosition(oPC); vector vFireCamp = GetPosition(oPC); vFireCamp.x+=abs(FloatToInt(vTent.x-vPC.x)); vFireCamp.y+=abs(FloatToInt(vTent.y-vPC.y)); // create the firecamp near the PC CreateObject(OBJECT_TYPE_PLACEABLE, "plc_campfr", Location(oArea, vFireCamp, 0.0), FALSE, "rfc_"+GetName(oPC)); SetLocalObject(oPC, "FIRECAMP_REST", GetNearestObjectByTag( "rfc_"+GetName(oPC), oPC)); // For scripting errors, you can comments these lines if (GetLocalObject(oPC, "TENT_REST") == OBJECT_INVALID) { SendMessageToPC(oPC, "Votre tente n'a pas pu être installée"); SendMessageToAllDMs( "Erreur script : x2_onrest, TENT_REST == OBJECT_INVALID"); } if (GetLocalObject(oPC, "FIRECAMP_REST") == OBJECT_INVALID) { SendMessageToPC(oPC, "Votre feu de camp n'a pas pu être installée"); SendMessageToAllDMs( "Erreur script : x2_onrest, FIRECAMP == OBJECT_INVALID"); } } if (!WMStartPlayerRest(oPC)) { // The resting system has objections against resting here and now // Probably because there is an ambush already in progress FloatingTextStrRefOnCreature( 84142 ,oPC); AssignCommand(oPC,ClearAllActions()); } if (WMCheckForWanderingMonster(oPC)) { //This script MUST be run or the player won't be able to rest again ... ExecuteScript( "x2_restsys_ambus",oPC); } } else if (GetLastRestEventType()==REST_EVENTTYPE_REST_CANCELLED) { // No longer used but left in for the community // WMFinishPlayerRest(oPC,TRUE); // removes sleep effect, etc clearRest(oPC, oArea, "FIRECAMP_REST"); clearRest(oPC, oArea, "TENT_REST"); } else if (GetLastRestEventType()==REST_EVENTTYPE_REST_FINISHED) { // No longer used but left in for the community // WMFinishPlayerRest(oPC); // removes sleep effect, etc // * Brent October 15 // * In Chapter 2, your henchmen will progress the romance dialog /* if (GetPlotProgress() == TRUE && GetTag(GetModule()) == "x0_module2") { AttemptRomanceDialog(oPC, 3); // * can only go up to 4th stage this way } */ clearRest(oPC, oArea, "FIRECAMP_REST"); clearRest(oPC, oArea, "TENT_REST"); } } - Code:
-
| |
|