diff --git a/_module/are/nessnoplay.are.json b/_module/are/nessnoplay.are.json new file mode 100644 index 0000000..06c252d --- /dev/null +++ b/_module/are/nessnoplay.are.json @@ -0,0 +1,1726 @@ +{ + "__data_type": "ARE ", + "ChanceLightning": { + "type": "int", + "value": 0 + }, + "ChanceRain": { + "type": "int", + "value": 0 + }, + "ChanceSnow": { + "type": "int", + "value": 0 + }, + "Comments": { + "type": "cexostring", + "value": "" + }, + "Creator_ID": { + "type": "int", + "value": -1 + }, + "DayNightCycle": { + "type": "byte", + "value": 0 + }, + "Expansion_List": { + "type": "list", + "value": [] + }, + "Flags": { + "type": "dword", + "value": 1 + }, + "FogClipDist": { + "type": "float", + "value": 45.0 + }, + "Height": { + "type": "int", + "value": 6 + }, + "ID": { + "type": "int", + "value": -1 + }, + "IsNight": { + "type": "byte", + "value": 1 + }, + "LightingScheme": { + "type": "byte", + "value": 13 + }, + "LoadScreenID": { + "type": "word", + "value": 0 + }, + "ModListenCheck": { + "type": "int", + "value": 0 + }, + "ModSpotCheck": { + "type": "int", + "value": 0 + }, + "MoonAmbientColor": { + "type": "dword", + "value": 2960685 + }, + "MoonDiffuseColor": { + "type": "dword", + "value": 6457991 + }, + "MoonFogAmount": { + "type": "byte", + "value": 5 + }, + "MoonFogColor": { + "type": "dword", + "value": 0 + }, + "MoonShadows": { + "type": "byte", + "value": 0 + }, + "Name": { + "type": "cexolocstring", + "value": { + "0": "| NessNoPlay |" + } + }, + "NoRest": { + "type": "byte", + "value": 0 + }, + "OnEnter": { + "type": "resref", + "value": "" + }, + "OnExit": { + "type": "resref", + "value": "" + }, + "OnHeartbeat": { + "type": "resref", + "value": "" + }, + "OnUserDefined": { + "type": "resref", + "value": "" + }, + "PlayerVsPlayer": { + "type": "byte", + "value": 3 + }, + "ResRef": { + "type": "resref", + "value": "nessnoplay" + }, + "ShadowOpacity": { + "type": "byte", + "value": 60 + }, + "SkyBox": { + "type": "byte", + "value": 0 + }, + "SunAmbientColor": { + "type": "dword", + "value": 0 + }, + "SunDiffuseColor": { + "type": "dword", + "value": 0 + }, + "SunFogAmount": { + "type": "byte", + "value": 0 + }, + "SunFogColor": { + "type": "dword", + "value": 0 + }, + "SunShadows": { + "type": "byte", + "value": 0 + }, + "Tag": { + "type": "cexostring", + "value": "NessNoPlay" + }, + "Tile_List": { + "type": "list", + "value": [ + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 4 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 13 + }, + "Tile_Orientation": { + "type": "int", + "value": 2 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 3 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 3 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 0 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 0 + }, + "Tile_Orientation": { + "type": "int", + "value": 3 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 0 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 0 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 0 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 13 + }, + "Tile_Orientation": { + "type": "int", + "value": 2 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 0 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 0 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 30 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 0 + }, + "Tile_Orientation": { + "type": "int", + "value": 3 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 0 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 0 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 0 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 0 + }, + "Tile_Orientation": { + "type": "int", + "value": 2 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 3 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 3 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 0 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 13 + }, + "Tile_Orientation": { + "type": "int", + "value": 3 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 2 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 2 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 0 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 13 + }, + "Tile_Orientation": { + "type": "int", + "value": 1 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 3 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 3 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 30 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 14 + }, + "Tile_Orientation": { + "type": "int", + "value": 0 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 3 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 3 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 0 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 14 + }, + "Tile_Orientation": { + "type": "int", + "value": 1 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 2 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 2 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 0 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 0 + }, + "Tile_Orientation": { + "type": "int", + "value": 0 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 2 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 2 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 0 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 0 + }, + "Tile_Orientation": { + "type": "int", + "value": 1 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 3 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 3 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 4 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 14 + }, + "Tile_Orientation": { + "type": "int", + "value": 0 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 3 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 3 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 0 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 13 + }, + "Tile_Orientation": { + "type": "int", + "value": 2 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 3 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 3 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 0 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 14 + }, + "Tile_Orientation": { + "type": "int", + "value": 3 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 3 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 3 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 30 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 0 + }, + "Tile_Orientation": { + "type": "int", + "value": 2 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 2 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 2 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 0 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 0 + }, + "Tile_Orientation": { + "type": "int", + "value": 3 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 0 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 0 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 30 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 14 + }, + "Tile_Orientation": { + "type": "int", + "value": 2 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 3 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 3 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 0 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 0 + }, + "Tile_Orientation": { + "type": "int", + "value": 3 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 3 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 3 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 0 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 13 + }, + "Tile_Orientation": { + "type": "int", + "value": 1 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 0 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 0 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 0 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 14 + }, + "Tile_Orientation": { + "type": "int", + "value": 0 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 2 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 2 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 0 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 14 + }, + "Tile_Orientation": { + "type": "int", + "value": 1 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 0 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 0 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 4 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 0 + }, + "Tile_Orientation": { + "type": "int", + "value": 0 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 0 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 0 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 0 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 0 + }, + "Tile_Orientation": { + "type": "int", + "value": 1 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 3 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 3 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 0 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 0 + }, + "Tile_Orientation": { + "type": "int", + "value": 0 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 2 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 2 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 0 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 0 + }, + "Tile_Orientation": { + "type": "int", + "value": 2 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 2 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 2 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 0 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 14 + }, + "Tile_Orientation": { + "type": "int", + "value": 3 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 3 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 3 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 0 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 0 + }, + "Tile_Orientation": { + "type": "int", + "value": 2 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 3 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 3 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 4 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 0 + }, + "Tile_Orientation": { + "type": "int", + "value": 3 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 3 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 3 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 30 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 13 + }, + "Tile_Orientation": { + "type": "int", + "value": 2 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 0 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 0 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 0 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 0 + }, + "Tile_Orientation": { + "type": "int", + "value": 3 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 2 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 2 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 0 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 0 + }, + "Tile_Orientation": { + "type": "int", + "value": 1 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 3 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 3 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 0 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 0 + }, + "Tile_Orientation": { + "type": "int", + "value": 0 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 2 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 2 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 4 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 14 + }, + "Tile_Orientation": { + "type": "int", + "value": 1 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 3 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 3 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 0 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 14 + }, + "Tile_Orientation": { + "type": "int", + "value": 0 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 3 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 3 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 0 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 0 + }, + "Tile_Orientation": { + "type": "int", + "value": 1 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 0 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 0 + } + }, + { + "__struct_id": 1, + "Tile_AnimLoop1": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop2": { + "type": "byte", + "value": 1 + }, + "Tile_AnimLoop3": { + "type": "byte", + "value": 1 + }, + "Tile_Height": { + "type": "int", + "value": 0 + }, + "Tile_ID": { + "type": "int", + "value": 82 + }, + "Tile_MainLight1": { + "type": "byte", + "value": 4 + }, + "Tile_MainLight2": { + "type": "byte", + "value": 0 + }, + "Tile_Orientation": { + "type": "int", + "value": 0 + }, + "Tile_SrcLight1": { + "type": "byte", + "value": 0 + }, + "Tile_SrcLight2": { + "type": "byte", + "value": 0 + } + } + ] + }, + "TileBrdrDisabled": { + "type": "byte", + "value": 0 + }, + "Tileset": { + "type": "resref", + "value": "tic01" + }, + "Version": { + "type": "dword", + "value": 5 + }, + "Width": { + "type": "int", + "value": 6 + }, + "WindPower": { + "type": "int", + "value": 0 + } +} diff --git a/_module/are/thevoid001.are.json b/_module/are/thevoid001.are.json index ff97a7f..7a1304b 100644 --- a/_module/are/thevoid001.are.json +++ b/_module/are/thevoid001.are.json @@ -104,7 +104,7 @@ }, "OnHeartbeat": { "type": "resref", - "value": "" + "value": "spawn_sample_hb" }, "OnUserDefined": { "type": "resref", @@ -2907,13 +2907,17 @@ } ] }, + "TileBrdrDisabled": { + "type": "byte", + "value": 0 + }, "Tileset": { "type": "resref", "value": "tdc01" }, "Version": { "type": "dword", - "value": 46 + "value": 47 }, "Width": { "type": "int", diff --git a/_module/dlg/spawn_banner.dlg.json b/_module/dlg/spawn_banner.dlg.json new file mode 100644 index 0000000..bdd7ea9 --- /dev/null +++ b/_module/dlg/spawn_banner.dlg.json @@ -0,0 +1,777 @@ +{ + "__data_type": "DLG ", + "DelayEntry": { + "type": "dword", + "value": 0 + }, + "DelayReply": { + "type": "dword", + "value": 0 + }, + "EndConverAbort": { + "type": "resref", + "value": "nw_walk_wp" + }, + "EndConversation": { + "type": "resref", + "value": "nw_walk_wp" + }, + "EntryList": { + "type": "list", + "value": [ + { + "__struct_id": 0, + "Animation": { + "type": "dword", + "value": 0 + }, + "AnimLoop": { + "type": "byte", + "value": 1 + }, + "Comment": { + "type": "cexostring", + "value": "" + }, + "Delay": { + "type": "dword", + "value": 4294967295 + }, + "Quest": { + "type": "cexostring", + "value": "" + }, + "RepliesList": { + "type": "list", + "value": [ + { + "__struct_id": 0, + "Active": { + "type": "resref", + "value": "spawnb_cc_activ" + }, + "Index": { + "type": "dword", + "value": 10 + }, + "IsChild": { + "type": "byte", + "value": 0 + } + }, + { + "__struct_id": 1, + "Active": { + "type": "resref", + "value": "spawnb_cc_dactiv" + }, + "Index": { + "type": "dword", + "value": 9 + }, + "IsChild": { + "type": "byte", + "value": 0 + } + }, + { + "__struct_id": 2, + "Active": { + "type": "resref", + "value": "spawnb_cc_trck" + }, + "Index": { + "type": "dword", + "value": 8 + }, + "IsChild": { + "type": "byte", + "value": 0 + } + }, + { + "__struct_id": 3, + "Active": { + "type": "resref", + "value": "spawnb_cc_notrck" + }, + "Index": { + "type": "dword", + "value": 7 + }, + "IsChild": { + "type": "byte", + "value": 0 + } + }, + { + "__struct_id": 4, + "Active": { + "type": "resref", + "value": "spawnb_cc_dump" + }, + "Index": { + "type": "dword", + "value": 6 + }, + "IsChild": { + "type": "byte", + "value": 0 + } + }, + { + "__struct_id": 5, + "Active": { + "type": "resref", + "value": "spawnb_cc_nodump" + }, + "Index": { + "type": "dword", + "value": 5 + }, + "IsChild": { + "type": "byte", + "value": 0 + } + }, + { + "__struct_id": 6, + "Active": { + "type": "resref", + "value": "" + }, + "Index": { + "type": "dword", + "value": 0 + }, + "IsChild": { + "type": "byte", + "value": 0 + } + } + ] + }, + "Script": { + "type": "resref", + "value": "" + }, + "Sound": { + "type": "resref", + "value": "" + }, + "Speaker": { + "type": "cexostring", + "value": "" + }, + "Text": { + "type": "cexolocstring", + "value": { + "0": "" + } + } + }, + { + "__struct_id": 1, + "Animation": { + "type": "dword", + "value": 0 + }, + "AnimLoop": { + "type": "byte", + "value": 1 + }, + "Comment": { + "type": "cexostring", + "value": "" + }, + "Delay": { + "type": "dword", + "value": 4294967295 + }, + "Quest": { + "type": "cexostring", + "value": "" + }, + "RepliesList": { + "type": "list", + "value": [ + { + "__struct_id": 0, + "Active": { + "type": "resref", + "value": "spawnb_cc_sdlog" + }, + "Index": { + "type": "dword", + "value": 4 + }, + "IsChild": { + "type": "byte", + "value": 0 + } + }, + { + "__struct_id": 1, + "Active": { + "type": "resref", + "value": "spawnb_cc_nsdlog" + }, + "Index": { + "type": "dword", + "value": 3 + }, + "IsChild": { + "type": "byte", + "value": 0 + } + }, + { + "__struct_id": 2, + "Active": { + "type": "resref", + "value": "spawnb_cc_sclog" + }, + "Index": { + "type": "dword", + "value": 2 + }, + "IsChild": { + "type": "byte", + "value": 0 + } + }, + { + "__struct_id": 3, + "Active": { + "type": "resref", + "value": "spawnb_cc_nsclog" + }, + "Index": { + "type": "dword", + "value": 1 + }, + "IsChild": { + "type": "byte", + "value": 0 + } + } + ] + }, + "Script": { + "type": "resref", + "value": "" + }, + "Sound": { + "type": "resref", + "value": "" + }, + "Speaker": { + "type": "cexostring", + "value": "" + }, + "Text": { + "type": "cexolocstring", + "value": { + "0": "What debug operation do you want to do?" + } + } + } + ] + }, + "NumWords": { + "type": "dword", + "value": 91 + }, + "PreventZoomIn": { + "type": "byte", + "value": 0 + }, + "ReplyList": { + "type": "list", + "value": [ + { + "__struct_id": 0, + "Animation": { + "type": "dword", + "value": 0 + }, + "AnimLoop": { + "type": "byte", + "value": 1 + }, + "Comment": { + "type": "cexostring", + "value": "" + }, + "Delay": { + "type": "dword", + "value": 4294967295 + }, + "EntriesList": { + "type": "list", + "value": [ + { + "__struct_id": 0, + "Active": { + "type": "resref", + "value": "" + }, + "Index": { + "type": "dword", + "value": 1 + }, + "IsChild": { + "type": "byte", + "value": 0 + } + } + ] + }, + "Quest": { + "type": "cexostring", + "value": "" + }, + "Script": { + "type": "resref", + "value": "" + }, + "Sound": { + "type": "resref", + "value": "" + }, + "Text": { + "type": "cexolocstring", + "value": { + "0": "I would like to debug NESS." + } + } + }, + { + "__struct_id": 1, + "Animation": { + "type": "dword", + "value": 0 + }, + "AnimLoop": { + "type": "byte", + "value": 1 + }, + "Comment": { + "type": "cexostring", + "value": "" + }, + "Delay": { + "type": "dword", + "value": 4294967295 + }, + "EntriesList": { + "type": "list", + "value": [] + }, + "Quest": { + "type": "cexostring", + "value": "" + }, + "Script": { + "type": "resref", + "value": "spawnb_sc_snclog" + }, + "Sound": { + "type": "resref", + "value": "" + }, + "Text": { + "type": "cexolocstring", + "value": { + "0": "Turn spawn counting in this area off." + } + } + }, + { + "__struct_id": 2, + "Animation": { + "type": "dword", + "value": 0 + }, + "AnimLoop": { + "type": "byte", + "value": 1 + }, + "Comment": { + "type": "cexostring", + "value": "" + }, + "Delay": { + "type": "dword", + "value": 4294967295 + }, + "EntriesList": { + "type": "list", + "value": [] + }, + "Quest": { + "type": "cexostring", + "value": "" + }, + "Script": { + "type": "resref", + "value": "spawnb_sc_sclog" + }, + "Sound": { + "type": "resref", + "value": "" + }, + "Text": { + "type": "cexolocstring", + "value": { + "0": "Turn spawn counting in this area on." + } + } + }, + { + "__struct_id": 3, + "Animation": { + "type": "dword", + "value": 0 + }, + "AnimLoop": { + "type": "byte", + "value": 1 + }, + "Comment": { + "type": "cexostring", + "value": "" + }, + "Delay": { + "type": "dword", + "value": 4294967295 + }, + "EntriesList": { + "type": "list", + "value": [] + }, + "Quest": { + "type": "cexostring", + "value": "" + }, + "Script": { + "type": "resref", + "value": "spawnb_sc_nsdlog" + }, + "Sound": { + "type": "resref", + "value": "" + }, + "Text": { + "type": "cexolocstring", + "value": { + "0": "Turn spawn delay logging in this area off." + } + } + }, + { + "__struct_id": 4, + "Animation": { + "type": "dword", + "value": 0 + }, + "AnimLoop": { + "type": "byte", + "value": 1 + }, + "Comment": { + "type": "cexostring", + "value": "" + }, + "Delay": { + "type": "dword", + "value": 4294967295 + }, + "EntriesList": { + "type": "list", + "value": [] + }, + "Quest": { + "type": "cexostring", + "value": "" + }, + "Script": { + "type": "resref", + "value": "spawnb_sc_sdlog" + }, + "Sound": { + "type": "resref", + "value": "" + }, + "Text": { + "type": "cexolocstring", + "value": { + "0": "Turn spawn delay logging in this area on." + } + } + }, + { + "__struct_id": 5, + "Animation": { + "type": "dword", + "value": 0 + }, + "AnimLoop": { + "type": "byte", + "value": 1 + }, + "Comment": { + "type": "cexostring", + "value": "" + }, + "Delay": { + "type": "dword", + "value": 4294967295 + }, + "EntriesList": { + "type": "list", + "value": [] + }, + "Quest": { + "type": "cexostring", + "value": "" + }, + "Script": { + "type": "resref", + "value": "spawnb_sc_nodump" + }, + "Sound": { + "type": "resref", + "value": "" + }, + "Text": { + "type": "cexolocstring", + "value": { + "0": "I would like to turn spawn dumping off." + } + } + }, + { + "__struct_id": 6, + "Animation": { + "type": "dword", + "value": 0 + }, + "AnimLoop": { + "type": "byte", + "value": 1 + }, + "Comment": { + "type": "cexostring", + "value": "" + }, + "Delay": { + "type": "dword", + "value": 4294967295 + }, + "EntriesList": { + "type": "list", + "value": [] + }, + "Quest": { + "type": "cexostring", + "value": "" + }, + "Script": { + "type": "resref", + "value": "spawnb_sc_dump" + }, + "Sound": { + "type": "resref", + "value": "" + }, + "Text": { + "type": "cexolocstring", + "value": { + "0": "I would like to turn spawn dumping on." + } + } + }, + { + "__struct_id": 7, + "Animation": { + "type": "dword", + "value": 0 + }, + "AnimLoop": { + "type": "byte", + "value": 1 + }, + "Comment": { + "type": "cexostring", + "value": "" + }, + "Delay": { + "type": "dword", + "value": 4294967295 + }, + "EntriesList": { + "type": "list", + "value": [] + }, + "Quest": { + "type": "cexostring", + "value": "" + }, + "Script": { + "type": "resref", + "value": "spawnb_sc_notrck" + }, + "Sound": { + "type": "resref", + "value": "" + }, + "Text": { + "type": "cexolocstring", + "value": { + "0": "I would like to turn spawn tracking off." + } + } + }, + { + "__struct_id": 8, + "Animation": { + "type": "dword", + "value": 0 + }, + "AnimLoop": { + "type": "byte", + "value": 1 + }, + "Comment": { + "type": "cexostring", + "value": "" + }, + "Delay": { + "type": "dword", + "value": 4294967295 + }, + "EntriesList": { + "type": "list", + "value": [] + }, + "Quest": { + "type": "cexostring", + "value": "" + }, + "Script": { + "type": "resref", + "value": "spawnb_sc_trck" + }, + "Sound": { + "type": "resref", + "value": "" + }, + "Text": { + "type": "cexolocstring", + "value": { + "0": "I would like to turn spawn tracking on." + } + } + }, + { + "__struct_id": 9, + "Animation": { + "type": "dword", + "value": 0 + }, + "AnimLoop": { + "type": "byte", + "value": 1 + }, + "Comment": { + "type": "cexostring", + "value": "" + }, + "Delay": { + "type": "dword", + "value": 4294967295 + }, + "EntriesList": { + "type": "list", + "value": [] + }, + "Quest": { + "type": "cexostring", + "value": "" + }, + "Script": { + "type": "resref", + "value": "spawnb_sc_dactiv" + }, + "Sound": { + "type": "resref", + "value": "" + }, + "Text": { + "type": "cexolocstring", + "value": { + "0": "I would like to Deactivate this spawn." + } + } + }, + { + "__struct_id": 10, + "Animation": { + "type": "dword", + "value": 0 + }, + "AnimLoop": { + "type": "byte", + "value": 1 + }, + "Comment": { + "type": "cexostring", + "value": "" + }, + "Delay": { + "type": "dword", + "value": 4294967295 + }, + "EntriesList": { + "type": "list", + "value": [] + }, + "Quest": { + "type": "cexostring", + "value": "" + }, + "Script": { + "type": "resref", + "value": "spawnb_sc_activ" + }, + "Sound": { + "type": "resref", + "value": "" + }, + "Text": { + "type": "cexolocstring", + "value": { + "0": "I would like to Activate this spawn." + } + } + } + ] + }, + "StartingList": { + "type": "list", + "value": [ + { + "__struct_id": 0, + "Active": { + "type": "resref", + "value": "" + }, + "Index": { + "type": "dword", + "value": 0 + } + } + ] + } +} diff --git a/_module/gic/nessnoplay.gic.json b/_module/gic/nessnoplay.gic.json new file mode 100644 index 0000000..c93372f --- /dev/null +++ b/_module/gic/nessnoplay.gic.json @@ -0,0 +1,103 @@ +{ + "__data_type": "GIC ", + "Creature List": { + "type": "list", + "value": [] + }, + "Door List": { + "type": "list", + "value": [] + }, + "Encounter List": { + "type": "list", + "value": [] + }, + "List": { + "type": "list", + "value": [] + }, + "Placeable List": { + "type": "list", + "value": [] + }, + "SoundList": { + "type": "list", + "value": [] + }, + "StoreList": { + "type": "list", + "value": [] + }, + "TriggerList": { + "type": "list", + "value": [] + }, + "WaypointList": { + "type": "list", + "value": [ + { + "__struct_id": 5, + "Comment": { + "type": "cexostring", + "value": "This is the default waypoint you may place to set a patrol path for a creature or NPC.\r\n1. Create the creature and either use its current Tag or fill in a new one.\r\n2. Place or make sure the WalkWayPoints() is within the body of the On Spawn script for the creature.\r\n3. Place a series of waypoints along the route you wish the creature to walk.\r\n4. Select all of the newly created waypoints and right click. Choose the Create Set option.\r\n5. The waypoint set will have a set name of \"WP_\" + NPC Tag. Thus if an NPC with the Tag \"Guard\" will have a waypoint set called \"WP_Guard\". Note that Tags are case sensitive." + } + }, + { + "__struct_id": 5, + "Comment": { + "type": "cexostring", + "value": "This is the default waypoint you may place to set a patrol path for a creature or NPC.\r\n1. Create the creature and either use its current Tag or fill in a new one.\r\n2. Place or make sure the WalkWayPoints() is within the body of the On Spawn script for the creature.\r\n3. Place a series of waypoints along the route you wish the creature to walk.\r\n4. Select all of the newly created waypoints and right click. Choose the Create Set option.\r\n5. The waypoint set will have a set name of \"WP_\" + NPC Tag. Thus if an NPC with the Tag \"Guard\" will have a waypoint set called \"WP_Guard\". Note that Tags are case sensitive." + } + }, + { + "__struct_id": 5, + "Comment": { + "type": "cexostring", + "value": "This is the default waypoint you may place to set a patrol path for a creature or NPC.\r\n1. Create the creature and either use its current Tag or fill in a new one.\r\n2. Place or make sure the WalkWayPoints() is within the body of the On Spawn script for the creature.\r\n3. Place a series of waypoints along the route you wish the creature to walk.\r\n4. Select all of the newly created waypoints and right click. Choose the Create Set option.\r\n5. The waypoint set will have a set name of \"WP_\" + NPC Tag. Thus if an NPC with the Tag \"Guard\" will have a waypoint set called \"WP_Guard\". Note that Tags are case sensitive." + } + }, + { + "__struct_id": 5, + "Comment": { + "type": "cexostring", + "value": "This is the default waypoint you may place to set a patrol path for a creature or NPC.\r\n1. Create the creature and either use its current Tag or fill in a new one.\r\n2. Place or make sure the WalkWayPoints() is within the body of the On Spawn script for the creature.\r\n3. Place a series of waypoints along the route you wish the creature to walk.\r\n4. Select all of the newly created waypoints and right click. Choose the Create Set option.\r\n5. The waypoint set will have a set name of \"WP_\" + NPC Tag. Thus if an NPC with the Tag \"Guard\" will have a waypoint set called \"WP_Guard\". Note that Tags are case sensitive." + } + }, + { + "__struct_id": 5, + "Comment": { + "type": "cexostring", + "value": "This is the default waypoint you may place to set a patrol path for a creature or NPC.\r\n1. Create the creature and either use its current Tag or fill in a new one.\r\n2. Place or make sure the WalkWayPoints() is within the body of the On Spawn script for the creature.\r\n3. Place a series of waypoints along the route you wish the creature to walk.\r\n4. Select all of the newly created waypoints and right click. Choose the Create Set option.\r\n5. The waypoint set will have a set name of \"WP_\" + NPC Tag. Thus if an NPC with the Tag \"Guard\" will have a waypoint set called \"WP_Guard\". Note that Tags are case sensitive." + } + }, + { + "__struct_id": 5, + "Comment": { + "type": "cexostring", + "value": "This is the default waypoint you may place to set a patrol path for a creature or NPC.\r\n1. Create the creature and either use its current Tag or fill in a new one.\r\n2. Place or make sure the WalkWayPoints() is within the body of the On Spawn script for the creature.\r\n3. Place a series of waypoints along the route you wish the creature to walk.\r\n4. Select all of the newly created waypoints and right click. Choose the Create Set option.\r\n5. The waypoint set will have a set name of \"WP_\" + NPC Tag. Thus if an NPC with the Tag \"Guard\" will have a waypoint set called \"WP_Guard\". Note that Tags are case sensitive." + } + }, + { + "__struct_id": 5, + "Comment": { + "type": "cexostring", + "value": "This is the default waypoint you may place to set a patrol path for a creature or NPC.\r\n1. Create the creature and either use its current Tag or fill in a new one.\r\n2. Place or make sure the WalkWayPoints() is within the body of the On Spawn script for the creature.\r\n3. Place a series of waypoints along the route you wish the creature to walk.\r\n4. Select all of the newly created waypoints and right click. Choose the Create Set option.\r\n5. The waypoint set will have a set name of \"WP_\" + NPC Tag. Thus if an NPC with the Tag \"Guard\" will have a waypoint set called \"WP_Guard\". Note that Tags are case sensitive." + } + }, + { + "__struct_id": 5, + "Comment": { + "type": "cexostring", + "value": "This is the default waypoint you may place to set a patrol path for a creature or NPC.\r\n1. Create the creature and either use its current Tag or fill in a new one.\r\n2. Place or make sure the WalkWayPoints() is within the body of the On Spawn script for the creature.\r\n3. Place a series of waypoints along the route you wish the creature to walk.\r\n4. Select all of the newly created waypoints and right click. Choose the Create Set option.\r\n5. The waypoint set will have a set name of \"WP_\" + NPC Tag. Thus if an NPC with the Tag \"Guard\" will have a waypoint set called \"WP_Guard\". Note that Tags are case sensitive." + } + }, + { + "__struct_id": 5, + "Comment": { + "type": "cexostring", + "value": "This is the default waypoint you may place to set a patrol path for a creature or NPC.\r\n1. Create the creature and either use its current Tag or fill in a new one.\r\n2. Place or make sure the WalkWayPoints() is within the body of the On Spawn script for the creature.\r\n3. Place a series of waypoints along the route you wish the creature to walk.\r\n4. Select all of the newly created waypoints and right click. Choose the Create Set option.\r\n5. The waypoint set will have a set name of \"WP_\" + NPC Tag. Thus if an NPC with the Tag \"Guard\" will have a waypoint set called \"WP_Guard\". Note that Tags are case sensitive." + } + } + ] + } +} diff --git a/_module/gic/thevoid001.gic.json b/_module/gic/thevoid001.gic.json index 7253262..b4e0d55 100644 --- a/_module/gic/thevoid001.gic.json +++ b/_module/gic/thevoid001.gic.json @@ -293,7 +293,7 @@ "__struct_id": 5, "Comment": { "type": "cexostring", - "value": "" + "value": "This is the default waypoint you may place to set a patrol path for a creature or NPC.\r\n1. Create the creature and either use its current Tag or fill in a new one.\r\n2. Place or make sure the WalkWayPoints() is within the body of the On Spawn script for the creature.\r\n3. Place a series of waypoints along the route you wish the creature to walk.\r\n4. Select all of the newly created waypoints and right click. Choose the Create Set option.\r\n5. The waypoint set will have a set name of \"WP_\" + NPC Tag. Thus if an NPC with the Tag \"Guard\" will have a waypoint set called \"WP_Guard\". Note that Tags are case sensitive." } } ] diff --git a/_module/git/nessnoplay.git.json b/_module/git/nessnoplay.git.json new file mode 100644 index 0000000..00fa335 --- /dev/null +++ b/_module/git/nessnoplay.git.json @@ -0,0 +1,641 @@ +{ + "__data_type": "GIT ", + "AreaProperties": { + "__struct_id": 100, + "type": "struct", + "value": { + "__struct_id": 100, + "AmbientSndDay": { + "type": "int", + "value": 66 + }, + "AmbientSndDayVol": { + "type": "int", + "value": 32 + }, + "AmbientSndNight": { + "type": "int", + "value": 66 + }, + "AmbientSndNitVol": { + "type": "int", + "value": 32 + }, + "EnvAudio": { + "type": "int", + "value": 0 + }, + "MusicBattle": { + "type": "int", + "value": 41 + }, + "MusicDay": { + "type": "int", + "value": 50 + }, + "MusicDelay": { + "type": "int", + "value": 90000 + }, + "MusicNight": { + "type": "int", + "value": 50 + } + } + }, + "Creature List": { + "type": "list", + "value": [] + }, + "Door List": { + "type": "list", + "value": [] + }, + "Encounter List": { + "type": "list", + "value": [] + }, + "List": { + "type": "list", + "value": [] + }, + "Placeable List": { + "type": "list", + "value": [] + }, + "SoundList": { + "type": "list", + "value": [] + }, + "StoreList": { + "type": "list", + "value": [] + }, + "TriggerList": { + "type": "list", + "value": [] + }, + "WaypointList": { + "type": "list", + "value": [ + { + "__struct_id": 5, + "Appearance": { + "type": "byte", + "value": 1 + }, + "Description": { + "type": "cexolocstring", + "value": {} + }, + "HasMapNote": { + "type": "byte", + "value": 0 + }, + "LinkedTo": { + "type": "cexostring", + "value": "" + }, + "LocalizedName": { + "type": "cexolocstring", + "value": { + "0": "wpNessCachedLoc", + "id": 14817 + } + }, + "MapNote": { + "type": "cexolocstring", + "value": {} + }, + "MapNoteEnabled": { + "type": "byte", + "value": 1 + }, + "Tag": { + "type": "cexostring", + "value": "wpNessCachedLoc" + }, + "TemplateResRef": { + "type": "resref", + "value": "nw_waypoint001" + }, + "XOrientation": { + "type": "float", + "value": 0.0 + }, + "XPosition": { + "type": "float", + "value": 29.93688201904297 + }, + "YOrientation": { + "type": "float", + "value": 1.0 + }, + "YPosition": { + "type": "float", + "value": 29.75654602050781 + }, + "ZPosition": { + "type": "float", + "value": 9.5367431640625e-007 + } + }, + { + "__struct_id": 5, + "Appearance": { + "type": "byte", + "value": 1 + }, + "Description": { + "type": "cexolocstring", + "value": {} + }, + "HasMapNote": { + "type": "byte", + "value": 0 + }, + "LinkedTo": { + "type": "cexostring", + "value": "" + }, + "LocalizedName": { + "type": "cexolocstring", + "value": { + "0": "wpNessCachedLoc1", + "id": 14817 + } + }, + "MapNote": { + "type": "cexolocstring", + "value": {} + }, + "MapNoteEnabled": { + "type": "byte", + "value": 1 + }, + "Tag": { + "type": "cexostring", + "value": "wpNessCachedLoc1" + }, + "TemplateResRef": { + "type": "resref", + "value": "nw_waypoint001" + }, + "XOrientation": { + "type": "float", + "value": 0.0 + }, + "XPosition": { + "type": "float", + "value": 10.11644172668457 + }, + "YOrientation": { + "type": "float", + "value": 1.0 + }, + "YPosition": { + "type": "float", + "value": 49.61051559448242 + }, + "ZPosition": { + "type": "float", + "value": -5.7220458984375e-006 + } + }, + { + "__struct_id": 5, + "Appearance": { + "type": "byte", + "value": 1 + }, + "Description": { + "type": "cexolocstring", + "value": {} + }, + "HasMapNote": { + "type": "byte", + "value": 0 + }, + "LinkedTo": { + "type": "cexostring", + "value": "" + }, + "LocalizedName": { + "type": "cexolocstring", + "value": { + "0": "wpNessCachedLoc2", + "id": 14817 + } + }, + "MapNote": { + "type": "cexolocstring", + "value": {} + }, + "MapNoteEnabled": { + "type": "byte", + "value": 1 + }, + "Tag": { + "type": "cexostring", + "value": "wpNessCachedLoc2" + }, + "TemplateResRef": { + "type": "resref", + "value": "nw_waypoint001" + }, + "XOrientation": { + "type": "float", + "value": 0.0 + }, + "XPosition": { + "type": "float", + "value": 9.882942199707031 + }, + "YOrientation": { + "type": "float", + "value": 1.0 + }, + "YPosition": { + "type": "float", + "value": 29.73343467712402 + }, + "ZPosition": { + "type": "float", + "value": -5.7220458984375e-006 + } + }, + { + "__struct_id": 5, + "Appearance": { + "type": "byte", + "value": 1 + }, + "Description": { + "type": "cexolocstring", + "value": {} + }, + "HasMapNote": { + "type": "byte", + "value": 0 + }, + "LinkedTo": { + "type": "cexostring", + "value": "" + }, + "LocalizedName": { + "type": "cexolocstring", + "value": { + "0": "wpNessCachedLoc3", + "id": 14817 + } + }, + "MapNote": { + "type": "cexolocstring", + "value": {} + }, + "MapNoteEnabled": { + "type": "byte", + "value": 1 + }, + "Tag": { + "type": "cexostring", + "value": "wpNessCachedLoc3" + }, + "TemplateResRef": { + "type": "resref", + "value": "nw_waypoint001" + }, + "XOrientation": { + "type": "float", + "value": 0.0 + }, + "XPosition": { + "type": "float", + "value": 10.10672569274902 + }, + "YOrientation": { + "type": "float", + "value": 1.0 + }, + "YPosition": { + "type": "float", + "value": 9.680875778198242 + }, + "ZPosition": { + "type": "float", + "value": -5.7220458984375e-006 + } + }, + { + "__struct_id": 5, + "Appearance": { + "type": "byte", + "value": 1 + }, + "Description": { + "type": "cexolocstring", + "value": {} + }, + "HasMapNote": { + "type": "byte", + "value": 0 + }, + "LinkedTo": { + "type": "cexostring", + "value": "" + }, + "LocalizedName": { + "type": "cexolocstring", + "value": { + "0": "wpNessCachedLoc4", + "id": 14817 + } + }, + "MapNote": { + "type": "cexolocstring", + "value": {} + }, + "MapNoteEnabled": { + "type": "byte", + "value": 1 + }, + "Tag": { + "type": "cexostring", + "value": "wpNessCachedLoc4" + }, + "TemplateResRef": { + "type": "resref", + "value": "nw_waypoint001" + }, + "XOrientation": { + "type": "float", + "value": 0.0 + }, + "XPosition": { + "type": "float", + "value": 30.02265167236328 + }, + "YOrientation": { + "type": "float", + "value": 1.0 + }, + "YPosition": { + "type": "float", + "value": 49.55963516235352 + }, + "ZPosition": { + "type": "float", + "value": -5.7220458984375e-006 + } + }, + { + "__struct_id": 5, + "Appearance": { + "type": "byte", + "value": 1 + }, + "Description": { + "type": "cexolocstring", + "value": {} + }, + "HasMapNote": { + "type": "byte", + "value": 0 + }, + "LinkedTo": { + "type": "cexostring", + "value": "" + }, + "LocalizedName": { + "type": "cexolocstring", + "value": { + "0": "wpNessCachedLoc5", + "id": 14817 + } + }, + "MapNote": { + "type": "cexolocstring", + "value": {} + }, + "MapNoteEnabled": { + "type": "byte", + "value": 1 + }, + "Tag": { + "type": "cexostring", + "value": "wpNessCachedLoc5" + }, + "TemplateResRef": { + "type": "resref", + "value": "nw_waypoint001" + }, + "XOrientation": { + "type": "float", + "value": 0.0 + }, + "XPosition": { + "type": "float", + "value": 29.89828872680664 + }, + "YOrientation": { + "type": "float", + "value": 1.0 + }, + "YPosition": { + "type": "float", + "value": 9.568124771118164 + }, + "ZPosition": { + "type": "float", + "value": -5.7220458984375e-006 + } + }, + { + "__struct_id": 5, + "Appearance": { + "type": "byte", + "value": 1 + }, + "Description": { + "type": "cexolocstring", + "value": {} + }, + "HasMapNote": { + "type": "byte", + "value": 0 + }, + "LinkedTo": { + "type": "cexostring", + "value": "" + }, + "LocalizedName": { + "type": "cexolocstring", + "value": { + "0": "wpNessCachedLoc6", + "id": 14817 + } + }, + "MapNote": { + "type": "cexolocstring", + "value": {} + }, + "MapNoteEnabled": { + "type": "byte", + "value": 1 + }, + "Tag": { + "type": "cexostring", + "value": "wpNessCachedLoc6" + }, + "TemplateResRef": { + "type": "resref", + "value": "nw_waypoint001" + }, + "XOrientation": { + "type": "float", + "value": 0.0 + }, + "XPosition": { + "type": "float", + "value": 50.05917739868164 + }, + "YOrientation": { + "type": "float", + "value": 1.0 + }, + "YPosition": { + "type": "float", + "value": 49.72054290771484 + }, + "ZPosition": { + "type": "float", + "value": -5.7220458984375e-006 + } + }, + { + "__struct_id": 5, + "Appearance": { + "type": "byte", + "value": 1 + }, + "Description": { + "type": "cexolocstring", + "value": {} + }, + "HasMapNote": { + "type": "byte", + "value": 0 + }, + "LinkedTo": { + "type": "cexostring", + "value": "" + }, + "LocalizedName": { + "type": "cexolocstring", + "value": { + "0": "wpNessCachedLoc7", + "id": 14817 + } + }, + "MapNote": { + "type": "cexolocstring", + "value": {} + }, + "MapNoteEnabled": { + "type": "byte", + "value": 1 + }, + "Tag": { + "type": "cexostring", + "value": "wpNessCachedLoc7" + }, + "TemplateResRef": { + "type": "resref", + "value": "nw_waypoint001" + }, + "XOrientation": { + "type": "float", + "value": 0.0 + }, + "XPosition": { + "type": "float", + "value": 49.90233612060547 + }, + "YOrientation": { + "type": "float", + "value": 1.0 + }, + "YPosition": { + "type": "float", + "value": 29.79799652099609 + }, + "ZPosition": { + "type": "float", + "value": -5.7220458984375e-006 + } + }, + { + "__struct_id": 5, + "Appearance": { + "type": "byte", + "value": 1 + }, + "Description": { + "type": "cexolocstring", + "value": {} + }, + "HasMapNote": { + "type": "byte", + "value": 0 + }, + "LinkedTo": { + "type": "cexostring", + "value": "" + }, + "LocalizedName": { + "type": "cexolocstring", + "value": { + "0": "wpNessCachedLoc8", + "id": 14817 + } + }, + "MapNote": { + "type": "cexolocstring", + "value": {} + }, + "MapNoteEnabled": { + "type": "byte", + "value": 1 + }, + "Tag": { + "type": "cexostring", + "value": "wpNessCachedLoc8" + }, + "TemplateResRef": { + "type": "resref", + "value": "nw_waypoint001" + }, + "XOrientation": { + "type": "float", + "value": 0.0 + }, + "XPosition": { + "type": "float", + "value": 50.07466888427734 + }, + "YOrientation": { + "type": "float", + "value": 1.0 + }, + "YPosition": { + "type": "float", + "value": 9.439542770385742 + }, + "ZPosition": { + "type": "float", + "value": -5.7220458984375e-006 + } + } + ] + } +} diff --git a/_module/git/thevoid001.git.json b/_module/git/thevoid001.git.json index 5bed082..a0f146b 100644 --- a/_module/git/thevoid001.git.json +++ b/_module/git/thevoid001.git.json @@ -35,7 +35,7 @@ }, "MusicDelay": { "type": "int", - "value": 89000 + "value": 45000 }, "MusicNight": { "type": "int", @@ -5561,7 +5561,10 @@ }, "LocalizedName": { "type": "cexolocstring", - "value": {} + "value": { + "0": "SP_SN01_SA_SD01_SF_DS0_RH_HL", + "id": 14817 + } }, "MapNote": { "type": "cexolocstring", @@ -5569,31 +5572,31 @@ }, "MapNoteEnabled": { "type": "byte", - "value": 0 + "value": 1 }, "Tag": { "type": "cexostring", - "value": "WP_void_lich_01" + "value": "void_lich" }, "TemplateResRef": { "type": "resref", - "value": "" + "value": "nw_waypoint001" }, "XOrientation": { "type": "float", - "value": 0.9972903728485107 + "value": 1.0 }, "XPosition": { "type": "float", - "value": 34.86428070068359 + "value": 34.65420150756836 }, "YOrientation": { "type": "float", - "value": 0.07356543838977814 + "value": 7.549790126404332e-008 }, "YPosition": { "type": "float", - "value": 45.25579071044922 + "value": 45.0279655456543 }, "ZPosition": { "type": "float", diff --git a/_module/ifo/module.ifo.json b/_module/ifo/module.ifo.json index 7d47022..4ed355f 100644 --- a/_module/ifo/module.ifo.json +++ b/_module/ifo/module.ifo.json @@ -839,6 +839,13 @@ "type": "resref", "value": "wol_a_dymond" } + }, + { + "__struct_id": 6, + "Area_Name": { + "type": "resref", + "value": "nessnoplay" + } } ] }, diff --git a/_module/itp/creaturepalcus.itp.json b/_module/itp/creaturepalcus.itp.json index 64fc822..6d38e73 100644 --- a/_module/itp/creaturepalcus.itp.json +++ b/_module/itp/creaturepalcus.itp.json @@ -18698,6 +18698,25 @@ "LIST": { "type": "list", "value": [ + { + "__struct_id": 0, + "CR": { + "type": "float", + "value": 7.0 + }, + "FACTION": { + "type": "cexostring", + "value": "Hostile" + }, + "NAME": { + "type": "cexostring", + "value": "Algoid" + }, + "RESREF": { + "type": "resref", + "value": "prc_algoid" + } + }, { "__struct_id": 0, "CR": { @@ -18945,6 +18964,25 @@ "value": "livingdarknes001" } }, + { + "__struct_id": 0, + "CR": { + "type": "float", + "value": 1.0 + }, + "FACTION": { + "type": "cexostring", + "value": "Commoner" + }, + "NAME": { + "type": "cexostring", + "value": "Myconid" + }, + "RESREF": { + "type": "resref", + "value": "prc_myconid" + } + }, { "__struct_id": 0, "CR": { @@ -18983,6 +19021,25 @@ "value": "zep_phyrexiann2" } }, + { + "__struct_id": 0, + "CR": { + "type": "float", + "value": 6.0 + }, + "FACTION": { + "type": "cexostring", + "value": "Hostile" + }, + "NAME": { + "type": "cexostring", + "value": "Shambling Mound" + }, + "RESREF": { + "type": "resref", + "value": "prc_shambmound" + } + }, { "__struct_id": 0, "CR": { @@ -29960,6 +30017,25 @@ "value": "hamatula" } }, + { + "__struct_id": 0, + "CR": { + "type": "float", + "value": 8.0 + }, + "FACTION": { + "type": "cexostring", + "value": "Commoner" + }, + "NAME": { + "type": "cexostring", + "value": "Hamatula" + }, + "RESREF": { + "type": "resref", + "value": "hamatula001" + } + }, { "__struct_id": 0, "CR": { @@ -31138,6 +31214,25 @@ "value": "mikesgod" } }, + { + "__struct_id": 0, + "CR": { + "type": "float", + "value": 3.0 + }, + "FACTION": { + "type": "cexostring", + "value": "Defender" + }, + "NAME": { + "type": "cexostring", + "value": "Spiritual Weapon" + }, + "RESREF": { + "type": "resref", + "value": "prc_spirit_weapn" + } + }, { "__struct_id": 0, "CR": { diff --git a/_module/itp/doorpalcus.itp.json b/_module/itp/doorpalcus.itp.json index a57b61b..9411c49 100644 --- a/_module/itp/doorpalcus.itp.json +++ b/_module/itp/doorpalcus.itp.json @@ -86,6 +86,17 @@ "LIST": { "type": "list", "value": [ + { + "__struct_id": 0, + "ID": { + "type": "byte", + "value": 10 + }, + "STRREF": { + "type": "dword", + "value": 111808 + } + }, { "__struct_id": 0, "ID": { diff --git a/_module/itp/itempalcus.itp.json b/_module/itp/itempalcus.itp.json index c98d183..c1b7f84 100644 --- a/_module/itp/itempalcus.itp.json +++ b/_module/itp/itempalcus.itp.json @@ -3813,6 +3813,17 @@ "type": "resref", "value": "devarobe" } + }, + { + "__struct_id": 0, + "NAME": { + "type": "cexostring", + "value": "Unarmed Spiritual Weapon \"Fists\"" + }, + "RESREF": { + "type": "resref", + "value": "prc_sprtwp_armor" + } } ] }, @@ -10500,6 +10511,17 @@ "value": "elefiendskin045" } }, + { + "__struct_id": 0, + "NAME": { + "type": "cexostring", + "value": "Algoid Hide" + }, + "RESREF": { + "type": "resref", + "value": "prc_hide_algoid" + } + }, { "__struct_id": 0, "NAME": { @@ -12623,6 +12645,17 @@ "value": 12938 } }, + { + "__struct_id": 0, + "NAME": { + "type": "cexostring", + "value": "Myconid Hide" + }, + "RESREF": { + "type": "resref", + "value": "prc_hide_myconid" + } + }, { "__struct_id": 0, "RESREF": { @@ -13316,6 +13349,17 @@ "value": "shadmastskin44" } }, + { + "__struct_id": 0, + "NAME": { + "type": "cexostring", + "value": "Shambling Mound Hide" + }, + "RESREF": { + "type": "resref", + "value": "prc_hide_shambmd" + } + }, { "__struct_id": 0, "RESREF": { @@ -13448,6 +13492,17 @@ "value": "servantprops4" } }, + { + "__struct_id": 0, + "NAME": { + "type": "cexostring", + "value": "Spiritual Weapon Properties" + }, + "RESREF": { + "type": "resref", + "value": "prc_sprtwpn_hide" + } + }, { "__struct_id": 0, "NAME": { @@ -14058,6 +14113,17 @@ "LIST": { "type": "list", "value": [ + { + "__struct_id": 0, + "NAME": { + "type": "cexostring", + "value": "Algoid Slam" + }, + "RESREF": { + "type": "resref", + "value": "prc_slam_algoid" + } + }, { "__struct_id": 0, "NAME": { @@ -15532,6 +15598,17 @@ "value": 16807690 } }, + { + "__struct_id": 0, + "NAME": { + "type": "cexostring", + "value": "Spirtual Weapon Slam" + }, + "RESREF": { + "type": "resref", + "value": "prc_sprtwpn_slam" + } + }, { "__struct_id": 0, "RESREF": { @@ -22919,6 +22996,17 @@ "value": "zep_rose_red" } }, + { + "__struct_id": 0, + "NAME": { + "type": "cexostring", + "value": "Rod of Spawn Banners" + }, + "RESREF": { + "type": "resref", + "value": "spawn_ban_rod" + } + }, { "__struct_id": 0, "NAME": { @@ -25679,6 +25767,17 @@ "value": 767 } }, + { + "__struct_id": 0, + "RESREF": { + "type": "resref", + "value": "prc_scr_997" + }, + "STRREF": { + "type": "dword", + "value": 16790493 + } + }, { "__struct_id": 0, "RESREF": { @@ -28594,6 +28693,17 @@ "value": 16827179 } }, + { + "__struct_id": 0, + "RESREF": { + "type": "resref", + "value": "prc_scr_995" + }, + "STRREF": { + "type": "dword", + "value": 16790488 + } + }, { "__struct_id": 0, "RESREF": { @@ -32763,6 +32873,50 @@ "value": 6340 } }, + { + "__struct_id": 0, + "RESREF": { + "type": "resref", + "value": "prc_scr_874" + }, + "STRREF": { + "type": "dword", + "value": 16790512 + } + }, + { + "__struct_id": 0, + "RESREF": { + "type": "resref", + "value": "prc_scr_865" + }, + "STRREF": { + "type": "dword", + "value": 16790497 + } + }, + { + "__struct_id": 0, + "RESREF": { + "type": "resref", + "value": "prc_scr_868" + }, + "STRREF": { + "type": "dword", + "value": 16790502 + } + }, + { + "__struct_id": 0, + "RESREF": { + "type": "resref", + "value": "prc_scr_871" + }, + "STRREF": { + "type": "dword", + "value": 16790507 + } + }, { "__struct_id": 0, "NAME": { @@ -33863,6 +34017,17 @@ "value": 917 } }, + { + "__struct_id": 0, + "RESREF": { + "type": "resref", + "value": "prc_scr_877" + }, + "STRREF": { + "type": "dword", + "value": 16790517 + } + }, { "__struct_id": 0, "RESREF": { @@ -33962,6 +34127,28 @@ "value": 2671 } }, + { + "__struct_id": 0, + "RESREF": { + "type": "resref", + "value": "prc_scr_880" + }, + "STRREF": { + "type": "dword", + "value": 16790522 + } + }, + { + "__struct_id": 0, + "RESREF": { + "type": "resref", + "value": "prc_scr_881" + }, + "STRREF": { + "type": "dword", + "value": 16790525 + } + }, { "__struct_id": 0, "NAME": { @@ -34655,6 +34842,17 @@ "value": 16829598 } }, + { + "__struct_id": 0, + "RESREF": { + "type": "resref", + "value": "prc_scr_884" + }, + "STRREF": { + "type": "dword", + "value": 16790530 + } + }, { "__struct_id": 0, "NAME": { @@ -36368,7 +36566,7 @@ }, "RESREF": { "type": "resref", - "value": "mc_blckstickbloo" + "value": "mc_blckstickbld" } }, { @@ -36544,7 +36742,7 @@ }, "RESREF": { "type": "resref", - "value": "mc_pieceofleathe" + "value": "mc_pieceofleathr" } }, { @@ -37501,7 +37699,7 @@ }, "RESREF": { "type": "resref", - "value": "mc_grasshopperhl" + "value": "mc_grasshopprhlg" } }, { @@ -46652,17 +46850,6 @@ "value": "hellsdagger66" } }, - { - "__struct_id": 0, - "NAME": { - "type": "cexostring", - "value": "Katar" - }, - "RESREF": { - "type": "resref", - "value": "katar" - } - }, { "__struct_id": 0, "NAME": { @@ -47113,6 +47300,17 @@ "value": "falchion" } }, + { + "__struct_id": 0, + "NAME": { + "type": "cexostring", + "value": "Falchion" + }, + "RESREF": { + "type": "resref", + "value": "prc_wswfa001" + } + }, { "__struct_id": 0, "NAME": { @@ -48212,6 +48410,17 @@ "value": "drowweapon" } }, + { + "__struct_id": 0, + "NAME": { + "type": "cexostring", + "value": "Eagle Claw" + }, + "RESREF": { + "type": "resref", + "value": "bbd_eagle_claw" + } + }, { "__struct_id": 0, "NAME": { @@ -48231,7 +48440,7 @@ }, "RESREF": { "type": "resref", - "value": "elvencourtblade" + "value": "prc_wspec001" } }, { @@ -48242,7 +48451,7 @@ }, "RESREF": { "type": "resref", - "value": "elvenlightblade" + "value": "prc_wspel001" } }, { @@ -48253,7 +48462,7 @@ }, "RESREF": { "type": "resref", - "value": "elventhinblade" + "value": "prc_wspet001" } }, { @@ -48333,6 +48542,17 @@ "value": "goad" } }, + { + "__struct_id": 0, + "NAME": { + "type": "cexostring", + "value": "Goad" + }, + "RESREF": { + "type": "resref", + "value": "prc_wspgd001" + } + }, { "__struct_id": 0, "NAME": { @@ -48374,7 +48594,7 @@ }, "RESREF": { "type": "resref", - "value": "heavypick" + "value": "prc_wblph001" } }, { @@ -48388,6 +48608,17 @@ "value": "hellsablade044" } }, + { + "__struct_id": 0, + "NAME": { + "type": "cexostring", + "value": "Katar" + }, + "RESREF": { + "type": "resref", + "value": "prc_wswdp001" + } + }, { "__struct_id": 0, "NAME": { @@ -48407,7 +48638,7 @@ }, "RESREF": { "type": "resref", - "value": "lightpick" + "value": "prc_wblpl001" } }, { @@ -48564,6 +48795,17 @@ "value": "sahuaginsticker" } }, + { + "__struct_id": 0, + "NAME": { + "type": "cexostring", + "value": "Sai" + }, + "RESREF": { + "type": "resref", + "value": "prc_wswsi001" + } + }, { "__struct_id": 0, "NAME": { @@ -48855,17 +49097,6 @@ "value": "drowner44" } }, - { - "__struct_id": 0, - "NAME": { - "type": "cexostring", - "value": "Eagle Claw" - }, - "RESREF": { - "type": "resref", - "value": "eagleclaw" - } - }, { "__struct_id": 0, "NAME": { @@ -49276,7 +49507,7 @@ }, "RESREF": { "type": "resref", - "value": "sap" + "value": "prc_wspsp001" } }, { @@ -49561,7 +49792,7 @@ }, "RESREF": { "type": "resref", - "value": "maul" + "value": "prc_wxblma001" } }, { @@ -49687,7 +49918,7 @@ }, "RESREF": { "type": "resref", - "value": "heavy_mace" + "value": "prc_wxblmh001" } }, { @@ -50034,7 +50265,7 @@ }, "RESREF": { "type": "resref", - "value": "scimitar_double" + "value": "prc_wxdbsc001" } }, { @@ -50644,7 +50875,7 @@ }, "RESREF": { "type": "resref", - "value": "nunchaku" + "value": "prc_wblnn001" } }, { @@ -50713,17 +50944,6 @@ "value": "ruinwhip44" } }, - { - "__struct_id": 0, - "NAME": { - "type": "cexostring", - "value": "Sai" - }, - "RESREF": { - "type": "resref", - "value": "sai" - } - }, { "__struct_id": 0, "RESREF": { diff --git a/_module/itp/placeablepalcus.itp.json b/_module/itp/placeablepalcus.itp.json index d30f4ea..d4c99b0 100644 --- a/_module/itp/placeablepalcus.itp.json +++ b/_module/itp/placeablepalcus.itp.json @@ -13928,6 +13928,83 @@ "value": "mil_clothingbuil" } }, + { + "__struct_id": 0, + "NAME": { + "type": "cexostring", + "value": "corpse" + }, + "RESREF": { + "type": "resref", + "value": "invis_corpse_bdy" + } + }, + { + "__struct_id": 0, + "NAME": { + "type": "cexostring", + "value": "corpse" + }, + "RESREF": { + "type": "resref", + "value": "invis_corpse_bon" + } + }, + { + "__struct_id": 0, + "NAME": { + "type": "cexostring", + "value": "corpse" + }, + "RESREF": { + "type": "resref", + "value": "invis_corpse_obj" + } + }, + { + "__struct_id": 0, + "NAME": { + "type": "cexostring", + "value": "corpse" + }, + "RESREF": { + "type": "resref", + "value": "invis_corpse_pch" + } + }, + { + "__struct_id": 0, + "NAME": { + "type": "cexostring", + "value": "corpse" + }, + "RESREF": { + "type": "resref", + "value": "invis_corpse_pot" + } + }, + { + "__struct_id": 0, + "NAME": { + "type": "cexostring", + "value": "corpse" + }, + "RESREF": { + "type": "resref", + "value": "invis_corpse_scr" + } + }, + { + "__struct_id": 0, + "NAME": { + "type": "cexostring", + "value": "corpse" + }, + "RESREF": { + "type": "resref", + "value": "invis_corpse_tre" + } + }, { "__struct_id": 0, "NAME": { @@ -22610,6 +22687,17 @@ "LIST": { "type": "list", "value": [ + { + "__struct_id": 0, + "NAME": { + "type": "cexostring", + "value": "Active Spawn" + }, + "RESREF": { + "type": "resref", + "value": "spawn_ban_a" + } + }, { "__struct_id": 0, "NAME": { @@ -22632,6 +22720,17 @@ "value": "buildersnotes1" } }, + { + "__struct_id": 0, + "NAME": { + "type": "cexostring", + "value": "Deactivated Spawn" + }, + "RESREF": { + "type": "resref", + "value": "spawn_ban_d" + } + }, { "__struct_id": 0, "NAME": { @@ -28752,7 +28851,7 @@ "__struct_id": 0, "NAME": { "type": "cexostring", - "value": "Genesis Enterance Portal" + "value": "Genesis Entrance Portal" }, "RESREF": { "type": "resref", diff --git a/_module/ncs/sf_wingwand.ncs b/_module/ncs/sf_wingwand.ncs index a416ab9..bc76f6e 100644 Binary files a/_module/ncs/sf_wingwand.ncs and b/_module/ncs/sf_wingwand.ncs differ diff --git a/_module/ncs/silenttrigger2.ncs b/_module/ncs/silenttrigger2.ncs index 90e8f4e..2274260 100644 Binary files a/_module/ncs/silenttrigger2.ncs and b/_module/ncs/silenttrigger2.ncs differ diff --git a/_module/ncs/spawn_corpse_dcy.ncs b/_module/ncs/spawn_corpse_dcy.ncs new file mode 100644 index 0000000..cf568b4 Binary files /dev/null and b/_module/ncs/spawn_corpse_dcy.ncs differ diff --git a/_module/ncs/spawn_corpse_dth.ncs b/_module/ncs/spawn_corpse_dth.ncs new file mode 100644 index 0000000..94ccc65 Binary files /dev/null and b/_module/ncs/spawn_corpse_dth.ncs differ diff --git a/_module/ncs/spawn_dist_corps.ncs b/_module/ncs/spawn_dist_corps.ncs new file mode 100644 index 0000000..66d26f5 Binary files /dev/null and b/_module/ncs/spawn_dist_corps.ncs differ diff --git a/_module/ncs/spawn_oncloscrp.ncs b/_module/ncs/spawn_oncloscrp.ncs new file mode 100644 index 0000000..3557f5b Binary files /dev/null and b/_module/ncs/spawn_oncloscrp.ncs differ diff --git a/_module/ncs/spawn_onopencrp.ncs b/_module/ncs/spawn_onopencrp.ncs new file mode 100644 index 0000000..67eda7c Binary files /dev/null and b/_module/ncs/spawn_onopencrp.ncs differ diff --git a/_module/ncs/spawn_orig_hb.ncs b/_module/ncs/spawn_orig_hb.ncs new file mode 100644 index 0000000..77d2eb4 Binary files /dev/null and b/_module/ncs/spawn_orig_hb.ncs differ diff --git a/_module/ncs/spawn_pseudohb.ncs b/_module/ncs/spawn_pseudohb.ncs new file mode 100644 index 0000000..bedb4fb Binary files /dev/null and b/_module/ncs/spawn_pseudohb.ncs differ diff --git a/_module/ncs/spawn_sample_hb.ncs b/_module/ncs/spawn_sample_hb.ncs new file mode 100644 index 0000000..77d2eb4 Binary files /dev/null and b/_module/ncs/spawn_sample_hb.ncs differ diff --git a/_module/ncs/spawn_sc_cmptrig.ncs b/_module/ncs/spawn_sc_cmptrig.ncs new file mode 100644 index 0000000..488916f Binary files /dev/null and b/_module/ncs/spawn_sc_cmptrig.ncs differ diff --git a/_module/ncs/spawn_sc_deactiv.ncs b/_module/ncs/spawn_sc_deactiv.ncs new file mode 100644 index 0000000..bc617f8 Binary files /dev/null and b/_module/ncs/spawn_sc_deactiv.ncs differ diff --git a/_module/ncs/spawn_sc_death.ncs b/_module/ncs/spawn_sc_death.ncs new file mode 100644 index 0000000..e797712 Binary files /dev/null and b/_module/ncs/spawn_sc_death.ncs differ diff --git a/_module/ncs/spawn_sc_hbeat.ncs b/_module/ncs/spawn_sc_hbeat.ncs new file mode 100644 index 0000000..9da1da9 Binary files /dev/null and b/_module/ncs/spawn_sc_hbeat.ncs differ diff --git a/_module/ncs/spawn_sc_patrol.ncs b/_module/ncs/spawn_sc_patrol.ncs new file mode 100644 index 0000000..28490c7 Binary files /dev/null and b/_module/ncs/spawn_sc_patrol.ncs differ diff --git a/_module/ncs/spawn_sc_spawn.ncs b/_module/ncs/spawn_sc_spawn.ncs new file mode 100644 index 0000000..6613568 Binary files /dev/null and b/_module/ncs/spawn_sc_spawn.ncs differ diff --git a/_module/ncs/spawn_smpl_onen2.ncs b/_module/ncs/spawn_smpl_onen2.ncs new file mode 100644 index 0000000..a8d66cc Binary files /dev/null and b/_module/ncs/spawn_smpl_onen2.ncs differ diff --git a/_module/ncs/spawn_smpl_onent.ncs b/_module/ncs/spawn_smpl_onent.ncs new file mode 100644 index 0000000..2bafc7b Binary files /dev/null and b/_module/ncs/spawn_smpl_onent.ncs differ diff --git a/_module/ncs/spawn_smpl_onext.ncs b/_module/ncs/spawn_smpl_onext.ncs new file mode 100644 index 0000000..97ea11d Binary files /dev/null and b/_module/ncs/spawn_smpl_onext.ncs differ diff --git a/_module/ncs/spawn_used_corps.ncs b/_module/ncs/spawn_used_corps.ncs new file mode 100644 index 0000000..7b93683 Binary files /dev/null and b/_module/ncs/spawn_used_corps.ncs differ diff --git a/_module/ncs/spawnb_cc_activ.ncs b/_module/ncs/spawnb_cc_activ.ncs new file mode 100644 index 0000000..de4d166 Binary files /dev/null and b/_module/ncs/spawnb_cc_activ.ncs differ diff --git a/_module/ncs/spawnb_cc_dactiv.ncs b/_module/ncs/spawnb_cc_dactiv.ncs new file mode 100644 index 0000000..77e80d7 Binary files /dev/null and b/_module/ncs/spawnb_cc_dactiv.ncs differ diff --git a/_module/ncs/spawnb_cc_dump.ncs b/_module/ncs/spawnb_cc_dump.ncs new file mode 100644 index 0000000..361de37 Binary files /dev/null and b/_module/ncs/spawnb_cc_dump.ncs differ diff --git a/_module/ncs/spawnb_cc_nodump.ncs b/_module/ncs/spawnb_cc_nodump.ncs new file mode 100644 index 0000000..58bdbf9 Binary files /dev/null and b/_module/ncs/spawnb_cc_nodump.ncs differ diff --git a/_module/ncs/spawnb_cc_notrck.ncs b/_module/ncs/spawnb_cc_notrck.ncs new file mode 100644 index 0000000..d044dde Binary files /dev/null and b/_module/ncs/spawnb_cc_notrck.ncs differ diff --git a/_module/ncs/spawnb_cc_nsclog.ncs b/_module/ncs/spawnb_cc_nsclog.ncs new file mode 100644 index 0000000..1da7b91 Binary files /dev/null and b/_module/ncs/spawnb_cc_nsclog.ncs differ diff --git a/_module/ncs/spawnb_cc_nsdlog.ncs b/_module/ncs/spawnb_cc_nsdlog.ncs new file mode 100644 index 0000000..f5d8703 Binary files /dev/null and b/_module/ncs/spawnb_cc_nsdlog.ncs differ diff --git a/_module/ncs/spawnb_cc_sclog.ncs b/_module/ncs/spawnb_cc_sclog.ncs new file mode 100644 index 0000000..08533e5 Binary files /dev/null and b/_module/ncs/spawnb_cc_sclog.ncs differ diff --git a/_module/ncs/spawnb_cc_sdlog.ncs b/_module/ncs/spawnb_cc_sdlog.ncs new file mode 100644 index 0000000..718c9dc Binary files /dev/null and b/_module/ncs/spawnb_cc_sdlog.ncs differ diff --git a/_module/ncs/spawnb_cc_trck.ncs b/_module/ncs/spawnb_cc_trck.ncs new file mode 100644 index 0000000..b616030 Binary files /dev/null and b/_module/ncs/spawnb_cc_trck.ncs differ diff --git a/_module/ncs/spawnb_sample_ai.ncs b/_module/ncs/spawnb_sample_ai.ncs new file mode 100644 index 0000000..9823929 Binary files /dev/null and b/_module/ncs/spawnb_sample_ai.ncs differ diff --git a/_module/ncs/spawnb_sc_activ.ncs b/_module/ncs/spawnb_sc_activ.ncs new file mode 100644 index 0000000..d932f40 Binary files /dev/null and b/_module/ncs/spawnb_sc_activ.ncs differ diff --git a/_module/ncs/spawnb_sc_dactiv.ncs b/_module/ncs/spawnb_sc_dactiv.ncs new file mode 100644 index 0000000..9859011 Binary files /dev/null and b/_module/ncs/spawnb_sc_dactiv.ncs differ diff --git a/_module/ncs/spawnb_sc_disp.ncs b/_module/ncs/spawnb_sc_disp.ncs new file mode 100644 index 0000000..7dc5ec1 Binary files /dev/null and b/_module/ncs/spawnb_sc_disp.ncs differ diff --git a/_module/ncs/spawnb_sc_dump.ncs b/_module/ncs/spawnb_sc_dump.ncs new file mode 100644 index 0000000..7983387 Binary files /dev/null and b/_module/ncs/spawnb_sc_dump.ncs differ diff --git a/_module/ncs/spawnb_sc_nodump.ncs b/_module/ncs/spawnb_sc_nodump.ncs new file mode 100644 index 0000000..668b2fe Binary files /dev/null and b/_module/ncs/spawnb_sc_nodump.ncs differ diff --git a/_module/ncs/spawnb_sc_notrck.ncs b/_module/ncs/spawnb_sc_notrck.ncs new file mode 100644 index 0000000..417f948 Binary files /dev/null and b/_module/ncs/spawnb_sc_notrck.ncs differ diff --git a/_module/ncs/spawnb_sc_nsdlog.ncs b/_module/ncs/spawnb_sc_nsdlog.ncs new file mode 100644 index 0000000..fdf1634 Binary files /dev/null and b/_module/ncs/spawnb_sc_nsdlog.ncs differ diff --git a/_module/ncs/spawnb_sc_sclog.ncs b/_module/ncs/spawnb_sc_sclog.ncs new file mode 100644 index 0000000..db1b06a Binary files /dev/null and b/_module/ncs/spawnb_sc_sclog.ncs differ diff --git a/_module/ncs/spawnb_sc_sdlog.ncs b/_module/ncs/spawnb_sc_sdlog.ncs new file mode 100644 index 0000000..dcb9323 Binary files /dev/null and b/_module/ncs/spawnb_sc_sdlog.ncs differ diff --git a/_module/ncs/spawnb_sc_snclog.ncs b/_module/ncs/spawnb_sc_snclog.ncs new file mode 100644 index 0000000..f53ea12 Binary files /dev/null and b/_module/ncs/spawnb_sc_snclog.ncs differ diff --git a/_module/ncs/spawnb_sc_trck.ncs b/_module/ncs/spawnb_sc_trck.ncs new file mode 100644 index 0000000..ba787d5 Binary files /dev/null and b/_module/ncs/spawnb_sc_trck.ncs differ diff --git a/_module/ncs/spawnbanner.ncs b/_module/ncs/spawnbanner.ncs new file mode 100644 index 0000000..c318226 Binary files /dev/null and b/_module/ncs/spawnbanner.ncs differ diff --git a/_module/nss/messagewarning.nss b/_module/nss/messagewarning.nss index 2c4146a..63e5e57 100644 --- a/_module/nss/messagewarning.nss +++ b/_module/nss/messagewarning.nss @@ -19,6 +19,6 @@ DelayCommand(4.0, FloatingTextStringOnCreature("Speak with the Master of the Voi DelayCommand(5.0, FloatingTextStringOnCreature("If you like playing here, play by the rules, or you won't be permitted to play here.", oPC)); -DelayCommand(6.0, FloatingTextStringOnCreature("WARNING! Promoting other Modules or Servers at anytime will get you banned, instantly!", oPC)); +//DelayCommand(6.0, FloatingTextStringOnCreature("WARNING! Promoting other Modules or Servers at anytime will get you banned, instantly!", oPC)); } diff --git a/_module/nss/spawn__history.nss b/_module/nss/spawn__history.nss new file mode 100644 index 0000000..81496a3 --- /dev/null +++ b/_module/nss/spawn__history.nss @@ -0,0 +1,544 @@ +// +// +// NESS +// Version 8.1.3 +// Spawn History +// +// +// Neshke Narovken (Original Author) +// +// Cereborn (Maintainer) +// +//******************************************************************* +// +// History: +// +// +++ Start Version 7.0 +// +// --/--/-- Neshke Created +// +// +// +++ Start Version 7.0.1 +// +// 12/03/02 Cereborn Added DanielleB's merchant-based loot tables +// 12/12/02 Cereborn Added area-wide count of currently spawned +// creatures +// 12/31/02 Cereborn Added LT subflags A, B, and C for specifying +// percentage chances of receiving 1, 2, or 3 +// loot items. +// 01/01/03 Cereborn Added SX flag for dim returns suppression. +// +// +++ Start Version 7.0.2 +// +// 01/07/03 Cereborn Added NESS_ActivateSpawn(), +// NESS_DeactivateSpawn, NESS_GetSpawnByID(), +// NESS_ActivateSpawnByID(), NESS_ForceProcess() +// NESS_DeactivateSpawnByID() and +// NESS_TrackModuleSpawns(). +// Modified so that an activated spawn is processed +// immediately instead of waiting for the next +// process tick when using SPxx +// Moved ReportSpawns and TrackModuleSpawns +// to spawn_functions from spawn_main; modified +// spawn_main to call TrackModuleSpawns() if +// enabled, removing the need for placing +// in each area heartbeat script +// +// 01/08/03 Cereborn Fixed bug preventing initial flag processing +// when using SPxx. +// Added new deactivate spawn (DS) condition +// (6) which deactivates a spawn whenever spawn +// count reaches spawn number. This is similar +// to DS1, except that DS1 is based on number +// of children *ever* spawned, so once +// deactivated can never be reactivated, while +// DS6 is based on current child count, allowing +// the spawn to be re-activated if 1 or more of +// it's children have been killed or despawned +// 01/10/03 Cereborn Prevent despawning creatures when possessed +// by a DM. (the code was attempting to do so +// already but due to a Bioware bug it wasn't +// working) +// 01/11/03 Cereborn Added I subflag to SU to check each child's +// location individually instead of the spawn's +// location +// 01/17/03 Cereborn Added force process of spawns when PCs +// re-arrive id deactivated by PC flag +// 01/18/03 Cereborn Added new type (3) to PL and subflag P +// Added P subflag to SD. +// 01/20/03 Cereborn Force process on deactivate +// Added NESS_IsModuleSpawnTracking() +// +// +++ Start Version 7.0.3 +// +// 01/22/03 Cereborn Bug fix: Initialize module spawn count to +// 0 to fix bug with loading from saved games +// 01/24/03 Cereborn Added NESS_DumpModuleSpawns() and +// NESS_IsModuleSpawnDumping(). When spawn +// dumping is enabled, each area with active +// spawns reports its spawn count each HB +// +// +// +++ Start Version ALFA 1.0 +// +// +// 02/05/03 - 03/21/03 +// +// Added NESS_ProcessDeadCreature(). This can be used to notify NESS that +// a spawned creature has died (typically from an onDeath event script). +// This is particularly useful when using larger SPxx values and the CD +// flag, since without notification it can take a long time for NESS to +// discover that the spawned creature has died and set up the lootable +// corpse. +// +// Added O(ffset) subflag to the SP flag. NESS now processes all spawns on +// the first heartbeat, and then spawns are be processed on heartbeat +// 1 + offset + (processRate * N). For example, SP3 gets processed on +// heartbeats 1, 4, 7, 10, etc.... while SP3O1 gets processed on heartbeats +// 1, 5, 8, 11..., and so on. This should be used to spread out heartbeats +// within an area. +// +// NESS no longer does any timing based on counted heartbeats. All timings +// are now based on the clock. A new file, spawn_timefuncs, contains +// functions for converting the game clock to real seconds for use in NESS +// timings. +// +// When spawns despawn due to using the PC flag (and if the R subflag is +// not specified) the despawning creature resrefs and their locations are +// recorded, and the spawn is restored to it previous state when PCs +// re-enter the area. This prevents exploits where players intentionally +// 'pop' a zone, then leave for the PC flag's duration, to effectively +// clear an area of all obstacles until the spawn delay timer (if any) +// expires. +// +// Fixed the bug causing corpses that had been fully looted to not decay. +// +// Fixed the bug that caused corpses to *never* decay if the decay timer +// went off when the inventory was open (now a new decay timer is set). +// +// Flag parsing code cleaned up; fixed a bug that caused the default value +// for a flag to always be 1 (ignoring what was set up in spawn_cfg_global) +// +// Items marked no-drop are no longer copied onto the lootable corpses +// +// All no-drop items are explicitly destroyed (whether the CD flag is used +// or not) to working around a current Bioware memory leak. +// +// Added NESS_ReturnHome(). Call to force a NESS spawn to it's home point. +// +// Added support for RH flag on spawn camps. +// +// +++ Start Version ALFA 1.0 Patch 1 (v1.0.1) +// +// 03/29/03 +// +// A bug where spawn delays were being applied to first time spawns that +// didn't happen right away (such as triggered spawns, day/night only, +// etc.) was fixed. +// +// If a spawn has the RH flag and is respawned after being despawned due +// to the PC flag, creatures will respawn at their home point instead of +// where they were when they despawned. +// +// An errant debug statement was removed. +// +// +++ Start Version ALFA 1.0 Patch 2 (v1.0.2) +// +// 03/30/03 +// +// Fixed a bug where the number of creatures in a spawn was getting +// confused due to spawns that use the M subflag of the SN flag +// recalculating their spawn numbers when spawns deactivated due to the +// PC flag. This bug fix should eliminate the overpopulating spawns +// problem. +// +// +++ Start Version ALFA 1.0 Patch 3 (v1.0.3) +// +// 03/31/03 +// +// Fixed a bug where spawn delays could be skipped. +// +// +++ Start Version ALFA 1.0 Patch 4 (v1.0.4) +// +// 04/04/03 +// +// Fixed a bug where spawn delays were ignored on placeables. +// Fixed P subflag of SD being ignored. +// Reset spawn delay after RS-failed spawn attempt +// Set up a new spawn delay when creature killed +// +// +++ Start Version ALFA 1.0 Patch 5 (v1.0.5) +// +// 04/07/03 +// +// Fixed bug in spawn_timefuncs that resulting in incorrect conversions +// in years other than the Epoch year. +// Changed the Epoch year to 1340 to conform to the lowest date in +// the NWN engine. +// +// +++ Start Version ALFA 1.0 Patch 6 (v1.0.6) +// +// 04/08/03 +// +// Fixed bug with corpse decay and death script flags not being available +// for camp spawns when onDeath notification occurs. +// +// +++ Start Version ALFA 1.0 Patch 7 (v1.0.7) +// +// 04/27/03 +// +// Added debugging for spawn delays and spawn counts that can be +// independently enabled/disabled for each area from the spawn banner +// rod. +// +// +++ Start Version ALFA 1.1 (v1.1) +// +// 04/28/03 +// +// Fixed bug in Loot Merchant code. The original code used +// GetNearestObjectByTag() to look up loot merchants, which according to +// the documentation should never have worked for merchants not in the same +// area as the creature spawned. In reality, it stopped working (at least +// in some cases) after Bioware released version 1.29 of the game. +// +// 05/03/03 +// +// Changed distribution method used for SR flag to evenly distribute +// spawns in the spawn circle instead. The old method made the spawns +// denser near the center and rarer near the circle's edge +// +// Made SF work (again?) for placeables +// +// When the SF flag is not specified for a multi-child spawn, a random +// SF is now calcualated independently for each child +// +// 05/08/03 +// +// Added NL (No Loot) flag. This suppresses looting of player corpses. +// Only applies when using ACR 1.14 and higher +// +// 05/25/03 +// +// Fixed overspawning bug caused by changing child counts on spawns that +// had been 'saved' with potentially different counts +// +// 05/27/03 +// +// Added C (Closest) subflag to the PR (Patrol Route) flag. If C is +// specified, the spawned creature will start at the closest waypoint +// rather than the first (does not apply to T2 flagged routes(random +// traverse)). +// +// 05/30/03 +// +// Added SB (Subdual) flag. Causes creatures to be spawned in in subdual +// mode. Only applies when using ACR 1.14 and higher. +// +// +// +++ Start Version ALFA 1.2 (v1.2) +// +// 08/24/03 +// +// Removed LocationToString() function from spawn_functions, as this is +// now a Bioware function +// +// 08/25/03 +// +// Modified the way the SX flag works. First, there is now a global flag, +// nGlobalSuppressDR, in spawn_cfg_global that can be set to determine +// whether or not creatures spawn in with DR on or off when no SX flag is +// specified. The current default is for DR to *not* be suppressed, i.e., +// it will be operational. Also, the SX flag can now take a value of 0 or 1. +// If 1, DR is suppressed, if 0 DR is enabled (useful if you've set +// nGlobalSuppressDR to 1). The default if no value is specified (just SX) +// is 1 (to suppress). You can also change this default in spawn_cfg_global. +// If nGlobalSuppressDR is 1 and nSuppressDR is 0, you will get the opposite +// of the v1.1 functionality; no DR on creatures, except when the SX flag is +// present. +// +// +++ Start Version ALFA 1.2.1 (v1.2.1) +// +// 09/01/03 +// +// Fixed bug where spawn number was always being set to the number of saved +// camp spawns on PC-flag restore instead of the sum of saved camp and +// regular spawn counts. +// +// +++ Start Version ALFA 1.2.2 (v1.2.2) +// +// 09/02/03 +// +// Fixed bug introduced by last bug fix that caused overspawning! +// +// +++ Start Version ALFA 1.2.3 (v1.2.3) +// +// 09/21/03 +// +// Added EL - E(ncounter) L(evel) flag +// +// +++ Start Version ALFA 1.2.4 (v1.2.4) +// +// 10/03/03 +// +// Added I subflag to SL flag. +// +// Modified ST behavior so that spawned creatures walk to their seats +// instead of running +// +// 10/18/03 +// +// Check night / day only, day, hour, lifespan and SU before restoring +// spawns +// +// Fixed recalculate random spawn number bug where the spawn number could +// change before a despawn due to the PC flag was restored, causing the +// number of creatures thought to exist to differ from what actually got +// restored +// +// 10/19/03 +// +// Fixed SD bug; under certain cases (such as a despawn due to CL flag) +// SD was being ignored. +// +// Fixed bug where SU|I only worked if RS or SL were in use +// +// +++ Start Version ALFA 1.2.5 (v1.2.5) +// +// 10/25/03 +// +// Do a ClearAllActions() before despawning creatures. This helps prevent +// 'broken' Bioware chairs caused by despawning creatures using the ST +// flag. +// +// 10/27/03 + +// Modified the spawn_cfg_camp example to use standard BW creatures / +// placeables for the benefit of non-ALFA users. +// +// +// 11/02/03 +// +// Added a scaled encounter example. This uses the same basic methodology +// as Sareena's random wilderness spawns - an SNxx flag is given large +// enough for the largest possible spawn and then the actual number (and +// types) of creatures is determined when the spawn actually takes place. +// +// +// +++ Start Version 8.0 +// +// Given that NESS is now being supported outside the ALFA umbrella, I've +// decided to begin version numbering from 8.0 from here out. Version 8.0 +// is the immediate successor to ALFA version 1.2.5. +// +// 01/19/04 +// +// Fixed problems with naked NPC corpses that had droppable armor / +// clothing. playable race characters (humans, dwarves, elves, etc.) +// now keep a copy of whatever is in the chest slot on the original +// corpse. +// +// +// 01/21/04 +// +// Added Rn subflag to CD to specify what type of remains are left after +// corpse decay. These correspond 1 to 1 to the treasure type field for +// placeables, except for R7, which causes no loot bag to be left (loot +// destroyed when corpse decays). See the specific flag documentation +// below for the values/types of each R subflag. +// +// Added D subflag to CD to cause corpse to drop wielded weapons on the +// ground. Note that droppable flag on weapon still takes precedence - +// non-droppable wielded weapons will not be dropped. +// +// Delete armor/clothing from corpse if looted. +// +// Added scripts for lootable corpse onOpen, onClosed, onUsed, and +// onDisturbed events (renamed with a spawn_ prefix). +// +// Added a lootable corpse placeable for each remains type; each has the +// correct event scripts attached. +// +// 01/22/04 +// +// Initialize global defaults and flags on first area heartbeat, not first +// heartbeat with PCs present. +// +// Use DelayCommand(0.0, ...) to give each spawn flag initialization +// function its own command queue (allowing many more spawn points before +// TMIs at initialization occur). +// +// 01/23/04 +// +// Fixed bug with EE flag. Spawned creature was not walking to spawn point +// after entrance. +// +// Fixed bug with spawn in effect when using EE. Spawn in effect now happens +// at the entrance point. +// +// Added support for ALFA-specific flags as Custom Flags (following the CF +// flag. Parsing and processing of custom flags can now be done by +// modifying spawn_cfg_cusflg. This file contains 2 functions: +// ParseCustomFlags() and SetupCustomFlags(). ParseCustomFlags is called +// with whatever flags follow the CF_ flag (when flags for the spawn are +// being initialized. Typically, flags are parsed and there values are +// written to the spawn object. SetupCustomFlags() is called when a +// creature is actually spawned (typically flags are copied from the spawn +// object to the creature (spawned) object. The processing of ALFA-specific +// flags are included in this file as an example. +// +// +// +++ Start Version 8.1 +// +// 1/29/04 +// +// Put better sounds for closing / opening corpses. Changed the names of +// the onOpen and onClose event scripts for corpses, and updated the corpse +// placeables to use those. +// +// 2/15/04 +// +// Fixed bugs in spawn_cfg_cusflag that caused flag values to be lost if +// specified as normal flags rather than custom flags (only affected the +// ALFA custom flags). +// +// 3/8/04 +// +// 'Home' is now either the place a creature spawned in, or the place it +// *would have spawned in* if there wasn't an alternate specified by the EE +// flag. Hopefully, this restores it to its original, correct behavior. +// +// The initial delay subflag of IS should now work correctly. +// +// The corpse remains type default value was using one variable name in +// spawn_defaults to set it and a different one in spawn_functions to +// retrieve the value, which resulted in the default not working. This has +// been fixed. +// +// Added 2 new Patrol Route flags at Danmar's request. They are RPn (for +// random pause and RRn for Random Route. These allow for some +// randomization of patrol routes. The RRn flag sets the percentage chance +// that the next stop in a route will actually be gone to (otherwise it's +// skipped. RPn specifies a range to randomly choose an additional pause +// amount which is added to the value specified by PSn. +// +// At EPOlson's request, NESS will now look for a local string variable on +// the spawn waypoint named "NESS" for spawn flags. If no string is found +// (or if it does not start with "SP") then the flags specified in the +// waypoint name are used (just like it used to). +// +// NESS now has full support for using pseudo-heartbeats as an alternative +// to the standard area heartbeats. For those who wish to use this, remove +// Spawn() from your area heartbeat script (or, if spawn_sample_hb is your +// area haertbeat script, just remove that script from your areas' On +// Heartbeat slots) and call Spawn_OnAreaEnter() and Spawn_OnAreaExit() +// from your area On Enter and On Exit scripts respectively. Again, if you +// do no currrent have On Enter and or On Exit scripts in use for your areas +// you can use spawn_smpl_onent and spawn_smpl_onext which are provided with +// this release. +// +// Spawn_OnAreaEnter() takes up to 3 optional arguments. The first is the +// name of the script you want called when the pseudo-heartbeat happens. +// By default, spawn_sample_hb is called (which in turn just calls Spawn(). +// You can put any script you like there, but remember that it will only be +// when PCs or NESS creatures are in the area. The second argument is the +// time between pseudo-heartbeats. The default is 6.0 seconds, which will +// result in Spawn() being called about as often as when you used regular +// area heartbeats. If you find you can get away with 10.0 seconds (that's +// what I'm currently using) you've reduced your NESS processing by 40%... +// The 3rd argument specifies a delay for the first heartbeat after a PC or +// PCs enter the area. In areas where there aren't a lot of spawns, and +// you are spawning in sight (like NPCs in a store) no delay is ideal. For +// outdoor areas with a lot of spawns that spawn away from the player, a +// delay helps prevent a spawn lag spike for the entering player. The +// default is 0.0 seconds (no delay). I'm currently delaying 3 seconds on +// all outdoor and underground areas, but no delay on indoor areas, by +// the following in my On Enter script: +// +// if ( GetIsAreaAboveGround( oCurrArea ) && +// ! GetIsAreaNatural( oCurrArea ) ) +// { +// // Indoors - no delay on the first HB +// Spawn_OnAreaEnter( "spawn_sample_hb", 10.0 ); +// } +// +// else +// { +// // Outdoors or underground - do a 3 second delay on the first HB +// Spawn_OnAreaEnter( "spawn_sample_hb", 10.0, 3.0 ); +// } +// +// Thanks to Mentha Arvensis who provided the starting scripts for pseudo- +// heartbeats. +// +// +// +++ Start Version 8.1.1 +// +// 2/1/04 - 5/28/04 +// +// +// NESS now allows you to specify the spawn tag by adding a variable, named +// "NESS_TAG", on the spawn waypoint. If this variable exists, it will use +// it's value as the spawn tag instead of waypoint's tag. +// +// Always retrieve spawn tag and spawn name from the variables written on +// the the spawn instead of using GetTag() an GetName(). This is necessary +// to support use of the "NESS" and "NESS_TAG" variables. +// +// Added a global flag, bLeftoversForceProcessing, to indicate whether or +// not spawned creatures in an area should cause NESS processing when no +// PCs are in the area. Default is TRUE (they do) which is how things +// worked before the flag was added. The flag essentially gives you the +// ability to suppress that behavior. To do so, set +// bLeftoversForceProcessing to FALSE in your spawn_cfg_global script. +// +// Added some bullet-proofing to check that spawn waypoints remain valid +// objects. +// +// Turned off ALL NESS processing of creatures that are DM possessed. +// +// Make sure a patrol waypoint actually exists before attempting to move to +// it. +// +// Normal Camp behavior is to despawn when all creatures in the camp have +// been destroyed. However, they were also despawning if there were never +// any creatures in the camp to begin with (a placeable-only camp). This +// was fixed. +// +// Loot/corpse decay was not working properly on camps, as the changes to +// this system to the regular spawns was never propagated to the camps. +// Fixed. +// +// +++ Start Version 8.1.2 +// +// 5/30/04 +// +// Advance routes to their next stop when patrol waypoints are missing +// +// +++ Start Version 8.1.3 +// +// 7/04/04 +// +// Write a local var onto entering PCs which can be checked on area exit +// to maintain a proper PC count. This is necessary because GetIsPC() does +// not work when a PC logs out. +// +// Don't call NESS_CleanInventory on camp placeables when a camp is +// destroyed, as the placeables may remain for a while. +// +// 7/05/04 +// +// Added code to detect stalled patrol routes and jump the creature to it's +// intended destination. This can be turned off by setting +// CheckForStuckPatrols global variable to FALSE. +// +// Write oSpawn onto the camp object "before" the call to SetCampSpawn() so +// it is available to that function. +// +// Added flag to turn off corpse destruction when CD is not specified. +// +// Added additional on area enter script with indoor/outdoor checking to +// determine if an initial delay should be used. +// +// 7/06/04 +// +// Added check to randomWalk for ACTION_CASTSPELL to avoid interruptions diff --git a/_module/nss/spawn__readme.nss b/_module/nss/spawn__readme.nss new file mode 100644 index 0000000..d2e4a46 --- /dev/null +++ b/_module/nss/spawn__readme.nss @@ -0,0 +1,694 @@ +// +// +// NESS +// Version 8.1.2 +// Spawn Readme +// +// +// Neshke Narovken (Original Author) +// +// Cereborn (Maintainer) +// +//******************************************************************* +// +// +// INCLUDES: +// +// Do NOT Modify Main Script: +// +// Spawn: 'spawn_main' +// +// Do NOT Modify Helper Scripts: +// +// Information: 'spawn__readme' +// Functions: 'spawn_functions' +// Corpse Death: 'spawn_corpse_dth' +// Corpse Decay: 'spawn_corpse_dcy' +// Global Defaults: 'spawn_defaults' +// Flag Parsing: 'spawn_flags' +// Pseudo-heartbeat 'spawn_pseudohb" +// +// Lootable corpse event scripts: + +// Corpse On Open: 'spawn_onopencrp' +// Corpse On Closed: 'spawn_oncloscrp' +// Corpse disturbed: 'spawn_dist_corps' +// Corpse used: 'spawn_used_corps' +// +// +// CONFIGURATION: +// +// Modify Configuration Includes if Needed +// Only where Specified in Each File: +// +// Spawn Flags: 'spawn_cfg_flag' +// Spawn Groups: 'spawn_cfg_group' +// Loot Tables: 'spawn_cfg_loot' +// Spawn Camps: 'spawn_cfg_camp' +// Spawn Effects: 'spawn_cfg_fxsp' +// Area Effects: 'spawn_cfg_fxae' +// Object Effects: 'spawn_cfg_fxobj' +// User Defaults: 'spawn_cfg_global' +// Custom Flags: 'spawn_cfg_cusflg' +// +// Modify Check Includes if Needed +// Only where Specified in each File: +// +// Check PCs: 'spawn_chk_pcs' +// Custom Check: 'spawn_chk_custom' +// +// Modify Scripting Includes if Needed +// Only where Specified in Each File: +// +// Spawn/Despawn: 'spawn_sc_spawn' +// Heartbeat: 'spawn_sc_hbeat' +// Death: 'spawn_sc_death' +// Deactivation: 'spawn_sc_deactiv' +// Camp Trigger: 'spawn_sc_cmptrig' +// Patrol Stops: 'spawn_sc_patrol' +// +// +// USAGE: +// +// Add Following to Area Heartbeat: +// +// Sample Script: 'spawn_sample_hb' +// +// #include "spawn_main" +// Spawn(); +// +// Add Spawn Waypoints +// All Switches Optional +// +// Waypoint Name: +// SP_ +// +// Waypoint Tag: +// Child Object Tag/ResRef +// Group Designation +// Camp Designation +// +// Note: +// For Custom Creatures +// You must use the ResRef +// +// Available Flags: +// SPnOn_ISnDn_IDn_FTn_SNnMn_SAnMn_SRnMnP_SDnMn_CLnMn +// _RGnMnCn_RWRn_DYnTn_HRnTn_DOD_NOD_PCnR_SF_SUnIn_FXnDn +// _PRnTn_PLnTn_EEnRn_EXnRn_SG_CDnTnRnD_LTnAnBnCn_DSnSn_DIn_CMDn +// _SSnDn_CCn_CPnRn_TRnDn_AEnDn_OEnDn_RSn_FCn +// _ALnSn_HBn_SLnRnI_RHDn_DTn_HLnE_IT_ST_PT_SM_CF +// _SXn_NL_SB_ELn +// +// +// Format: +// Flag|OptionalFlag +// +// +// SPn|On +// : Designates Spawn Waypoint +// : SP is Required on all Spawn Waypoints +// : Performs Spawn processing every SP1 to SP99 heartbeats +// : Default is SP1 Heartbeat : ~6 Seconds +// : SP00 Defaults to SP01 +// : Optional Flag: On +// : Offset processing spawn from first process by n heartbeats. +// : Used to stagger spawn processing within an area +// +// ISn|Dn +// : Initial State +// : Type 0 : Inactive +// : Type 1 : Default : Active +// : Optional Flag: D000 +// : Delay Initial Spawn D000 Minutes +// +// IDn +// : SpawnID +// : Sets LocalInt "SpawnID" to SpawnID +// : On Spawn Waypoint Object +// +// FTn +// : Flag Table +// : Use Flags from Table FT00 +// : Flags are Defined in 'spawn_cfg_flag' +// +// +// SNn|Mn +// : Spawn Number +// : Maintains a Spawn of SN00 to SN99 Children +// : Despawns Extra Children +// : Optional Flag: M00 +// : Minimum Children +// : Will Randomly Spawn between M00 and SN00 Children +// +// SA|n|Mn +// : Spawn All at Once +// : Default is Spawn One Child per Cycle +// : Optional Flag: 00 +// : Spawn 00 Children per Cycle +// : Optional Flag: M00 +// : Spawn Minimum M00 per Cycle +// +// SRn|Mn|P +// : Spawn Radius +// : Randomly Spawns Children in a +// : Location SR00 to SR99 Meters from Waypoint +// : Optional Flag: M00 +// : Minimum Radius, M00 to SR99 Meters +// : Optional Flag: P +// : Spawn Center is Near a Random PC in Area +// +// SDn|Mn|P +// : Spawn Delay +// : Delay SD00 to SD99 Minutes between Spawns +// : Optional Flag: M00 +// : Minimum Delay, M00 to SD99 Minutes +// : Optional Flag: P +// : This flag sets up a spawn period, whereas the default spawn delay +// : specifies a spacing between spawns. +// : This is particularly useful with PL3 (keep the times the same on +// : each) it will cause the placeable to refresh if alive or respawn +// : if not on a regular schedule. Note that if the P subflag is used, +// : the M subflag is ignored. +// +// +// CLn|Mn +// : Child Lifespan +// : Child will Despawn after CL00 Minutes +// : Optional Flag: M00 +// : Child will Despawn after M00 to CL00 Minutes +// +// DYn|Tn +// : Spawn Day +// : Spawn Only on Day DY00 to DY28 +// : Children are Despawned during Invalid Days +// : Optional Flag: T00 +// : Spawn from Day DY00 to Day T00 +// +// HRn|Tn +// : Spawn Hour +// : Spawn Only during Hour HR00 to HR24 +// : Children are Despawned during Invalid Hours +// : Optional Flag: T00 +// : Spawn from Hour HR00 to Hour T00 +// +// DO|D +// : Day Only +// : Only Spawns at Day +// : Optional Flag: D +// : Despawn Children at Nightfall +// +// NO|D +// : Night Only +// : Only Spawns at Night +// : Optional Flag: D +// : Despawn Children at Daybreak +// +// RW|Rn +// : Random Walk +// : Children Wander Randomly +// : Optional Flag: R00 +// : WARNING: This is Resource Intensive!! +// : Wander Range, R00 to R99 Meters +// +// PC|n|R +// : PC Check +// : Only Spawn Children if PCs are in Area +// : Children are Despawned if no PCs in Area +// : Optional Flag: PC00 +// : Depawn if no PCs in Area for PC00 Minutes +// : Optional Flag: R +// : Reset Spawn Point if no PCs are Present +// +// RGn|Mn|Cn +// : Random Gold +// : Generates Random Amount of Gold on Children +// : From RG000 to RG999 Gold +// : Optional Flag: M00 +// : Minimum Gold Amount +// : Optional Flag: C00 +// : Gold Chance C00% to C99% +// : Default 100% chance +// +// SF +// : Spawn Facing +// : Set Facing of Children to Match Waypoint +// : Default Random Facing +// +// SUn|In +// : Spawn Unseen +// : Only Spawn if PCs are not within SU00 to SU99 Meters +// : Optional flag: I00 +// : Use the location of each individual child to determine if that +// : child can spawn, instead of using to location of the spawn itself. +// : If using SR or SL|R, I00 to I99 additional random locations will be +// : attempted +// +// FXn|Dn +// : Spawn Effect +// : Spawn in with Effect FX001 to FX999 +// : Effects are Defined in 'spawn_cfg_fxsp' +// : Optional Flag: D000 +// : Despawn with Effect D001 to D999 +// +// PRn|Tn|C +// : Patrol Route +// : Assign Waypoints Route PR00 to PR99 +// : Optional Flag: T0 +// : Route Type +// : 0 - Sequential +// : 1 - Circular +// : 2 - Random +// : 3 - Walk Once/Despawn +// : Optional Flag C +// : Start at closest waypoint. Does not apply to T2 (random) +// : +// : Route Name: Variable +// : Route Tag: PR00_SN00_PS000_RN_FC_DO_NO_SC000 +// : +// : PR - Route Number 00 to 99 +// : SN - Stop Number 00 to 99 +// : PS - Pause 000 to maxint seconds at Stop +// : RP - Random additional amount (0 - maxint) added to PS +// : RN - Run to Stop +// : RR - Percentage chance a Stop will be visited (skipped otherwise) +// : SF - Face the Waypoint Direction +// : DO - Only Stop here during the Day +// : NO - Only Stop here during the Night +// : SC - Run script 000 to 999 +// : Scripts are Defined in 'spawn_sc_patrol' +// +// EEn|Rn +// : Entrance/Exit +// : Enter and Exit at Waypoint EE00 +// : Optional Flag: R +// : Choose Random Entrance Exit +// : from R00 to EE00 +// : +// : Entrance/Exit Name: Variable +// : Entrance/Exit Tag: EE00 +// +// EXn|Rn +// : Exit +// : Exit at Waypoint EX00 +// : Optional Flag: R +// : Choose Random Exit +// : from R00 to EX00 +// : +// : Exit Name: Variable +// : Exit Tag: EX00 +// +// PLn|Tn|Pn +// : Placeable Object +// : Spawns a Placeable Object with Behavior +// : Behavior 0: Default Behavior +// : Behavior 1: Despawn if Empty +// : Behavior 2: Refill if Empty (after spawn delay minutes!) +// : Behavior 3: Refresh (despawn/respawn) every P000 minutes; default +// : (if no Pn specified) is 60 minutes +// : Optional Flag: T00 +// : Trap Disabled Chance +// : 00% to 99% chance of Trap Disabled +// : Trap must already be part of Placeable's Template +// : Default 100% Chance Trap is Disabled +// : Optional Flag: P00 +// : Refresh period (in minutes) +// +// SG +// : Spawn Group +// : Spawn Children from Group +// : Waypoint Tag is Defined Group +// : Groups are Defined in 'spawn_cfg_group' +// +// CDn|Tn|Rn|D +// : Corpse Decay +// : Decay Corpse after CD000 to CD999 Seconds +// : Default No Corpse, Standard Loot Bag +// : Optional Flag: T +// : Corpse Inventory Type +// : Type 0: Inventory Items +// : Type 1: Inventory & Equipped Items +// : Type 2: Inventory Items, if PC Killed +// : Type 3: Inventory & Equipped Items, if PC Killed +// : Optional Flag: R +// : Remains Type +// : Type 0: Loot bag +// : Type 1: Body +// : Type 2: Bones +// : Type 3: Potion +// : Type 4: Pouch +// : Type 5: Scroll +// : Type 6: Treasure +// : Type 7: None (destroy loot on decay) +// : Optional Flag: D +// : Drop wielded weapons +// +// LTn|An|Bn|Cn +// : Loot Table +// : Spawn Loot on Children from Table LT000 to LT999 +// : Loot Tables are Defined in 'spawn_cfg_loot' +// : LT500 to LT999 currently reserved for merchant-based +// : loot tables +// : Optional Flag: A000 +// : When using merchant-based loot tables, the percentage chance that +// : only 1 item will spawn. Default is 50%. Values over 100% are truncated +// : to 100% +// : Optional Flag: B000 +// : When using merchant-based loot tables, the percentage chance that +// : 2 items will spawn. Default is 15%. Values over 100% are truncated +// : to 100% +// : Optional Flag: C000 +// : When using merchant-based loot tables, the percentage chance that +// : 3 items will spawn. Default is 05%. Values over 100% are truncated +// : to 100% +// +// DSn|Sn +// : Deactivate Spawn +// : Deactivate Spawn based on Condition +// : Type 0: Deactivate if all Children are Dead +// : Type 1: Deactivate if Spawn Number has been Spawned +// : Type 2: Deactive Spawn until all Children are Dead +// : Type 3: Deactivate Spawn after DI00 Children +// : Type 4: Deactivate Spawn after DI00 Minutes +// : Type 5: Deactivate Spawn after DI00 Cycles +// : Type 6: Deactivate when Spawn Count == Spawn Number +// : Optional Flag: S000 +// : Run Script 000 to 999 when Spawn Deactivated +// : Scripts are Defined in 'spawn_sc_deactiv' +// : +// : Can Reactivate by Manually Calling: +// : SetLocalInt(oSpawn, "SpawnDeactivated", FALSE); +// +// DIn +// : Deactivation Information +// +// CM|Dn +// : Spawn Camp +// : Spawns Camp of Creatures and Placeables +// : Waypoint Tag is Defined Camp +// : Despawns Camp when all Children Dead +// : Camps are Defined in 'spawn_cfg_camp' +// : Optional Flag: D000 +// : Placeables Decay 000 Seconds after Camp Despawn +// : +// : Camp Children Flags: +// : +// : RW : Random Walk +// : SF : Spawn Facing Camp +// : SG : Spawn Group +// : LT00 : Loot Table +// : CD000|T0 : Corpse Decay +// : PL0|T00 : Placeable Type +// : Placeable Trap Disabled +// +// SSn|Dn +// : Spawn Script +// : Run Script 001 to 999 on Spawn +// : Scripts are Defined in 'spawn_sc_spawn' +// : Optional Flag: D000 +// : Run Script 001 to 999 on Despawn +// +// DTn +// : Death Script +// : Run Script 001 to 999 on Death +// : Scripts are Defined in 'spawn_sc_death' +// +// CPn|Rn +// : Spawn Check PCs +// : Check Custom Code to see if Spawn Proceeds +// : Custom Code is Defined in 'spawn_chk_pcs' +// : Optional Flag: R00 +// : Check all PCs in Radius R00 +// : Default Check all PCs in Area +// +// CCn +// : Spawn Check Custom +// : Check Custom Code to see if Spawn Proceeds +// : Custom Code is Defined in 'spawn_chk_custom' +// +// TRn|Dn +// : Spawn Trigger +// : Only Spawns if PC is within 00 Meters +// : Optional Flag: D00 +// : Despawns if PC is not within D00 Meters +// +// AEn|Dn +// : Spawn Area Effect +// : Area Effects are Defined in 'spawn_cfg_fxae' +// : Waypoint Tag can be "AE" to Spawn only Area Effect +// : Optional Flag: D000 +// : Area Effect Duration of 000 to 999 Seconds +// : Duration of 000 means Permanent Area Effect +// : Default Duration is 005 Seconds +// +// OEn|Dn +// : Object Effect +// : Object Effects are Defined in 'spawn_cfg_fxobj' +// : Optional Flag: D000 +// : Object Effect Duration of 000 to 999 Seconds +// : Duration of 000 means Permanent Object Effect +// : Default Duration is Permanent +// +// RSn +// : Random Spawn +// : Percentage Chance Spawn will Occur +// : Default 100% Chance +// +// FCn +// : Spawn Faction +// : Change Faction of Children: +// : Faction 0: COMMONER +// : Faction 1: DEFENDER +// : Faction 2: MERCHANT +// : Faction 3: HOSTILE +// : Faction 4: CUSTOM +// : Change Faction to Same as Nearest +// : Object with Tag 'SpawnFaction' +// +// ALn|Sn +// : Spawn Alignment +// : Shift Alignment of Children +// : Alignment 0: Neutral +// : Alignment 1: Law +// : Alignment 2: Chaos +// : Alignment 3: Good +// : Alignment 4: Evil +// : Alignment 5: All +// : Optional Flag: S00 +// : Shift Alignment by S00 +// : Default Shift by 10 +// +// HBn +// : Heartbeat Script +// : Children will Run Script HB000 each Cycle +// : Scripts are Defined in 'spawn_sc_hbeat' +// +// SLn|Rn|I +// : Spawn Location +// : Spawn Children at Waypoint SL00 +// : Optional Flag: R +// : Choose Random Location +// : from R00 to SL00 +// : Optional Flag: I +// : When spawning multiple children, each child takes the next +// : waypoint, In order - (first child spawns at SL00, next at SL01, etc.) +// : +// : Location Name: Variable +// : Location Tag: SL00 +// +// RH|Dn +// : Return Home +// : Child will always Return to Home +// : Optional Flag: D00 +// : Child will Return to Home +// : Only if further than D00 Meters +// +// HL|n|E +// : Heal Children if Not in Combat +// : Optional Value: 00 +// : Heal 00% per Cycle +// +// IT +// : Spawn Item +// : Spawnpoint Tag is Item Template +// +// ST +// : Spawn Sit +// : Children will Sit in Nearest Unoccupied Sittable +// : Sittable's Tag must be 'Seat' +// +// PT +// : Spawn Plot +// : Sets Children as Plot +// +// SM +// : Spawn Merchant +// : Spawnpoint Tag is Merchant Template +// +// CF +// : Custom Flag +// : Everything in Spawn Name after CF +// : Is Stored in LocalString "CustomFlag" +// : On Each Spawned Child +// +// +// +// + +// +// Functions for external control. Please use these when possible instead +// of modifying variables directly in NESS. +// +// object NESS_GetSpawnByID(int nSpawnID, object oArea) +// : Returns the spawn waypoint in area oArea with ID nSpawnID +// +// void NESS_ActivateSpawnByID(int nSpawnID, object oArea) +// : Activates the spawn in area oArea with ID nSpawnID +// +// void NESS_DeactivateSpawnByID(int nSpawnID, object oArea) +// : Deactivates the spawn in area oArea with ID nSpawnID +// +// void NESS_ActivateSpawn(object oSpawn) +// : Activates spawn oSpawn +// +// void NESS_DeactivateSpawn(object oSpawn) +// : Deactivates spawn oSpawn +// +// void NESS_ForceProcess(object oSpawn) +// : Force spawn oSpawn to be processed next heartbeat (regardless of +// : SPxx value) +// +// void NESS_TrackModuleSpawns(int nFlag=TRUE) +// : Enable (nFlag == TRUE) or Disable (nFlag == FALSE) Spawn Tracking +// +// int NESS_IsModuleSpawnTracking() +// : Returns TRUE is spawn tracking is enabled, FALSE otherwise +// +// +// Some Tips and Pointers +// - with Thanks to Eliha for Creating this Section +// +// 1. The .erf script files we import for NWN usually contain .nss and +// .utp files. +// +// 1.1. The .nss files are the Nwn Source Scripts that are in plain text that +// we manipulate in the script editor. +// +// 1.2. The .utp file(s) are objects such as an invisible corpse object that +// automatically gets put in the right column of the toolset where you select +// the creatures, doors, placeables, etc. under the custom button. +// +// 2. After importing the .erf and ignoring that it couldn't find the .ncs files +// you'll need to save your module then reopen it for the new scripts to appear +// in the left column (due to the lack of a refresh button). +// +// 3. When working in the various configuration scripts you only need to save +// them, not compile them. They are just add-ons to the main spawn_sample_hb.nss +// script and attempts to compile them will result in errors. The spawn_sc_xxxx +// files will compile but even they should just be saved like all the other +// spawn_cfg_xxxx scripts. +// +// 4. When finished editing and saving the various configuration scripts you +// will then need to open the spawn_sample_hb script and compile it to integrate +// your new changes into the system. If you customized your scripts, saved them, +// saved the module, then loaded the game and find nothings working....chances are +// you forgot to compile the spawn_sample_hb script after making your changes. +// +// 5. You can usually tell which script needs to be compiled by noticing which +// one needs to be put in an area heartbeat or on an object somewhere, etc.. In +// this case, we are adding the spawn_sample_hb to the area heartbeat so it is the +// main file and requires compiling. +// + + +// +// Package Header +// +/* +NESS Version 8.1.1 + +Cereborn + +See 'spawn__readme' for Instructions +Ignore all 'Missing Resource' Errors +See the NWN Forums for More Info + +Spawn Package: + + NESS Scripts: +- spawn__readme +- spawn__history +- spawn_cfg_camp +- spawn_cfg_flag +- spawn_cfg_fxae +- spawn_cfg_fxobj +- spawn_cfg_fxsp +- spawn_cfg_global +- spawn_cfg_group +- spawn_cfg_loot +- spawn_cfg_cusflg +- spawn_chk_pcs +- spawn_chk_custom +- spawn_corpse_dcy +- spawn_corpse_dth +- spawn_defaults +- spawn_dist_corps +- spawn_flags +- spawn_functions +- spawn_main +- spawn_onopencrp +- spawn_oncloscrp +- spawn_pseudohb +- spawn_sample_hb +- spawn_sc_cmptrig +- spawn_sc_deactiv +- spawn_sc_death +- spawn_sc_patrol +- spawn_sc_spawn +- spawn_smpl_onent +- spawn_smpl_onext +- spawn_timefuncs +- spawn_used_corps + + NESS Resources: +- invis_corpse_obj +- invis_corpse_bdy +- invis_corpse_bon +- invis_corpse_pot +- invis_corpse_pch +- invis_corpse_ser +- invis_corpse_tre + + Spawn Banner Scripts: +- spawnb_cc_activ +- spawnb_cc_dactiv +- spawnb_cc_dump +- spawnb_cc_nodump +- spawnb_cc_notrck +- spawnb_cc_nsclog +- spawnb_cc_nsdlog +- spawnb_cc_sclog +- spawnb_cc_sdlog +- spawnb_cc_trck +- spawnb_main +- spawnb_sample_ai +- spawnb_sc_activ +- spawnb_sc_dactiv +- spawnb_sc_disp +- spawnb_sc_dump +- spawnb_sc_nodump +- spawnb_sc_notrck +- spawnb_sc_nsdlog +- spawnb_sc_sclog +- spawnb_sc_sdlog +- spawnb_sc_snclog +- spawnb_sc_trck + + Spawn Banner Resources: +- spawn_ban_rod.uti +- spawn_banner.dlg +- spawn_ban_a.utp +- spawn_ban_d.utp + + +*/ diff --git a/_module/nss/spawn_cfg_camp.nss b/_module/nss/spawn_cfg_camp.nss new file mode 100644 index 0000000..034d56b --- /dev/null +++ b/_module/nss/spawn_cfg_camp.nss @@ -0,0 +1,134 @@ +// +// Spawn Camp +// +// +// CampNumP +// CampNumC +// CampRadius +// CampTrigger +// CampTriggerScript +// +// RW : Random Walk +// SF : Spawn Facing Camp +// SG : Spawn Group +// LT00 : Loot Table +// CD000|T0 : Corpse Decay +// PL0|T00 : Placeable Trap Disabled +// DT000 : Death Script +// RH000 : Return Home +// +// +object GetChildByTag(object oSpawn, string sChildTag); +object GetChildByNumber(object oSpawn, int nChildNum); +object GetSpawnByID(int nSpawnID); +void DeactivateSpawn(object oSpawn); +void DeactivateSpawnsByTag(string sSpawnTag); +void DeactivateAllSpawns(); +void DespawnChildren(object oSpawn); +void DespawnChildrenByTag(object oSpawn, string sSpawnTag); +// +// +void SetCampSpawn(object oCamp, string sCamp, location lCamp) +{ + +// +// Place Custom Camps Here +// ------------------------------------------- + + + // Example Camp + // One Campfire and 4 Goblins + if (sCamp == "goblincamp") + { + + // Set Number of Placeables + SetLocalInt(oCamp, "CampNumP", 2); + // Set Number of Creatures + SetLocalInt(oCamp, "CampNumC", 4); + // Set Radius of Camp + SetLocalFloat(oCamp, "CampRadius", 10.0); + + // Set Creature 0 to be Trigger + // Script 00 : Kill him and the Camp Despawns + SetLocalString(oCamp, "CampTrigger", "C0"); + SetLocalInt(oCamp, "CampTriggerScript", 0); + + // Set Placeable 0 to be Camp Center + SetLocalString(oCamp, "CampCenter", "P0"); + + // Set Placeable 0 and Spawn Flags + // First Placeable always Spawns at Center of Camp + // If CampCenter Is Not Set + SetLocalString(oCamp, "CampP0", "plc_campfrwspit"); + SetLocalString(oCamp, "CampP0_Flags", "SP_SF"); + + // Set Placeable 1 and Spawn Flags + SetLocalString(oCamp, "CampP1", "plc_chest1"); + SetLocalString(oCamp, "CampP1_Flags", "SP_PL3T80P30"); + + // Set Creature 0 and Spawn Flags + SetLocalString(oCamp, "CampC0", "NW_GOBCHIEFB"); + SetLocalString(oCamp, "CampC0_Flags", "SP_RW_CD60_RH30"); + + // Set Creature 1 and Spawn Flags + SetLocalString(oCamp, "CampC1", "goblins_low"); + SetLocalString(oCamp, "CampC1_Flags", "SP_SF_SG_CD60_RH"); + + // Set Creature 2 and Spawn Flags + SetLocalString(oCamp, "CampC2", "goblins_low"); + SetLocalString(oCamp, "CampC2_Flags", "SP_SF_SG_CD60_RH"); + + // Set Creature 3 and Spawn Flags + SetLocalString(oCamp, "CampC3", "goblins_low"); + SetLocalString(oCamp, "CampC3_Flags", "SP_SF_SG_CD60_RH"); + } + else if (sCamp == "demoncamp") + { + + // Set Number of Placeables + SetLocalInt(oCamp, "CampNumP", 2); + // Set Number of Creatures + SetLocalInt(oCamp, "CampNumC", 4); + // Set Radius of Camp + SetLocalFloat(oCamp, "CampRadius", 5.0); + + // Set Creature 0 to be Trigger + // Script 00 : Kill him and the Camp Despawns + SetLocalString(oCamp, "CampTrigger", "C0"); + SetLocalInt(oCamp, "CampTriggerScript", 0); + + // Set Placeable 0 to be Camp Center + SetLocalString(oCamp, "CampCenter", "P0"); + + // Set Placeable 0 and Spawn Flags + // First Placeable always Spawns at Center of Camp + // If CampCenter Is Not Set + SetLocalString(oCamp, "CampP0", "plc_campfrwspit"); + SetLocalString(oCamp, "CampP0_Flags", "SP_SF"); + + // Set Placeable 1 and Spawn Flags + SetLocalString(oCamp, "CampP1", "plc_chest1"); + SetLocalString(oCamp, "CampP1_Flags", "SP_PL3T80P30"); + + // Set Creature 0 and Spawn Flags + SetLocalString(oCamp, "CampC0", "NW_DEMON"); + SetLocalString(oCamp, "CampC0_Flags", "SP_RW"); + + // Set Creature 1 and Spawn Flags + SetLocalString(oCamp, "CampC1", "NW_DEMON"); + SetLocalString(oCamp, "CampC1_Flags", "SP_SF"); + + // Set Creature 2 and Spawn Flags + SetLocalString(oCamp, "CampC2", "NW_DEMON"); + SetLocalString(oCamp, "CampC2_Flags", "SP_SF"); + + // Set Creature 3 and Spawn Flags + SetLocalString(oCamp, "CampC3", "NW_DEMON"); + SetLocalString(oCamp, "CampC3_Flags", "SP_SF"); + } + // + + +// ------------------------------------------- +// +} diff --git a/_module/nss/spawn_cfg_cusflg.nss b/_module/nss/spawn_cfg_cusflg.nss new file mode 100644 index 0000000..8ff8fd0 --- /dev/null +++ b/_module/nss/spawn_cfg_cusflg.nss @@ -0,0 +1,114 @@ +// +// NESS V8.1 +// Spawn Config Custom Flags +// +// This file is for the USER to to add support for custom flags. It will +// normally not be overwritten by UPDATE releases, so remerging can be avoided. +// +// ALFA and LoG Custom Flags (included here both as examples and to aid +// ALFA builders in switching over to the new methodology) +// +// SXn +// : Suppress XP +// : Suppress diminishing returns XP +// : SX1 turns suppression on (the default, you may just use SX) +// : SX0 turns suppression off for the spawn if it has been put on +// : globally (by setting nGlobalSuppressDR to TRUE in spawn_cfg_global) +// +// NL +// : No Loot +// : Suppress player corpse looting +// +// SB +// : SuBdual +// : Spawn creatures in in subdual mode +// +// ELn +// : Encounter Level +// : Set the encounter level for a spawn +// : This is used by the ALFA core rules in determining whether or not +// : an encounter should result in XP to a given level party. If not +// : specified, the CR of the creature killed is used as the EL. +// +// + +#include "spawn_flags" + +void ParseCustomFlags(object oSpawn, string sFlags) +{ + // Get Defaults. You can set defaults for your custom flags in + // spawn_cfg_global + object oModule = GetModule(); + + int dfSuppressDR = GetLocalInt(oModule, "df_SuppressDR"); + int dfGlobalSuppressDR = GetLocalInt(oModule, "df_GlobalSuppressDR"); + int dfEncounterLevel = GetLocalInt(oModule, "df_EncounterLevel"); + + + // NOTE: Because of the unique nature of these flags being present as both + // standard flags and custom flags (for back compatibility) only write flags + // if they're present!! + + // Initialize Dim Returns Suppression + int nSuppressDimReturns = IsFlagPresent(sFlags, "SX"); + + if (nSuppressDimReturns) + { + // If the flag is present, get suppression mode from its value + nSuppressDimReturns = GetFlagValue(sFlags, "SX", dfSuppressDR); + SetLocalInt(oSpawn, "f_SuppressDimReturns", nSuppressDimReturns); + } + + // Initialize Loot Suppression + int nSuppressLooting = IsFlagPresent(sFlags, "NL"); + + // Record Loot Suppression + if (nSuppressLooting) + { + SetLocalInt(oSpawn, "f_SuppressLooting", nSuppressLooting); + } + + // Initialize Subdual Mode + int nSubdualMode = IsFlagPresent(sFlags, "SB"); + + // Record Subdual Mode + if (nSubdualMode) + { + SetLocalInt(oSpawn, "f_SubdualMode", nSubdualMode); + } + + int nEncounterLevel; + + // Initialize Encounter Level + if (IsFlagPresent(sFlags, "EL")) + { + nEncounterLevel = GetFlagValue(sFlags, "EL", dfEncounterLevel); + SetLocalInt(oSpawn, "f_EncounterLevel", nEncounterLevel); + } +} + +void SetupCustomFlags(object oSpawn, object oSpawned) +{ + int nSuppressLooting = GetLocalInt(oSpawn, "f_SuppressLooting"); + int nSubdualMode = GetLocalInt(oSpawn, "f_SubdualMode"); + int nEncounterLevel = GetLocalInt(oSpawn, "f_EncounterLevel"); + + + // Set up loot suppression + if (nSuppressLooting) + { + SetLocalInt(oSpawned, "DoNotLoot", TRUE); + } + + // Set up subdual mode + if (nSubdualMode) + { + SetLocalInt(oSpawned, "SubdualMode", TRUE); + } + + // Set up encounter level + if (nEncounterLevel > 0) + { + SetLocalInt(oSpawned, "AlfaEncounterLevel", nEncounterLevel); + } +} diff --git a/_module/nss/spawn_cfg_flag.nss b/_module/nss/spawn_cfg_flag.nss new file mode 100644 index 0000000..d49484b --- /dev/null +++ b/_module/nss/spawn_cfg_flag.nss @@ -0,0 +1,77 @@ +// +// Spawn Flags +// +void SpawnFlags(object oSpawn, int nFlagTableNumber) +{ + // Initialize Values + string sSpawnName = GetLocalString(oSpawn, "f_Flags"); + string sSpawnTag = GetLocalString(oSpawn, "f_Template"); + string sFlags, sTemplate; + +// +// Only Make Modifications Between These Lines +// ------------------------------------------- + + + // Sample Complex Replacement + // Using FT without FT00 will + // Default to nFlagTableNumber 0 + if (nFlagTableNumber == 0) + { + // Old Method of using SpawnTag + if (sSpawnTag == "myspawns") + { + sFlags = "SP_SN02_SA_RW"; + sTemplate = "NW_DOG"; + } + + if (sSpawnTag == "undead") + { + sFlags = "SP_SNO4"; + sTemplate = "NW_ZOMBIE01"; + } + } + // + + // Sample Simple Replacement Flag + // Completely Replaces Flags + // On Spawnpoints with FT01 + if (nFlagTableNumber == 1) + { + sFlags = "SP_SN04_RW_DOD"; + sTemplate = "NW_DOG"; + } + // + + // Sample Template Flags + // These Flags Get Added + // To Spawnpoints with FT02 + if (nFlagTableNumber == 2) + { + sFlags = "_RW_PC05R"; + } + // + + +// ------------------------------------------- +// Only Make Modifications Between These Lines +// + + // Record Values + if (sFlags != "") + { + SetLocalString(oSpawn, "f_Flags", sFlags); + } + else + { + SetLocalString(oSpawn, "f_Flags", sSpawnName); + } + if (sTemplate != "") + { + SetLocalString(oSpawn, "f_Template", sTemplate); + } + else + { + SetLocalString(oSpawn, "f_Template", sSpawnTag); + } +} diff --git a/_module/nss/spawn_cfg_fxae.nss b/_module/nss/spawn_cfg_fxae.nss new file mode 100644 index 0000000..72198bf --- /dev/null +++ b/_module/nss/spawn_cfg_fxae.nss @@ -0,0 +1,75 @@ +// +// Spawn AreaEffect +// +int ParseFlagValue(string sName, string sFlag, int nDigits, int nDefault); +int ParseSubFlagValue(string sName, string sFlag, int nDigits, string sSubFlag, int nSubDigits, int nDefault); +object GetChildByTag(object oSpawn, string sChildTag); +object GetChildByNumber(object oSpawn, int nChildNum); +object GetSpawnByID(int nSpawnID); +void DeactivateSpawn(object oSpawn); +void DeactivateSpawnsByTag(string sSpawnTag); +void DeactivateAllSpawns(); +void DespawnChildren(object oSpawn); +void DespawnChildrenByTag(object oSpawn, string sSpawnTag); +// +// +effect SpawnAreaEffect(object oSpawn) +{ + // Initialize Variables + effect eAreaEffect; + + // Initialize Values + int nSpawnAreaEffect = GetLocalInt(oSpawn, "f_SpawnAreaEffect"); + +// +// Only Make Modifications Between These Lines +// ------------------------------------------- + + // AreaEffect 00 + // Dummy AreaEffect - Never Use + if (nSpawnAreaEffect == 0) + { + return eAreaEffect; + } + // + + // Web, only Visual + if (nSpawnAreaEffect == 1) + { + eAreaEffect = EffectAreaOfEffect(AOE_PER_WEB, "****", "****", "****"); + } + // + + +// ------------------------------------------- +// Only Make Modifications Between These Lines +// + + // Return the AreaEffect + return eAreaEffect; +} + +/* +0 - AOE_PER_FOGACID +1 - AOE_PER_FOGFIRE +2 - AOE_PER_FOGSTINK +3 - AOE_PER_FOGKILL +4 - AOE_PER_FOGMIND +18 - AOE_MOB_UNEARTHLY +19 - AOE_MOB_MENACE +20 - AOE_MOB_UNNATURAL +21 - AOE_MOB_STUN +22 - AOE_MOB_PROTECTION +23 - AOE_MOB_FIRE +24 - AOE_MOB_FROST +25 - AOE_MOB_ELECTRICAL +26 - AOE_PER_FOGGHOUL +27 - AOE_MOB_TYRANT_FOG +28 - AOE_PER_STORM +29 - AOE_PER_INVIS_SPHERE +30 - AOE_MOB_SILENCE +31 - AOE_PER_DELAY_BLAST_FIREBALL +32 - AOE_PER_GREASE +33 - AOE_PER_CREEPING_DOOM +35 - AOE_MOB_INVISIBILITY_PURGE +*/ diff --git a/_module/nss/spawn_cfg_fxobj.nss b/_module/nss/spawn_cfg_fxobj.nss new file mode 100644 index 0000000..4b7809d --- /dev/null +++ b/_module/nss/spawn_cfg_fxobj.nss @@ -0,0 +1,55 @@ +// +// Spawn ObjectEffect +// +int ParseFlagValue(string sName, string sFlag, int nDigits, int nDefault); +int ParseSubFlagValue(string sName, string sFlag, int nDigits, string sSubFlag, int nSubDigits, int nDefault); +object GetChildByTag(object oSpawn, string sChildTag); +object GetChildByNumber(object oSpawn, int nChildNum); +object GetSpawnByID(int nSpawnID); +void DeactivateSpawn(object oSpawn); +void DeactivateSpawnsByTag(string sSpawnTag); +void DeactivateAllSpawns(); +void DespawnChildren(object oSpawn); +void DespawnChildrenByTag(object oSpawn, string sSpawnTag); +// +// +effect ObjectEffect(object oSpawn) +{ + // Initialize Variables + effect eObjectEffect; + + // Initialize Values + int nObjectEffect = GetLocalInt(oSpawn, "f_ObjectEffect"); + +// +// Only Make Modifications Between These Lines +// ------------------------------------------- + + + // ObjectEffect 00 + // Dummy ObjectEffect - Never Use + if (nObjectEffect == 0) + { + return eObjectEffect; + } + // + + // Bard's Song + if (nObjectEffect == 1) + { + eObjectEffect = EffectVisualEffect(VFX_DUR_BARD_SONG); + } + // + + +// ------------------------------------------- +// Only Make Modifications Between These Lines +// + + // Return the ObjectEffect + return eObjectEffect; +} + +/* + +*/ diff --git a/_module/nss/spawn_cfg_fxsp.nss b/_module/nss/spawn_cfg_fxsp.nss new file mode 100644 index 0000000..f61776c --- /dev/null +++ b/_module/nss/spawn_cfg_fxsp.nss @@ -0,0 +1,243 @@ +// +// Spawn Effect +// +int ParseFlagValue(string sName, string sFlag, int nDigits, int nDefault); +int ParseSubFlagValue(string sName, string sFlag, int nDigits, string sSubFlag, int nSubDigits, int nDefault); +object GetChildByTag(object oSpawn, string sChildTag); +object GetChildByNumber(object oSpawn, int nChildNum); +object GetSpawnByID(int nSpawnID); +void DeactivateSpawn(object oSpawn); +void DeactivateSpawnsByTag(string sSpawnTag); +void DeactivateAllSpawns(); +void DespawnChildren(object oSpawn); +void DespawnChildrenByTag(object oSpawn, string sSpawnTag); +// +// +int SpawnEffect(object oSpawn, int nSpawnEffect, int nDespawnEffect) +{ + // Initialize + int nEffect; + int nEffectNumber; + + // Initialize Values + if (nSpawnEffect == TRUE) + { + nEffectNumber = GetLocalInt(oSpawn, "f_SpawnEffect"); + } + else if (nDespawnEffect == TRUE) + { + nEffectNumber = GetLocalInt(oSpawn, "f_DespawnEffect"); + } + +// +// Only Make Modifications Between These Lines +// ------------------------------------------- + + + // Effect 00 + // Dummy Effect - Never Use + if (nEffectNumber == 0) + { + return nEffect; + } + // + + // Rotting Corpse Spawn/Despawn + if (nEffectNumber == 51) + { + nEffect = VFX_IMP_DISEASE_S; + } + // + + +// ------------------------------------------- +// Only Make Modifications Between These Lines +// + + // Return the Effect + return nEffect; +} + +/* +18 - VFX_FNF_BLINDDEAF +19 - VFX_FNF_DISPEL +20 - VFX_FNF_DISPEL_DISJUNCTION +21 - VFX_FNF_DISPEL_GREATER +22 - VFX_FNF_FIREBALL +23 - VFX_FNF_FIRESTORM +24 - VFX_FNF_IMPLOSION +26 - VFX_FNF_MASS_HEAL +27 - VFX_FNF_MASS_MIND_AFFECTING +28 - VFX_FNF_METEOR_SWARM +29 - VFX_FNF_NATURES_BALANCE +30 - VFX_FNF_PWKILL +31 - VFX_FNF_PWSTUN +32 - VFX_FNF_SUMMON_GATE +33 - VFX_FNF_SUMMON_MONSTER_1 +34 - VFX_FNF_SUMMON_MONSTER_2 +35 - VFX_FNF_SUMMON_MONSTER_3 +36 - VFX_FNF_SUMMON_UNDEAD +37 - VFX_FNF_SUNBEAM +38 - VFX_FNF_TIME_STOP +39 - VFX_FNF_WAIL_O_BANSHEES +40 - VFX_FNF_WEIRD +41 - VFX_FNF_WORD +42 - VFX_IMP_AC_BONUS +43 - VFX_IMP_ACID_L +44 - VFX_IMP_ACID_S +46 - VFX_IMP_BLIND_DEAF_M +47 - VFX_IMP_BREACH +48 - VFX_IMP_CONFUSION_S +49 - VFX_IMP_DAZED_S +50 - VFX_IMP_DEATH +51 - VFX_IMP_DISEASE_S +52 - VFX_IMP_DISPEL +53 - VFX_IMP_DISPEL_DISJUNCTION +54 - VFX_IMP_DIVINE_STRIKE_FIRE +55 - VFX_IMP_DIVINE_STRIKE_HOLY +56 - VFX_IMP_DOMINATE_S +57 - VFX_IMP_DOOM +58 - VFX_IMP_FEAR_S +60 - VFX_IMP_FLAME_M +61 - VFX_IMP_FLAME_S +62 - VFX_IMP_FROST_L +63 - VFX_IMP_FROST_S +64 - VFX_IMP_GREASE +65 - VFX_IMP_HASTE +66 - VFX_IMP_HEALING_G +67 - VFX_IMP_HEALING_L +68 - VFX_IMP_HEALING_M +69 - VFX_IMP_HEALING_S +70 - VFX_IMP_HEALING_X +71 - VFX_IMP_HOLY_AID +72 - VFX_IMP_KNOCK +74 - VFX_IMP_LIGHTNING_M +75 - VFX_IMP_LIGHTNING_S +76 - VFX_IMP_MAGBLUE +81 - VFX_IMP_NEGATIVE_ENERGY +83 - VFX_IMP_POISON_L +84 - VFX_IMP_POISON_S +85 - VFX_IMP_POLYMORPH +86 - VFX_IMP_PULSE_COLD +87 - VFX_IMP_PULSE_FIRE +88 - VFX_IMP_PULSE_HOLY +89 - VFX_IMP_PULSE_NEGATIVE +90 - VFX_IMP_RAISE_DEAD +91 - VFX_IMP_REDUCE_ABILITY_SCORE +92 - VFX_IMP_REMOVE_CONDITION +93 - VFX_IMP_SILENCE +94 - VFX_IMP_SLEEP +95 - VFX_IMP_SLOW +96 - VFX_IMP_SONIC +97 - VFX_IMP_STUN +98 - VFX_IMP_SUNSTRIKE +99 - VFX_IMP_UNSUMMON +100 - VFX_COM_SPECIAL_BLUE_RED +101 - VFX_COM_SPECIAL_PINK_ORANGE +102 - VFX_COM_SPECIAL_RED_WHITE +103 - VFX_COM_SPECIAL_RED_ORANGE +104 - VFX_COM_SPECIAL_WHITE_BLUE +105 - VFX_COM_SPECIAL_WHITE_ORANGE +106 - VFX_COM_BLOOD_REG_WIMP +107 - VFX_COM_BLOOD_LRG_WIMP +108 - VFX_COM_BLOOD_CRT_WIMP +109 - VFX_COM_BLOOD_REG_RED +110 - VFX_COM_BLOOD_REG_GREEN +111 - VFX_COM_BLOOD_REG_YELLOW +112 - VFX_COM_BLOOD_LRG_RED +113 - VFX_COM_BLOOD_LRG_GREEN +114 - VFX_COM_BLOOD_LRG_YELLOW +115 - VFX_COM_BLOOD_CRT_RED +116 - VFX_COM_BLOOD_CRT_GREEN +117 - VFX_COM_BLOOD_CRT_YELLOW +118 - FX_COM_SPARKS_PARRY +120 - VFX_COM_UNLOAD_MODEL +121 - VFX_COM_CHUNK_RED_SMALL +122 - VFX_COM_CHUNK_RED_MEDIUM +123 - VFX_COM_CHUNK_GREEN_SMALL +124 - VFX_COM_CHUNK_GREEN_MEDIUM +125 - VFX_COM_CHUNK_YELLOW_SMALL +126 - VFX_COM_CHUNK_YELLOW_MEDIUM +139 - VFX_IMP_IMPROVE_ABILITY_SCORE +140 - VFX_IMP_CHARM +141 - VFX_IMP_MAGICAL_VISION +144 - VFX_IMP_EVIL_HELP +145 - VFX_IMP_GOOD_HELP +146 - VFX_IMP_DEATH_WARD +149 - VFX_IMP_MAGIC_PROTECTION +150 - VFX_IMP_SUPER_HEROISM +151 - VFX_FNF_STORM +152 - VFX_IMP_ELEMENTAL_PROTECTION +181 - VFX_IMP_MIRV +183 - VFX_FNF_SOUND_BURST +184 - VFX_FNF_STRIKE_HOLY +185 - VFX_FNF_LOS_EVIL_10 +186 - VFX_FNF_LOS_EVIL_20 +187 - VFX_FNF_LOS_EVIL_30 +188 - VFX_FNF_LOS_HOLY_10 +189 - VFX_FNF_LOS_HOLY_20 +190 - VFX_FNF_LOS_HOLY_30 +191 - VFX_FNF_LOS_NORMAL_10 +192 - VFX_FNF_LOS_NORMAL_20 +193 - VFX_FNF_LOS_NORMAL_30 +194 - VFX_IMP_HEAD_ACID +195 - VFX_IMP_HEAD_FIRE +196 - VFX_IMP_HEAD_SONIC +197 - VFX_IMP_HEAD_ELECTRICITY +198 - VFX_IMP_HEAD_COLD +199 - VFX_IMP_HEAD_HOLY +200 - VFX_IMP_HEAD_NATURE +201 - VFX_IMP_HEAD_HEAL +202 - VFX_IMP_HEAD_MIND +203 - VFX_IMP_HEAD_EVIL +204 - VFX_IMP_HEAD_ODD +217 - VFX_IMP_DEATH_L +219 - VFX_FNF_SUMMON_CELESTIAL +221 - VFX_IMP_RESTORATION_LESSER +222 - VFX_IMP_RESTORATION +223 - VFX_IMP_RESTORATION_GREATER +231 - VFX_FNF_ICESTORM +233 - VFX_IMP_MIRV_FLAME +234 - VFX_IMP_DESTRUCTION +235 - VFX_COM_CHUNK_RED_LARGE +236 - VFX_COM_CHUNK_BONE_MEDIUM +237 - VFX_COM_BLOOD_SPARK_SMALL +238 - VFX_COM_BLOOD_SPARK_MEDIUM +239 - VFX_COM_BLOOD_SPARK_LARGE +241 - VFX_FNF_HORRID_WILTING +246 - VFX_IMP_HARM +250 - VFX_IMP_MAGIC_RESISTANCE_USE +251 - VFX_IMP_GLOBE_USE +252 - VFX_IMP_WILL_SAVING_THROW_USE +253 - VFX_IMP_SPIKE_TRAP +254 - VFX_IMP_SPELL_MANTLE_USE +255 - VFX_IMP_FORTITUDE_SAVING_THROW_USE +256 - VFX_IMP_REFLEX_SAVE_THROW_USE +257 - VFX_FNF_GAS_EXPLOSION_ACID +258 - VFX_FNF_GAS_EXPLOSION_EVIL +259 - VFX_FNF_GAS_EXPLOSION_NATURE +260 - VFX_FNF_GAS_EXPLOSION_FIRE +261 - VFX_FNF_GAS_EXPLOSION_GREASE +262 - VFX_FNF_GAS_EXPLOSION_MIND +263 - VFX_FNF_SMOKE_PUFF +264 - VFX_IMP_PULSE_WATER +265 - VFX_IMP_PULSE_WIND +266 - VFX_IMP_PULSE_NATURE +273 - VFX_IMP_AURA_HOLY +274 - VFX_IMP_AURA_UNEARTHLY +275 - VFX_IMP_AURA_FEAR +276 - VFX_IMP_AURA_NEGATIVE_ENERGY +278 - VFX_FNF_HOWL_MIND +279 - VFX_FNF_HOWL_ODD +280 - VFX_COM_HIT_FIRE +281 - VFX_COM_HIT_FROST +282 - VFX_COM_HIT_ELECTRICAL +283 - VFX_COM_HIT_ACID +284 - VFX_COM_HIT_SONIC +285 - VFX_FNF_HOWL_WAR_CRY +286 - VFX_FNF_SCREEN_SHAKE +287 - VFX_FNF_SCREEN_BUMP +288 - VFX_COM_HIT_NEGATIVE +289 - VFX_COM_HIT_DIVINE +290 - VFX_FNF_HOWL_WAR_CRY_FEMALE +*/ diff --git a/_module/nss/spawn_cfg_global.nss b/_module/nss/spawn_cfg_global.nss new file mode 100644 index 0000000..f1959fb --- /dev/null +++ b/_module/nss/spawn_cfg_global.nss @@ -0,0 +1,32 @@ +// +// ALFA NESS V1.2.3 +// Spawn Global Defaults +// +// History: +// 09/21/03 Cereborn Created +// +// This file is for the USER to make changes to NESS default values. It will +// normally not be overwritten by UPDATE releases, so remerging can be avoided. +// + +#include "spawn_defaults" + +void SetUserGlobalDefaults() +{ + // SXn + // Set this value to TRUE (or 1) to have dim returns suppression be the default + // when no SX flag is present. + // + // **** uncomment me to make DR off by default + // nGlobalSuppressDR = TRUE; + + // This is the default value for the SX flag when no value is specified. + // Set to FALSE (or 0) to make SX (without a value) enable dim returns. + // + // **** uncomment me to make the SX flag (without arguments) turn DR on for + // a spawn. Note that this is not strictly necessary, as you can also just use + // SX0 on the spawn. This was added for Albereth because he had already created + // spawn points using SX without the 0... + // nSuppressDR = FALSE; + +} diff --git a/_module/nss/spawn_cfg_group.nss b/_module/nss/spawn_cfg_group.nss new file mode 100644 index 0000000..d56f5b4 --- /dev/null +++ b/_module/nss/spawn_cfg_group.nss @@ -0,0 +1,541 @@ +// +// Spawn Groups +// +// +// nChildrenSpawned +// : Number of Total Children ever Spawned +// +// nSpawnCount +// : Number of Children currently Alive +// +// nSpawnNumber +// : Number of Children to Maintain at Spawn +// +// nRandomWalk +// : Walking Randomly? TRUE/FALSE +// +// nPlaceable +// : Spawning Placeables? TRUE/FALSE +// +// +int ParseFlagValue(string sName, string sFlag, int nDigits, int nDefault); +int ParseSubFlagValue(string sName, string sFlag, int nDigits, string sSubFlag, int nSubDigits, int nDefault); +object GetChildByTag(object oSpawn, string sChildTag); +object GetChildByNumber(object oSpawn, int nChildNum); +object GetSpawnByID(int nSpawnID); +void DeactivateSpawn(object oSpawn); +void DeactivateSpawnsByTag(string sSpawnTag); +void DeactivateAllSpawns(); +void DespawnChildren(object oSpawn); +void DespawnChildrenByTag(object oSpawn, string sSpawnTag); +// +// + +string GetTemplateByCR(int nCR, string sGroupType) +{ + string sRetTemplate; + + if (sGroupType == "outdoor") + { + switch (nCR) + { + case 1: + switch(d6(1)) + { + case 1: sRetTemplate = "NW_SKELETON"; break; + case 2: sRetTemplate = "NW_ZOMBIE01"; break; + case 3: sRetTemplate = "NW_NIXIE"; break; + case 4: sRetTemplate = "NW_ORCA"; break; + case 5: sRetTemplate = "NW_ORCB"; break; + case 6: sRetTemplate = "NW_BTLFIRE"; break; + } + break; + case 2: + switch(d4(1)) + { + case 1: sRetTemplate = "NW_KOBOLD004"; break; + case 2: sRetTemplate = "NW_KOBOLD005"; break; + case 3: sRetTemplate = "NW_KOBOLD003"; break; + case 4: sRetTemplate = "NW_PIXIE"; break; + } + break; + case 3: + switch(d4(1)) + { + case 1: sRetTemplate = "NW_BTLBOMB"; break; + case 2: sRetTemplate = "NW_BTLFIRE002"; break; + case 3: sRetTemplate = "NW_BTLSTINK"; break; + case 4: sRetTemplate = "NW_NYMPH"; break; + } + break; + default: + sRetTemplate = ""; + break; + } + } + + else if (sGroupType == "crypt") + { + switch (nCR) + { + case 1: + switch(d4(1)) + { + case 1: + case 2: sRetTemplate = "NW_SKELETON"; break; + case 3: sRetTemplate = "NW_ZOMBIE01"; break; + case 4: sRetTemplate = "NW_ZOMBIE02"; break; + } + break; + case 2: + sRetTemplate = "NW_GHOUL"; + break; + case 3: + sRetTemplate = "NW_SHADOW"; + break; + default: + sRetTemplate = ""; + break; + } } + + else + { + // unknown group type + sRetTemplate = ""; + } + + return sRetTemplate; +} + + +// Convert a given EL equivalent and its encounter level, +// return the corresponding CR +float ConvertELEquivToCR(float fEquiv, float fEncounterLevel) +{ + float fCR, fEquivSq, fTemp; + + if (fEquiv == 0.0) + { + return 0.0; + } + + fEquivSq = fEquiv * fEquiv; + fTemp = log(fEquivSq); + fTemp /= log(2.0); + fCR = fEncounterLevel + fTemp; + + return fCR; +} + +// Convert a given CR to its encounter level equivalent per DMG page 101. +float ConvertCRToELEquiv(float fCR, float fEncounterLevel) +{ + if (fCR > fEncounterLevel || fCR < 1.0) + { + return 1.; + } + + float fEquiv, fExponent, fDenom; + + fExponent = fEncounterLevel - fCR; + fExponent *= 0.5; + fDenom = pow(2.0, fExponent); + fEquiv = 1.0 / fDenom; + + return fEquiv; +} + +string SpawnGroup(object oSpawn, string sTemplate) +{ + // Initialize + string sRetTemplate; + + // Initialize Values + int nSpawnNumber = GetLocalInt(oSpawn, "f_SpawnNumber"); + int nRandomWalk = GetLocalInt(oSpawn, "f_RandomWalk"); + int nPlaceable = GetLocalInt(oSpawn, "f_Placeable"); + int nChildrenSpawned = GetLocalInt(oSpawn, "ChildrenSpawned"); + int nSpawnCount = GetLocalInt(oSpawn, "SpawnCount"); + +// +// Only Make Modifications Between These Lines +// ------------------------------------------- + + if (GetStringLeft(sTemplate, 7) == "scaled_") + { + float fEncounterLevel; + int nScaledInProgress = GetLocalInt(oSpawn, "ScaledInProgress"); + string sGroupType = GetStringRight(sTemplate, + GetStringLength(sTemplate) - 7); + + // First Time in for this encounter? + if (! nScaledInProgress) + { + + // First time in - find the party level + int nTotalPCs = 0; + int nTotalPCLevel = 0; + + object oArea = GetArea(OBJECT_SELF); + + object oPC = GetFirstObjectInArea(oArea); + while (oPC != OBJECT_INVALID) + { + if (GetIsPC(oPC) == TRUE) + { + nTotalPCs++; + nTotalPCLevel = nTotalPCLevel + GetHitDice(oPC); + } + oPC = GetNextObjectInArea(oArea); + } + if (nTotalPCs == 0) + { + fEncounterLevel = 0.0; + } + else + { + fEncounterLevel = IntToFloat(nTotalPCLevel) / IntToFloat(nTotalPCs); + } + + // Save this for subsequent calls + SetLocalFloat(oSpawn, "ScaledEncounterLevel", fEncounterLevel); + + // We're done when the CRs chosen add up to the + // desired encounter level + SetLocalInt(oSpawn, "ScaledCallCount", 0); + SetLocalInt(oSpawn, "ScaledInProgress", TRUE); + } + + + fEncounterLevel = GetLocalFloat(oSpawn, "ScaledEncounterLevel"); + int nScaledCallCount = GetLocalInt(oSpawn, "ScaledCallCount"); + + // For simplicity, I'm not supporting creatures with CR < 1.0) + if (fEncounterLevel < 1.0) + { + // We're done... No creatures have CR low enough to add to this encounter + sRetTemplate = ""; + } + + else + { + // randomly choose a CR at or below the remaining (uncovered) encounter + // level + int nCR = Random(FloatToInt(fEncounterLevel)) + 1; + + // cap to the largest CR we currently support in GetTemplateByCR + if (nCR > 3) + { + nCR = 3; + } + + sRetTemplate = GetTemplateByCR(nCR, sGroupType); + + + // Convert CR to Encounter Level equivalent so it can be correctly + // subtracted. This does the real scaling work + float fELEquiv = ConvertCRToELEquiv(IntToFloat(nCR), fEncounterLevel); + float fElRemaining = 1.0 - fELEquiv; + + fEncounterLevel = ConvertELEquivToCR(fElRemaining, fEncounterLevel); + SetLocalFloat(oSpawn, "ScaledEncounterLevel", fEncounterLevel); + } + + nScaledCallCount++; + SetLocalInt(oSpawn, "ScaledCallCount", nScaledCallCount); + + nSpawnNumber = GetLocalInt(oSpawn, "f_SpawnNumber"); + + if (nScaledCallCount >= nSpawnNumber) + { + // reset... + SetLocalInt(oSpawn, "ScaledInProgress", FALSE); + } + } + + // cr_militia + if (sTemplate == "cr_militia") + { + switch(d2(1)) + { + case 1: + sRetTemplate = "cr_militia_m"; + break; + case 2: + sRetTemplate = "cr_militia_f"; + break; + } + } + // + + // pg_guard + if (sTemplate == "pg_guard") + { + switch(d2(1)) + { + case 1: + sRetTemplate = "pg_guard_m"; + break; + case 2: + sRetTemplate = "pg_guard_f"; + break; + } + } + // + + // Goblins + if (sTemplate == "goblins_low") + { + if (d2(1) == 1) + { + sRetTemplate = "NW_GOBLINA"; + } + else + { + sRetTemplate = "NW_GOBLINB"; + } + } + // + + // Goblins and Boss + if (sTemplate == "gobsnboss") + { + int nIsBossSpawned = GetLocalInt(oSpawn, "IsBossSpawned"); + if (nIsBossSpawned == TRUE) + { + // Find the Boss + object oBoss = GetChildByTag(oSpawn, "NW_GOBCHIEFA"); + + // Check if Boss is Alive + if (oBoss != OBJECT_INVALID && GetIsDead(oBoss) == FALSE) + { + // He's alive, spawn a Peon to keep him Company + sRetTemplate = "NW_GOBLINA"; + } + else + { + // He's dead, Deactivate Camp! + SetLocalInt(oSpawn, "SpawnDeactivated", TRUE); + } + } + else + { + // No Boss, so Let's Spawn Him + sRetTemplate = "NW_GOBCHIEFA"; + SetLocalInt(oSpawn, "IsBossSpawned", TRUE); + } + } + // + + // Scaled Encounter + if (sTemplate == "scaledgobs") + { + // Initialize Variables + int nTotalPCs; + int nTotalPCLevel; + int nAveragePCLevel; + object oArea = GetArea(OBJECT_SELF); + + // Cycle through PCs in Area + object oPC = GetFirstObjectInArea(oArea); + while (oPC != OBJECT_INVALID) + { + if (GetIsPC(oPC) == TRUE) + { + nTotalPCs++; + nTotalPCLevel = nTotalPCLevel + GetHitDice(oPC); + } + oPC = GetNextObjectInArea(oArea); + } + if (nTotalPCs == 0) + { + nAveragePCLevel = 0; + } + else + { + nAveragePCLevel = nTotalPCLevel / nTotalPCs; + } + + // Select a Creature to Spawn + switch (nAveragePCLevel) + { + // Spawn Something with CR 1 + case 1: + sRetTemplate = "cr1creature"; + break; + // + + // Spawn Something with CR 5 + case 5: + sRetTemplate = "cr5creature"; + break; + // + } + } + // + + // Pirates and Boss + if (sTemplate == "pirates") + { + // Delay the Spawn for 45 Minutes + if (GetLocalInt(oSpawn, "DelayEnded") == FALSE) + { + if (GetLocalInt(oSpawn, "DelayStarted") == FALSE) + { + // Start the Delay + SetLocalInt(oSpawn, "DelayStarted", TRUE); + DelayCommand(20.0, SetLocalInt(oSpawn, "DelayEnded", TRUE)); + } + sRetTemplate = ""; + return sRetTemplate; + } + int nIsBossSpawned = GetLocalInt(oSpawn, "IsBossSpawned"); + if (nIsBossSpawned == TRUE) + { + // Find the Boss + object oBoss = GetChildByTag(oSpawn, "NW_GOBCHIEFA"); + + // Check if Boss is Alive + if (oBoss != OBJECT_INVALID && GetIsDead(oBoss) == FALSE) + { + // He's alive, spawn a Peon to keep him Company + sRetTemplate = "NW_GOBLINA"; + } + else + { + // He's dead, Deactivate Camp! + SetLocalInt(oSpawn, "SpawnDeactivated", TRUE); + } + } + else + { + // No Boss, so Let's Spawn Him + sRetTemplate = "NW_GOBCHIEFA"; + SetLocalInt(oSpawn, "IsBossSpawned", TRUE); + } + } + // + + // Advanced Scaled Encounter + if (sTemplate == "advscaled") + { + //Initalize Variables + int nTotalPCs; + int nTotalPCLevel; + int nAveragePCLevel; + object oArea = GetArea(OBJECT_SELF); + + //Cycle through PCs in area + object oPC = GetFirstObjectInArea(oArea); + while (oPC != OBJECT_INVALID) + { + if (GetIsPC(oPC) == TRUE) + { + nTotalPCs++; + nTotalPCLevel = nTotalPCLevel + GetHitDice(oPC); + } + oPC = GetNextObjectInArea(oArea); + } + if (nTotalPCs == 0) + { + nAveragePCLevel = 0; + } + else + { + nAveragePCLevel = nTotalPCLevel / nTotalPCs; + } + + //Select a Creature to Spawn + switch (nAveragePCLevel) + { + //Spawn Something with CR 1 + case 1: + switch (d6()) + { + case 1: sRetTemplate = "cr1example1"; + case 2: sRetTemplate = "cr1example2"; + case 3: sRetTemplate = "cr1example3"; + case 4: sRetTemplate = "cr1example4"; + case 5: sRetTemplate = "cr1example5"; + case 6: sRetTemplate = "cr1example6"; + } + break; + } + } + // + + // Encounters + if (sTemplate == "encounter") + { + // Declare Variables + int nCounter, nCounterMax; + string sCurrentTemplate; + + // Retreive and Increment Counter + nCounter = GetLocalInt(oSpawn, "GroupCounter"); + nCounterMax = GetLocalInt(oSpawn, "CounterMax"); + nCounter++; + + // Retreive CurrentTemplate + sCurrentTemplate = GetLocalString(oSpawn, "CurrentTemplate"); + + // Check CounterMax + if (nCounter > nCounterMax) + { + sCurrentTemplate = ""; + nCounter = 1; + } + + if (sCurrentTemplate != "") + { + // Spawn Another CurrentTemplate + sRetTemplate = sCurrentTemplate; + } + else + { + // Choose New CurrentTemplate and CounterMax + switch (Random(2)) + { + // Spawn 1-4 NW_DOGs + case 0: + sRetTemplate = "NW_DOG"; + nCounterMax = Random(4) + 1; + break; + } + // Record New CurrentTemplate and CounterMax + SetLocalString(oSpawn, "CurrentTemplate", sRetTemplate); + SetLocalInt(oSpawn, "CounterMax", nCounterMax); + } + + // Record Counter + SetLocalInt(oSpawn, "GroupCounter", nCounter); + } + // + + // + if (sTemplate == "kobolds") + { + int nKobold = Random(6) + 1; + sRetTemplate = "NW_KOBOLD00" + IntToString(nKobold); + } + // + //Sily's Groups + if (sTemplate == "sily_goblin_scout") + { + switch(d2(1)) + { + case 1: + sRetTemplate = "an_goblin"; + break; + case 2: + sRetTemplate = "an_goblin2"; + break; + } + } + + +// ------------------------------------------- +// Only Make Modifications Between These Lines +// + return sRetTemplate; +} diff --git a/_module/nss/spawn_cfg_loot.nss b/_module/nss/spawn_cfg_loot.nss new file mode 100644 index 0000000..9930f3c --- /dev/null +++ b/_module/nss/spawn_cfg_loot.nss @@ -0,0 +1,162 @@ +// +// Spawn Loot +// +// History: +// --/--/-- Neshke Created +// 12/03/02 Cereborn Added DanielleB's merchant-based loot tables +// 12/31/02 Cereborn Use newly added flags for determining the +// probabilities of 1,2, or 3 item drops from +// merchant-based (LT500-LT999) loot tables. +// Fixed an off-by-one bug in the item choosing +// code for for merchant-based loot tables. The +// code was trying to take items 2 through n+1. +// +int ParseFlagValue(string sName, string sFlag, int nDigits, int nDefault); +int ParseSubFlagValue(string sName, string sFlag, int nDigits, string sSubFlag, int nSubDigits, int nDefault); +object GetChildByTag(object oSpawn, string sChildTag); +object GetChildByNumber(object oSpawn, int nChildNum); +object GetSpawnByID(int nSpawnID); +void DeactivateSpawn(object oSpawn); +void DeactivateSpawnsByTag(string sSpawnTag); +void DeactivateAllSpawns(); +void DespawnChildren(object oSpawn); +void DespawnChildrenByTag(object oSpawn, string sSpawnTag); +void CleanInventory(object oSpawned); +// +// +void LootTable(object oSpawn, object oSpawned, int nLootTable) +{ + // Initialize + object oItem; + string sTemplate; + int nStack = 1; + +// +// Only Make Modifications Between These Lines +// ------------------------------------------- + + // Table 00 + if (nLootTable == 0) + { + // 50% Chance + if (d100(1) > 50) + { + // Created Custom Item with ResRef of magicsword + sTemplate = "magicsword"; + nStack = 1; + } + oItem = CreateItemOnObject(sTemplate, oSpawned, nStack); + } + // + + // Random Gold and *Nothing* Else + else if (nLootTable == 1) + { + CleanInventory(oSpawned); + // Add our Items: Gold for Example + nStack = Random(50) + 1; + oItem = CreateItemOnObject("nw_it_gold001", oSpawned, nStack); + } + // Merchant-based loot - from DanieleB NESS scripts + else if( nLootTable >= 500 ) + { + object oStore = OBJECT_INVALID; + oStore = GetObjectByTag( "LOOT_" + IntToString(nLootTable)); + + object oItem; + int nCount; + int nAmount; + if( GetIsObjectValid( oStore ) ) + { + // -- check if we already know item count + nCount = GetLocalInt( oStore , "nItemCount" ); + if( nCount <= 0 ) + { + // -- Count Items in Store Inventory + oItem = GetFirstItemInInventory( oStore ); + while( GetIsObjectValid( oItem ) ) + { + nCount++ ; + oItem = GetNextItemInInventory( oStore ); + } + SetLocalInt( oStore , "nItemCount" , nCount ); + } + // -- probability for multiple items + nAmount = d100(); + + // Cereborn: removed 12/31/02 + // Old: + // int nProbOneItem = 50; // 50% chance 1 item + // int nProbTwoItems = 15; // 15% chance 2 items + // int nProbThreeItems = 5; // 5% chance 3 items + // 30% chance no items ( implied ) + // New: + int nProbOneItem = GetLocalInt(oSpawn, "f_LootTable1ItemChance"); + int nProbTwoItems = GetLocalInt(oSpawn, "f_LootTable2ItemChance"); + int nProbThreeItems = GetLocalInt(oSpawn, "f_LootTable3ItemChance"); + + if( nAmount <= nProbThreeItems ) + nAmount = 3; + else + if( nAmount <= nProbThreeItems + nProbTwoItems ) + nAmount = 2; + else + if( nAmount <= nProbThreeItems + nProbTwoItems + nProbOneItem ) + nAmount = 1; + else + nAmount = 0; + // -- Generate nAmount items on oSpawned + while( nAmount > 0 ) + { + // -- Determine random item + int nSelected; + int nRand = Random( nCount ) + 1; + // -- Get the item + oItem = GetFirstItemInInventory( oStore ); + + for( nSelected = 1 ; nSelected < nRand ; nSelected++ ) + { + oItem = GetNextItemInInventory( oStore ); + } + // -- Grab item template + if (oItem != OBJECT_INVALID) + { + sTemplate = GetResRef( oItem ); + } + + // -- Checks to see if this it is a ammo or thrown item and creates more in the stack + string sRoot = GetStringLowerCase( GetSubString( sTemplate , 0 , 6 ) ); + if( sRoot == "nw_wam" || sRoot == "nw_wth" ) + { + nStack = Random( 30 ) + 1; + } + else + // -- Check if the item is Gold, and creates more in Stack + // small amount generated : gold placement should maybe be handled in some other way. + if( GetStringLowerCase( sTemplate ) == "nw_it_gold001" ) + nStack = Random( 30 ) + 5; + else + if( nStack < 1 ) + nStack = 1; + // -- create the item on oSpawned + oItem = CreateItemOnObject( sTemplate , oSpawned , nStack ); + // -- decerement the Item Amount counter + nAmount--; + } + } + else + { + // Write to log + PrintString( "Could not find Loot Merchant [" + + "LOOT_" + + IntToString( nLootTable ) + + "] for Spawn Waypoint : " + + GetLocalString(oSpawn, "f_Flags") ); + } + } + +// ------------------------------------------- +// Only Make Modifications Between These Lines +// + +} diff --git a/_module/nss/spawn_chk_custom.nss b/_module/nss/spawn_chk_custom.nss new file mode 100644 index 0000000..cfdb1de --- /dev/null +++ b/_module/nss/spawn_chk_custom.nss @@ -0,0 +1,103 @@ +// +// Spawn Check - Custom +// +int ParseFlagValue(string sName, string sFlag, int nDigits, int nDefault); +int ParseSubFlagValue(string sName, string sFlag, int nDigits, string sSubFlag, int nSubDigits, int nDefault); +object GetChildByTag(object oSpawn, string sChildTag); +object GetChildByNumber(object oSpawn, int nChildNum); +object GetSpawnByID(int nSpawnID); +void DeactivateSpawn(object oSpawn); +void DeactivateSpawnsByTag(string sSpawnTag); +void DeactivateAllSpawns(); +void DespawnChildren(object oSpawn); +void DespawnChildrenByTag(object oSpawn, string sSpawnTag); +// +// +int SpawnCheckCustom(object oSpawn) +{ + // Initialize Values + int nSpawnCheckCustom = GetLocalInt(oSpawn, "f_SpawnCheckCustom"); + + // Block Spawn by Default + int nProcessSpawn = FALSE; + +// +// Only Make Modifications Between These Lines +// ------------------------------------------- + + // Check 00 + if (nSpawnCheckCustom == 0) + { + // Example, Allow Spawn + nProcessSpawn = TRUE; + } + // + + // + if (nSpawnCheckCustom == 1) + { + if (GetIsDawn() == TRUE || GetIsDay() == TRUE) + { + nProcessSpawn = TRUE; + SetLocalInt(oSpawn, "SpawnProcessed", FALSE); + } + else + { + int nSpawnProcessed = GetLocalInt(oSpawn, "SpawnProcessed"); + if (nSpawnProcessed == FALSE) + { + nProcessSpawn = TRUE; + SetLocalInt(oSpawn, "SpawnProcessed", TRUE); + } + } + } + // + + // Reproducing Predators + if (nSpawnCheckCustom == 10) + { + int nChildren = GetLocalInt(oSpawn, "ChildrenSpawned"); + if (nChildren >= 10) + { + int nHappy = 0; + int nPredators; + int nNth = 1; + object oPredator = GetNearestObject(OBJECT_TYPE_CREATURE, oSpawn, nNth); + while (oPredator != OBJECT_INVALID) + { + if (GetLocalInt(oPredator, "Predator") == TRUE) + { + nPredators++; + if (GetLocalInt(oPredator, "CurrentHungerState") > 0) + { + nHappy++; + } + } + nNth++; + oPredator = GetNearestObject(OBJECT_TYPE_CREATURE, oSpawn, nNth); + } + SendMessageToAllDMs("There are " + IntToString(nPredators) + " Predators Alive."); + if (nHappy >= 2) + { + nProcessSpawn = TRUE; + } + } + else + { + nProcessSpawn = TRUE; + } + if (nProcessSpawn == TRUE) + { + SendMessageToAllDMs("A Predator is Born!"); + } + } + // + + +// ------------------------------------------- +// Only Make Modifications Between These Lines +// + + // Return whether Spawn can Proceed + return nProcessSpawn; +} diff --git a/_module/nss/spawn_chk_pcs.nss b/_module/nss/spawn_chk_pcs.nss new file mode 100644 index 0000000..06d35d8 --- /dev/null +++ b/_module/nss/spawn_chk_pcs.nss @@ -0,0 +1,132 @@ +// +// Spawn Check - PCs +// +int ParseFlagValue(string sName, string sFlag, int nDigits, int nDefault); +int ParseSubFlagValue(string sName, string sFlag, int nDigits, string sSubFlag, int nSubDigits, int nDefault); +object GetChildByTag(object oSpawn, string sChildTag); +object GetChildByNumber(object oSpawn, int nChildNum); +object GetSpawnByID(int nSpawnID); +void DeactivateSpawn(object oSpawn); +void DeactivateSpawnsByTag(string sSpawnTag); +void DeactivateAllSpawns(); +void DespawnChildren(object oSpawn); +void DespawnChildrenByTag(object oSpawn, string sSpawnTag); +// +// +int SpawnCheckPCs(object oSpawn) +{ + // Initialize Values + object oPC; + object oArea = GetArea(oSpawn); + string sSpawnName = GetLocalString(oSpawn, "f_Flags"); + location lSpawn = GetLocation(oSpawn); + int nCheckPCs = GetLocalInt(oSpawn, "f_SpawnCheckPCs"); + float fCheckPCsRadius = GetLocalFloat(oSpawn, "f_CheckPCsRadius"); + + // Block Spawn by Default + int nProcessSpawn = FALSE; + + // Cycle through PCs + if (fCheckPCsRadius > -1.0) + { + oPC = GetFirstObjectInShape(SHAPE_SPHERE, fCheckPCsRadius, lSpawn, FALSE, OBJECT_TYPE_CREATURE); + } + else + { + oPC = GetFirstObjectInArea(oArea); + } + while (oPC != OBJECT_INVALID) + { + if (GetIsPC(oPC) == TRUE) + { + +// +// Only Make Modifications Between These Lines +// ------------------------------------------- + + + // Check 00 + if (nCheckPCs == 0) + { + // Example, Allow Spawn + nProcessSpawn = TRUE; + } + // + + // Spawn with a Skill Check + if (nCheckPCs == 1) + { + // Get Current Number of Children + int nSpawnCount = GetLocalInt(oSpawn, "SpawnCount"); + + if (nSpawnCount == 0) + { + // DC of Hidden Placeable + int nItemDC = 20; + + // Player's Skill + int nSkill = GetSkillRank(SKILL_SEARCH, oPC); + + // Do Skill Check + int nDCCheck = d20() + nSkill; + if (nDCCheck >= nItemDC) + { + // Placeable Spotted! + string sSpotted = "You notice a thingamathingy!"; + FloatingTextStringOnCreature(sSpotted, oPC, TRUE); + //Spawn it! + nProcessSpawn = TRUE; + } + } + } + // + + // Spawn Based on Journal Quest Entry + if (nCheckPCs == 1) + { + // Check Journal Quest Entry + int nQuest = GetLocalInt(oPC, "NW_JOURNAL_ENTRYQuest1"); + if (nQuest == 1) + { + // Quest Entry is 1, Spawn! + nProcessSpawn = TRUE; + } + } + // + + // Spawn Based on Item in PC Inventory + if (nCheckPCs == 2) + { + // Check Player for Item + object oItem = GetFirstItemInInventory(oPC); + while (oItem != OBJECT_INVALID) + { + if (GetTag(oItem) == "MysticKey") + { + // Item Found, Spawn! + nProcessSpawn = TRUE; + } + oItem = GetNextItemInInventory(oPC); + } + } + // + + +// ------------------------------------------- +// Only Make Modifications Between These Lines +// + } + // Retreive Next PC + if (fCheckPCsRadius > -1.0) + { + oPC = GetNextObjectInShape(SHAPE_SPHERE, fCheckPCsRadius, lSpawn, FALSE, OBJECT_TYPE_CREATURE); + } + else + { + oPC = GetNextObjectInArea(oArea); + } + } + + // Return whether Spawn can Proceed + return nProcessSpawn; +} diff --git a/_module/nss/spawn_corpse_dcy.nss b/_module/nss/spawn_corpse_dcy.nss new file mode 100644 index 0000000..c27063b --- /dev/null +++ b/_module/nss/spawn_corpse_dcy.nss @@ -0,0 +1,62 @@ +// +// NESS V8.0 +// Spawn: Corpse Decay Script +// +// +// Do NOT Modify this File +// See 'spawn__readme' for Instructions +// + +#include "spawn_functions" + +void main() +{ + object oHostBody = OBJECT_SELF; + object oLootCorpse = GetLocalObject(oHostBody, "Corpse"); + object oItem; + float fCorpseDecay; + + // Don't Decay while Someone is Looting + if (GetIsOpen(oLootCorpse) == TRUE) + { + // try again + fCorpseDecay = GetLocalFloat(oHostBody, "CorpseDecay"); + DelayCommand(fCorpseDecay, ExecuteScript("spawn_corpse_dcy", oHostBody)); + return; + } + + // Don't Decay if not Empty and Timer not Expired + oItem = GetFirstItemInInventory(oLootCorpse); + int nDecayTimerExpired = GetLocalInt(oHostBody, "DecayTimerExpired"); + + // Don't think this should ever happen, since nDecayTimerExpired should + // be set to try by the command immediately beforethe one invoking this + // script! + if (oItem != OBJECT_INVALID && nDecayTimerExpired == FALSE) + { + fCorpseDecay = GetLocalFloat(oHostBody, "CorpseDecay"); + DelayCommand(fCorpseDecay - 0.1, SetLocalInt(oHostBody, "DecayTimerExpired", TRUE)); + DelayCommand(fCorpseDecay, ExecuteScript("spawn_corpse_dcy", oHostBody)); + return; + } + + int bDeleteLootOnDecay = GetLocalInt(oHostBody, "CorpseDeleteLootOnDecay"); + + // To avoid potential memory leaks, we clean everything that might be left on the + // original creatures body + NESS_CleanCorpse(oHostBody); + + // Destroy all loot if indicated (R7 subflag) + if (bDeleteLootOnDecay) + { + NESS_CleanInventory(oLootCorpse); + } + + // Destroy the invis corpse and drop a loot bag (if any loot left) + SetPlotFlag(oLootCorpse, FALSE); + DestroyObject(oLootCorpse); + + // Destroy the visible corpse + SetObjectIsDestroyable(oHostBody, TRUE, FALSE, FALSE); + DestroyObject(oHostBody, 0.2); +} diff --git a/_module/nss/spawn_corpse_dth.nss b/_module/nss/spawn_corpse_dth.nss new file mode 100644 index 0000000..2489048 --- /dev/null +++ b/_module/nss/spawn_corpse_dth.nss @@ -0,0 +1,142 @@ +// +// NESS V8.0 +// Spawn : Corpse Death Script +// +// +// Do NOT Modify this File +// See 'spawn__readme' for Instructions +// + +#include "spawn_functions" + +void CopyItemVarsAndPlot(object oSource, object oInventory) +{ + int bWasPlot = GetPlotFlag(oSource); + object oNewItem = CopyItem(oSource, oInventory, TRUE); + if (bWasPlot == TRUE) + { + SetPlotFlag(oNewItem,TRUE); + } +} +// Strip everything droppable in the regular inventory, too. +void LootInventoryAndPreserveVars(object oVictim, object oCorpse) +{ + object oItem = GetFirstItemInInventory(oVictim); + while (GetIsObjectValid(oItem)) { + if (GetDroppableFlag(oItem)) { + // Copy to the corpse and destroy + CopyItemVarsAndPlot(oItem, oCorpse); + DestroyObject(oItem, 0.1); + } + oItem = GetNextItemInInventory(oVictim); + } +} + +void main() +{ + object oDeadNPC = OBJECT_SELF; + object oLootCorpse, oBlood; + location lCorpseLoc = GetLocation(oDeadNPC); + float fCorpseDecay = GetLocalFloat(oDeadNPC, "CorpseDecay"); + int nCorpseDecayType = GetLocalInt(oDeadNPC, "CorpseDecayType"); + int bDropWielded = GetLocalInt(oDeadNPC, "CorpseDropWielded"); + string sLootCorpseResRef = GetLocalString(oDeadNPC, "CorpseRemainsResRef"); + struct NESS_CorpseInfo stCorpseInfo; + + int nCorpseGold = FALSE, nCorpseInv = FALSE, nCorpseEquip = FALSE; + + object oKiller = GetLastDamager(); + if (oKiller == OBJECT_INVALID) + { + oKiller = GetLastKiller(); + } + + if (fCorpseDecay > 0.0) + { + //Protect our corpse from decaying + SetIsDestroyable(FALSE, FALSE, FALSE); + + // Create Corpse and Lootable Corpse + oLootCorpse = CreateObject(OBJECT_TYPE_PLACEABLE, sLootCorpseResRef, lCorpseLoc); + + SetLocalObject(oLootCorpse, "HostBody", oDeadNPC); + SetLocalObject(oDeadNPC, "Corpse", oLootCorpse); + + switch (nCorpseDecayType) + { + // Type 0: + // Inventory Items + case 0: + nCorpseGold = TRUE; + nCorpseInv = TRUE; + nCorpseEquip = FALSE; + break; + + // Type 1: + // Inventory & Equipped Items + case 1: + nCorpseGold = TRUE; + nCorpseInv = TRUE; + nCorpseEquip = TRUE; + break; + + // Type 2: + // Inventory Items, if PC Killed + case 2: + if (GetIsPC(oKiller) == TRUE || GetIsPC(GetMaster(oKiller)) == TRUE) + { + nCorpseGold = TRUE; + nCorpseInv = TRUE; + nCorpseEquip = FALSE; + } + break; + + // Type 3: + // Inventory & Equipped Items, if PC Killed + case 3: + if (GetIsPC(oKiller) == TRUE || GetIsPC(GetMaster(oKiller)) == TRUE) + { + nCorpseGold = TRUE; + nCorpseInv = TRUE; + nCorpseEquip = TRUE; + } + break; + } + + // Get Gold + if (nCorpseGold == TRUE) + { + int nAmtGold = GetGold(oDeadNPC); + if(nAmtGold) + { + object oGold = CreateItemOnObject("nw_it_gold001", oLootCorpse, nAmtGold); + AssignCommand(oLootCorpse, TakeGoldFromCreature(nAmtGold, oDeadNPC,TRUE)); + } + } + + // Get Inventory & Equipment + if (nCorpseEquip == TRUE) + { + stCorpseInfo = TransferAllInventorySlots(oDeadNPC, oLootCorpse, bDropWielded); + } + + if (nCorpseInv == TRUE) + { + LootInventoryAndPreserveVars(oDeadNPC, oLootCorpse); + } + + // Write a record of stuff left on the original corpse and its loot + // corpse counterpart. These are used to remove items from the visual corpse + // when the corresponding items are looted + SetLocalObject(oLootCorpse, "OrigArmor", stCorpseInfo.origArmor); + SetLocalObject(oLootCorpse, "LootArmor", stCorpseInfo.lootArmor); + SetLocalObject(oLootCorpse, "OrigRgtWpn", stCorpseInfo.origRgtWpn); + SetLocalObject(oLootCorpse, "LootRgtWpn", stCorpseInfo.lootRgtWpn); + SetLocalObject(oLootCorpse, "OrigLftWpn", stCorpseInfo.origLftWpn); + SetLocalObject(oLootCorpse, "LootLftWpn", stCorpseInfo.lootLftWpn); + + // Set Corpse to Decay + DelayCommand(fCorpseDecay - 0.1, SetLocalInt(oDeadNPC, "DecayTimerExpired", TRUE)); + DelayCommand(fCorpseDecay, ExecuteScript("spawn_corpse_dcy", oDeadNPC)); + } +} diff --git a/_module/nss/spawn_defaults.nss b/_module/nss/spawn_defaults.nss new file mode 100644 index 0000000..febcbc7 --- /dev/null +++ b/_module/nss/spawn_defaults.nss @@ -0,0 +1,306 @@ +// +// NESS V8.1.3 +// +// Spawn Global Defaults +// +// + +// SXn +// Set this value to 1 to have dim returns suppression be the default +// when no SX flag is present. +int nGlobalSuppressDR = 0; + +// This is the default value for the SX flag when no value is specified. +// Set to 0 to make SX (without a value) enable dim returns. +int nSuppressDR = 1; + +// SPnOn +int nProcessFrequency = 1; +int nProcessOffset = 0; + +// ISnDn +// InitialState +int nInitialState = 1; +int nInitialDelay = -1; + +// FTn +// FlagTable +int nFlagTableNumber = 0; + +// SDn|Mn +// SpawnDelay +int nSpawnDelay = 0; +int nDelayMinimum = 0; + +// SNn|Mn SA|n|Mn +// SpawnNumber +int nSpawnNumber = 1; +int nSpawnNumberMin = -1; +int nSpawnNumberAtOnce = 0; +int nSpawnNumberAtOnceMin = 0; + +// DYn|Tn +// SpawnDay +int nSpawnDayStart = -1; +int nSpawnDayEnd = -1; + +// HRn|Tn +// SpawnHour +int nSpawnHourStart = -1; +int nSpawnHourEnd = -1; + +// RW|Rn +// RandomWalk +int nWanderRange = 0; + +// RH|Dn +// ReturnHome +int nReturnHomeRange = 1; + +// PC|n|R +// PCCheck +int nPCCheckDelay = 0; + +// RGn|Mn|Cn +// RandomGold +int nRandomGold = 0; +int nRandomGoldMin = 0; +int nGoldChance = 100; + +// FXn|Dn +// SpawnEffects +int nSpawnEffect = 0; +int nDespawnEffect = 0; + +// PRn|Tn +// PatrolRoutes +int nPatrolRoute = -1; +int nRouteType = 0; + +// PLn|Tn|Pn +// Placeables +int nPlaceableType = 0; +int nPlaceableRefreshPeriod = 60; +int nTrapDisabled = 100; + +// LTn|An|Bn|Cn +// LootTable +int nLootTable = -1; + +// Cereborn: added 12/31/02 +int nLootTable1ItemChance = 50; +int nLootTable2ItemChance = 15; +int nLootTable3ItemChance = 5; + +// DSn|Sn +// SpawnDeactivation +int nDeactivateSpawn = -1; +int nDeactivateScript = -1; + +// DIn +// DeactivationInfo +int nDeactivationInfo = -1; + +// CLn|Mn +// ChildLifespan +int nChildLifespanMax = -1; +int nChildLifespanMin = -1; + +// SRn|Mn|P +// SpawnRadius +int nSpawnRadius = 0; +int nSpawnRadiusMin = 0; + +// SUn|In +// SpawnUnseen +int nSpawnUnseen = 0; +int nUnseenRetryCount = -1; + +// CDn|Tn|Rn|D +// CorpseDecay +int nCorpseDecay = 0; +int nCorpseDecayType = 0; +int nCorpseRemainsType = 0; + +// CM|Dn +// SpawnCamp +int nCampDecay = 0; + +// SSn|Dn +// SpawnScript +int nSpawnScript = -1; +int nDespawnScript = -1; + +// DTn +// DeathScript +int nDeathScript = -1; + +// CCn +// SpawnCheckCustom +int nSpawnCheckCustom = -1; + +// CPn|Rn +// SpawnCheckPCs +int nSpawnCheckPCs = -1; +int nCheckPCsRadius = -1; + +// TRn|Dn +// SpawnTrigger +int nSpawnTrigger = 0; +int nDespawnTrigger = 0; + +// AEn|Dn +// AreaEffect +int nSpawnAreaEffect = 0; +int nAreaEffectDuration = 5; + +// OEn|Dn +// ObjectEffect +int nObjectEffect = 0; +int nObjectEffectDuration = -1; + +// RSn +// RandomSpawn +int nRandomSpawn = 100; + +// FCn +// SpawnFaction +int nSpawnFaction = -1; + +// ALn|Sn +int nSpawnAlignment = -1; +int nAlignmentShift = 10; + +// HBn +// HeartbeatScript +int nHeartbeatScript = -1; + +// SLn|Rn +// SpawnLocation +int nSpawnLocation = -1; +int nSpawnLocationMin = -1; + +// EEn|Rn +// EntranceExit +int nEntranceExit = -1; +int nEntranceExitMin = -1; +int nExit = -1; +int nExitMin = -1; + +// HL|n|E +// HealChildren +int nHealChildren = 0; + +// Sittable Tag +string sSeatTag = "Seat"; + +int nEncounterLevel = 0; +int bLeftoversForceProcessing = 1; +int bCheckForStuckPatrols = 1; +int bAlwaysDestroyCorpses = 1; + +//CS|n|Cn|Tn +//Cache Spawn + +int nUseCache = 0; //if you set this to 1 then, by default all flags will assume to have basic caching. +int nCacheBucket = 0; +int nCacheCondition = 0; +int nCacheTiming = 0; + +void SetUserGlobalDefaults(); + +void SetGlobalDefaults() +{ + SetUserGlobalDefaults(); + + // Record Values + object oModule = GetModule(); + SetLocalInt(oModule, "df_GlobalSuppressDR", nGlobalSuppressDR); + SetLocalInt(oModule, "df_SuppressDR", nSuppressDR); + SetLocalInt(oModule, "df_processFrequency", nProcessFrequency); + SetLocalInt(oModule, "df_processOffset", nProcessOffset); + SetLocalInt(oModule, "df_InitialState", nInitialState); + SetLocalInt(oModule, "df_InitialDelay", nInitialDelay); + SetLocalInt(oModule, "df_FlagTableNumber", nFlagTableNumber); + SetLocalInt(oModule, "df_SpawnDelay", nSpawnDelay); + SetLocalInt(oModule, "df_DelayMinimum", nDelayMinimum); + SetLocalInt(oModule, "df_SpawnNumber", nSpawnNumber); + SetLocalInt(oModule, "df_SpawnNumberMin", nSpawnNumberMin); + SetLocalInt(oModule, "df_SpawnNumberAtOnce", nSpawnNumberAtOnce); + SetLocalInt(oModule, "df_SpawnNumberAtOnceMin", nSpawnNumberAtOnceMin); + SetLocalInt(oModule, "df_SpawnDayStart", nSpawnDayStart); + SetLocalInt(oModule, "df_SpawnDayEnd", nSpawnDayEnd); + SetLocalInt(oModule, "df_SpawnHourStart", nSpawnHourStart); + SetLocalInt(oModule, "df_SpawnHourEnd", nSpawnHourEnd); + SetLocalInt(oModule, "df_WanderRange", nWanderRange); + SetLocalInt(oModule, "df_ReturnHomeRange", nReturnHomeRange); + SetLocalInt(oModule, "df_PCCheckDelay", nPCCheckDelay); + SetLocalInt(oModule, "df_RandomGold", nRandomGold); + SetLocalInt(oModule, "df_RandomGoldMin", nRandomGoldMin); + SetLocalInt(oModule, "df_GoldChance", nGoldChance); + SetLocalInt(oModule, "df_SpawnEffect", nSpawnEffect); + SetLocalInt(oModule, "df_DespawnEffect", nDespawnEffect); + SetLocalInt(oModule, "df_PatrolRoute", nPatrolRoute); + SetLocalInt(oModule, "df_RouteType", nRouteType); + SetLocalInt(oModule, "df_PlaceableType", nPlaceableType); + SetLocalInt(oModule, "df_PlaceableRefreshPeriod", nPlaceableRefreshPeriod); + SetLocalInt(oModule, "df_TrapDisabled", nTrapDisabled); + SetLocalInt(oModule, "df_LootTable", nLootTable); + SetLocalInt(oModule, "df_LootTable1ItemChance", nLootTable1ItemChance); + SetLocalInt(oModule, "df_LootTable2ItemChance", nLootTable2ItemChance); + SetLocalInt(oModule, "df_LootTable3ItemChance", nLootTable3ItemChance); + SetLocalInt(oModule, "df_DeactivateSpawn", nDeactivateSpawn); + SetLocalInt(oModule, "df_DeactivateScript", nDeactivateScript); + SetLocalInt(oModule, "df_DeactivationInfo", nDeactivationInfo); + SetLocalInt(oModule, "df_ChildLifespanMax", nChildLifespanMax); + SetLocalInt(oModule, "df_ChildLifespanMin", nChildLifespanMin); + SetLocalInt(oModule, "df_SpawnRadius", nSpawnRadius); + SetLocalInt(oModule, "df_SpawnRadiusMin", nSpawnRadiusMin); + SetLocalInt(oModule, "df_SpawnUnseen", nSpawnUnseen); + SetLocalInt(oModule, "df_UnseenRetryCount", nUnseenRetryCount); + SetLocalInt(oModule, "df_CorpseDecay", nCorpseDecay); + SetLocalInt(oModule, "df_CorpseDecayType", nCorpseDecayType); + SetLocalInt(oModule, "df_CampDecay", nCampDecay); + SetLocalInt(oModule, "df_SpawnScript", nSpawnScript); + SetLocalInt(oModule, "df_DespawnScript", nDespawnScript); + SetLocalInt(oModule, "df_DeathScript", nDeathScript); + SetLocalInt(oModule, "df_SpawnCheckCustom", nSpawnCheckCustom); + SetLocalInt(oModule, "df_SpawnCheckPCs", nSpawnCheckPCs); + SetLocalInt(oModule, "f_CheckPCsRadius", nCheckPCsRadius); + SetLocalInt(oModule, "df_SpawnTrigger", nSpawnTrigger); + SetLocalInt(oModule, "df_DespawnTrigger", nDespawnTrigger); + SetLocalInt(oModule, "df_SpawnAreaEffect", nSpawnAreaEffect); + SetLocalInt(oModule, "df_AreaEffectDuration", nAreaEffectDuration); + SetLocalInt(oModule, "df_ObjectEffect", nObjectEffect); + SetLocalInt(oModule, "df_ObjectEffectDuration", nObjectEffectDuration); + SetLocalInt(oModule, "df_RandomSpawn", nRandomSpawn); + SetLocalInt(oModule, "df_SpawnFaction", nSpawnFaction); + SetLocalInt(oModule, "df_SpawnAlignment", nSpawnAlignment); + SetLocalInt(oModule, "df_AlignmentShift", nAlignmentShift); + SetLocalInt(oModule, "df_HeartbeatScript", nHeartbeatScript); + SetLocalInt(oModule, "df_SpawnLocation", nSpawnLocation); + SetLocalInt(oModule, "df_SpawnLocationMin", nSpawnLocationMin); + SetLocalInt(oModule, "df_EntranceExit", nEntranceExit); + SetLocalInt(oModule, "df_EntranceExitMin", nEntranceExitMin); + SetLocalInt(oModule, "df_Exit", nExit); + SetLocalInt(oModule, "df_ExitMin", nExitMin); + SetLocalInt(oModule, "df_HealChildren", nHealChildren); + SetLocalInt(oModule, "df_EncounterLevel", nEncounterLevel); + SetLocalInt(oModule, "df_CorpseRemainsType", nCorpseRemainsType); + + + SetLocalInt(oModule, "df_UseCache", nUseCache); + SetLocalInt(oModule, "df_CacheBucket", nCacheBucket); + SetLocalInt(oModule, "df_CacheCondition", nCacheCondition); + SetLocalInt(oModule, "df_CacheTiming", nCacheTiming); + + SetLocalInt(oModule, "ModuleSpawnCount", 0); + + SetLocalString(oModule, "df_SeatTag", sSeatTag); + SetLocalInt(oModule, "LeftoversForceProcessing", bLeftoversForceProcessing); + SetLocalInt(oModule, "CheckForStuckPatrols", bCheckForStuckPatrols); + SetLocalInt(oModule, "AlwaysDestroyCorpses", bAlwaysDestroyCorpses); + + // Record Initialization + SetLocalInt(oModule, "GlobalDefaultsInitialized", TRUE); +} diff --git a/_module/nss/spawn_dist_corps.nss b/_module/nss/spawn_dist_corps.nss new file mode 100644 index 0000000..fa0fde3 --- /dev/null +++ b/_module/nss/spawn_dist_corps.nss @@ -0,0 +1,127 @@ +// +// NESS V8.0 +// Spawn Disturbed Corpse +// +// Brought into the NESS distribution for Version 8.0 and beyond. Original +// header below. This file has been modified from its original form. +// + +//////////////////////////////////////////////////////////////////////////////// +// // // +// _kb_ondist_loot // VERSION 1.1 // +// // // +// by Keron Blackfeld on 07/17/2002 //////////////////////////// +// // +// email Questions and Comments to: keron@broadswordgaming.com or catch me // +// in Bioware's NWN Community - Builder's NWN Scripting Forum // +// // +//////////////////////////////////////////////////////////////////////////////// +// // +// This is an OnDisturbed Script to go with my _kb_loot_corpse script for // +// LOOTABLE MONSTER/NPC CORPSES. If you were using my _kb_ohb_lootable, be // +// sure to remove that script from the onHeartbeat of your lootable, the // +// "invis_corpse_obj" placeable. // +// // +// PLACE THIS SCRIPT IN THE ONDISTURBED EVENT OF YOUR "invis_corpse_obj" // +// BLUEPRINT. This script checks the inventory of OBJECT_SELF, and when it // +// is empty, it checks the LocalInt to see if the now empty corpse should // +// be Destroyed along with the Lootable Corpse Object. This script will also // +// checks to see if it should clear its own inventory prior to fading in // +// order to prevent a lootbag from appearing. If the inventory is NOT empty, // +// it checks to see if the ARMOUR is removed from itself, and if so, it // +// destroys the Original Armour on the corpse. // +// // +// The _kb_loot_corpse script must have this line: // +// int nKeepEmpties = FALSE; // +// in order for the Empty Corpse to Destroy itself in this script. // +// // +//////////////////////////////////////////////////////////////////////////////// + +// +// ALFA NESS +// Spawn : Loot Corpse Disturbed Script v1.2 +// +// +// Do NOT Modify this File +// See 'spawn__readme' for Instructions +// + +#include "spawn_functions" + +/******************************************* + ** Here is our main script, which is ** + ** fired if the Inventory is disturbed. ** + ** It then checks to see if it needs to ** + ** either clean up the corpse or Destroy ** + ** the original suit of armor still on ** + ** the corpse. ** + *******************************************/ +void main() +{ + //** Get all of our required information + + //Get item that was disturbed to trigger event + object oInvDisturbed = GetInventoryDisturbItem(); + + //Get type of inventory disturbance + int nInvDistType = GetInventoryDisturbType(); + + // Get Values set by spawn_corpse_dth at creation + object oHostCorpse = GetLocalObject(OBJECT_SELF, "HostBody"); + object oOrigArmor = GetLocalObject(OBJECT_SELF, "OrigArmor"); + object oLootArmor = GetLocalObject(OBJECT_SELF, "LootArmor"); + object oOrigRgtWpn = GetLocalObject(OBJECT_SELF, "OrigRgtWpn"); + object oLootRgtWpn = GetLocalObject(OBJECT_SELF, "LootRgtWpn"); + object oOrigLftWpn = GetLocalObject(OBJECT_SELF, "OrigLftWpn"); + object oLootLftWpn = GetLocalObject(OBJECT_SELF, "LootLftWpn"); + + object oPC = GetLastDisturbed(); + AssignCommand(oPC, ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW, 1.0f, 1.2f)); + + object oHasInventory = GetFirstItemInInventory(OBJECT_SELF); //Check for inventory + if (oHasInventory == OBJECT_INVALID) //If no inventory found + { + /******************************************* + ** Delete empty. ** + *******************************************/ + NESS_CleanCorpse(oHostCorpse); + AssignCommand(oHostCorpse,SetIsDestroyable(TRUE,FALSE,FALSE)); //Set actual corpse to destroyable + DestroyObject(oHostCorpse); //Delete the actual Creature Corpse + + DelayCommand(1.0f,DestroyObject(OBJECT_SELF)); //Delete Lootable Object (Self) + + } + + else + { + /******************************************* + ** If not empty, check to see if armor, ** + ** left or right weapons have been ** + ** removed from corpse. ** + *******************************************/ + if (nInvDistType == INVENTORY_DISTURB_TYPE_REMOVED) + { + if (oInvDisturbed == oLootArmor) + { + /******************************************* + ** The Armor is gone - destroy original ** + ** armor still showing on corpse. ** + *******************************************/ + DestroyObject(oOrigArmor); + } + + // We don't do these for now, as the unequip animations look too + // damn silly + //else if (oInvDisturbed == oLootRgtWpn) + //{ + // DestroyObject(oOrigRgtWpn); + //} + + //else if (oInvDisturbed == oLootLftWpn) + //{ + // DestroyObject(oOrigLftWpn); + //} + } + } + +} diff --git a/_module/nss/spawn_flags.nss b/_module/nss/spawn_flags.nss new file mode 100644 index 0000000..7fa45b0 --- /dev/null +++ b/_module/nss/spawn_flags.nss @@ -0,0 +1,154 @@ +// +// NESS V8.0 +// Spawn Flags +// +// Do NOT Modify this File +// See 'spawn__readme' for Instructions +// + +int IsFlagPresent(string sName, string sFlag) +{ + int nPos = FindSubString(sName, sFlag); + if (nPos >= 0) // flag found + { + //debug("flag " + sFlag + " present"); + return TRUE; + } + return FALSE; +} + +// This Function parses a String for Flags +// When nGetValue is FALSE, this returns TRUE if the flag exists, FALSE otherwise. +// nDefault is unused when nGetValue is FALSE. +// When nGetValue is TRUE, it returns the value of the flag if it +// exists, or nDefault otherwise. +int GetFlagValue(string sName, string sFlag, int nDefault) +{ + int nRetValue; + int nPos; + + nPos = FindSubString(sName, sFlag); + if (nPos >= 0) // flag found + { + // Trim to the start of the flag + sName = GetStringRight(sName, GetStringLength(sName) - + (nPos + GetStringLength(sFlag))); + + // find the end of the flag + nPos = FindSubString(sName, "_"); + if (nPos >= 0) + { + sName = GetStringLeft(sName, nPos); + } + + // Retreive Flag + if (TestStringAgainstPattern("*n", GetStringLeft(sName, 1)) == FALSE) + { + // No value specified, use default + nRetValue = nDefault; + //debug("flag " + sFlag + " - def val = " + IntToString(nRetValue)); + + + } + else + { + // Retrieve Value + nRetValue = StringToInt(sName); + //debug("flag " + sFlag + " - val = " + IntToString(nRetValue)); + } + } + + else // flag not found at all + { + nRetValue = nDefault; + + } + + // Return Value + return nRetValue; +} +// + +int IsSubFlagPresent(string sName, string sFlag, string sSubFlag) +{ + int nPos = FindSubString(sName, sFlag); + if (nPos >= 0) + { + // Trim Flag + sName = GetStringRight(sName, GetStringLength(sName) - + (nPos + GetStringLength(sFlag))); + + nPos = FindSubString(sName, "_"); + if (nPos >= 0) + { + sName = GetStringLeft(sName, nPos); + } + + // Retreive SubFlag + nPos = FindSubString(sName, sSubFlag); + if (nPos >= 0) + { + //debug("flag " + sFlag + "subflag " + sSubFlag + " present"); + return TRUE; + } + } + + return FALSE; +} + +// This Function parses a String for a Subvalue from Flags +int GetSubFlagValue(string sName, string sFlag, string sSubFlag, int nDefault) +{ + int nRetValue; + int nPos; + + nPos = FindSubString(sName, sFlag); + if (nPos >= 0) + { + // Trim Flag + sName = GetStringRight(sName, GetStringLength(sName) - + (nPos + GetStringLength(sFlag))); + + nPos = FindSubString(sName, "_"); + + if (nPos >= 0) + { + sName = GetStringLeft(sName, nPos); + } + + // Retreive SubFlag + nPos = FindSubString(sName, sSubFlag); + if (nPos >= 0) + { + sName = GetStringRight(sName, GetStringLength(sName) - + (nPos + GetStringLength(sSubFlag))); + + if (TestStringAgainstPattern("*n", GetStringLeft(sName, 1)) == FALSE) + { + nRetValue = nDefault; // SubFlag found but no value + //debug("flag " + sFlag + " subflag " + sSubFlag + " - def val = " + + // IntToString(nRetValue)); + } + else + { + // Retrieve Value + nRetValue = StringToInt(sName); // Subflag (with value) found + //debug("flag " + sFlag + " subflag " + sSubFlag + " - val = " + + // IntToString(nRetValue)); + } + } + else + { + nRetValue = nDefault; // subflag not found + } + } + else + { + nRetValue = nDefault; // Main flag not found + } + + // Return Value + return nRetValue; +} +// + diff --git a/_module/nss/spawn_functions.nss b/_module/nss/spawn_functions.nss new file mode 100644 index 0000000..d0e1b95 --- /dev/null +++ b/_module/nss/spawn_functions.nss @@ -0,0 +1,3702 @@ +// +// NESS V8.1.3 +// Spawn Functions +// +// Do NOT Modify this File +// See 'spawn__readme' for Instructions +// + +#include "spawn_timefuncs" +#include "spawn_flags" +#include "spawn_cfg_cusflg" +#include "x0_i0_corpses" + +void InitFlags(object oSpawn, string sSpawnName, string sSpawnTag); +int SetSpawns(location lBase); +string PadIntToString(int nInt, int nDigits); + +void ResetSpawn(object oSpawn, int nTimeNow); +int IsRestoreBlocked(object oSpawn, location lChildLoc, int iExpireTime, + int nTimeNow); + +void SetupSpawned(object oSpawn, object oSpawned, location lHome, int nTimeNow, + int nWalkToHome = FALSE); + +void SetupCampSpawned(object oSpawn, object oSpawned, vector vCampPosition, + location lHome, string sFlags); + +// Returns new nNextSpawnTime +int SetupSpawnDelay(int nSpawnDelay, int nDelayMinimum, int nDelayRandom, + int nTimeNow); + +// Writes all the necessary info onto a spawn and its child after spawning +void RecordSpawned(object oSpawn, object oSpawned, location lHome, + location lEntranceExit, float fSpawnedFacing); + +// Saves the state of one child onto the spawn (or a camp object) for respawning +void SaveStateOnDespawn(object oSpawned, object oSpawn, int nCamp=FALSE); + +// Saves a camp object onto the spawn for respawning +void SaveCampStateOnDespawn(object oCamp, object oSpawn); + +// Respawns all saved children/camps +void RestorePCDespawns(object oSpawn, int nTimeNow); + +void ReturnHome(location lHome); +int FindNextEmptyChildSlot(object oSpawn); + +//creates a Ness object by either copying or creating and copying +object CreateNessObject(object oSpawn, int nObjectType, string sTemplate, location lLocation + , int nCacheCondition = 0, int nCacheBucket = 0); + +//creates a cached object from oSpawned +void CreateCachedObject(object oSpawn, object oSpawned, int nCacheBucket = 0, int nCachedCondtion = 0); + +// refcounting support + +const string REFCOUNT = "RefCount"; +const int bUseRefCount = TRUE; + +//adds to the refcount of oCachedSpawn if not already referencd by oCounter +int AddRef(object oCachedSpawn, object oCounter); + +//Reduces the refcount of oCachedSpawn(if referenced by oCounter). +//If the count drops to zero the cached spawn is destroyed +int Release(object oCachedSpawn, object oCounter); + +//returns the current count of oCachedSpawn +int RefCount(object oCachedSpawn); + +//hard sets the refcount, should only be used to transfer reffed counts whe +//using forced caching. +void SetRefOverride(object oCachedSpawn, int nRefCount); + +//adds to a running list of templates for caches the spawn point. This +//list is used to release cached spawns when no longer in use. +void AddRefCountList(object oCounter, string sTemplate); + +//returns TRUE if the template is already in the refcountlist +int TemplateInRefCountList(object oCounter, string sTemplate); + +//releases all refed objects in oCounter; +void ReleaseAll(object oCounter); + +//calls releaseall on every spawn in oArea +void ReleaseAreaRefs(object oArea); +// +// Pseudo-heartbeat support +// + +const string SPAWN_INTERVAL = "Spawn_Interval"; +const string SPAWN_PCS_IN_AREA = "Spawn_PCsInArea"; +const string SPAWN_AREA_COUNT = "AreaSpawnCount"; +const string SPAWN_HEARTBEAT_SCRIPT = "SpawnHeartbeatScript"; +const string SPAWN_HEARTBEAT_SCHEDULED = "SpawnHeartbeatScheduled"; + +// This checks conditions to determine if a pseudo-heartbeat should be called +int NeedPseudoHeartbeat( object oArea ); +// ... and if it should, this schedules it. +void ScheduleNextPseudoHeartbeat( object oArea ); + +// Pseudo-heartbeat area enter and exit functions +void Spawn_OnAreaEnter( string sHeartbeatScript = "spawn_sample_hb", + float fHeartbeatInterval = 6.0, float fFirstDelay = 0.0 ); +void Spawn_OnAreaExit(); + +// Externals +void LootTable(object oSpawn, object oSpawned, int nLootTable); +effect ObjectEffect(object oSpawn); + + + +int SPAWN_DELAY_DEBUG = FALSE; +int SPAWN_COUNT_DEBUG = FALSE; +int CONSOLE_DEBUG = TRUE; + +void SpawnDelayDebug(object oSpawn, string str) +{ + if (SPAWN_DELAY_DEBUG) + { + WriteTimestampedLogEntry("[sd " + GetName(GetArea(oSpawn)) + "] " + + GetLocalString(oSpawn, "f_Template") + " (" + ObjectToString(oSpawn) + "): " + str); + + if (CONSOLE_DEBUG) + { + SendMessageToAllDMs("[sd " + GetName(GetArea(oSpawn)) + "] " + + GetLocalString(oSpawn, "f_Template") + " (" + ObjectToString(oSpawn) + "): " + str); + } + /* + object oPC = GetFirstPC(); + if (! GetIsDM(oPC)) + SendMessageToPC(oPC, str); + */ + } +} + +void SpawnCountDebug(object oSpawn, string str) +{ + if (SPAWN_COUNT_DEBUG) + { + WriteTimestampedLogEntry("[sc " + GetName(GetArea(oSpawn)) + "] " + + GetLocalString(oSpawn, "f_Template") + " (" +ObjectToString(oSpawn) + "): " + str); + + if (CONSOLE_DEBUG) + { + SendMessageToAllDMs("[sc " + GetName(GetArea(oSpawn)) + "] " + + GetLocalString(oSpawn, "f_Template") + " (" +ObjectToString(oSpawn) + "): " + str); + } + /* + object oPC = GetFirstPC(); + if (! GetIsDM(oPC)) + SendMessageToPC(oPC, str); + */ + } +} + +// +// Custom Functions +// +object GetChildByTag(object oSpawn, string sChildTag); +object GetChildByNumber(object oSpawn, int nChildNum); +object GetSpawnByID(int nSpawnID); +void DeactivateSpawn(object oSpawn); +void DeactivateSpawnsByTag(string sSpawnTag); +void DeactivateAllSpawns(); +void DespawnChildren(object oSpawn); +void DespawnChildrenByTag(object oSpawn, string sSpawnTag); +void AddChild(object oSpawn, object oSpawned); +void ReportSpawns(int nAreaSpawns, int nModuleSpawns); +void TrackModuleSpawns(int nAreaSpawnCount, int nTrackModuleSpawns); +void DumpModuleSpawns(); +void DumpModuleSpawns(); + +// +// PC and NPC Functions +// +int CountPCsInArea(object oArea = OBJECT_INVALID, int nDM = FALSE); +int CountPCsInRadius(location lCenter, float fRadius, int nDM = FALSE); +object GetRandomPCInArea(object oArea, object oSpawn); + +// This struct is returned by TransferAllInventorySlots() to return back the +// object ids of the armor, right hand weapon, and left hand weapons (if any) +// both left on the (original) corpse and copied to the lootable corpse +struct NESS_CorpseInfo +{ + object origLftWpn; + object origRgtWpn; + object origArmor; + object lootLftWpn; + object lootRgtWpn; + object lootArmor; +}; + +// This is equivalent to (and adapted from) the Bioware LootInventorySlots() function. +// However, it does not schedule deletions for a hardcoded +// corpse decay time later (the corpse decay script handles those). +struct NESS_CorpseInfo TransferAllInventorySlots(object oCreature, object oTarget, + int bDropWielded=FALSE); + +int IsCreatureItem(object oItem); +void RandomWalk(object oSpawn, float fWalkingRadius, int nRun); +void FindSeat(object oSpawn, object oSpawned); + +void NESS_CleanInventory(object oSpawned); +// for back compatibility (grr) will remove at some point +void CleanInventory(object oSpawned) +{ + NESS_CleanInventory(oSpawned); +} +void NESS_CleanEquipped(object oSpawned); +void NESS_CleanCorpse(object oSpawned); +object NESS_CopyCorpseItem(object oSource, object oInventory); +void StripNonDroppables(object oSpawned); +void DestroyIfNonDrop(object oItem); + +// +// Date and Time Functions +// +int IsBetweenDays(int nCheckDay, int nDayStart, int nDayEnd); +int IsBetweenHours(int nCheckHour, int nHourStart, int nHourEnd); +// +// Patrol Route Functions +// +void SetPatrolRoute(int nPatrolRoute, int nStartClosest=FALSE); +void DoPatrolRoute(int nPatrolRoute, int nRouteType); +void AddPatrolStop(int nPatrolRoute, int nStopNumber, int bJump=FALSE); +void CheckForStuckPatrol(object oCreature, int nPatrolRoute, int nRouteType); + +// +// Camp Functions +// +int ProcessCamp(object oCamp); +void DestroyCamp(object oCamp, float fCampDecay, int nSaveState); +// +// Outside Functions +// +void SpawnFlags(object oSpawn, int nFlagTableNumber); +// +// + +// Functions for External Use. +object NESS_GetSpawnByID(int nSpawnID, object oArea); +void NESS_ActivateSpawnByID(int nSpawnID, object oAreaD); +void NESS_DeactivateSpawnByID(int nSpawnID, object oArea); +void NESS_ActivateSpawn(object oSpawn); +void NESS_DeactivateSpawn(object oSpawn); +void NESS_ForceProcess(object oSpawn); +void NESS_TrackModuleSpawns(int flag=TRUE); +int NESS_IsModuleSpawnTracking(); +void NESS_DumpModuleSpawns(int flag=TRUE); +int NESS_IsModuleSpawnDumping(); +void NESS_ReturnHome(object oCreature, int bRun=FALSE); +void NESS_ProcessDeadCreature(object oCreature, object oSpawn=OBJECT_INVALID); + +// This Function Initializes the Flags +void InitFlags(object oSpawn, string sSpawnName, string sSpawnTag) +{ + // These are true when certain flags are present, false otherwise + + // Retreive Defaults + object oModule = GetModule(); + + // These have values associated with them, although in some cases value + // of 0 is treated as a non-existent flag + int dfProcessFrequency = GetLocalInt(oModule, "df_processFrequency"); + int dfProcessOffset = GetLocalInt(oModule, "df_processOffest"); + int dfInitialState = GetLocalInt(oModule, "df_InitialState"); + int dfInitialDelay = GetLocalInt(oModule, "df_InitialDelay"); + int dfFlagTableNumber = GetLocalInt(oModule, "df_FlagTableNumber"); + int dfSpawnDelay = GetLocalInt(oModule, "df_SpawnDelay"); + int dfDelayMinimum = GetLocalInt(oModule, "df_DelayMinimum"); + int dfSpawnNumber = GetLocalInt(oModule, "df_SpawnNumber"); + int dfSpawnNumberMin = GetLocalInt(oModule, "df_SpawnNumberMin"); + int dfSpawnNumberAtOnce = GetLocalInt(oModule, "df_SpawnNumberAtOnce"); + int dfSpawnNumberAtOnceMin = GetLocalInt(oModule, "df_SpawnNumberAtOnceMin"); + int dfSpawnDayStart = GetLocalInt(oModule, "df_SpawnDayStart"); + int dfSpawnDayEnd = GetLocalInt(oModule, "df_SpawnDayEnd"); + int dfSpawnHourStart = GetLocalInt(oModule, "df_SpawnHourStart"); + int dfSpawnHourEnd = GetLocalInt(oModule, "df_SpawnHourEnd"); + int dfWanderRange = GetLocalInt(oModule, "df_WanderRange"); + int dfReturnHomeRange = GetLocalInt(oModule, "df_ReturnHomeRange"); + int dfPCCheckDelay = GetLocalInt(oModule, "df_PCCheckDelay"); + int dfRandomGold = GetLocalInt(oModule, "df_RandomGold"); + int dfRandomGoldMin = GetLocalInt(oModule, "df_RandomGoldMin"); + int dfGoldChance = GetLocalInt(oModule, "df_GoldChance"); + int dfSpawnEffect = GetLocalInt(oModule, "df_SpawnEffect"); + int dfDespawnEffect = GetLocalInt(oModule, "df_DespawnEffect"); + int dfPatrolRoute = GetLocalInt(oModule, "df_PatrolRoute"); + int dfRouteType = GetLocalInt(oModule, "df_RouteType"); + int dfPlaceableType = GetLocalInt(oModule, "df_PlaceableType"); + int dfTrapDisabled = GetLocalInt(oModule, "df_TrapDisabled"); + int dfPlaceableRefreshPeriod = GetLocalInt(oModule, "df_PlaceableRefreshPeriod"); + int dfLootTable = GetLocalInt(oModule, "df_LootTable"); + int dfLootTable1ItemChance = GetLocalInt(oModule, "df_LootTable1ItemChance"); + int dfLootTable2ItemChance = GetLocalInt(oModule, "df_LootTable2ItemChance"); + int dfLootTable3ItemChance = GetLocalInt(oModule, "df_LootTable3ItemChance"); + int dfDeactivateSpawn = GetLocalInt(oModule, "df_DeactivateSpawn"); + int dfDeactivateScript = GetLocalInt(oModule, "df_DeactivateScript"); + int dfDeactivationInfo = GetLocalInt(oModule, "df_DeactivationInfo"); + int dfChildLifespanMax = GetLocalInt(oModule, "df_ChildLifespanMax"); + int dfChildLifespanMin = GetLocalInt(oModule, "df_ChildLifespanMin"); + int dfSpawnRadius = GetLocalInt(oModule, "df_SpawnRadius"); + int dfSpawnRadiusMin = GetLocalInt(oModule, "df_SpawnRadiusMin"); + int dfSpawnUnseen = GetLocalInt(oModule, "df_SpawnUnseen"); + int dfUnseenRetryCount = GetLocalInt(oModule, "df_dfUnseenRetryCount"); + int dfCorpseDecay = GetLocalInt(oModule, "df_CorpseDecay"); + int dfCorpseDecayType = GetLocalInt(oModule, "df_CorpseDecayType"); + int dfCorpseRemainsType = GetLocalInt(oModule, "df_CorpseRemainsType"); + int dfCampDecay = GetLocalInt(oModule, "df_CampDecay"); + int dfSpawnScript = GetLocalInt(oModule, "df_SpawnScript"); + int dfDespawnScript = GetLocalInt(oModule, "df_DespawnScript"); + int dfDeathScript = GetLocalInt(oModule, "df_DeathScript"); + int dfSpawnCheckCustom = GetLocalInt(oModule, "df_SpawnCheckCustom"); + int dfSpawnCheckPCs = GetLocalInt(oModule, "df_SpawnCheckPCs"); + int dfCheckPCsRadius = GetLocalInt(oModule, "f_CheckPCsRadius"); + int dfSpawnTrigger = GetLocalInt(oModule, "df_SpawnTrigger"); + int dfDespawnTrigger = GetLocalInt(oModule, "df_DespawnTrigger"); + int dfSpawnAreaEffect = GetLocalInt(oModule, "df_SpawnAreaEffect"); + int dfAreaEffectDuration = GetLocalInt(oModule, "df_AreaEffectDuration"); + int dfObjectEffect = GetLocalInt(oModule, "df_ObjectEffect"); + int dfObjectEffectDuration = GetLocalInt(oModule, "df_ObjectEffectDuration"); + int dfRandomSpawn = GetLocalInt(oModule, "df_RandomSpawn"); + int dfSpawnFaction = GetLocalInt(oModule, "df_SpawnFaction"); + int dfSpawnAlignment = GetLocalInt(oModule, "df_SpawnAlignment"); + int dfAlignmentShift = GetLocalInt(oModule, "df_AlignmentShift"); + int dfHeartbeatScript = GetLocalInt(oModule, "df_HeartbeatScript"); + int dfSpawnLocation = GetLocalInt(oModule, "df_SpawnLocation"); + int dfSpawnLocationMin = GetLocalInt(oModule, "df_SpawnLocationMin"); + int dfSpawnFacing = GetLocalInt(oModule, "df_SpawnFacing"); + int dfEntranceExit = GetLocalInt(oModule, "df_EntranceExit"); + int dfEntranceExitMin = GetLocalInt(oModule, "df_EntranceExitMin"); + int dfExit = GetLocalInt(oModule, "df_Exit"); + int dfExitMin = GetLocalInt(oModule, "df_ExitMin"); + int dfHealChildren = GetLocalInt(oModule, "df_HealChildren"); + int dfGlobalSuppressDR = GetLocalInt(oModule, "df_GlobalSuppressDR"); + int dfSuppressDR = GetLocalInt(oModule, "df_SuppressDR"); + int dfEncounterLevel = GetLocalInt(oModule, "df_EncounterLevel"); + int dfUseCache = GetLocalInt(oModule, "df_UseCache"); + int dfCacheBucket = GetLocalInt(oModule, "df_CacheBucket"); + int dfCacheCondition = GetLocalInt(oModule, "df_CacheCondition"); + int dfCacheTiming = GetLocalInt(oModule, "df_CacheTiming"); + + //debug("init flags: " + sSpawnName); + SetLocalString(oSpawn, "f_Flags", sSpawnName); + SetLocalString(oSpawn, "f_Template", sSpawnTag); + + // Initialize FlagTable + int nFlagTable = IsFlagPresent(sSpawnName, "_FT"); + int nFlagTableNumber = GetFlagValue(sSpawnName, "_FT", dfFlagTableNumber); + + if (nFlagTable == TRUE) + { + SpawnFlags(oSpawn, nFlagTableNumber); + if (GetStringLeft(GetLocalString(oSpawn, "f_Flags"), 2) == "SP") + { + sSpawnName = GetLocalString(oSpawn, "f_Flags"); + } + else if (GetStringLeft(GetLocalString(oSpawn, "f_Flags"), 1) == "_") + { + sSpawnName = sSpawnName + GetLocalString(oSpawn, "f_Flags"); + } + + SetLocalString(oSpawn, "f_Flags", sSpawnName); + sSpawnTag = GetLocalString(oSpawn, "f_Template"); + } + + // Initialize CustomFlag + string sCustomFlag; + int nCustomFlag = IsFlagPresent(sSpawnName, "CF"); + + if (nCustomFlag == TRUE) + { + sCustomFlag = GetStringRight(sSpawnName, GetStringLength(sSpawnName) - + (FindSubString(sSpawnName, "CF") + 2)); + sSpawnName = GetStringLeft(sSpawnName, GetStringLength(sSpawnName) - + (GetStringLength(sCustomFlag) + 3)); + SetLocalString(oSpawn, "f_Flags", sSpawnName); + + } + + // Record CustomFlag + SetLocalString(oSpawn, "f_CustomFlag", sCustomFlag); + ParseCustomFlags(oSpawn, sCustomFlag); + + // Initialize Process Frequency + int nProcessFrequency = GetFlagValue(sSpawnName, "SP", dfProcessFrequency); + int nProcessOffset = GetSubFlagValue(sSpawnName, "SP", "O", dfProcessOffset); + if (nProcessFrequency <= 0) + { + nProcessFrequency = 1; + } + + // Record Process Frequency + SetLocalInt(oSpawn, "f_ProcessFrequency", nProcessFrequency); + SetLocalInt(oSpawn, "f_ProcessOffset", nProcessOffset); + + // Initialize InitialState + int nInitialState = GetFlagValue(sSpawnName, "IS", dfInitialState); + int nInitialDelay = GetSubFlagValue(sSpawnName, "IS", "D", dfInitialDelay); + nInitialDelay *= 60; // convert to seconds + + // Record InitialState + SetLocalInt(oSpawn, "f_InitialState", nInitialState); + SetLocalInt(oSpawn, "f_InitialDelay", nInitialDelay); + + // Initialize SpawnID + int nSpawnID = GetFlagValue(sSpawnName, "ID", 0); + + // Record SpawnID + if (nSpawnID > 0) + { + SetLocalInt(oSpawn, "SpawnID", nSpawnID); + } + + // Initialize SpawnDelay + int nSpawnDelay = GetFlagValue(sSpawnName, "SD", dfSpawnDelay); + nSpawnDelay *= 60; // convert to seconds + int nDelayRandom = IsSubFlagPresent(sSpawnName, "SD", "M"); + int nDelayMinimum = GetSubFlagValue(sSpawnName, "SD", "M", dfDelayMinimum); + nDelayMinimum *= 60; // convert to seconds + int nSpawnDelayPeriodic = IsSubFlagPresent(sSpawnName, "SD", "P"); + + if (nDelayMinimum > nSpawnDelay) + { + nDelayRandom = FALSE; + nDelayMinimum = 0; + } + + // Record SpawnDelay + SetLocalInt(oSpawn, "f_SpawnDelay", nSpawnDelay); + SetLocalInt(oSpawn, "f_DelayRandom", nDelayRandom); + SetLocalInt(oSpawn, "f_DelayMinimum", nDelayMinimum); + SetLocalInt(oSpawn, "f_SpawnDelayPeriodic", nSpawnDelayPeriodic); + + // Initialize SpawnNumber + int nSpawnNumber = GetFlagValue(sSpawnName, "SN", dfSpawnNumber); + int nSpawnNumberMax = nSpawnNumber; + int nSpawnNumberMin = GetSubFlagValue(sSpawnName, "SN", "M", dfSpawnNumberMin); + int nSpawnAllAtOnce = IsFlagPresent(sSpawnName, "SA"); + int nSpawnNumberAtOnce = GetFlagValue(sSpawnName, "SA", dfSpawnNumberAtOnce); + int nSpawnNumberAtOnceMin = GetSubFlagValue(sSpawnName, "SA", "M", + dfSpawnNumberAtOnceMin); + + if (nSpawnNumberMin > nSpawnNumber) + { + nSpawnNumberMin = -1; + } + if (nSpawnNumberMin > -1) + { + int nRndSpawnNumber = Random(nSpawnNumberMax + 1); + while (nRndSpawnNumber < nSpawnNumberMin) + { + nRndSpawnNumber = Random(nSpawnNumberMax + 1); + } + nSpawnNumber = nRndSpawnNumber; + } + + if (nSpawnNumberAtOnce == 1) + { + nSpawnAllAtOnce = FALSE; + } + if (nSpawnNumberAtOnceMin > nSpawnNumberAtOnce) + { + nSpawnNumberAtOnceMin = 0; + } + + // Record SpawnNumber + SetLocalInt(oSpawn, "f_SpawnNumber", nSpawnNumber); + SetLocalInt(oSpawn, "f_SpawnNumberMin", nSpawnNumberMin); + SetLocalInt(oSpawn, "f_SpawnNumberMax", nSpawnNumberMax); + SetLocalInt(oSpawn, "f_SpawnAllAtOnce", nSpawnAllAtOnce); + SetLocalInt(oSpawn, "f_SpawnNumberAtOnce", nSpawnNumberAtOnce); + SetLocalInt(oSpawn, "f_SpawnNumberAtOnceMin", nSpawnNumberAtOnceMin); + + // Initialize Day/Night Only + int nDayOnly = IsFlagPresent(sSpawnName, "DO"); + int nDayOnlyDespawn = IsSubFlagPresent(sSpawnName, "DO", "D"); + int nNightOnly = IsFlagPresent(sSpawnName, "NO"); + int nNightOnlyDespawn = IsSubFlagPresent(sSpawnName, "NO", "D"); + + // Record Day/Night Only + SetLocalInt(oSpawn, "f_DayOnly", nDayOnly); + SetLocalInt(oSpawn, "f_DayOnlyDespawn", nDayOnlyDespawn); + SetLocalInt(oSpawn, "f_NightOnly", nNightOnly); + SetLocalInt(oSpawn, "f_NightOnlyDespawn", nNightOnlyDespawn); + + // Initialize Day/Hour Spawns + int nSpawnDayStart = GetFlagValue(sSpawnName, "DY", dfSpawnDayStart); + int nSpawnDayEnd = GetSubFlagValue(sSpawnName, "DY", "T", dfSpawnDayEnd); + if (nSpawnDayEnd > nSpawnDayStart) + { + nSpawnDayEnd = -1; + } + int nSpawnHourStart = GetFlagValue(sSpawnName, "HR", dfSpawnHourStart); + int nSpawnHourEnd = GetSubFlagValue(sSpawnName, "HR", "T", dfSpawnHourEnd); + if (nSpawnHourStart > nSpawnHourEnd) + { + nSpawnHourEnd = -1; + } + + // Record Day/Hour Spawns + SetLocalInt(oSpawn, "f_SpawnDayStart", nSpawnDayStart); + SetLocalInt(oSpawn, "f_SpawnDayEnd", nSpawnDayEnd); + SetLocalInt(oSpawn, "f_SpawnHourStart", nSpawnHourStart); + SetLocalInt(oSpawn, "f_SpawnHourEnd", nSpawnHourEnd); + + // Initialize RandomWalk + int nRandomWalk = IsFlagPresent(sSpawnName, "RW"); + float fWanderRange = IntToFloat(GetSubFlagValue(sSpawnName, "RW", "R", dfWanderRange)); + + // Record RandomWalk + SetLocalInt(oSpawn, "f_RandomWalk", nRandomWalk); + SetLocalFloat(oSpawn, "f_WanderRange", fWanderRange); + + // Initialize ReturnHome + int nReturnHome = IsFlagPresent(sSpawnName, "RH"); + float fReturnHomeRange = IntToFloat(GetFlagValue(sSpawnName, "RH", dfReturnHomeRange)); + + // Record ReturnHome + SetLocalInt(oSpawn, "f_ReturnHome", nReturnHome); + SetLocalFloat(oSpawn, "f_ReturnHomeRange", fReturnHomeRange); + + // Initialize PCCheck + int nPCCheck = IsFlagPresent(sSpawnName, "PC"); + int nPCCheckDelay = GetFlagValue(sSpawnName, "PC", dfPCCheckDelay); + nPCCheckDelay *= 60; // convert to seconds + int nPCReset = IsSubFlagPresent(sSpawnName, "PC", "R"); + + // Record PCCheck + SetLocalInt(oSpawn, "f_PCCheck", nPCCheck); + SetLocalInt(oSpawn, "f_PCCheckDelay", nPCCheckDelay); + SetLocalInt(oSpawn, "f_PCReset", nPCReset); + + // Initialize RandomGold + int nRandomGold = GetFlagValue(sSpawnName, "RG", dfRandomGold); + int nRandomGoldMin = GetSubFlagValue(sSpawnName, "RG", "M", dfRandomGoldMin); + int nGoldChance = GetSubFlagValue(sSpawnName, "RG", "C", dfGoldChance); + + // Record RandomGold + SetLocalInt(oSpawn, "f_RandomGold", nRandomGold); + SetLocalInt(oSpawn, "f_RandomGoldMin", nRandomGoldMin); + SetLocalInt(oSpawn, "f_GoldChance", nGoldChance); + + // Initialize SpawnEffects + int nSpawnEffect = GetFlagValue(sSpawnName, "FX", dfSpawnEffect); + int nDespawnEffect = GetSubFlagValue(sSpawnName, "FX", "D", dfDespawnEffect); + + // Record SpawnEffects + SetLocalInt(oSpawn, "f_SpawnEffect", nSpawnEffect); + SetLocalInt(oSpawn, "f_DespawnEffect", nDespawnEffect); + + // Initialize PatrolRoutes + int nPatrolRoute = GetFlagValue(sSpawnName, "PR", dfPatrolRoute); + int nRouteType = GetSubFlagValue(sSpawnName, "PR", "T", dfRouteType); + int nStartAtClosest = IsSubFlagPresent(sSpawnName, "PR", "C"); + + // Record PatrolRoutes + SetLocalInt(oSpawn, "f_PatrolRoute", nPatrolRoute); + SetLocalInt(oSpawn, "f_RouteType", nRouteType); + SetLocalInt(oSpawn, "f_PatrolStartAtClosest", nStartAtClosest); + + // Initialize Placeables + int nPlaceable = IsFlagPresent(sSpawnName, "PL"); + int nPlaceableType = GetFlagValue(sSpawnName, "PL", dfPlaceableType); + int nTrapDisabled = GetSubFlagValue(sSpawnName, "PL", "T", dfTrapDisabled); + int nPlaceableRefreshPeriod = GetSubFlagValue(sSpawnName, "PL", "P", dfPlaceableRefreshPeriod); + nPlaceableRefreshPeriod *= 60; // convert to seconds + + // Record Placeables + SetLocalInt(oSpawn, "f_Placeable", nPlaceable); + SetLocalInt(oSpawn, "f_PlaceableType", nPlaceableType); + SetLocalInt(oSpawn, "f_TrapDisabled", nTrapDisabled); + SetLocalInt(oSpawn, "f_PlaceableRefreshPeriod", nPlaceableRefreshPeriod); + + // Initialize SpawnGroups + int nSpawnGroup = IsFlagPresent(sSpawnName, "SG"); + + // Record SpawnGroups + SetLocalInt(oSpawn, "f_SpawnGroup", nSpawnGroup); + + // Initialize LootTable + int nLootTable = GetFlagValue(sSpawnName, "LT", dfLootTable); + int nLootTable1ItemChance = GetSubFlagValue(sSpawnName, "LT", "A", dfLootTable1ItemChance); + int nLootTable2ItemChance = GetSubFlagValue(sSpawnName, "LT", "B", dfLootTable2ItemChance); + int nLootTable3ItemChance = GetSubFlagValue(sSpawnName, "LT", "C", dfLootTable3ItemChance); + + if (nLootTable1ItemChance > 100) nLootTable1ItemChance = 100; + if (nLootTable2ItemChance > 100) nLootTable2ItemChance = 100; + if (nLootTable3ItemChance > 100) nLootTable3ItemChance = 100; + + // Record LootTable + SetLocalInt(oSpawn, "f_LootTable", nLootTable); + SetLocalInt(oSpawn, "f_LootTable1ItemChance", nLootTable1ItemChance); + SetLocalInt(oSpawn, "f_LootTable2ItemChance", nLootTable2ItemChance); + SetLocalInt(oSpawn, "f_LootTable3ItemChance", nLootTable3ItemChance); + + // Initialize SpawnDeactivation + int nDeactivateSpawn = GetFlagValue(sSpawnName, "DS", dfDeactivateSpawn); + int nDeactivateScript = GetSubFlagValue(sSpawnName, "DS", "S", dfDeactivateScript); + int nDeactivationInfo = GetFlagValue(sSpawnName, "DI", dfDeactivationInfo); + + // Record SpawnDeactivations + SetLocalInt(oSpawn, "f_DeactivateSpawn", nDeactivateSpawn); + SetLocalInt(oSpawn, "f_DeactivateScript", nDeactivateScript); + + if (nDeactivateSpawn == 4) + { + nDeactivationInfo *= 60; // convert minutes to seconds + } + else if (nDeactivateSpawn == 5) + { + nDeactivationInfo *= 6; // convert cycles to seconds + } + + SetLocalInt(oSpawn, "f_DeactivationInfo", nDeactivationInfo); + + // Initialize ChildLifespan + int nChildLifespanMax = GetFlagValue(sSpawnName, "CL", dfChildLifespanMax); + nChildLifespanMax *= 60; // convert to seconds + int nChildLifespanMin = GetSubFlagValue(sSpawnName, "CL", "M", dfChildLifespanMin); + nChildLifespanMin *= 60; // convert to seconds + if (nChildLifespanMin > nChildLifespanMax) + { + nChildLifespanMin = -1; + } + + // Record ChildLifespan + SetLocalInt(oSpawn, "f_ChildLifespanMax", nChildLifespanMax); + SetLocalInt(oSpawn, "f_ChildLifespanMin", nChildLifespanMin); + + // Initialize SpawnRadius + float fSpawnRadius = IntToFloat(GetFlagValue(sSpawnName, "SR", dfSpawnRadius)); + float fSpawnRadiusMin = IntToFloat(GetSubFlagValue(sSpawnName, "SR", "M", dfSpawnRadiusMin)); + int nSpawnNearPCs = IsSubFlagPresent(sSpawnName, "SR", "P"); + if (fSpawnRadiusMin > fSpawnRadius) + { + fSpawnRadiusMin = 0.0; + } + + // Record SpawnRadius + SetLocalFloat(oSpawn, "f_SpawnRadius", fSpawnRadius); + SetLocalFloat(oSpawn, "f_SpawnRadiusMin", fSpawnRadiusMin); + SetLocalInt(oSpawn, "f_SpawnNearPCs", nSpawnNearPCs); + + // Initialize SpawnUnseen + float fSpawnUnseen = IntToFloat(GetFlagValue(sSpawnName, "SU", dfSpawnUnseen)); + + int nUnseenIndividual = IsSubFlagPresent(sSpawnName, "SU", "I"); + int nUnseenRetryCount = GetSubFlagValue(sSpawnName, "SU", "I", dfUnseenRetryCount); + + // Record SpawnUnseen + SetLocalFloat(oSpawn, "f_SpawnUnseen", fSpawnUnseen); + SetLocalInt(oSpawn, "f_UnseenIndividual", nUnseenIndividual); + SetLocalInt(oSpawn, "f_UnseenRetryCount", nUnseenRetryCount); + + // Initialize CorpseDecay + float fCorpseDecay = IntToFloat(GetFlagValue(sSpawnName, "CD", dfCorpseDecay)); + int nCorpseDecayType = GetSubFlagValue(sSpawnName, "CD", "T", dfCorpseDecayType); + int nCorpseRemainsType = GetSubFlagValue(sSpawnName, "CD", "R", dfCorpseRemainsType); + int bDropWielded = IsSubFlagPresent(sSpawnName, "CD", "D"); + + string sCorpseRemainsResRef; + int bDeleteLootOnDecay = FALSE; + + switch (nCorpseRemainsType) + { + case 0: sCorpseRemainsResRef = "invis_corpse_obj"; break; + case 1: sCorpseRemainsResRef = "invis_corpse_bdy"; break; + case 2: sCorpseRemainsResRef = "invis_corpse_bon"; break; + case 3: sCorpseRemainsResRef = "invis_corpse_pot"; break; + case 4: sCorpseRemainsResRef = "invis_corpse_pch"; break; + case 5: sCorpseRemainsResRef = "invis_corpse_scr"; break; + case 6: sCorpseRemainsResRef = "invis_corpse_tre"; break; + case 7: + sCorpseRemainsResRef = "invis_corpse_obj"; + bDeleteLootOnDecay = TRUE; + break; + } + + // Record CorpseDecay + SetLocalFloat(oSpawn, "f_CorpseDecay", fCorpseDecay); + SetLocalInt(oSpawn, "f_CorpseDecayType", nCorpseDecayType); + SetLocalString(oSpawn, "f_CorpseRemainsResRef", sCorpseRemainsResRef); + SetLocalInt(oSpawn, "f_CorpseDropWielded", bDropWielded); + SetLocalInt(oSpawn, "f_CorpseDeleteLootOnDecay", bDeleteLootOnDecay); + + // Initialize SpawnCamp + int nSpawnCamp = IsFlagPresent(sSpawnName, "CM"); + float fCampDecay = IntToFloat(GetSubFlagValue(sSpawnName, "CM", "D", dfCampDecay)); + + // Record SpawnCamp + SetLocalInt(oSpawn, "f_SpawnCamp", nSpawnCamp); + SetLocalFloat(oSpawn, "f_CampDecay", fCampDecay); + + // Initialize Spawn Scripts + int nSpawnScript = GetFlagValue(sSpawnName, "SS", dfSpawnScript); + int nDespawnScript = GetSubFlagValue(sSpawnName, "SS", "D", dfDespawnScript); + + // Record Spawn Scripts + SetLocalInt(oSpawn, "f_SpawnScript", nSpawnScript); + SetLocalInt(oSpawn, "f_DespawnScript", nDespawnScript); + + // Initialize Death Scripts + int nDeathScript = GetFlagValue(sSpawnName, "DT", dfDeathScript); + + // Record Death Scripts + SetLocalInt(oSpawn, "f_DeathScript", nDeathScript); + + // Initialize SpawnCheckCustom + int nSpawnCheckCustom = GetFlagValue(sSpawnName, "CC", dfSpawnCheckCustom); + + // Record SpawnCheckCustom + SetLocalInt(oSpawn, "f_SpawnCheckCustom", nSpawnCheckCustom); + + // Initialize SpawnCheckPCs + int nSpawnCheckPCs = GetFlagValue(sSpawnName, "CP", dfSpawnCheckPCs); + float fCheckPCsRadius = IntToFloat(GetSubFlagValue(sSpawnName, "CP", "R", dfCheckPCsRadius)); + + // Record SpawnCheckPCs + SetLocalInt(oSpawn, "f_SpawnCheckPCs", nSpawnCheckPCs); + SetLocalFloat(oSpawn, "f_CheckPCsRadius", fCheckPCsRadius); + + // Intialize SpawnTrigger + float fSpawnTrigger = IntToFloat(GetFlagValue(sSpawnName, "TR", dfSpawnTrigger)); + float fDespawnTrigger = IntToFloat(GetSubFlagValue(sSpawnName, "TR", "D", dfDespawnTrigger)); + + // Record SpawnTrigger + SetLocalFloat(oSpawn, "f_SpawnTrigger", fSpawnTrigger); + SetLocalFloat(oSpawn, "f_DespawnTrigger", fDespawnTrigger); + + // Initialize AreaEffect + int nSpawnAreaEffect = GetFlagValue(sSpawnName, "AE", dfSpawnAreaEffect); + float fAreaEffectDuration = IntToFloat(GetSubFlagValue(sSpawnName, "AE", "D", dfAreaEffectDuration)); + + // Record AreaEffect + SetLocalInt(oSpawn, "f_SpawnAreaEffect", nSpawnAreaEffect); + SetLocalFloat(oSpawn, "f_AreaEffectDuration", fAreaEffectDuration); + + // Initialize ObjectEffect + int nObjectEffect = GetFlagValue(sSpawnName, "OE", dfObjectEffect); + float fObjectEffectDuration = IntToFloat(GetSubFlagValue(sSpawnName, "OE", "D", dfObjectEffectDuration)); + if (fObjectEffectDuration == 0.0) + { + fObjectEffectDuration = -1.0; + } + + // Record ObjectEffect + SetLocalInt(oSpawn, "f_ObjectEffect", nObjectEffect); + SetLocalFloat(oSpawn, "f_ObjectEffectDuration", fObjectEffectDuration); + + // Initialize RandomSpawn + int nRandomSpawn = GetFlagValue(sSpawnName, "RS", dfRandomSpawn); + + // Record RandomSpawn + SetLocalInt(oSpawn, "f_RandomSpawn", nRandomSpawn); + + // Initialize SpawnFaction + int nSpawnFaction = GetFlagValue(sSpawnName, "FC", dfSpawnFaction); + + // Record SpawnFaction + SetLocalInt(oSpawn, "f_SpawnFaction", nSpawnFaction); + + // Initialize SpawnAlignment + int nSpawnAlignment = GetFlagValue(sSpawnName, "AL", dfSpawnAlignment); + int nAlignmentShift = GetSubFlagValue(sSpawnName, "AL", "S", dfAlignmentShift); + + // Record SpawnAlignment + SetLocalInt(oSpawn, "f_SpawnAlignment", nSpawnAlignment); + SetLocalInt(oSpawn, "f_AlignmentShift", nAlignmentShift); + + // Initialize Heartbeat + int nHeartbeatScript = GetFlagValue(sSpawnName, "HB", dfHeartbeatScript); + + // Record HeartBeat + SetLocalInt(oSpawn, "f_HeartbeatScript", nHeartbeatScript); + + // Initialize SpawnLocation + int nSpawnLocation = GetFlagValue(sSpawnName, "SL", dfSpawnLocation); + int nSpawnLocationMin = GetSubFlagValue(sSpawnName, "SL", "R", dfSpawnLocationMin); + int nSpawnLocationInd = IsSubFlagPresent(sSpawnName, "SL", "I"); + if (nSpawnLocationMin > nSpawnLocation) + { + nSpawnLocationMin = -1; + } + + // Record SpawnLocation + SetLocalInt(oSpawn, "f_SpawnLocation", nSpawnLocation); + SetLocalInt(oSpawn, "f_SpawnLocationMin", nSpawnLocationMin); + SetLocalInt(oSpawn, "f_SpawnLocationInd", nSpawnLocationInd); + + // Initialize SpawnFacing + float fSpawnFacing; + int nSpawnFacing = IsFlagPresent(sSpawnName, "SF"); + if (nSpawnFacing == TRUE) + { + fSpawnFacing = GetFacingFromLocation(GetLocation(oSpawn)); + } + else + { + // If f_Facing is false, fSpawnFacing is now calculated for + // each individual creature + fSpawnFacing = 0.0; + // fSpawnFacing = IntToFloat(Random(360)); + } + + // Record SpawnFacing + SetLocalInt(oSpawn, "f_Facing", nSpawnFacing); + SetLocalFloat(oSpawn, "f_SpawnFacing", fSpawnFacing); + + // Initialize EntranceExit + int nEntranceExit = GetFlagValue(sSpawnName, "EE", dfEntranceExit); + int nEntranceExitMin = GetSubFlagValue(sSpawnName, "EE", "R", dfEntranceExitMin); + if (nEntranceExitMin > nEntranceExit) + { + nEntranceExitMin = -1; + } + int nExit = GetFlagValue(sSpawnName, "EX", dfExit); + int nExitMin = GetSubFlagValue(sSpawnName, "EX", "R", dfExitMin); + if (nExitMin > nExit) + { + nExitMin = -1; + } + + // Record EntranceExit + SetLocalInt(oSpawn, "f_EntranceExit", nEntranceExit); + SetLocalInt(oSpawn, "f_EntranceExitMin", nEntranceExitMin); + SetLocalInt(oSpawn, "f_Exit", nExit); + SetLocalInt(oSpawn, "f_ExitMin", nExitMin); + + // Initialize HealChildren + int nHealChildren = GetFlagValue(sSpawnName, "HL", dfHealChildren); + int nHealEffects = IsSubFlagPresent(sSpawnName, "HL", "E"); + if (nHealChildren == 1) + { + nHealChildren == 100; + } + + // Record HealChildren + SetLocalInt(oSpawn, "f_HealChildren", nHealChildren); + SetLocalInt(oSpawn, "f_HealEffects", nHealEffects); + + // Initialize SpawnItem + int nSpawnItem = IsFlagPresent(sSpawnName, "IT"); + + // Record SpawnItem + SetLocalInt(oSpawn, "f_SpawnItem", nSpawnItem); + + // Initialize SpawnSit + int nSpawnSit = IsFlagPresent(sSpawnName, "ST"); + + // Record SpawnSit + SetLocalInt(oSpawn, "f_SpawnSit", nSpawnSit); + + // Initialize SpawnPlot + int nSpawnPlot = IsFlagPresent(sSpawnName, "PT"); + + // Record SpawnPlot + SetLocalInt(oSpawn, "f_SpawnPlot", nSpawnPlot); + + // Initialize SpawnMerchant + int nSpawnMerchant = IsFlagPresent(sSpawnName, "SM"); + + // Record SpawnMerchant + SetLocalInt(oSpawn, "f_SpawnMerchant", nSpawnMerchant); + + // Initialize Dim Returns Suppression + int nSuppressDimReturns = IsFlagPresent(sSpawnName, "SX"); + + if (nSuppressDimReturns) + { + // If the flag is present, get suppression mode from its value + nSuppressDimReturns = GetFlagValue(sSpawnName, "SX", dfSuppressDR); + } + + else + { + // Use the global setting + nSuppressDimReturns = dfGlobalSuppressDR; + } + + // Record Dim Returns Suppression + SetLocalInt(oSpawn, "f_SuppressDimReturns", nSuppressDimReturns); + + // Initialize Loot Suppression + int nSuppressLooting = IsFlagPresent(sSpawnName, "NL"); + + // Record Loot Suppression + SetLocalInt(oSpawn, "f_SuppressLooting", nSuppressLooting); + + // Initialize Subdual Mode + int nSubdualMode = IsFlagPresent(sSpawnName, "SB"); + + // Record Subdual Mode + SetLocalInt(oSpawn, "f_SubdualMode", nSubdualMode); + + int nEncounterLevel; + + // Initialize Encounter Level + if (IsFlagPresent(sSpawnName, "EL")) + { + nEncounterLevel = GetFlagValue(sSpawnName, "EL", dfEncounterLevel); + SetLocalInt(oSpawn, "f_EncounterLevel", nEncounterLevel); + } + + int nUseCache; + int nCacheBucket; + int nCacheCondition; + int nCacheTiming; + + //iniitialize Cached Spawning + if(IsFlagPresent(sSpawnName, "CS") || 0 != nUseCache) + { + nCacheBucket = GetFlagValue(sSpawnName, "CS", dfCacheBucket); + nCacheCondition = GetSubFlagValue(sSpawnName, "CS", "C", dfCacheCondition); + nCacheTiming = GetSubFlagValue(sSpawnName, "CS", "T", dfCacheTiming); + + SetLocalInt(oSpawn, "f_UseCache", TRUE); + SetLocalInt(oSpawn, "f_CacheBucket", nCacheBucket); + SetLocalInt(oSpawn, "f_CacheCondition", nCacheCondition); + SetLocalInt(oSpawn, "CacheTiming", nCacheTiming); + } + + // Record Flags Initialized + SetLocalInt(oSpawn, "FlagsInitialized", TRUE); +} +// + +// This Function Sets the Spawns +int SetSpawns(location lBase) +{ + string sSpawnName, sSpawnNum, sSpawnTag; + int nNth = 1; + int nSpawnNum = 0; + + // Enumerate Waypoints in the Area + object oSpawn = GetFirstObjectInArea(OBJECT_SELF); + while (oSpawn != OBJECT_INVALID) + { + // Check for a local string called "NESS" on the waypoint + // first. If it exists, use it instead of the name + sSpawnName = GetLocalString(oSpawn, "NESS"); + + if (GetStringLeft(sSpawnName, 2) != "SP") + { + // Retrieve Name + sSpawnName = GetName(oSpawn); + } + + // Check if Waypoint is a Spawn Controller + if (GetStringLeft(sSpawnName, 2) == "SP") + { + // Set Spawn + nSpawnNum++; + sSpawnNum = "Spawn" + PadIntToString(nSpawnNum, 2); + SetLocalObject(OBJECT_SELF, sSpawnNum, oSpawn); + + + sSpawnTag = GetLocalString(oSpawn, "NESS_TAG"); + if (sSpawnTag == "") + { + sSpawnTag = GetTag(oSpawn); + } + + DelayCommand(0.0, InitFlags(oSpawn, sSpawnName, sSpawnTag)); + } + nNth++; + oSpawn = GetNextObjectInArea(OBJECT_SELF); + } + SetLocalInt(OBJECT_SELF, "Spawns", nSpawnNum); + return nSpawnNum; +} +// + +// This Function returns the Number of PCs in an Area +int CountPCsInArea(object oArea = OBJECT_INVALID, int nDM = FALSE) + { + int retVal = 0; + if (oArea == OBJECT_INVALID) + { + oArea = GetArea(OBJECT_SELF); + } + object oPC = GetFirstPC(); + while (oPC != OBJECT_INVALID) + { + if (GetArea(oPC) == oArea) + { + if (GetIsDM(oPC) == TRUE) + { + if (nDM == TRUE) + { + retVal++; + } + } + else + { + retVal++; + } + } + oPC = GetNextPC(); + } + return retVal; +} +// + +// This Function Returns the Number of PCs in a Radius +int CountPCsInRadius(location lCenter, float fRadius, int nDM = FALSE) +{ + int nPCs = 0; + object oPC = GetFirstObjectInShape(SHAPE_SPHERE, fRadius, lCenter, FALSE, + OBJECT_TYPE_ALL); + + while (oPC != OBJECT_INVALID) + { + if (GetIsPC(oPC)) + { + if (GetIsDM(oPC)) + { + //debug(GetName(oPC) + " is a DM "); + if (nDM == TRUE) + { + nPCs++; + } + } + else + { + //debug("found a real PC"); + nPCs++; + } + } + + oPC = GetNextObjectInShape(SHAPE_SPHERE, fRadius, lCenter, FALSE, + OBJECT_TYPE_ALL); + } + return nPCs; +} +// + +int IsCreatureItem(object oItem) +{ + if (GetBaseItemType(oItem) == BASE_ITEM_CREATUREITEM || + GetBaseItemType(oItem) == BASE_ITEM_CBLUDGWEAPON || + GetBaseItemType(oItem) == BASE_ITEM_CPIERCWEAPON || + GetBaseItemType(oItem) == BASE_ITEM_CSLASHWEAPON || + GetBaseItemType(oItem) == BASE_ITEM_CSLSHPRCWEAP) + { + return TRUE; + } + + return FALSE; +} + +// This Function Returns a Random PC from Area +object GetRandomPCInArea(object oArea, object oSpawn) +{ + int nPCsInArea = CountPCsInArea(oArea, TRUE); + int nNth = Random(nPCsInArea) + 1; + object oRandomPC = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC, oSpawn, nNth); + return oRandomPC; +} + +object NESS_CopyCorpseItem(object oSource, object oInventory) +{ + int bWasPlot = GetPlotFlag(oSource); + object oNewItem = CopyItem(oSource, oInventory); + if (bWasPlot == TRUE) + { + SetPlotFlag(oNewItem,TRUE); + } + + return oNewItem; +} + +// +struct NESS_CorpseInfo TransferAllInventorySlots(object oVictim, + object oCorpse, int bDropWielded=FALSE) +{ + int i=0; + object oItem = OBJECT_INVALID; + location locItem; + struct NESS_CorpseInfo stCorpseInfo; + + // Initialize + stCorpseInfo.origRgtWpn = OBJECT_INVALID; + stCorpseInfo.origLftWpn = OBJECT_INVALID; + stCorpseInfo.origArmor = OBJECT_INVALID; + stCorpseInfo.lootRgtWpn = OBJECT_INVALID; + stCorpseInfo.lootLftWpn = OBJECT_INVALID; + stCorpseInfo.lootArmor = OBJECT_INVALID; + + for (i=0; i < NUM_INVENTORY_SLOTS; i++) + { + oItem = GetItemInSlot(i, oVictim); + + // See if we're going to allow looting of this item. + if (GetIsObjectValid(oItem) && GetDroppableFlag(oItem)) + { + // Handle different items slightly differently. + + if (i == INVENTORY_SLOT_CHEST && GetIsVictimDressed(oVictim)) + { + // The victim is wearing the armor. We don't want to destroy + // it while the corpse is around, since that would leave the + // body naked. + stCorpseInfo.origArmor = oItem; + stCorpseInfo.lootArmor = NESS_CopyCorpseItem(oItem, oCorpse); + } + + else if (i == INVENTORY_SLOT_RIGHTHAND) + { + if (bDropWielded) + { + // This is a wielded item. Drop it nearby. + locItem = GetStepRightLocation(oVictim); + CreateObject(OBJECT_TYPE_ITEM, GetResRef(oItem), locItem); + DestroyObject(oItem, 0.1); + } + + else + { + stCorpseInfo.origRgtWpn = oItem; + stCorpseInfo.lootRgtWpn = NESS_CopyCorpseItem(oItem, oCorpse); + } + + } + + else if (i == INVENTORY_SLOT_LEFTHAND) + { + if(bDropWielded) + { + // This is a wielded item. Drop it nearby. + locItem = GetStepLeftLocation(oVictim); + CreateObject(OBJECT_TYPE_ITEM, GetResRef(oItem), locItem); + DestroyObject(oItem, 0.1); + } + + else + { + stCorpseInfo.origLftWpn = oItem; + stCorpseInfo.lootLftWpn = NESS_CopyCorpseItem(oItem, oCorpse); + } + } + + else + { + NESS_CopyCorpseItem(oItem, oCorpse); + DestroyObject(oItem, 0.1); + } + } + } + return stCorpseInfo; +} + +// + +// This Function Checks if the Party is within fDistance Meters of Each Other +int IsPartyTogether(object oPC, float fDistance) +{ + int nTogether = TRUE; + object oMember = GetFirstFactionMember(oPC, TRUE); + while (oMember != OBJECT_INVALID) + { + if (GetIsDead(oMember) == FALSE) + { + if (GetDistanceBetween(oPC, oMember) > fDistance) + { + nTogether = FALSE; + oMember = OBJECT_INVALID; + } + } + oMember = GetNextFactionMember(oPC, TRUE); + } + return nTogether; +} +// + +// This Function Returns the Number of PCs in a Party +int CountMembersInParty(object oPC, int bPCOnly = TRUE) +{ + int nCount; + object oMember = GetFirstFactionMember(oPC, bPCOnly); + while (oMember != OBJECT_INVALID) + { + nCount++; + oMember = GetNextFactionMember(oPC, bPCOnly); + } + return nCount; +} +// + +// This Function Checks if nCheckDay is Between Days +int IsBetweenDays(int nCheckDay, int nDayStart, int nDayEnd) +{ + if (nDayEnd > -1) + { + if (nCheckDay >= nDayStart && nCheckDay <= nDayEnd) + { + return TRUE; + } + } + else + { + if (nCheckDay == nDayStart) + { + return TRUE; + } + } + + return FALSE; +} +// + +// This Function Checks if nCheckHour is Between Hours +int IsBetweenHours(int nCheckHour, int nHourStart, int nHourEnd) +{ + if (nHourEnd > -1) + { + if (nCheckHour >= nHourStart && nCheckHour <= nHourEnd) + { + return TRUE; + } + } + else + { + if (nCheckHour == nHourStart) + { + return TRUE; + } + } + + return FALSE; +} +// + +// This Function Pads an IntToString with 0s +string PadIntToString(int nInt, int nDigits) +{ + string sRetString; + string sTempInt = IntToString(nInt); + int iCount; + + sRetString = ""; + for (iCount = 1; iCount <= (nDigits - GetStringLength(sTempInt)); iCount++) + { + sRetString = sRetString + "0"; + } + sRetString = sRetString + sTempInt; + return sRetString; +} +// + +// This Function returns a Child Object by Tag +object GetChildByTag(object oSpawn, string sChildTag) +{ + object oChild; + object oRetChild = OBJECT_INVALID; + string sChildSlot; + int nChildSlot; + + string sSpawnName = GetLocalString(oSpawn, "f_Flags"); + int nSpawnNumber = GetFlagValue(sSpawnName, "SN", 1); + + // Cycle through Children + for (nChildSlot = 1; nChildSlot <= nSpawnNumber; nChildSlot++) + { + // Retrieve Child + + sChildSlot = "ChildSlot" + PadIntToString(nChildSlot, 2); + oChild = GetLocalObject(oSpawn, sChildSlot); + if (GetTag(oChild) == sChildTag) + { + oRetChild = oChild; + } + } + + return oRetChild; +} +// + +// This Function returns a Child Object by Slot Number +object GetChildByNumber(object oSpawn, int nChildNum) +{ + object oRetChild = OBJECT_INVALID; + string sChildSlot; + + string sSpawnName = GetLocalString(oSpawn, "f_Flags"); + int nSpawnNumber = GetFlagValue(sSpawnName, "SN", 1); + + // Check if Valid Number + if (nChildNum > nSpawnNumber) + { + return oRetChild; + } + + // Retrieve Child + sChildSlot = "ChildSlot" + PadIntToString(nChildNum, 2); + oRetChild = GetLocalObject(oSpawn, sChildSlot); + + // Return Child + return oRetChild; +} +// +object NESS_GetSpawnByID(int nSpawnID, object oArea) +{ + string sSpawnName; + object oRetSpawn; + + // Enumerate Waypoints in the Area + object oSpawn = GetFirstObjectInArea(oArea); + while (oSpawn != OBJECT_INVALID) + { + // Retrieve Name + sSpawnName = GetLocalString(oSpawn, "f_Flags"); + + // Check if Waypoint is a Spawn Controller + if (GetStringLeft(sSpawnName, 2) == "SP") + { + if (GetLocalInt(oSpawn, "SpawnID") == nSpawnID) + { + oRetSpawn = oSpawn; + } + } + oSpawn = GetNextObjectInArea(oArea); + } + return oRetSpawn; +} +// + +// This Function returns a Spawn Object by ID +object GetSpawnByID(int nSpawnID) +{ + return NESS_GetSpawnByID(nSpawnID, OBJECT_SELF); +} +// + +// This Function Sets Children to Despawn +void DespawnChildren(object oSpawn) +{ + object oChild; + string sChildSlot; + int nChildSlot; + + string sSpawnName = GetLocalString(oSpawn, "f_Flags"); + int nSpawnNumber = GetFlagValue(sSpawnName, "SN", 1); + + // Cycle through Children + for (nChildSlot = 1; nChildSlot <= nSpawnNumber; nChildSlot++) + { + // Retrieve Child + + sChildSlot = "ChildSlot" + PadIntToString(nChildSlot, 2); + oChild = GetLocalObject(oSpawn, sChildSlot); + SetLocalInt(oChild, "ForceDespawn", TRUE); + } +} +// + +// This Function Sets Children to Despawn by Tag +void DespawnChildrenByTag(object oSpawn, string sChildTag) +{ + object oChild; + string sChildSlot; + int nChildSlot; + + string sSpawnName = GetLocalString(oSpawn, "f_Flags"); + int nSpawnNumber = GetFlagValue(sSpawnName, "SN", 1); + + // Cycle through Children + for (nChildSlot = 1; nChildSlot <= nSpawnNumber; nChildSlot++) + { + // Retrieve Child + + sChildSlot = "ChildSlot" + PadIntToString(nChildSlot, 2); + oChild = GetLocalObject(oSpawn, sChildSlot); + if (GetTag(oChild) == sChildTag) + { + SetLocalInt(oChild, "ForceDespawn", TRUE); + } + } +} +// + +// This Function Adds a Child to a Spawn +void AddChild(object oSpawn, object oSpawned) +{ + // Declare Variables + int nEmptyChildSlot, nChildSlot; + int nSpawnNumber, nSpawnCount, nChildrenSpawned; + string sChildSlot, sEmptyChildSlot; + object oChild; + + // Retreive Values + nSpawnNumber = GetLocalInt(oSpawn, "f_SpawnNumber"); + nChildrenSpawned = GetLocalInt(oSpawn, "ChildrenSpawned"); + nSpawnCount = GetLocalInt(oSpawn, "SpawnCount"); + + // Find Empty Child Slot + nEmptyChildSlot = 0; + for (nChildSlot = 1; nChildSlot <= nSpawnNumber; nChildSlot++) + { + // Retrieve Child + sChildSlot = "ChildSlot" + PadIntToString(nChildSlot, 2); + oChild = GetLocalObject(oSpawn, sChildSlot); + + // Check if this is Child Slot is Valid + if (GetIsObjectValid(oChild) == FALSE || GetIsDead(oChild)) + { + // Empty Slot + if (nEmptyChildSlot == 0) + { + nEmptyChildSlot = nChildSlot; + sEmptyChildSlot = sChildSlot; + } + } + } + + if (nEmptyChildSlot != 0) + { + // Assign Values to oSpawned + SetLocalObject(oSpawned, "ParentSpawn", oSpawn); + SetLocalFloat(oSpawned, "HomeX", GetPositionFromLocation(GetLocation(oSpawned)).x); + SetLocalFloat(oSpawned, "HomeY", GetPositionFromLocation(GetLocation(oSpawned)).y); + + // Assign Child Slot + SetLocalObject(oSpawn, sEmptyChildSlot, oSpawned); + SetLocalString(oSpawned, "ParentChildSlot", sEmptyChildSlot); + + // Assign Values to oSpawn + nChildrenSpawned++; + SetLocalInt(oSpawn, "ChildrenSpawned", nChildrenSpawned); + nSpawnCount++; + SetLocalInt(oSpawn, "SpawnCount", nSpawnCount); + } +} +// + +void NESS_DeactivateSpawnByID(int nSpawnID, object oArea) +{ + object oSpawn = NESS_GetSpawnByID(nSpawnID, oArea); + NESS_DeactivateSpawn(oSpawn); +} +// Identical to DeactivateSpawn, but included for interface consistency +void NESS_DeactivateSpawn(object oSpawn) +{ + DeactivateSpawn(oSpawn); +} +// This Function Sets a Spawn to Deactivate +void DeactivateSpawn(object oSpawn) +{ + SetLocalInt(oSpawn, "ForceDeactivateSpawn", TRUE); + NESS_ForceProcess(oSpawn); +} + +void NESS_ActivateSpawnByID(int nSpawnID, object oArea) +{ + object oSpawn = NESS_GetSpawnByID(nSpawnID, oArea); + NESS_ActivateSpawn(oSpawn); +} + +// This Function Sets a Spawn to Activate +void NESS_ActivateSpawn(object oSpawn) +{ + SetLocalInt(oSpawn, "SpawnDeactivated", FALSE); + NESS_ForceProcess(oSpawn); +} + +void NESS_ForceProcess(object oSpawn) +{ + SetLocalInt(oSpawn, "SpawnForceProcess", TRUE); +} + +void NESS_TrackModuleSpawns(int flag=TRUE) +{ + SetLocalInt(GetModule(), "TrackModuleSpawns", flag); +} + +int NESS_IsModuleSpawnTracking() +{ + return GetLocalInt(GetModule(), "TrackModuleSpawns"); +} + +// + +void NESS_DumpModuleSpawns(int flag=TRUE) +{ + SetLocalInt(GetModule(), "DumpModuleSpawns", flag); +} + +int NESS_IsModuleSpawnDumping() +{ + return GetLocalInt(GetModule(), "DumpModuleSpawns"); +} +// +// This Function Sets all Spawns by Tag to Deactivate +void DeactivateSpawnsByTag(string sSpawnTag) +{ + int nNth; + object oSpawn; + string sSpawnNum; + + int nSpawns = GetLocalInt(GetArea(OBJECT_SELF), "Spawns"); + + for (nNth = 1; nNth <= nSpawns; nNth++) + { + // Retrieve Spawn + sSpawnNum = "Spawn" + PadIntToString(nNth, 2); + oSpawn = GetLocalObject(OBJECT_SELF, sSpawnNum); + if (GetTag(oSpawn) == sSpawnTag) + { + SetLocalInt(oSpawn, "ForceDeactivateSpawn", TRUE); + } + } +} +// + +// This Function Sets all Spawns to Deactivate +void DeactivateAllSpawns() +{ + int nNth; + object oSpawn; + string sSpawnNum; + + int nSpawns = GetLocalInt(GetArea(OBJECT_SELF), "Spawns"); + + for (nNth = 1; nNth <= nSpawns; nNth++) + { + // Retrieve Spawn + sSpawnNum = "Spawn" + PadIntToString(nNth, 2); + oSpawn = GetLocalObject(OBJECT_SELF, sSpawnNum); + SetLocalInt(oSpawn, "ForceDeactivateSpawn", TRUE); + } +} +// +location GetRandomLocationInRadius(object oSpawn, float fWalkingRadius) +{ + vector vCurrentLocation, vTargetLocation; + float fRadiusX, fRadiusY; + location lTargetLocation; + + // Create our Random Location + fRadiusX = IntToFloat(Random(FloatToInt(fWalkingRadius))); + fRadiusY = IntToFloat(Random(FloatToInt(fWalkingRadius))); + if (d2() == 2) + { + fRadiusX = -fRadiusX; + } + if (d2() == 2) + { + fRadiusY = -fRadiusY; + } + vTargetLocation = Vector(fRadiusX, fRadiusY); + vCurrentLocation = GetPositionFromLocation(GetLocation(oSpawn)); + lTargetLocation = Location(OBJECT_SELF, vCurrentLocation + vTargetLocation, + 0.0); + + return lTargetLocation; +} + +// Random Walking with Range +void RandomWalk(object oSpawn, float fWalkingRadius, int nRun) +{ + // Walk to the New Location + float fRadiusX, fRadiusY; + + // Create our Random Location + fRadiusX = IntToFloat(Random(FloatToInt(fWalkingRadius))); + fRadiusY = IntToFloat(Random(FloatToInt(fWalkingRadius))); + if (d2() == 2) + { + fRadiusX = -fRadiusX; + } + if (d2() == 2) + { + fRadiusY = -fRadiusY; + } + + location lSpawnLocation = GetLocation(oSpawn); + vector vNewPosition = GetPositionFromLocation(lSpawnLocation); + + vNewPosition.x += fRadiusX; + vNewPosition.y += fRadiusY; + + location lRandomWalkLocation = Location(GetArea(OBJECT_SELF), vNewPosition, + 0.0); + ActionMoveToLocation(lRandomWalkLocation, nRun); +} +// + +// This Function Finds aaSeatnd Sits in It +void FindSeat(object oSpawn, object oSpawned) +{ + object oSeat; + string sSeatTag = GetLocalString(GetModule(), "df_SeatTag"); + location lSeatLocation; + + int nNth = 1; + object oSittable = GetNearestObjectByTag(sSeatTag, oSpawned, nNth); + while (oSittable != OBJECT_INVALID && oSeat == OBJECT_INVALID) + { + if (GetSittingCreature(oSittable) == OBJECT_INVALID) + { + oSeat = oSittable; + } + nNth++; + oSittable = GetNearestObjectByTag(sSeatTag, oSpawned, nNth); + } + + if (GetIsObjectValid(oSeat)) + { + lSeatLocation = GetLocation(oSeat); + AssignCommand(oSpawned, ClearAllActions()); + AssignCommand(oSpawned, ActionMoveToLocation(lSeatLocation)); + AssignCommand(oSpawned, ActionSit(oSeat)); + } +} +// + +// This Function Cleans an Object's Inventory + +void NESS_CleanCorpse(object oSpawned) +{ + NESS_CleanEquipped(oSpawned); + NESS_CleanInventory(oSpawned); +} + +void NESS_CleanEquipped(object oSpawned) +{ + int i = 0; + object oItem = OBJECT_INVALID; + + for (i=0; i < NUM_INVENTORY_SLOTS; i++) + { + oItem = GetItemInSlot(i, oSpawned); + + if (GetIsObjectValid(oItem)) + { + // Why the delay? This is used to remove equipped items from corpses. If the + // corpse is still around, it do it's unequip animation... + SetDroppableFlag( oItem, FALSE ); + DestroyObject(oItem, 1.0); + } + } +} + +void NESS_CleanInventory(object oSpawned) +{ + // Clean out oSpawned's Inventory + //debug("in clean inventory"); + object oItem = GetFirstItemInInventory(oSpawned); + while (oItem != OBJECT_INVALID) + { + //debug("destroying " + GetName(oItem)); + DestroyObject(oItem); + oItem = GetNextItemInInventory(oSpawned); + } +} + +// + +// This Functions Sets up the Patrol Route +void SetPatrolRoute(int nPatrolRoute, int nStartClosest=FALSE) +{ + object oStop; + int nRouteNumber, nStopNumber, iCount, nNumStops; + string sStop; + + // These 3 vars only used if nStartClosest is TRUE; + float fLeastDistance = 9999999.0;// any distance returned should be smaller + float fCurrentDistance; + int nClosestStopNum; + + // Cycle through Available Patrol Route Stops + iCount = 0; + nNumStops = 0; + oStop = GetNearestObject(OBJECT_TYPE_WAYPOINT, OBJECT_SELF, iCount); + while (oStop != OBJECT_INVALID) + { + sStop = GetTag(oStop); + // Check Route Number + nRouteNumber = GetFlagValue(sStop, "PR", -1); + if (nRouteNumber == nPatrolRoute) + { + // Identical Route Number, Add this Stop to oSpawned + nNumStops++; + nStopNumber = GetFlagValue(sStop, "SN", 0); + SetLocalObject(OBJECT_SELF, "PR_SN" + PadIntToString(nStopNumber, 2), oStop); + if (nStartClosest) + { + fCurrentDistance = GetDistanceToObject(oStop); + if (fCurrentDistance < fLeastDistance) + { + nClosestStopNum = nStopNumber; + fLeastDistance = fCurrentDistance; + } + } + + } + iCount++; + oStop = GetNearestObject(OBJECT_TYPE_WAYPOINT, OBJECT_SELF, iCount); + } + SetLocalInt(OBJECT_SELF, "PR_STOPS", nNumStops); + if (nStartClosest && (nClosestStopNum > 0)) + { + SetLocalInt(OBJECT_SELF, "PR_LASTSTOP", nClosestStopNum - 1); + + // Force it to go to a new waypoint + SetLocalInt(OBJECT_SELF, "PR_NEXTSTOP", -1); + + } +} +// + +// This Function Performs the Patrol Route +void DoPatrolRoute(int nPatrolRoute, int nRouteType) +{ + int nNumStops, nDespawn; + int nNextPatrolStop = -1; + int nLastPatrolStop = -1; + int nReturnRoute = FALSE; + + if (GetCurrentAction() != ACTION_INVALID) + return; + + ClearAllActions(); + + // Retreive Stop Information + nNumStops = GetLocalInt(OBJECT_SELF, "PR_STOPS"); + if ( nNumStops == 0 ) return; + nNextPatrolStop = GetLocalInt(OBJECT_SELF, "PR_NEXTSTOP"); + nLastPatrolStop = GetLocalInt(OBJECT_SELF, "PR_LASTSTOP"); + nReturnRoute = GetLocalInt(OBJECT_SELF, "PR_RETURNROUTE"); + + // Add New Stop to Route + if (nNextPatrolStop == -1) + { + // Sequential Route + if (nRouteType == 0 || nRouteType == 3) + { + if (nReturnRoute == TRUE) + { + if (nLastPatrolStop == 0) + { + nReturnRoute = FALSE; + SetLocalInt(OBJECT_SELF, "PR_RETURNROUTE", nReturnRoute); + nNextPatrolStop = nLastPatrolStop + 1; + } + else + { + nNextPatrolStop = nLastPatrolStop - 1; + } + } + else + { + if (nLastPatrolStop == nNumStops) + { + if (nRouteType == 3) + { + // End of Line, Despawn + nDespawn = TRUE; + } + else + { + nReturnRoute = TRUE; + SetLocalInt(OBJECT_SELF, "PR_RETURNROUTE", nReturnRoute); + nNextPatrolStop = nLastPatrolStop - 2; + } + } + else + { + nNextPatrolStop = nLastPatrolStop + 1; + } + } + } + + // Circular Route + if (nRouteType == 1) + { + if (nLastPatrolStop == nNumStops) + { + nNextPatrolStop = 0; + } + else + { + nNextPatrolStop = nLastPatrolStop + 1; + } + } + + // Random Route + if (nRouteType == 2) + { + nNextPatrolStop = Random(nNumStops); + while (nNextPatrolStop == nLastPatrolStop) + { + nNextPatrolStop = Random(nNumStops); + } + } + } + + if (nDespawn == TRUE) + { + ClearAllActions(); + SetLocalInt(OBJECT_SELF, "ForceDespawn", TRUE); + } + else + { + // Set Next Stop + SetLocalInt(OBJECT_SELF, "PR_NEXTSTOP", nNextPatrolStop); + + // Add Stop to Patrol + AddPatrolStop(nPatrolRoute, nNextPatrolStop); + + // Repeat the Process + ActionDoCommand(DoPatrolRoute(nPatrolRoute, nRouteType)); + } +} +// + +// This Function adds a Stop to the Patrol Route +void AddPatrolStop(int nPatrolRoute, int nStopNumber, int bJump=FALSE) +{ + object oStop; + int nRun, nScript, nFacing; + int nDayOnly, nNightOnly; + float fPause; + // Danmar: Added below for random pause setup + int nRandomPause; + int nRandomRoute; + // End Danmar changes + string sStop; + int nValid = TRUE; + + // Gather Stop Information + oStop = GetLocalObject(OBJECT_SELF, "PR_SN" + + PadIntToString(nStopNumber, 2)); + + if (GetIsObjectValid( oStop ) ) + { + sStop = GetTag(oStop); + nRun = IsFlagPresent(sStop, "RN"); + fPause = IntToFloat(GetFlagValue(sStop, "PS", 1)); + + // Danmar: Added RP###/RR### flag to patrol points to allow randomization + // of the pause time and stops. + nRandomPause = GetFlagValue(sStop, "RP", 0); + nRandomRoute = GetFlagValue(sStop, "RR", 0); + // End Danmar changes. + + nScript = GetFlagValue(sStop, "SC", -1); + nFacing = IsFlagPresent(sStop, "SF"); + nDayOnly = IsFlagPresent(sStop, "DO"); + nNightOnly = IsFlagPresent(sStop, "NO"); + + // Day Only + if (nDayOnly == TRUE && (GetIsDay() == FALSE && GetIsDawn() == FALSE)) + { + nValid = FALSE; + } + + // Night Only + if (nNightOnly == TRUE && (GetIsNight() == FALSE && GetIsDusk() == FALSE)) + { + nValid = FALSE; + } + + // Check if Valid + if (nValid == TRUE) + { + // Move to Stop + // Modified by Danmar + // ActionMoveToObject(oStop, nRun); // Original NESS line. + // if d% is less than nRandomRoute (RRxxx) then we move to the next stop. + // If its not then we skip that one and move to the next. + if ((nRandomRoute == 0) || ((Random(100) + 1) < nRandomRoute)) + { + if (bJump) + { + ActionJumpToLocation(GetLocation(oStop)); + } + else + { + ActionMoveToObject(oStop, nRun); + } + } + // End Danmar Changes + if (nFacing == TRUE) + { + ActionDoCommand(SetFacing(GetFacingFromLocation(GetLocation(oStop)))); + } + + // Execute Script + if (nScript > -1) + { + SetLocalInt(OBJECT_SELF, "PatrolScript", nScript); + ActionDoCommand(SetLocalInt(OBJECT_SELF, "PatrolScriptRunning", TRUE)); + ExecuteScript("spawn_sc_patrol", OBJECT_SELF); + ActionDoCommand(SetLocalInt(OBJECT_SELF, "PatrolScriptRunning", FALSE)); + } + + // Pause + /* Danmar: If fRandomPause!=0 then let's pick a random pause length and + add it to the existing fpause. This way you can use PS to set the + minimum pause and RP to set the maximum pause. + Example: PR01_SN01_PS010_RR011 would cause the creature to pause between + 10 to 20 seconds. */ + if (nRandomPause != 0) + { + fPause = fPause + IntToFloat(Random(nRandomPause)); + } + // End Danmar Changes + ActionWait(fPause); + } + } + + // Record this Stop and Clear Next Stop + ActionDoCommand(SetLocalInt(OBJECT_SELF, "PR_LASTSTOP", nStopNumber)); + ActionDoCommand(SetLocalInt(OBJECT_SELF, "PR_NEXTSTOP", -1)); +} + +void CheckForStuckPatrol(object oCreature, int nPatrolRoute, int nRouteType) +{ + // are we at the same location as last time? + location lLast = GetLocalLocation(oCreature, "NESSLastLoc"); + location lCurrent = GetLocation(oCreature); + if (lLast != lCurrent) + { + SetLocalLocation(oCreature, "NESSLastLoc", lCurrent); + SetLocalInt(oCreature, "NESSStuckCount", 0); + return; + } + + int nStuckCount = GetLocalInt(oCreature, "NESSStuckCount"); + nStuckCount += 1; + + if (nStuckCount < 3) + { + SetLocalInt(oCreature, "NESSStuckCount", nStuckCount); + return; + } + + AssignCommand(oCreature, ClearAllActions()); + + // unstuck 'im + int nLastStop = GetLocalInt(OBJECT_SELF, "PR_LASTSTOP"); + + // force a move + AssignCommand(oCreature, AddPatrolStop(nPatrolRoute, nLastStop, TRUE)); + + // reset + SetLocalInt(oCreature, "NESSStuckCount", 0); + +} +// + +// This Function Checks Camp State +int ProcessCamp(object oCamp) +{ + int iCount; + int nIsAlive = FALSE; + int nCampNumC, nCampNumP, nPlaceableType, nDeathScript; + float fCorpseDecay; + object oSpawned, oCampTrigger, oItem; + string sObject, sFlags, sCampTrigger; + + // Check Creatures + nCampNumC = GetLocalInt(oCamp, "CampNumC"); + + // Suppress despawning on creatureless camps + if ( nCampNumC == 0 ) + { + nIsAlive = TRUE; + } + + for (iCount = 1; iCount <= nCampNumC; iCount++) + { + sObject = "CampC" + IntToString(iCount - 1); + sFlags = GetLocalString(oCamp, sObject + "_Flags"); + fCorpseDecay = IntToFloat(GetFlagValue(sFlags, "CD", 0)); + nDeathScript = GetFlagValue(sFlags, "DT", -1); + oSpawned = GetLocalObject(oCamp, sObject); + if (oSpawned != OBJECT_INVALID) + { + if (GetIsDead(oSpawned) == FALSE) + { + nIsAlive = TRUE; + int nIsBusy = FALSE; + if (GetIsInCombat(oSpawned) || IsInConversation(oSpawned) || + (GetCurrentAction(oSpawned) != ACTION_INVALID)) + { + nIsBusy = TRUE; + } + if (! nIsBusy) + { + // Do return home processing + int nReturnHome = GetLocalInt(oSpawned, "f_ReturnHome"); + if (nReturnHome) + { + // retrieve lHome and fReturnRange + float fReturnHomeRange = GetLocalFloat(oSpawned, + "f_ReturnHomeRange"); + float fHomeX = GetLocalFloat(oSpawned, "HomeX"); + float fHomeY = GetLocalFloat(oSpawned, "HomeY"); + vector vHome = Vector(fHomeX, fHomeY, 0.0); + location lHome = Location(OBJECT_SELF, vHome, 0.0); + + if (GetDistanceBetweenLocations(lHome, GetLocation(oSpawned)) + > fReturnHomeRange) + { + AssignCommand(oSpawned, ReturnHome(lHome)); + nIsBusy = TRUE; + } + + } + } + + // Do random walk + if (! nIsBusy) + { + int nRandomWalk = GetLocalInt(oSpawned, "f_RandomWalk"); + if (nRandomWalk && + GetCurrentAction(oSpawned) != ACTION_WAIT && + GetCurrentAction(oSpawned) != ACTION_CASTSPELL && + (d2(1) == 2)) + { + AssignCommand(oSpawned, ClearAllActions()); + AssignCommand(oSpawned, ActionRandomWalk()); + } + } + } + else + { + NESS_ProcessDeadCreature(oSpawned); + DeleteLocalObject(oCamp, sObject); + } + } + } + + // Check Camp Trigger + if (nIsAlive) + { + sCampTrigger = GetLocalString(oCamp, "CampTrigger"); + if (sCampTrigger != "") + { + oCampTrigger = GetLocalObject(oCamp, "Camp" + sCampTrigger); + if (oCampTrigger == OBJECT_INVALID || GetIsDead(oCampTrigger) == TRUE) + { + // Run Trigger Script + ExecuteScript("spawn_sc_cmptrig", oCamp); + } + } + } + + // Check Placeable + nCampNumP = GetLocalInt(oCamp, "CampNumP"); + for (iCount = 1; iCount <= nCampNumP; iCount++) + { + sObject = "CampP" + IntToString(iCount - 1); + sFlags = GetLocalString(oCamp, sObject + "_Flags"); + nPlaceableType = GetFlagValue(sFlags, "PL", 0); + if (nPlaceableType == 1) + { + // Despawn if Empty + oSpawned = GetLocalObject(oCamp, sObject); + if (GetFirstItemInInventory(oSpawned) == OBJECT_INVALID) + { + DestroyObject(oSpawned); + } + } + } + + return nIsAlive; +} +// + +// This Function will Despawn a Camp +void DestroyCamp(object oCamp, float fCampDecay, int nSaveState) +{ + int iCount; + object oSpawned; + string sObject; + + int nCampNumP = GetLocalInt(oCamp, "CampNumP"); + int nCampNumC = GetLocalInt(oCamp, "CampNumC"); + + // Destroy Placeables + for (iCount = 1; iCount <= nCampNumP; iCount++) + { + sObject = "CampP" + IntToString(iCount - 1); + oSpawned = GetLocalObject(oCamp, sObject); + + if (nSaveState) + { + //debug("Saving " + sObject); + SaveStateOnDespawn(oSpawned, oCamp, TRUE); + } + SpawnCountDebug(oCamp, "despawning camp object " + ObjectToString(oSpawned)); + DestroyObject(oSpawned, fCampDecay); + } + + // Destroy Creatures + for (iCount = 1; iCount <= nCampNumC; iCount++) + { + sObject = "CampC" + IntToString(iCount - 1); + oSpawned = GetLocalObject(oCamp, sObject); + + if (nSaveState) + { + //debug("Saving " + sObject); + SaveStateOnDespawn(oSpawned, oCamp, TRUE); + } + AssignCommand(oSpawned, ClearAllActions()); + if (oSpawned != OBJECT_INVALID) + { + + NESS_CleanInventory(oSpawned); + AssignCommand(oSpawned, SetIsDestroyable(TRUE)); + SpawnCountDebug(oCamp, "despawning camp creature " + ObjectToString(oSpawned)); + + DestroyObject(oSpawned); + } + // remove from camp object + DeleteLocalObject(oCamp, sObject); + } +} +// + +object GetSpawnLocationObject(object oSpawn, int nSpawnLocationMin, + int nSpawnLocation, int nSpawnLocationInd) +{ + string sSpawnLocation; + object oSpawnLocation; + + if (nSpawnLocationInd) + { + int nNextEmptySlot; + + nNextEmptySlot = FindNextEmptyChildSlot(oSpawn); + + if (nNextEmptySlot > 0) + { + sSpawnLocation = "SL" + PadIntToString(nSpawnLocation + nNextEmptySlot - 1, + 2); + } + + else + { + // no empty slots? Just use base, I guess + sSpawnLocation = "SL" + PadIntToString(nSpawnLocation, 2); + } + + oSpawnLocation = GetNearestObjectByTag(sSpawnLocation, oSpawn); + } + + else + { + int nRndSpawnLocation; + + if (nSpawnLocationMin > -1) + { + nRndSpawnLocation = Random(nSpawnLocation + 1); + while (nRndSpawnLocation < nSpawnLocationMin) + { + nRndSpawnLocation = Random(nSpawnLocation + 1); + } + nSpawnLocation = nRndSpawnLocation; + } + sSpawnLocation = "SL" + PadIntToString(nSpawnLocation, 2); + oSpawnLocation = GetNearestObjectByTag(sSpawnLocation, oSpawn); + } + + return oSpawnLocation; +} + +vector GetSpawnRadiusPosition(vector vSpawnPos, float fSpawnRadius, + float fSpawnRadiusMin, int nRadialDistribution=FALSE) +{ + float fX, fY; + vector vRadius; + + if (nRadialDistribution) + { + float fSpawnAngle, fRadius; + + fSpawnAngle = IntToFloat(Random(361)); + if (fSpawnRadiusMin == fSpawnRadius) + { + fX = fSpawnRadius * cos(fSpawnAngle); + fY = fSpawnRadius * sin(fSpawnAngle); + } + else + { + fRadius = IntToFloat(Random(FloatToInt(fSpawnRadius) + 1)); + while (fRadius < fSpawnRadiusMin) + { + fRadius = IntToFloat(Random(FloatToInt(fSpawnRadius) + 1)); + } + fX = fRadius * cos(fSpawnAngle); + fY = fRadius * sin(fSpawnAngle); + } + } + + else + { + float fTestDistSquared, fMaxRadiusSquared, fMinRadiusSquared; + int nSpawnRadius = FloatToInt(fSpawnRadius); + + // Set up comparators + fMaxRadiusSquared = fSpawnRadius * fSpawnRadius; + fMinRadiusSquared = fSpawnRadiusMin * fSpawnRadiusMin; + + // Calculate first attempt + fX = IntToFloat(Random((2 * nSpawnRadius) + 1) - + nSpawnRadius + 1); + fY = IntToFloat(Random((2 * nSpawnRadius) + 1) - + nSpawnRadius + 1); + fTestDistSquared = (fX * fX) + (fY * fY); + + while (fTestDistSquared < fMinRadiusSquared || + fTestDistSquared > fMaxRadiusSquared) + { + fX = IntToFloat(Random((2 * nSpawnRadius) + 1) - + nSpawnRadius + 1); + fY = IntToFloat(Random((2 * nSpawnRadius) + 1) - + nSpawnRadius + 1); + fTestDistSquared = (fX * fX) + (fY * fY); + } + } + vRadius = Vector(vSpawnPos.x + fX, vSpawnPos.y + fY, vSpawnPos.z); + return vRadius; +} + +int CheckPositionUnseen(vector vSpawnPos, float fUnseenRadius) +{ + location lSpawn = Location(OBJECT_SELF, vSpawnPos, 0.0); + + object oCreature = GetFirstObjectInShape(SHAPE_SPHERE, fUnseenRadius, + lSpawn, FALSE, OBJECT_TYPE_CREATURE); + + while (oCreature != OBJECT_INVALID) + { + if (GetIsPC(oCreature) == TRUE) + { + return FALSE; + } + oCreature = GetNextObjectInShape(SHAPE_SPHERE, fUnseenRadius, + lSpawn, FALSE, OBJECT_TYPE_CREATURE); + } + + return TRUE; + +} + +void ReportSpawns(int nAreaSpawns, int nModuleSpawns) +{ + SendMessageToAllDMs("New creature count in " + + GetName(OBJECT_SELF) + ": " + IntToString(nAreaSpawns) + + " Module spawn count: " + IntToString(nModuleSpawns) + + (SPAWN_DELAY_DEBUG ? " (sd+)" : " (sd-)") + + (SPAWN_COUNT_DEBUG ? " (sc+)" : " (sc-)")); +} + +void TrackModuleSpawns(int nAreaSpawnCount, int nTrackModuleSpawns) +{ + int nNewAreaSpawnCount = GetLocalInt(OBJECT_SELF, SPAWN_AREA_COUNT ); + int nSpawnDifference = nNewAreaSpawnCount - nAreaSpawnCount; + + if (nSpawnDifference) + { + int nModuleSpawns = GetLocalInt(GetModule(), "ModuleSpawnCount"); + nModuleSpawns += nSpawnDifference; + SetLocalInt(GetModule(), "ModuleSpawnCount", nModuleSpawns); + if (nTrackModuleSpawns) + { + ReportSpawns(nNewAreaSpawnCount, nModuleSpawns); + } + } +} + +void DumpModuleSpawns() +{ + int nAreaSpawnCount = GetLocalInt(OBJECT_SELF, SPAWN_AREA_COUNT ); + if (nAreaSpawnCount > 0) + { + SendMessageToAllDMs("Area " + GetName(OBJECT_SELF) + ": " + + IntToString(nAreaSpawnCount) + + (SPAWN_DELAY_DEBUG ? " (sd+)" : " (sd-)") + + (SPAWN_COUNT_DEBUG ? " (sc+)" : " (sc-)")); + } +} + +void NESS_ReturnHome(object oCreature, int bRun=FALSE) +{ + float fHomeX = GetLocalFloat(oCreature, "HomeX"); + float fHomeY = GetLocalFloat(oCreature, "HomeY"); + vector vHome = Vector(fHomeX, fHomeY, 0.0); + location lHome = Location(GetArea(oCreature), vHome, 0.0); + + ClearAllActions(); + ActionMoveToLocation(lHome, bRun); +} + +void ReturnHome(location lHome) +{ + if (GetCurrentAction() != ACTION_INVALID) + return; + + ClearAllActions(); + ActionMoveToLocation(lHome); +} + +void DestroyIfNonDrop(object oItem) +{ + if(GetIsObjectValid(oItem)) + { + if (! GetDroppableFlag(oItem)) + { + //debug("Destroying non-drop item named " + GetName(oItem)); + DestroyObject(oItem); + } + } +} + +void StripNonDroppables(object oSpawned) +{ + DestroyIfNonDrop(GetItemInSlot(INVENTORY_SLOT_ARMS, oSpawned)); + DestroyIfNonDrop(GetItemInSlot(INVENTORY_SLOT_ARROWS, oSpawned)); + DestroyIfNonDrop(GetItemInSlot(INVENTORY_SLOT_BELT, oSpawned)); + DestroyIfNonDrop(GetItemInSlot(INVENTORY_SLOT_BOLTS, oSpawned)); + DestroyIfNonDrop(GetItemInSlot(INVENTORY_SLOT_BOOTS, oSpawned)); + DestroyIfNonDrop(GetItemInSlot(INVENTORY_SLOT_BULLETS, oSpawned)); + DestroyIfNonDrop(GetItemInSlot(INVENTORY_SLOT_CHEST, oSpawned)); + DestroyIfNonDrop(GetItemInSlot(INVENTORY_SLOT_CLOAK, oSpawned)); + DestroyIfNonDrop(GetItemInSlot(INVENTORY_SLOT_HEAD, oSpawned)); + DestroyIfNonDrop(GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oSpawned)); + DestroyIfNonDrop(GetItemInSlot(INVENTORY_SLOT_LEFTRING, oSpawned)); + DestroyIfNonDrop(GetItemInSlot(INVENTORY_SLOT_NECK, oSpawned)); + DestroyIfNonDrop(GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oSpawned)); + DestroyIfNonDrop(GetItemInSlot(INVENTORY_SLOT_RIGHTRING, oSpawned)); + + object oItem = GetFirstItemInInventory(oSpawned); + while (oItem != OBJECT_INVALID) + { + DestroyIfNonDrop(oItem); + oItem = GetNextItemInInventory(oSpawned); + } +} + +void NESS_ProcessDeadCreature(object oCreature, object oSpawn=OBJECT_INVALID) +{ + int nCampCreature; + + // Only do once per creature. Since this may be called from onDeath + // or within a NESS HB, check/mark for having been processed + int nProcessedDeath = GetLocalInt(oCreature, "ProcessedDeath"); + if (nProcessedDeath) + { + return; + } + + + SetLocalInt(oCreature, "ProcessedDeath", TRUE); + + // Find parent if not passed in + if (oSpawn == OBJECT_INVALID) + { + oSpawn = GetLocalObject(oCreature, "ParentSpawn"); + } + + object oArea = GetArea(oCreature); + SPAWN_DELAY_DEBUG = GetLocalInt(oArea, "SpawnDelayDebug"); + SPAWN_COUNT_DEBUG = GetLocalInt(oArea, "SpawnCountDebug"); + SpawnDelayDebug(oSpawn, "creature " + ObjectToString(oCreature) + " died"); + + // Remove non-drop items + // StripNonDroppables(oCreature); + + // Initialize DeathScripts + int nDeathScript; + float fCorpseDecay; + if (oSpawn == OBJECT_INVALID) + { + //debug("camp creature died"); + string sCampFlags; + nCampCreature = TRUE; + sCampFlags = GetLocalString(oCreature, "CreatureFlags"); + //debug("in process dead with flags " + sCampFlags); + fCorpseDecay = IntToFloat(GetFlagValue(sCampFlags, "CD", 0)); + nDeathScript = GetFlagValue(sCampFlags, "DT", -1); + //debug("camp creature: cd = " + FloatToString(fCorpseDecay)); + } + + else + { + //debug("non-camp creature died"); + nCampCreature = FALSE; + nDeathScript = GetLocalInt(oSpawn, "f_DeathScript"); + fCorpseDecay = GetLocalFloat(oSpawn, "f_CorpseDecay"); + //debug("not a camp creature: cd = " + FloatToString(fCorpseDecay)); + } + + // Run Death Script + if (nDeathScript > -1 && GetLocalInt(oCreature, "DeathScriptRan") == FALSE) + { + SetLocalInt(oCreature, "DeathScript", nDeathScript); + ExecuteScript("spawn_sc_death", oCreature); + } + + // Spawn Corpse if Dead and No Corpse + if (fCorpseDecay > 0.0) + { + if (GetLocalObject(oCreature, "Corpse") == OBJECT_INVALID) + { + //debug("calling spawn_corpse_dth"); + ExecuteScript("spawn_corpse_dth", oCreature); + } + } + + else + { + if (GetLocalInt(GetModule(), "AlwaysDestroyCorpses")) + { + AssignCommand(oCreature, SetIsDestroyable(TRUE, FALSE, FALSE)); + } + } +} + +void ResetSpawn(object oSpawn, int nTimeNow) +{ + // Reset the Spawn + SetLocalInt(oSpawn, "NextSpawnTime", nTimeNow); + //debug("set next spawn time on reset: " + IntToString(nTimeNow)); + SetLocalInt(oSpawn, "SpawnDeactivated", FALSE); + SetLocalInt(oSpawn, "ChildrenSpawned", 0); + SetLocalInt(oSpawn, "CurrentProcessTick", 0); + SetLocalInt(oSpawn, "SpawnAgeTime", 0); + //debug("PC reset"); + +} + +// + +void SaveStateOnDespawn(object oSpawned, object oSpawn, int nCamp=FALSE) +{ + string sSaveVarName; + + // These are the values needed to recreate the spawned object where + // it was when it despawned + int nObjectType = 0; + string sTemplate; + location lLastLocation; + float fLastFacing; + float fHomeX; + float fHomeY; + int nReturnHome; + + if (nCamp && !GetIsObjectValid(oSpawned)) + { + SpawnCountDebug(oSpawn, "creating slot for dead camp object" + + ObjectToString(oSpawned)); + sTemplate = ""; + } + + else + { + nObjectType = GetObjectType(oSpawned); + sTemplate = GetResRef(oSpawned); + lLastLocation = GetLocation(oSpawned); + fLastFacing = GetFacing(oSpawned); + fHomeX = GetLocalFloat(oSpawned, "HomeX"); + fHomeY = GetLocalFloat(oSpawned, "HomeY"); + + // if the return home flag is on, respawn at the home point + if (nCamp) + { + nReturnHome = GetLocalInt(oSpawned, "f_ReturnHome"); + } + + else + { + nReturnHome = GetLocalInt(oSpawn, "f_ReturnHome"); + } + + if (nReturnHome) + { + vector vHome = Vector(fHomeX, fHomeY, 0.0); + location lHome = Location(GetArea(oSpawned), vHome, fLastFacing); + lLastLocation = lHome; + } + } + + int nNumberSaveStates = GetLocalInt(oSpawn, "SpawnNumSavedStates"); + SetLocalInt(oSpawn, "SpawnNumSavedStates", ++nNumberSaveStates); + string sSaveVarNameBase = "SpawnedSaveState" + IntToString(nNumberSaveStates); + SpawnCountDebug(oSpawn, "PC despawn save count: " + IntToString(nNumberSaveStates)); + + + // Save the stuff needed to respawn + sSaveVarName = sSaveVarNameBase + "ObjectType"; + SetLocalInt(oSpawn, sSaveVarName, nObjectType); + + sSaveVarName = sSaveVarNameBase + "Template"; + SetLocalString(oSpawn, sSaveVarName, sTemplate); + + sSaveVarName = sSaveVarNameBase + "LastLocation"; + SetLocalLocation(oSpawn, sSaveVarName, lLastLocation); + + sSaveVarName = sSaveVarNameBase + "HomeX"; + SetLocalFloat(oSpawn, sSaveVarName, fHomeX); + + sSaveVarName = sSaveVarNameBase + "HomeY"; + SetLocalFloat(oSpawn, sSaveVarName, fHomeY); + + // These need to be preserved so they can be rewritten to the respawned + // object; they may be used in ProcessSpawn + if (! nCamp) + { + float fSpawnFacing = GetLocalFloat(oSpawned, "SpawnFacing"); + float fEntranceExitX = GetLocalFloat(oSpawned, "EntranceExitX"); + float fEntranceExitY = GetLocalFloat(oSpawned, "EntranceExitY"); + int iExpireTime = GetLocalInt(oSpawned, "LifespanExpireTime"); + + // Save the stuff we need to rewrite onto the spawn + sSaveVarName = sSaveVarNameBase + "SpawnFacing"; + SetLocalFloat(oSpawn, sSaveVarName, fSpawnFacing); + + sSaveVarName = sSaveVarNameBase + "EntranceExitX"; + SetLocalFloat(oSpawn, sSaveVarName, fEntranceExitX); + + sSaveVarName = sSaveVarNameBase + "EntranceExitY"; + SetLocalFloat(oSpawn, sSaveVarName, fEntranceExitY); + + sSaveVarName = sSaveVarNameBase + "LifeSpanExpireTime"; + SetLocalInt(oSpawn, sSaveVarName, iExpireTime); + } +} + +// + +void SaveCampStateOnDespawn(object oCamp, object oSpawn) +{ + // Note that most of what needs to be saved is on the camp object itself. + // This saves the camp object onto oSpawn + int nNumSavedCampStates = GetLocalInt(oSpawn,"SpawnNumSavedCampStates"); + SetLocalInt(oSpawn, "SpawnNumSavedCampStates",++nNumSavedCampStates); + + SpawnCountDebug(oSpawn, "PC despawn camp save count: " + IntToString(nNumSavedCampStates)); + + string sSaveCampVarName = "SpawnedSaveCampState" + + IntToString(nNumSavedCampStates); + SetLocalObject(oSpawn, sSaveCampVarName, oCamp); +} + +// + +void RestorePCDespawns(object oSpawn, int nTimeNow) +{ + int nSpawnNumSavedStates = GetLocalInt(oSpawn, "SpawnNumSavedStates"); + string sSaveVarNameBase; + string sSaveVarName; + int nChildNum; + + object oSpawned; + int nObjectType; + string sTemplate; + location lLastLocation; + location lEntranceExit; + float fHomeX; + float fHomeY; + location lHome; + int iExpireTime; + int i; + + SpawnCountDebug(oSpawn, "restoring " + IntToString(nSpawnNumSavedStates) + " objects"); + + for (i = 0; i < nSpawnNumSavedStates; i++) + { + nChildNum = i + 1; + sSaveVarNameBase = "SpawnedSaveState" + IntToString(nChildNum); + + sSaveVarName = sSaveVarNameBase + "ObjectType"; + nObjectType = GetLocalInt(oSpawn, sSaveVarName); + DeleteLocalInt(oSpawn, sSaveVarName); + + sSaveVarName = sSaveVarNameBase + "Template"; + sTemplate = GetLocalString(oSpawn, sSaveVarName); + DeleteLocalString (oSpawn, sSaveVarName); + + sSaveVarName = sSaveVarNameBase + "LastLocation"; + lLastLocation = GetLocalLocation(oSpawn, sSaveVarName); + DeleteLocalLocation(oSpawn, sSaveVarName); + + sSaveVarName = sSaveVarNameBase + "SpawnFacing"; + float fSpawnFacing = GetLocalFloat(oSpawn, sSaveVarName); + DeleteLocalFloat(oSpawn, sSaveVarName); + + sSaveVarName = sSaveVarNameBase + "HomeX"; + fHomeX = GetLocalFloat(oSpawn, sSaveVarName); + DeleteLocalFloat(oSpawn, sSaveVarName); + + sSaveVarName = sSaveVarNameBase + "HomeY"; + fHomeY = GetLocalFloat(oSpawn, sSaveVarName); + DeleteLocalFloat(oSpawn, sSaveVarName); + + sSaveVarName = sSaveVarNameBase + "EntranceExitX"; + float fEntranceExitX = GetLocalFloat(oSpawn, sSaveVarName); + DeleteLocalFloat(oSpawn, sSaveVarName); + + sSaveVarName = sSaveVarNameBase + "EntranceExitY"; + float fEntranceExitY = GetLocalFloat(oSpawn, sSaveVarName); + DeleteLocalFloat(oSpawn, sSaveVarName); + + sSaveVarName = sSaveVarNameBase + "LifeSpanExpireTime"; + iExpireTime = GetLocalInt(oSpawn, sSaveVarName); + DeleteLocalInt(oSpawn, sSaveVarName); + + //Initialize Cached Spawning + int nUseCache = GetLocalInt(oSpawn, "f_UseCache"); + int nCacheBucket = GetLocalInt(oSpawn, "f_CacheBucket"); + int nCacheCondition = GetLocalInt(oSpawn, "f_CacheCondition"); + int nCacheTiming = GetLocalInt(oSpawn, "CacheTiming"); + + if (! IsRestoreBlocked(oSpawn, lLastLocation, iExpireTime, nTimeNow)) + { + if(FALSE == nUseCache || nCacheTiming == 1) + { + //**FLAG standard create + oSpawned = CreateObject(nObjectType, sTemplate, lLastLocation); + } + else + { + oSpawned = CreateNessObject(oSpawn, nObjectType, sTemplate, lLastLocation, nCacheCondition, nCacheBucket); + } + + SpawnCountDebug(oSpawn, "restored " + sSaveVarNameBase + "object id: " + + ObjectToString(oSpawned)); + + lHome = Location(OBJECT_SELF, Vector(fHomeX, fHomeY, 0.), fSpawnFacing); + lEntranceExit = Location(OBJECT_SELF, Vector(fEntranceExitX, + fEntranceExitY, 0.), fSpawnFacing); + + RecordSpawned(oSpawn, oSpawned, lHome, lEntranceExit, fSpawnFacing); + SetupSpawned(oSpawn, oSpawned, lHome, nTimeNow, FALSE); + if(TRUE == nUseCache && 1 == nCacheTiming) + { + CreateCachedObject(oSpawn, oSpawned, nCacheBucket, nCacheCondition); + } + + // Lifespan expire time needs to be rewritten the the spawned object, + // since SetupSpawned generated a new one based on the current time... + SetLocalInt(oSpawned, "LifespanExpireTime", iExpireTime); + } + + else + { + SpawnCountDebug(oSpawn, "restore blocked: " + sSaveVarNameBase); + } + } + + int nNumSavedCampStates = GetLocalInt(oSpawn, "SpawnNumSavedCampStates"); + + // restore camps + for (i = 0; i < nNumSavedCampStates; i++) + { + int j; + int nCampNum = i + 1; + + string sSaveCampVarName = "SpawnedSaveCampState" + + IntToString(nCampNum); + object oCamp = GetLocalObject(oSpawn, sSaveCampVarName); + DeleteLocalObject(oSpawn, sSaveCampVarName); + + // respawn camp objects + //debug("restoring " + sSaveCampVarName); + nSpawnNumSavedStates = GetLocalInt(oCamp, "SpawnNumSavedStates"); + int nPlaceableCount = 0; + int nCreatureCount = 0; + for (j = 0; j < nSpawnNumSavedStates; j++) + { + nChildNum = j + 1; + sSaveVarNameBase = "SpawnedSaveState" + IntToString(nChildNum); + //debug("restoring " + sSaveVarNameBase); + + sSaveVarName = sSaveVarNameBase + "ObjectType"; + //debug("Getting objtype with var name " + sSaveVarName); + nObjectType = GetLocalInt(oCamp, sSaveVarName); + DeleteLocalInt(oCamp, sSaveVarName); + + sSaveVarName = sSaveVarNameBase + "Template"; + sTemplate = GetLocalString(oCamp, sSaveVarName); + //debug("template: " + sTemplate); + DeleteLocalString (oCamp, sSaveVarName); + + sSaveVarName = sSaveVarNameBase + "LastLocation"; + lLastLocation = GetLocalLocation(oCamp, sSaveVarName); + DeleteLocalLocation(oCamp, sSaveVarName); + + sSaveVarName = sSaveVarNameBase + "HomeX"; + fHomeX = GetLocalFloat(oCamp, sSaveVarName); + DeleteLocalFloat(oCamp, sSaveVarName); + + sSaveVarName = sSaveVarNameBase + "HomeY"; + fHomeY = GetLocalFloat(oCamp, sSaveVarName); + DeleteLocalFloat(oCamp, sSaveVarName); + lHome = Location(OBJECT_SELF, Vector(fHomeX, fHomeY, 0.), 0.); + + sSaveVarName = sSaveVarNameBase + "LifeSpanExpireTime"; + iExpireTime = GetLocalInt(oSpawn, sSaveVarName); + DeleteLocalInt(oSpawn, sSaveVarName); + + string sObject; + + if (nObjectType == OBJECT_TYPE_CREATURE) + { + sObject = "CampC" + IntToString(nCreatureCount++); + } + + else if (nObjectType == OBJECT_TYPE_PLACEABLE) + { + sObject = "CampP"+ IntToString(nPlaceableCount++); + } + + if (sTemplate != "") + { + if (! IsRestoreBlocked(oCamp, lLastLocation, iExpireTime, nTimeNow)) + { + oSpawned = CreateObject(nObjectType, sTemplate, lLastLocation); + + SetLocalObject(oCamp, sObject, oSpawned); + + vector vCamp = GetPositionFromLocation(GetLocation(oSpawn)); + string sFlags = GetLocalString(oCamp, sObject + "_Flags"); + + SetupCampSpawned(oSpawn, oSpawned, vCamp, lHome, sFlags); + + // Lifespan expire time needs to be rewritten the the spawned object, + // since SetupSpawned generated a new one based on the current time... + SetLocalInt(oSpawned, "LifespanExpireTime", iExpireTime); + + } + + else + { + SetLocalObject(oCamp, sObject, OBJECT_INVALID); + } + } + + else + { + SetLocalObject(oCamp, sObject, OBJECT_INVALID); + } + } + location lCampLocation = GetLocation(oSpawn); + float fCampFacing = GetFacing(oSpawn); + RecordSpawned(oSpawn, oCamp, lCampLocation, lCampLocation, fCampFacing); + } + + SetLocalInt(oSpawn, "SpawnNumSavedStates", 0); + SetLocalInt(oSpawn, "SpawnNumSavedCampStates", 0); +} + +// + +void RecordSpawned(object oSpawn, object oSpawned, location lHome, + location lEntranceExit, float fSpawnedFacing) +{ + int nChildrenSpawned; + int nSpawnCount; + int nChildSlot; + int nEmptyChildSlot; + object oChild; + string sChildSlot, sEmptyChildSlot; + + string sCustomFlag = GetLocalString(oSpawn, "f_CustomFlag"); + int nSpawnNumber = GetLocalInt(oSpawn, "f_SpawnNumber"); + + // Assign Values to oSpawned + SetLocalObject(oSpawned, "ParentSpawn", oSpawn); + SetLocalFloat(oSpawned, "SpawnFacing", fSpawnedFacing); + SetLocalFloat(oSpawned, "HomeX", GetPositionFromLocation(lHome).x); + SetLocalFloat(oSpawned, "HomeY", GetPositionFromLocation(lHome).y); + SetLocalFloat(oSpawned, "EntranceExitX", GetPositionFromLocation(lEntranceExit).x); + SetLocalFloat(oSpawned, "EntranceExitY", GetPositionFromLocation(lEntranceExit).y); + SetLocalString(oSpawned, "CustomFlag", sCustomFlag); + + // Assign Values to oSpawn + nChildrenSpawned = GetLocalInt(oSpawn, "ChildrenSpawned"); + nChildrenSpawned++; + SetLocalInt(oSpawn, "ChildrenSpawned", nChildrenSpawned); + nSpawnCount = GetLocalInt(oSpawn, "SpawnCount"); + nSpawnCount++; + SetLocalInt(oSpawn, "SpawnCount", nSpawnCount); + + // Find Empty Child Slot + nChildSlot = 1; + nEmptyChildSlot = 0; + for (nChildSlot = 1; nChildSlot <= nSpawnNumber; nChildSlot++) + { + // Retrieve Child + sChildSlot = "ChildSlot" + PadIntToString(nChildSlot, 2); + oChild = GetLocalObject(oSpawn, sChildSlot); + + // Check if this is Child Slot is Valid + if (GetIsObjectValid(oChild) == FALSE || GetIsDead(oChild)) + { + // Empty Slot + if (nEmptyChildSlot == 0) + { + nEmptyChildSlot = nChildSlot; + sEmptyChildSlot = sChildSlot; + } + } + } + + // Assign Child Slot + SpawnCountDebug(oSpawn, "recorded spawn " + GetTag(oSpawned) + " (" + + ObjectToString(oSpawned) + ") as " + sEmptyChildSlot); + SetLocalObject(oSpawn, sEmptyChildSlot, oSpawned); + SetLocalString(oSpawned, "ParentChildSlot", sEmptyChildSlot); + object oIdiot = GetLocalObject(oSpawn, sEmptyChildSlot); + string sValid = GetIsObjectValid(oIdiot) ? "valid" : "invalid"; +} + +// + +// Returns 0 if no empty slots +int FindNextEmptyChildSlot(object oSpawn) +{ + int nChildSlot; + int nEmptyChildSlot; + object oChild; + string sChildSlot; + int nSpawnNumber = GetLocalInt(oSpawn, "f_SpawnNumber"); + + nChildSlot = 1; + nEmptyChildSlot = 0; + for (nChildSlot = 1; nChildSlot <= nSpawnNumber; nChildSlot++) + { + // Retrieve Child + sChildSlot = "ChildSlot" + PadIntToString(nChildSlot, 2); + oChild = GetLocalObject(oSpawn, sChildSlot); + + // Check if this is Child Slot is Valid + if (GetIsObjectValid(oChild) == FALSE || GetIsDead(oChild)) + { + // Empty Slot + nEmptyChildSlot = nChildSlot; + break; + + } + } + + return nEmptyChildSlot; +} + +void SetupSpawned(object oSpawn, object oSpawned, location lHome, + int nTimeNow, int nWalkToHome = FALSE) +{ + object oFaction; + int nChildLifespanExpireTime; + int nGoldAmount; + effect eObject; + + int nSpawnFaction = GetLocalInt(oSpawn, "f_SpawnFaction"); + int nSpawnSit = GetLocalInt(oSpawn, "f_SpawnSit"); + int nSpawnPlot = GetLocalInt(oSpawn, "f_SpawnPlot"); + int nSpawnAlignment = GetLocalInt(oSpawn, "f_SpawnAlignment"); + int nAlignmentShift = GetLocalInt(oSpawn, "f_AlignmentShift"); + int nChildLifespanMax = GetLocalInt(oSpawn, "f_ChildLifespanMax"); + int nChildLifespanMin = GetLocalInt(oSpawn, "f_ChildLifespanMin"); + int nRandomGold = GetLocalInt(oSpawn, "f_RandomGold"); + int nRandomGoldMin = GetLocalInt(oSpawn, "f_RandomGoldMin"); + int nGoldChance = GetLocalInt(oSpawn, "f_GoldChance"); + int nLootTable = GetLocalInt(oSpawn, "f_LootTable"); + int nTrapDisabled = GetLocalInt(oSpawn, "f_TrapDisabled"); + float fCorpseDecay = GetLocalFloat(oSpawn, "f_CorpseDecay"); + int nCorpseDecayType = GetLocalInt(oSpawn, "f_CorpseDecayType"); + int bDropWielded = GetLocalInt(oSpawn, "f_CorpseDropWielded"); + int bDeleteLootOnDecay = GetLocalInt(oSpawn, "f_CorpseDeleteLootOnDecay"); + string sCorpseRemainsResRef = GetLocalString(oSpawn, "f_CorpseRemainsResRef"); + int nDeathScript = GetLocalInt(oSpawn, "f_DeathScript"); + int nSpawnScript = GetLocalInt(oSpawn, "f_SpawnScript"); + int nSpawnAreaEffect = GetLocalInt(oSpawn, "f_SpawnAreaEffect"); + float fAreaEffectDuration = GetLocalFloat(oSpawn, "f_AreaEffectDuration"); + int nObjectEffect = GetLocalInt(oSpawn, "f_ObjectEffect"); + float fObjectEffectDuration = GetLocalFloat(oSpawn, "f_ObjectEffectDuration"); + string sSpawnTag = GetLocalString(oSpawn, "f_Template"); + int nPatrolRoute = GetLocalInt(oSpawn, "f_PatrolRoute"); + int nPatrolStartAtClosest = GetLocalInt(oSpawn, "f_PatrolStartAtClosest"); + int nRouteType = GetLocalInt(oSpawn, "f_RouteType"); + int nRandomWalk = GetLocalInt(oSpawn, "f_RandomWalk"); + float fWanderRange = GetLocalFloat(oSpawn, "f_WanderRange"); + int nSuppressLooting = GetLocalInt(oSpawn, "f_SuppressLooting"); + int nSubdualMode = GetLocalInt(oSpawn, "f_SubdualMode"); + int nEncounterLevel = GetLocalInt(oSpawn, "f_EncounterLevel"); + + + if (nWalkToHome) + { + AssignCommand(oSpawned, ActionMoveToLocation(lHome)); + } + + // Spawn it in with the right facing, and you don't need this; and + // then it works for placeables as well! + // AssignCommand(oSpawned, ActionDoCommand(SetFacing(fSpawnedFacing))); + + // Set up SpawnPlot + if (nSpawnPlot == TRUE) + { + SetPlotFlag(oSpawned, TRUE); + } + + // Set up Faction + if (nSpawnFaction > -1) + { + switch (nSpawnFaction) + { + case 0: + ChangeToStandardFaction(oSpawned, STANDARD_FACTION_COMMONER); + break; + case 1: + ChangeToStandardFaction(oSpawned, STANDARD_FACTION_DEFENDER); + break; + case 2: + ChangeToStandardFaction(oSpawned, STANDARD_FACTION_MERCHANT); + break; + case 3: + ChangeToStandardFaction(oSpawned, STANDARD_FACTION_HOSTILE); + break; + case 4: + oFaction = GetNearestObjectByTag("SpawnFaction", oSpawned); + if (oFaction != OBJECT_INVALID) + { + ChangeFaction(oSpawned, oFaction); + } + break; + } + } + + // Set up Alignment + if (nSpawnAlignment > -1) + { + switch (nSpawnAlignment) + { + case 0: + AdjustAlignment(oSpawned, ALIGNMENT_NEUTRAL, nAlignmentShift); + break; + case 1: + AdjustAlignment(oSpawned, ALIGNMENT_LAWFUL, nAlignmentShift); + break; + case 2: + AdjustAlignment(oSpawned, ALIGNMENT_CHAOTIC, nAlignmentShift); + break; + case 3: + AdjustAlignment(oSpawned, ALIGNMENT_GOOD, nAlignmentShift); + break; + case 4: + AdjustAlignment(oSpawned, ALIGNMENT_EVIL, nAlignmentShift); + break; + case 5: + AdjustAlignment(oSpawned, ALIGNMENT_ALL, nAlignmentShift); + break; + } + } + + // Set up Lifespan + if (nChildLifespanMax > -1) + { + if (nChildLifespanMin > -1) + { + nChildLifespanExpireTime = -1; + while (nChildLifespanExpireTime < nChildLifespanMin) + { + nChildLifespanExpireTime = nTimeNow + Random(nChildLifespanMax) + 1; + } + } + else + { + nChildLifespanExpireTime = nTimeNow + nChildLifespanMax; + } + SetLocalInt(oSpawned, "LifespanExpireTime", nChildLifespanExpireTime); + } + + // Give Creature Loot + if (nLootTable > -1) + { + DelayCommand(1.0, LootTable(oSpawn, oSpawned, nLootTable)); + } + + // Give RandomGold + if (nRandomGold > 0) + { + // One in Four Creatures give Gold + if (d100(1) <= nGoldChance) + { + // Calculate Gold to Drop + nGoldAmount = Random(nRandomGold + 1); + while (nGoldAmount < nRandomGoldMin) + { + nGoldAmount = Random(nRandomGold + 1); + } + + // Give Gold + CreateItemOnObject("nw_it_gold001", oSpawned, nGoldAmount); + } + } + + // Set up Trap on Placeable + if (GetIsTrapped(oSpawned)) + { + if (d100(1) <= nTrapDisabled) + { + SetTrapDisabled(oSpawned); + } + } + + // Set up Corpse Decay + if (fCorpseDecay > 0.0) + { + SetLocalFloat(oSpawned, "CorpseDecay", fCorpseDecay); + SetLocalInt(oSpawned, "CorpseDecayType", nCorpseDecayType); + SetLocalString(oSpawned, "CorpseRemainsResRef", sCorpseRemainsResRef); + SetLocalInt(oSpawned, "CorpseDropWielded", bDropWielded); + SetLocalInt(oSpawned, "CorpseDeleteLootOnDecay", bDeleteLootOnDecay); + AssignCommand(oSpawned, SetIsDestroyable(FALSE, FALSE, FALSE)); + } + + // Set up Death Script + if (nDeathScript > -1) + { + AssignCommand(oSpawned, SetIsDestroyable(FALSE, FALSE, FALSE)); + } + + // Set up Object Effects + if (nObjectEffect > 0) + { + eObject = ObjectEffect(oSpawn); + if (fObjectEffectDuration == -1.0) + { + ApplyEffectToObject(DURATION_TYPE_PERMANENT, eObject, oSpawned, 0.0); + } + else + { + ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eObject, oSpawned, fObjectEffectDuration); + } + } + + // Set up Area Effect + if (nSpawnAreaEffect > 0 && sSpawnTag == "AE" && fAreaEffectDuration > 0.0) + { + DestroyObject(oSpawned, fAreaEffectDuration); + } + + // Run the Spawn Script + if (nSpawnScript > -1) + { + SetLocalInt(oSpawned, "SpawnScript", nSpawnScript); + ExecuteScript("spawn_sc_spawn", oSpawned); + } + + // Set up Random Walking + if (nRandomWalk == TRUE) + { + if (fWanderRange > 0.0) + { + AssignCommand(oSpawned, RandomWalk(oSpawn, fWanderRange, FALSE)); + } + else + { + AssignCommand(oSpawned, ActionRandomWalk()); + } + } + + // Set up the Patrol Route + if (nPatrolRoute > -1) + { + AssignCommand(oSpawned, SetPatrolRoute(nPatrolRoute, + nPatrolStartAtClosest)); + AssignCommand(oSpawned, DoPatrolRoute(nPatrolRoute, nRouteType)); + } + + // Set up Spawn Sit + if (nSpawnSit == TRUE) + { + FindSeat(oSpawn, oSpawned); + } + + // Set up loot suppression + if (nSuppressLooting) + { + SetLocalInt(oSpawned, "DoNotLoot", TRUE); + } + + // Set up subdual mode + if (nSubdualMode) + { + SetLocalInt(oSpawned, "SubdualMode", TRUE); + } + + // Set up encounter level + if (nEncounterLevel > 0) + { + SetLocalInt(oSpawned, "AlfaEncounterLevel", nEncounterLevel); + } + + SetupCustomFlags(oSpawn, oSpawned); +} + +// + +void SetupCampSpawned(object oSpawn, object oSpawned, vector vCampPosition, + location lHome, string sFlags) +{ + //debug("in setupCampSpawned"); + + // This is the closest we get to an "InitFlags" call for camp creatures + // write the flags onto the spawned creature + SetLocalString(oSpawned, "CreatureFlags", sFlags); + int nSpawnFacing = IsFlagPresent(sFlags, "SF"); + + object oModule = GetModule(); + int dfLootTable = GetLocalInt(oModule, "df_LootTable"); + int dfLootTable1ItemChance = GetLocalInt(oModule, "df_LootTable1ItemChance"); + int dfLootTable2ItemChance = GetLocalInt(oModule, "df_LootTable2ItemChance"); + int dfLootTable3ItemChance = GetLocalInt(oModule, "df_LootTable3ItemChance"); + int nLootTable = GetFlagValue(sFlags, "LT", dfLootTable); + int nLootTable1ItemChance = GetSubFlagValue(sFlags, "LT", "A", dfLootTable1ItemChance); + int nLootTable2ItemChance = GetSubFlagValue(sFlags, "LT", "B", dfLootTable2ItemChance); + int nLootTable3ItemChance = GetSubFlagValue(sFlags, "LT", "C", dfLootTable3ItemChance); + if (nLootTable1ItemChance > 100) nLootTable1ItemChance = 100; + if (nLootTable2ItemChance > 100) nLootTable2ItemChance = 100; + if (nLootTable3ItemChance > 100) nLootTable3ItemChance = 100; + // Make %'s available to spawn_cfg_loot + SetLocalInt(oSpawn, "f_LootTable1ItemChance", nLootTable1ItemChance); + SetLocalInt(oSpawn, "f_LootTable2ItemChance", nLootTable2ItemChance); + SetLocalInt(oSpawn, "f_LootTable3ItemChance", nLootTable3ItemChance); + + int nTrapDisabled = GetSubFlagValue(sFlags, "PL", "T", 100); + int nRandomWalk = IsFlagPresent(sFlags, "RW"); + SetLocalInt(oSpawned, "f_RandomWalk", nRandomWalk); + + float fCorpseDecay = IntToFloat(GetFlagValue(sFlags, "CD", 0)); + int nCorpseDecayType = GetSubFlagValue(sFlags, "CD", "T", 0); + int nCorpseRemainsType = GetSubFlagValue(sFlags, "CD", "R", 0); + int bDropWielded = IsSubFlagPresent(sFlags, "CD", "D"); + + int nDeathScript = GetFlagValue(sFlags, "DT", -1); + int nReturnHome = IsFlagPresent(sFlags, "RH"); + SetLocalInt(oSpawned, "f_ReturnHome", nReturnHome); + + + if (nReturnHome) + { + int dfReturnHomeRange = GetLocalInt(GetModule(), "df_ReturnHomeRange"); + float fReturnHomeRange = IntToFloat(GetFlagValue(sFlags, "RH", + dfReturnHomeRange)); + SetLocalFloat(oSpawned, "f_ReturnHomeRange", fReturnHomeRange); + SetLocalFloat(oSpawned, "HomeX", GetPositionFromLocation(lHome).x); + SetLocalFloat(oSpawned, "HomeY", GetPositionFromLocation(lHome).y); + } + + // Spawn Facing + if (nSpawnFacing == TRUE) + { + AssignCommand(oSpawned, SetFacingPoint(vCampPosition)); + } + else + { + AssignCommand(oSpawned, SetFacing(IntToFloat(Random(360)))); + } + + // Loot Table + if (nLootTable > -1) + { + LootTable(oSpawn, oSpawned, nLootTable); + } + + // Trap Disabled + if (GetIsTrapped(oSpawned)) + { + if (d100(1) <= nTrapDisabled) + { + SetTrapDisabled(oSpawned); + } + } + + // RandomWalk + if (nRandomWalk == TRUE) + { + AssignCommand(oSpawned, ActionRandomWalk()); + } + + // Corpse Decay + if (fCorpseDecay > 0.0) + { + string sCorpseRemainsResRef; + int bDeleteLootOnDecay = FALSE; + + switch (nCorpseRemainsType) + { + case 0: sCorpseRemainsResRef = "invis_corpse_obj"; break; + case 1: sCorpseRemainsResRef = "invis_corpse_bdy"; break; + case 2: sCorpseRemainsResRef = "invis_corpse_bon"; break; + case 3: sCorpseRemainsResRef = "invis_corpse_pot"; break; + case 4: sCorpseRemainsResRef = "invis_corpse_pch"; break; + case 5: sCorpseRemainsResRef = "invis_corpse_scr"; break; + case 6: sCorpseRemainsResRef = "invis_corpse_tre"; break; + case 7: + sCorpseRemainsResRef = "invis_corpse_obj"; + bDeleteLootOnDecay = TRUE; + break; + } + + // Record CorpseDecay + SetLocalString(oSpawned, "CorpseRemainsResRef", sCorpseRemainsResRef); + SetLocalInt(oSpawned, "CorpseDropWielded", bDropWielded); + SetLocalInt(oSpawned, "CorpseDeleteLootOnDecay", bDeleteLootOnDecay); + SetLocalFloat(oSpawned, "CorpseDecay", fCorpseDecay); + SetLocalInt(oSpawned, "CorpseDecayType", nCorpseDecayType); + AssignCommand(oSpawned, SetIsDestroyable(FALSE, FALSE, FALSE)); + } + + // Death Script + if (nDeathScript > -1) + { + AssignCommand(oSpawned, SetIsDestroyable(FALSE, FALSE, FALSE)); + } +} + +int SetupSpawnDelay(int nSpawnDelay, int nDelayRandom, int nDelayMinimum, + int nTimeNow) +{ + int nNextSpawnTime; + + if (nDelayRandom == TRUE) + { + // Setup Next Spawn Randomly + nNextSpawnTime = Random(nSpawnDelay) + 1; + while (nNextSpawnTime < nDelayMinimum) + { + nNextSpawnTime = Random(nSpawnDelay) + 1; + } + nNextSpawnTime += nTimeNow; + } + else + { + // Setup Next Spawn + nNextSpawnTime = nTimeNow + nSpawnDelay; + } + return nNextSpawnTime; +} + +int IsRestoreBlocked(object oSpawn, location lChildLoc, int iExpireTime, + int nTimeNow) +{ + int nSpawnBlock = FALSE; + + if(GetResRef(oSpawn) == "plc_invisobj") oSpawn = GetLocalObject(oSpawn, "ParentSpawn"); + + // Initialize Day/Night Only + int nDayOnly = GetLocalInt(oSpawn, "f_DayOnly"); + int nDayOnlyDespawn = GetLocalInt(oSpawn, "f_DayOnlyDespawn"); + int nNightOnly = GetLocalInt(oSpawn, "f_NightOnly"); + int nNightOnlyDespawn = GetLocalInt(oSpawn, "f_NightOnlyDespawn"); + + // Initialize Day/Hour Spawns + int nDay, nHour; + int nSpawnDayStart = GetLocalInt(oSpawn, "f_SpawnDayStart"); + int nSpawnDayEnd = GetLocalInt(oSpawn, "f_SpawnDayEnd"); + int nSpawnHourStart = GetLocalInt(oSpawn, "f_SpawnHourStart"); + int nSpawnHourEnd = GetLocalInt(oSpawn, "f_SpawnHourEnd"); + + // Initialize Child Lifespan + int nChildLifespanMax = GetLocalInt(oSpawn, "f_ChildLifespanMax"); + + // Initialize SpawnUnseen + float fSpawnUnseen = GetLocalFloat(oSpawn, "f_SpawnUnseen"); + int nUnseenIndividual = GetLocalInt(oSpawn, "f_UnseenIndividual"); + + + // Check Against Spawn Unseen (_SUnn|I_) + if (fSpawnUnseen > 0.0) + { + if (nUnseenIndividual) + { + vector vChildPos = GetPositionFromLocation(lChildLoc); + + if (CheckPositionUnseen(vChildPos, fSpawnUnseen) == FALSE) + { + nSpawnBlock = TRUE; + } + } + + else + { + vector vSpawnPos = GetPositionFromLocation(GetLocation(oSpawn)); + + if (CheckPositionUnseen(vSpawnPos, fSpawnUnseen) == FALSE) + { + nSpawnBlock = TRUE; + } + } + } + + // Check Against Night Only. Since this is a restore of something already + // spawned, it should only be blocked if despawn has been specified for the + // creature (_NOD_) + if (nNightOnly && nNightOnlyDespawn) + { + if (GetIsDay() || GetIsDawn()) + { + nSpawnBlock = TRUE; + } + } + + // Check Against Day Only (_DOD_) + if (nDayOnly && nDayOnlyDespawn) + { + if (GetIsDay() == FALSE && GetIsDawn() == FALSE) + { + nSpawnBlock = TRUE; + } + } + + // Check Against Specific Day(s) (_DYnn_) + if (nSpawnDayStart > -1) + { + nDay = GetCalendarDay(); + if (IsBetweenDays(nDay, nSpawnDayStart, nSpawnDayEnd) == FALSE) + { + nSpawnBlock = TRUE; + } + } + + // Check Against Specific Hour(s) (_HRnn_) + if (nSpawnHourStart > -1) + { + nHour = GetTimeHour(); + if (IsBetweenHours(nHour, nSpawnHourStart, nSpawnHourEnd) == FALSE) + { + nSpawnBlock = TRUE; + } + } + + // Check Lifespan (_CLnn_) + if (nChildLifespanMax > -1) + { + if (nTimeNow >= iExpireTime) + { + //debug("restore: lifespawn exceeded"); + nSpawnBlock = TRUE; + } + } + + return nSpawnBlock; +} + +int NeedPseudoHeartbeat( object oArea ) +{ + int bPCsInArea = GetLocalInt( oArea, SPAWN_PCS_IN_AREA ); + int nAreaSpawnCount = GetLocalInt( oArea, SPAWN_AREA_COUNT ); + int bHeartbeatScheduled = GetLocalInt( oArea, SPAWN_HEARTBEAT_SCHEDULED ); + int bLeftoversForceProcessing = GetLocalInt( GetModule(), + "LeftoversForceProcessing"); + + // Do a heartbeat if there are PCs in the area or any spawns up, and we + // don't already have a heartbeat scheduled + + if (bLeftoversForceProcessing) + { + return ( (bPCsInArea || nAreaSpawnCount) && ! bHeartbeatScheduled ); + } + + return ( bPCsInArea && ! bHeartbeatScheduled ); +} + +void Spawn_OnAreaEnter( string sHeartbeatScript = "spawn_sample_hb", + float fHeartbeatInterval = 6.0, float fFirstDelay = 0.0 ) +{ + object oPC = GetEnteringObject(); + object oArea = OBJECT_SELF; + + SetLocalString( oArea, SPAWN_HEARTBEAT_SCRIPT, sHeartbeatScript ); + SetLocalFloat( oArea, SPAWN_INTERVAL, fHeartbeatInterval ); + + if ( GetIsPC( oPC ) ) + { + SetLocalInt(oPC, "NESS_Player", TRUE); + int nPCsInArea = GetLocalInt( oArea, SPAWN_PCS_IN_AREA ); + int nAreaSpawnCount = GetLocalInt( oArea, SPAWN_AREA_COUNT ); + + nPCsInArea++; + SetLocalInt( oArea, SPAWN_PCS_IN_AREA, nPCsInArea ); + + if ( NeedPseudoHeartbeat( oArea ) ) + { + if ( fFirstDelay > 0.0 ) + { + DelayCommand( fFirstDelay, ExecuteScript( "spawn_pseudohb", oArea ) ); + } + + else + { + ExecuteScript( "spawn_pseudohb", oArea ); + } + } + } +} + +void Spawn_OnAreaExit() +{ + object oPC = GetExitingObject(); + object oArea = OBJECT_SELF; + int bIsPC = GetLocalInt(oPC, "NESS_Player"); + + if ( bIsPC ) + { + int nPCsInArea = GetLocalInt( oArea, SPAWN_PCS_IN_AREA ); + nPCsInArea--; + SetLocalInt( oArea, SPAWN_PCS_IN_AREA, nPCsInArea ); + } +} + +void ScheduleNextPseudoHeartbeat( object oArea ) +{ + float fInterval = GetLocalFloat( oArea, SPAWN_INTERVAL ); + + if ( fInterval == 0.0 ) + { + fInterval = 6.0; + } + + DelayCommand( fInterval, ExecuteScript( "spawn_pseudohb", oArea ) ); + SetLocalInt( oArea, SPAWN_HEARTBEAT_SCHEDULED, TRUE ); +} + +void CountAndTrackModuleSpawns( int nAreaSpawnCount ) +{ + int nSpawns = GetLocalInt(OBJECT_SELF, "Spawns"); + int nNewAreaSpawnCount = 0; + // First we count the spawns in the area + int nNth; + for (nNth = 1; nNth <= nSpawns; nNth++) + { + string sSpawnNum = "Spawn" + PadIntToString(nNth, 2); + object oSpawn = GetLocalObject(OBJECT_SELF, sSpawnNum); + nNewAreaSpawnCount += GetLocalInt(oSpawn, "SpawnCount"); + } + SetLocalInt(OBJECT_SELF, SPAWN_AREA_COUNT, nNewAreaSpawnCount); + // Do spawn tracking + int nTrackModuleSpawns = GetLocalInt(GetModule(), "TrackModuleSpawns"); + // call with old count + TrackModuleSpawns(nAreaSpawnCount, nTrackModuleSpawns); + // Do Spawn dumping + int nDumpModuleSpawns = GetLocalInt(GetModule(), "DumpModuleSpawns"); + if (nDumpModuleSpawns) + { + DumpModuleSpawns(); + } +} + +//creates a Ness object by either copying or creating and copying +object CreateNessObject(object oSpawn, int nObjectType, string sTemplate, location lLocation + , int nCacheCondition = 0, int nCacheBucket = 0) +{ + string sBucketWPTag = "wpNessCachedLoc"; + if(nCacheBucket != 0) + { + sBucketWPTag += IntToString(nCacheBucket); + } + + int nRefCount; + location lCachedLocation = GetLocation(GetObjectByTag(sBucketWPTag)); +; + object oModule = GetModule(); + object oCachedObject = GetLocalObject(oModule, sTemplate); + + if(!GetIsObjectValid(oCachedObject)) + { + if(2 == nCacheCondition) + { + return OBJECT_INVALID; + } + + oCachedObject = CreateObject(nObjectType, sTemplate, lCachedLocation); + SetLocalObject(oModule, sTemplate, oCachedObject); + } + else + if(1 == nCacheCondition)//if object valid and force cache is true + { + // get cached object RefCount + nRefCount = RefCount(oCachedObject); + + DestroyObject(oCachedObject); + oCachedObject = CreateObject(nObjectType, sTemplate, lCachedLocation); + + //do refcounting + if(0 < nRefCount) SetRefOverride(oCachedObject, nRefCount); + + SetLocalObject(oModule, sTemplate, oCachedObject); + } + + if(!GetIsObjectValid(oCachedObject)) + { + WriteTimestampedLogEntry("Failed to cache object"); + return CreateObject(nObjectType, sTemplate, lLocation); + } + object oSpawned = CopyObject(oCachedObject, lLocation); + AddRef(oCachedObject, oSpawn); + return oSpawned; +} + +//creates a cached object from oSpawned +void CreateCachedObject(object oSpawn, object oSpawned, int nCacheBucket = 0, int nCacheCondition = 0) +{ + string sTemplate = GetResRef(oSpawned); + object oModule = GetModule(); + string sBucketWPTag = "wpNessCachedLoc"; + int nRefCount = -1; + + if(!GetIsObjectValid(oSpawned)) return; + if(nCacheBucket != 0) + { + sBucketWPTag += IntToString(nCacheBucket); + } + location lCachedLocation = GetLocation(GetObjectByTag(sBucketWPTag)); + + object oCachedObject = GetLocalObject(oModule, sTemplate); + + if(GetIsObjectValid(oCachedObject)) + { + if(0 == nCacheCondition) + { + AddRef(oCachedObject, oSpawn); + return; + } + + //get cached object refcount + nRefCount = RefCount(oCachedObject); + DestroyObject(oCachedObject); + } + + //create cached by copying spawned + oCachedObject = CopyObject(oSpawned, lCachedLocation); + SetLocalObject(oModule, sTemplate, oCachedObject); + + //do refcounting + if(0 < nRefCount) + { + SetRefOverride(oCachedObject, nRefCount); + } + AddRef(oCachedObject, oSpawn); +} + +//adds to the refcount of oCachedSpawn +int AddRef(object oCachedSpawn, object oCounter) +{ + if(FALSE == bUseRefCount) return -1; + if(!GetIsObjectValid(oCachedSpawn) || !GetIsObjectValid(oCounter)) + { + return -1; + } + string sResRef = GetResRef(oCachedSpawn); + + if(0 != GetLocalInt(oCounter, sResRef)) + { + return 0; + } + SetLocalInt(oCounter, sResRef, 1); + AddRefCountList(oCounter, sResRef); + + int nRefCount = GetLocalInt(oCachedSpawn, REFCOUNT) + 1; + SetLocalInt(oCachedSpawn, REFCOUNT, nRefCount); + + return nRefCount; +} + +//reduces the refcount of oCachedSpawn. If the count drops to zero the cached spawn +//is destroyed +int Release(object oCachedSpawn, object oCounter) +{ + if(FALSE == bUseRefCount) return -1; + + if(!GetIsObjectValid(oCachedSpawn) || !GetIsObjectValid(oCounter)) + { + return -1; + } + + string sResRef = GetResRef(oCachedSpawn); + if(1 != GetLocalInt(oCounter, sResRef)) + { + return -1; + } + SetLocalInt(oCounter, sResRef, 0); + + int nRefCount = GetLocalInt(oCachedSpawn, REFCOUNT) - 1; + if(0 >= nRefCount) + { + DestroyObject(oCachedSpawn); + return 0; + } + + SetLocalInt(oCachedSpawn, REFCOUNT, nRefCount); + return nRefCount; +} + +int RefCount(object oCachedSpawn) +{ + if(!GetIsObjectValid(oCachedSpawn)) return -1; + return GetLocalInt(oCachedSpawn, REFCOUNT); +} + +void SetRefOverride(object oCachedSpawn, int nRefCount) +{ + if(GetIsObjectValid(oCachedSpawn)) + { + SetLocalInt(oCachedSpawn, REFCOUNT, nRefCount); + } +} + +//adds to a running list of templates for caches the spawn point. This +//list is used to release cached spawns when no longer in use. +void AddRefCountList(object oCounter, string sTemplate) +{ + if(!GetIsObjectValid(oCounter)) return; + if(TRUE == TemplateInRefCountList(oCounter, sTemplate)) return; + + int nRefCountListCount = GetLocalInt(oCounter, "RefCountListCount"); + SetLocalString(oCounter, "RefCountList" + IntToString(nRefCountListCount), sTemplate); + nRefCountListCount++; + SetLocalInt(oCounter, "RefCountListCount", nRefCountListCount); +} + +int TemplateInRefCountList(object oCounter, string sTemplate) +{ + int nRet = FALSE; + int nRefCountListCount = GetLocalInt(oCounter, "RefCountListCount"); + if(nRefCountListCount <= 0) return FALSE; + + int nth; + string sVarTemplate; + for(nth = 0; nth < nRefCountListCount; nth++) + { + sVarTemplate = GetLocalString(oCounter, "RefCountList" + IntToString(nth)); + if(sTemplate == sVarTemplate) + { + nRet = TRUE; + break; + } + + } + + return nRet; +} + +void ReleaseAll(object oCounter) +{ + int nRefCountListCount = GetLocalInt(oCounter, "RefCountListCount"); + if(nRefCountListCount <= 0) return; + + int nth; + string sVarTemplate; + object oCachedObject; + for(nth = 0; nth < nRefCountListCount; nth++) + { + sVarTemplate = GetLocalString(oCounter, "RefCountList" + IntToString(nth)); + + if(GetLocalInt(oCounter, sVarTemplate) == 1) + { + oCachedObject = GetLocalObject(GetModule(), sVarTemplate); + Release(oCachedObject, oCounter); + } + } +} + +void ReleaseAreaRefs(object oArea) +{ + + // Declare Variables + object oSpawn; + string sSpawnName, sSpawnNum; + int nNth; + + int nSpawns = GetLocalInt(OBJECT_SELF, "Spawns"); + + // Enumerate Waypoints in the Area + for (nNth = 1; nNth <= nSpawns; nNth++) + { + // Retrieve Spawn + sSpawnNum = "Spawn" + PadIntToString(nNth, 2); + oSpawn = GetLocalObject(OBJECT_SELF, sSpawnNum); + + // Validate spawn + if (! GetIsObjectValid( oSpawn ) ) + { + continue; + } + + ReleaseAll(oSpawn); + } +} + + + + + diff --git a/_module/nss/spawn_main.nss b/_module/nss/spawn_main.nss new file mode 100644 index 0000000..b8ebecb --- /dev/null +++ b/_module/nss/spawn_main.nss @@ -0,0 +1,1906 @@ +// +// +// NESS +// Spawn Main v8.1.3 +// +// +// Do NOT Modify this File +// See 'spawn__readme' for Instructions +// + +// Function Includes +#include "spawn_functions" + +// + +// Configuration Includes +#include "spawn_cfg_flag" +#include "spawn_cfg_group" +#include "spawn_cfg_global" +#include "spawn_cfg_loot" +#include "spawn_cfg_camp" +#include "spawn_cfg_fxsp" +#include "spawn_cfg_fxae" +#include "spawn_cfg_fxobj" +// + +// Check Includes +#include "spawn_chk_pcs" +#include "spawn_chk_custom" +// + +// Declare external functions +int GetCurrentRealSeconds(); + +// Declare Function Includes +void SetGlobalDefaults(); +int SetSpawns(location lBase); +string PadIntToString(int nInt, int nDigits); +int CountPCsInArea(object oArea = OBJECT_INVALID, int nDM = FALSE); +int CountPCsInRadius(location lCenter, float fRadius, int nDM = FALSE); +object GetRandomPCInArea(object oArea, object oSpawn); +int IsBetweenDays(int nCheckDay, int nDayStart, int nDayEnd); +int IsBetweenHours(int nCheckHour, int nHourStart, int nHourEnd); +void RandomWalk(object oSpawn, float fWalkingRadius, int nRun); +void FindSeat(object oSpawn, object oSpawned); +void SetPatrolRoute(int nPatrolRoute, int nStartClosest=FALSE); +void DoPatrolRoute(int nPatrolRoute, int nRouteType); +int ProcessCamp(object oCamp); +void DestroyCamp(object oCamp, float fCampDecay, int nSaveState); +// + +// Declare Configuration Includes +void LootTable(object oSpawn, object oSpawned, int nLootTable); +string SpawnGroup(object oSpawn, string sTemplate); +int SpawnCheckCustom(object oSpawn); +int SpawnCheckPCs(object oSpawn); +effect SpawnAreaEffect(object oSpawn); +effect ObjectEffect(object oSpawn); +int SpawnEffect(object oSpawn, int nSpawnEffect, int nDespawnEffect); +void SetCampSpawn(object oCamp, string sCamp, location lCamp); +// + +//Declare Functions we Define after Main Function +void ProcessSpawn(object oSpawn, int nProcessFrequency, int nPCCount, int nTimeNow, + int nWaypointCount); +void DoSpawn(object oSpawn, int nTimeNow); +object CampSpawn(object oSpawn, string sCamp, location lCamp); +object DoCampSpawn(object oCamp, location lCamp, float fSpawnRadius, + string sTemplate, int nPlaceable, int nSpawnNumber, int nCampCenter); + +// + +// The Spawn Function +void Spawn() +{ + // Declare Variables + object oSpawn; + string sSpawnName, sSpawnNum; + int nSpawnDeactivated; + int nProcessSpawn; + int nCurrentProcessTick; + int nProcessFrequency; + int nProcessOffset; + int nNth; + + SPAWN_DELAY_DEBUG = GetLocalInt(OBJECT_SELF, "SpawnDelayDebug"); + SPAWN_COUNT_DEBUG = GetLocalInt(OBJECT_SELF, "SpawnCountDebug"); + + int bAreaInitialized = GetLocalInt(OBJECT_SELF, "NESS_AreaInitialized"); + + if (! bAreaInitialized) + { + + // Set Global Defaults + SetGlobalDefaults(); + + // Set Spawns + location lBase = Location(OBJECT_SELF, Vector(), 0.0); + SetSpawns(lBase); + SetLocalInt(OBJECT_SELF, SPAWN_AREA_COUNT, 0); + SetLocalInt(OBJECT_SELF, "NESS_AreaInitialized", TRUE); + + // Recall ourselves after flags have been initialized + DelayCommand(0.1, Spawn()); + return; + } + + // Check Area State + if (GetLocalInt(OBJECT_SELF, "AreaSpawnsDeactivated") == TRUE) + { + return; + } + + int nPCCount = CountPCsInArea(OBJECT_SELF, TRUE); + + int nAreaSpawnCount = GetLocalInt(OBJECT_SELF, SPAWN_AREA_COUNT ); + int bLeftoversForceProcessing = GetLocalInt( GetModule(), + "LeftoversForceProcessing"); + + if (nPCCount == 0 && (nAreaSpawnCount == 0 || ! bLeftoversForceProcessing)) + { + ReleaseAreaRefs(OBJECT_SELF); + return; + } + + int nSpawns = GetLocalInt(OBJECT_SELF, "Spawns"); + + // What time is it? Used to compare all times + int nTimeNow = GetCurrentRealSeconds(); + + // Enumerate Waypoints in the Area + for (nNth = 1; nNth <= nSpawns; nNth++) + { + // Retrieve Spawn + sSpawnNum = "Spawn" + PadIntToString(nNth, 2); + oSpawn = GetLocalObject(OBJECT_SELF, sSpawnNum); + + // Validate spawn + if (! GetIsObjectValid( oSpawn ) ) + { + continue; + } + sSpawnName = GetLocalString(oSpawn, "f_Flags"); + + // Check for spawns that need to be processed because they despawned + // due to a PCxx flag and PCs have returned + if (nPCCount > 0) + { + int nSpawnNumSaveStates = GetLocalInt(oSpawn, "SpawnNumSavedStates"); + int nSpawnNumSaveCampStates = GetLocalInt(oSpawn, "SpawnNumSavedCampStates"); + if (nSpawnNumSaveStates > 0 || nSpawnNumSaveCampStates > 0) + { + //debug("forcing respawns"); + RestorePCDespawns(oSpawn, nTimeNow); + NESS_ForceProcess(oSpawn); + } + } + + // Only Process every nProcessFrequency Seconds + nProcessSpawn = FALSE; + nProcessFrequency = GetLocalInt(oSpawn, "f_ProcessFrequency"); + nProcessOffset = GetLocalInt(oSpawn, "f_ProcessOffset"); + nCurrentProcessTick = GetLocalInt(oSpawn, "CurrentProcessTick"); + + if (nProcessFrequency == 1) + { + // Don't even need to bother with CurrentProcessTick or offset + nProcessSpawn = TRUE; + } + + else if (nCurrentProcessTick == 0) + { + // First time in. Always process the first time + nProcessSpawn = TRUE; + SetLocalInt(oSpawn, "CurrentProcessTick", 2-nProcessOffset); + //debug("Tick 1"); + //debug("+"); + } + + else + { + int nForceProcess = GetLocalInt(oSpawn, "SpawnForceProcess"); + if (nForceProcess) + { + SetLocalInt(oSpawn, "SpawnForceProcess", FALSE); + } + + if (nCurrentProcessTick > nProcessFrequency) + { + // Roll over Counter Tick + nCurrentProcessTick = 1; + //debug("Tick " + IntToString(nCurrentProcessTick)); + //debug("+"); + + nProcessSpawn = TRUE; + } + + else + { + //debug("Tick " + IntToString(nCurrentProcessTick)); + + if (nForceProcess) + { + //debug("+ (forced)"); + nProcessSpawn = TRUE; + } + + } + // Increment Counter Tick + nCurrentProcessTick++; + SetLocalInt(oSpawn, "CurrentProcessTick", nCurrentProcessTick); + } + + // Check if Deactivated + nSpawnDeactivated = GetLocalInt(oSpawn, "SpawnDeactivated"); + if (nSpawnDeactivated == TRUE) + { + nProcessSpawn = FALSE; + } + + // Process the Spawn + if (nProcessSpawn == TRUE) + { + DelayCommand(0.0, ProcessSpawn(oSpawn, nProcessFrequency, + nPCCount, nTimeNow, nNth)); + } + } + + // New in 8.1.4 + DelayCommand(0.1, CountAndTrackModuleSpawns( nAreaSpawnCount ) ); +} +// + +// This Function Processes a Spawn +void ProcessSpawn(object oSpawn, int nProcessFrequency, int nPCCount, + int nTimeNow, int nWaypoint) +{ + // Initialize Miscellaneous + int iCount; + int jCount; + + // Initialize Spawn and Spawned + object oCreature, oChild; + int nSpawnChild, nSpawnCount, nCurrentChildren; + int nChildSlot, nEmptyChildSlots; + string sChildSlot, sChild; + int nSpawnBlock, nSpawnDespawn, nDespawning; + string sSpawnName = GetLocalString(oSpawn, "f_Flags"); + string sSpawnTag = GetLocalString(oSpawn, "f_Template"); + location lSpawn = GetLocation(oSpawn); + int nChildrenSpawned = GetLocalInt(oSpawn, "ChildrenSpawned"); + int nProcessesPerMinute = 60 / (nProcessFrequency * 6); + + // Get New Name and Tag + sSpawnName = GetLocalString(oSpawn, "f_Flags"); + sSpawnTag = GetLocalString(oSpawn, "f_Template"); + + // Initialize InitialState + int nInitialState = GetLocalInt(oSpawn, "f_InitialState"); + int nInitialDelay = GetLocalInt(oSpawn, "f_InitialDelay"); + int nNextSpawnTime = GetLocalInt(oSpawn, "NextSpawnTime"); + + // Set Initial Delay + if (nInitialDelay > 0) + { + if (GetLocalInt(oSpawn, "InitialDelaySet") == FALSE) + { + nNextSpawnTime = nTimeNow + nInitialDelay; + SpawnDelayDebug(oSpawn, "setting NextSpawnTime for initial delay " + + IntToString(nNextSpawnTime) + " [" + RealSecondsToString(nNextSpawnTime) + + "]"); + SetLocalInt(oSpawn, "NextSpawnTime", nNextSpawnTime); + SetLocalInt(oSpawn, "InitialDelaySet", TRUE); + } + } + + // Initialize SpawnDelay + int nSpawnDelay = GetLocalInt(oSpawn, "f_SpawnDelay"); + int nDelayRandom = GetLocalInt(oSpawn, "f_DelayRandom"); + int nDelayMinimum = GetLocalInt(oSpawn, "f_DelayMinimum"); + int nSpawnDelayPeriodic = GetLocalInt(oSpawn, "f_SpawnDelayPeriodic"); + + // Initialize SpawnNumber + int nRndSpawnNumber; + int nSpawnNumber = GetLocalInt(oSpawn, "f_SpawnNumber"); + int nSpawnNumberMax = GetLocalInt(oSpawn, "f_SpawnNumberMax"); + int nSpawnNumberMin = GetLocalInt(oSpawn, "f_SpawnNumberMin"); + int nSpawnAllAtOnce = GetLocalInt(oSpawn, "f_SpawnAllAtOnce"); + int nSpawnNumberAtOnce = GetLocalInt(oSpawn, "f_SpawnNumberAtOnce"); + int nSpawnNumberAtOnceMin = GetLocalInt(oSpawn, "f_SpawnNumberAtOnceMin"); + + // Initialize Day/Night Only + int nDayOnly = GetLocalInt(oSpawn, "f_DayOnly"); + int nDayOnlyDespawn = GetLocalInt(oSpawn, "f_DayOnlyDespawn"); + int nNightOnly = GetLocalInt(oSpawn, "f_NightOnly"); + int nNightOnlyDespawn = GetLocalInt(oSpawn, "f_NightOnlyDespawn"); + + // Initialize Day/Hour Spawns + int nDay, nHour; + int nSpawnDayStart = GetLocalInt(oSpawn, "f_SpawnDayStart"); + int nSpawnDayEnd = GetLocalInt(oSpawn, "f_SpawnDayEnd"); + int nSpawnHourStart = GetLocalInt(oSpawn, "f_SpawnHourStart"); + int nSpawnHourEnd = GetLocalInt(oSpawn, "f_SpawnHourEnd"); + + // Initialize RandomWalk + int nRandomWalk = GetLocalInt(oSpawn, "f_RandomWalk"); + float fWanderRange = GetLocalFloat(oSpawn, "f_WanderRange"); + + // Initialize ReturnHome + int nReturnHome = GetLocalInt(oSpawn, "f_ReturnHome"); + float fReturnHomeRange = GetLocalFloat(oSpawn, "f_ReturnHomeRange"); + + // Initialize PCCheck + int nPCCheck = GetLocalInt(oSpawn, "f_PCCheck"); + int nPCCheckDelay = GetLocalInt(oSpawn, "f_PCCheckDelay"); + int nPCReset = GetLocalInt(oSpawn, "f_PCReset"); + + // Initialize RandomGold + int nGoldAmount; + int nRandomGold = GetLocalInt(oSpawn, "f_RandomGold"); + int nRandomGoldMin = GetLocalInt(oSpawn, "f_RandomGoldMin"); + int nGoldChance = GetLocalInt(oSpawn, "f_GoldChance"); + + // Initialize Spawn Effects + effect sSpawn, eDespawn; + int nSpawnEffect = GetLocalInt(oSpawn, "f_SpawnEffect"); + int nDespawnEffect = GetLocalInt(oSpawn, "f_DespawnEffect"); + + // Initialize Patrol Routes + int nPatrolScriptRunning; + int nPatrolRoute = GetLocalInt(oSpawn, "f_PatrolRoute"); + int nRouteType = GetLocalInt(oSpawn, "f_RouteType"); + int bCheckForStuckPatrols; + if (nPatrolRoute) + { + bCheckForStuckPatrols = GetLocalInt(GetModule(), "CheckForStuckPatrols"); + } + + // Initialize Placeables + int nLootTime; + int nRefreshTime; + int nPlaceable = GetLocalInt(oSpawn, "f_Placeable"); + int nPlaceableType = GetLocalInt(oSpawn, "f_PlaceableType"); + int nTrapDisabled = GetLocalInt(oSpawn, "f_TrapDisabled"); + int nPlaceableRefreshPeriod = GetLocalInt(oSpawn, "f_PlaceableRefreshPeriod"); + + // Initialize SpawnGroups + int nSpawnGroup = GetLocalInt(oSpawn, "f_SpawnGroup"); + + // Initialize LootTable + int nLootTable = GetLocalInt(oSpawn, "f_LootTable"); + + // Initialize Spawn Deactivation + int nSpawnDeactivated, nRunDeactivateScript, nSpawnAgeTime; + int nDeactivateSpawn = GetLocalInt(oSpawn, "f_DeactivateSpawn"); + int nDeactivateScript = GetLocalInt(oSpawn, "f_DeactivateScript"); + int nDeactivationInfo = GetLocalInt(oSpawn, "f_DeactivationInfo"); + int nForceDeactivateSpawn = GetLocalInt(oSpawn, "ForceDeactivateSpawn"); + + // Initialize Child Lifespan + int nChildLifespanExpireTime; + int nChildLifespanMax = GetLocalInt(oSpawn, "f_ChildLifespanMax"); + int nChildLifespanMin = GetLocalInt(oSpawn, "f_ChildLifespanMin"); + + // Initialize SpawnRadius + float fSpawnRadius = GetLocalFloat(oSpawn, "f_SpawnRadius"); + float fSpawnRadiusMin = GetLocalFloat(oSpawn, "f_SpawnRadiusMin"); + int nSpawnNearPCs = GetLocalInt(oSpawn, "f_SpawnNearPCs"); + + // Initialize SpawnUnseen + float fSpawnUnseen = GetLocalFloat(oSpawn, "f_SpawnUnseen"); + int nUnseenIndividual = GetLocalInt(oSpawn, "f_UnseenIndividual"); + int nUnseenRetryCount = GetLocalInt(oSpawn, "f_UnseenRetryCount"); + + // Initialize CorpseDecay + float fCorpseDecay = GetLocalFloat(oSpawn, "f_CorpseDecay"); + + // Initialize SpawnCamp + int nSpawnCamp = GetLocalInt(oSpawn, "f_SpawnCamp"); + float fCampDecay = GetLocalFloat(oSpawn, "f_CampDecay"); + + // Initialize SpawnScripts + int nSpawnScript = GetLocalInt(oSpawn, "f_SpawnScript"); + int nDespawnScript = GetLocalInt(oSpawn, "f_DespawnScript"); + + // Initialize SpawnCheckCustom + int nSpawnCheckCustom = GetLocalInt(oSpawn, "f_SpawnCheckCustom"); + + // Initialize SpawnCheckPCs + int nSpawnCheckPCs = GetLocalInt(oSpawn, "f_SpawnCheckPCs"); + + // Intialize SpawnTrigger + float fSpawnTrigger = GetLocalFloat(oSpawn, "f_SpawnTrigger"); + float fDespawnTrigger = GetLocalFloat(oSpawn, "f_DespawnTrigger"); + + // Initialize AreaEffect + int nSpawnAreaEffect = GetLocalInt(oSpawn, "f_SpawnAreaEffect"); + float fAreaEffectDuration = GetLocalFloat(oSpawn, "f_AreaEffectDuration"); + + // Initialize ObjectEffect + int nObjectEffect = GetLocalInt(oSpawn, "f_ObjectEffect"); + float fObjectEffectDuration = GetLocalFloat(oSpawn, "f_ObjectEffectDuration"); + + // Initialize RandomSpawn + int nRandomSpawn = GetLocalInt(oSpawn, "f_RandomSpawn"); + + // Initialize SpawnFaction + int nSpawnFaction = GetLocalInt(oSpawn, "f_SpawnFaction"); + + // Initialize SpawnAlignment + int nSpawnAlignment = GetLocalInt(oSpawn, "f_SpawnAlignment"); + int nAlignmentShift = GetLocalInt(oSpawn, "f_AlignmentShift"); + + // Initialize Heartbeat Script + int nHeartbeatScript = GetLocalInt(oSpawn, "f_HeartbeatScript"); + + // Initialize SpawnLocation + int nSpawnLocation = GetLocalInt(oSpawn, "f_SpawnLocation"); + int nSpawnLocationMin = GetLocalInt(oSpawn, "f_SpawnLocationMin"); + int nSpawnLocationInd = GetLocalInt(oSpawn, "f_SpawnLocationInd"); + + // Initialize SpawnFacing + int nFacing = GetLocalInt(oSpawn, "f_Facing"); + float fSpawnFacing = GetLocalFloat(oSpawn, "f_SpawnFacing"); + + // Initialize EntranceExit + float fEntranceExitX, fEntranceExitY; + vector vEntranceExit; + string sEntranceExit, sExit; + location lEntranceExit, lExit; + int nRndExit; + object oExit; + int nEntranceExit = GetLocalInt(oSpawn, "f_EntranceExit"); + int nEntranceExitMin = GetLocalInt(oSpawn, "f_EntranceExitMin"); + int nExit = GetLocalInt(oSpawn, "f_Exit"); + int nExitMin = GetLocalInt(oSpawn, "f_ExitMin"); + + // Initialize HealChildren + int nHealAmount; + effect eEffect; + int nHealChildren = GetLocalInt(oSpawn, "f_HealChildren"); + int nHealEffects = GetLocalInt(oSpawn, "f_HealEffects"); + + // Initialize SpawnItem + int nSpawnItem = GetLocalInt(oSpawn, "f_SpawnItem"); + + // Initialize SpawnSit + int nSpawnSit = GetLocalInt(oSpawn, "f_SpawnSit"); + + // Initialize SpawnPlot + int nSpawnPlot = GetLocalInt(oSpawn, "f_SpawnPlot"); + + // Initialize SpawnMerchant + int nSpawnMerchant = GetLocalInt(oSpawn, "f_SpawnMerchant"); + + int nPCCheckDespawn = FALSE; + + // decide if we'll despawn this HB due to PC Check + if (nPCCheck == TRUE) + { + //debug("Pc check"); + // Check for PCs + if (nPCCount == 0) + { + int nPCCheckDespawnTime = GetLocalInt(oSpawn, "PCCheckDespawnTime"); + //debug("despawn time = " + IntToString(nPCCheckDespawnTime)); + //debug("time now = " + IntToString(nTimeNow)); + if (nPCCheckDespawnTime == 0) + { + nPCCheckDespawnTime = nTimeNow + nPCCheckDelay; + SetLocalInt(oSpawn, "PCCheckDespawnTime", nPCCheckDespawnTime); + } + if (nTimeNow >= nPCCheckDespawnTime) + { + nPCCheckDespawn = TRUE; + SetLocalInt(oSpawn, "PCCheckDespawnTime", 0); + } + } + else + { + SetLocalInt(oSpawn, "PCCheckDespawnTime", 0); + } + } + + // Enumerate oSpawned Children + nChildSlot = 1; + nSpawnCount = 0; + nEmptyChildSlots = 0; + int nSpawnDelayTimerExpired = FALSE; + + for (nChildSlot = 1; nChildSlot <= nSpawnNumber; nChildSlot++) + { + // Starting Conditional + nSpawnDespawn = FALSE; + nDespawning = FALSE; + nSpawnChild = FALSE; + + // Retrieve Child + sChildSlot = "ChildSlot" + PadIntToString(nChildSlot, 2); + oCreature = GetLocalObject(oSpawn, sChildSlot); + //debug("checking " + sChildSlot + " of " + IntToString(nSpawnNumber)); + + + // Check if this is Child Slot is Valid + if (GetIsObjectValid(oCreature) == FALSE) + { + // Empty Slot + SpawnDelayDebug(oSpawn, "invalid in slot " + sChildSlot + ": object " + + ObjectToString(oCreature)); + SpawnCountDebug(oSpawn, "invalid in slot " + sChildSlot + ": object " + + ObjectToString(oCreature)); + nEmptyChildSlots++; + + } + else + { + if (nPlaceable == FALSE && nSpawnCamp == FALSE && nSpawnItem == FALSE) + { + // Don't process DM possessed creatures + + if (GetIsDMPossessed( oCreature ) ) + { + continue; + } + + // Check for Corpses + if (GetIsDead(oCreature) == FALSE) + { + //debug("alive"); + nSpawnChild = TRUE; + } + else + { + // Empty Slot + SpawnDelayDebug(oSpawn, "dead in slot " + sChildSlot + ": object " + + ObjectToString(oCreature)); + SpawnCountDebug(oSpawn, "dead in slot " + sChildSlot + ": object " + + ObjectToString(oCreature)); + nEmptyChildSlots++; + NESS_ProcessDeadCreature(oCreature, oSpawn); + } + } + else + { + nSpawnChild = TRUE; + } + } + + if (nSpawnChild == TRUE) + { + // Add to Count Total + nSpawnCount++; + //SpawnCountDebug("+ spawn count to " + IntToString(nSpawnCount)); + nSpawnBlock = FALSE; + + // Check Despawning + nDespawning = GetLocalInt(oCreature, "Despawning"); + + // Check Force Despawn + if (GetLocalInt(oCreature, "ForceDespawn") == TRUE) + { + //debug("force despawn"); + nDespawning = TRUE; + nSpawnDespawn = TRUE; + } + + // Get Creature Home + float fHomeX = GetLocalFloat(oCreature, "HomeX"); + float fHomeY = GetLocalFloat(oCreature, "HomeY"); + vector vHome = Vector(fHomeX, fHomeY, 0.0); + location lHome = Location(OBJECT_SELF, vHome, 0.0); + + // Check Facing + float fChildFacing = GetLocalFloat(oCreature, "SpawnFacing"); + + // Check Lifespan + if (nChildLifespanMax > -1) + { + nChildLifespanExpireTime = GetLocalInt(oCreature, "LifespanExpireTime"); + if (nTimeNow >= nChildLifespanExpireTime) + { + //debug("despawn: lifespawn exceeded"); + nSpawnDespawn = TRUE; + } + } + + // Day Only + if (nDayOnlyDespawn == TRUE && (nDayOnly == TRUE && (GetIsDay() == FALSE && GetIsDawn() == FALSE))) + { + //debug("despawn: night time for DO spawn"); + nSpawnDespawn = TRUE; + } + + // Night Only + if (nNightOnlyDespawn == TRUE && (nNightOnly == TRUE && (GetIsNight() == FALSE && GetIsDusk() == FALSE))) + { + //debug("despawn: day for NO spawn"); + nSpawnDespawn = TRUE; + } + + // Check Against Day + if (nSpawnDayStart > -1) + { + nDay = GetCalendarDay(); + if (IsBetweenDays(nDay, nSpawnDayStart, nSpawnDayEnd) == FALSE) + { + //debug("despawn: not right day"); + nSpawnDespawn = TRUE; + } + } + + // Check Against Hour + if (nSpawnHourStart > -1) + { + nHour = GetTimeHour(); + if (IsBetweenHours(nHour, nSpawnHourStart, nSpawnHourEnd) == FALSE) + { + //debug("despawn: not right hour"); + nSpawnDespawn = TRUE; + } + } + + // Random Walk + if (nRandomWalk == TRUE && nDespawning == FALSE && nSpawnDespawn == FALSE) + { + if (GetCurrentAction(oCreature) != ACTION_WAIT && + GetCurrentAction(oCreature) != ACTION_CASTSPELL && + !GetIsInCombat(oCreature) && !IsInConversation(oCreature)) + { + if (d2(1) == 2) + { + if (fWanderRange > 0.0) + { + //AssignCommand(oCreature, ClearAllActions()); + //RandomWalk(oSpawn, oCreature, fWanderRange, FALSE); + AssignCommand(oCreature, RandomWalk(oSpawn, + fWanderRange, FALSE)); + } + else + { + AssignCommand(oCreature, ClearAllActions()); + AssignCommand(oCreature, ActionRandomWalk()); + } + } + } + } + + // Patrol + if (nPatrolRoute > -1 && nDespawning == FALSE && nSpawnDespawn == FALSE) + { + if (!GetIsInCombat(oCreature) && !IsInConversation(oCreature)) + { + + nPatrolScriptRunning = GetLocalInt(oCreature, "PatrolScriptRunning"); + if (GetCurrentAction(oCreature) == ACTION_INVALID && nPatrolScriptRunning == FALSE) + { + // He's Slacking! Send him back to work! + //AssignCommand(oCreature, ClearAllActions()); + AssignCommand(oCreature, SetPatrolRoute(nPatrolRoute)); + AssignCommand(oCreature, DoPatrolRoute(nPatrolRoute, nRouteType)); + } + + else if (bCheckForStuckPatrols) + { + CheckForStuckPatrol(oCreature, nPatrolRoute, nRouteType); + } + } + else if (IsInConversation(oCreature) == TRUE) + { + // Reset Script State + SetLocalInt(oCreature, "PatrolScriptRunning", FALSE); + } + } + + // ReturnHome + if (nReturnHome == TRUE && nDespawning == FALSE && nSpawnDespawn == FALSE) + { + if (GetDistanceBetweenLocations(lHome, GetLocation(oCreature)) > fReturnHomeRange) + { + if (GetCurrentAction(oCreature) == ACTION_INVALID && !GetIsInCombat(oCreature) && !IsInConversation(oCreature)) + { + // Send them back to Home + //AssignCommand(oCreature,ClearAllActions()); + //AssignCommand(oCreature,ActionMoveToLocation(lHome)); + AssignCommand(oCreature, ReturnHome(lHome)); + + if (nFacing == TRUE) + { + AssignCommand(oCreature, ActionDoCommand(SetFacing(fChildFacing))); + } + } + } + } + + // PC Check + if (nPCCheckDespawn == TRUE) + { + //debug("despawn: PC Check"); + nSpawnDespawn = TRUE; + } + + // Check Camp + if (nSpawnCamp == TRUE) + { + if (ProcessCamp(oCreature) == 0) + { + //debug("despawn: camp state is 0"); + nSpawnDespawn = TRUE; + } + } + + // Check Trigger + if (fDespawnTrigger > 0.0) + { + if (CountPCsInRadius(lSpawn, fDespawnTrigger, TRUE) == 0) + { + //debug("despawn: PCs in despawn trigger"); + nSpawnDespawn = TRUE; + } + } + + // Check Placeable + if (nPlaceable == TRUE) + { + // Despawn if Empty + if (nPlaceableType == 1) + { + if (GetFirstItemInInventory(oCreature) == OBJECT_INVALID) + { + //debug("despawn: empty placeable"); + nSpawnDespawn = TRUE; + } + } + // Generate Loot if Empty + else if (nPlaceableType == 2) + { + if (GetFirstItemInInventory(oCreature) == OBJECT_INVALID && GetIsOpen(oCreature) == FALSE) + { + // Check Delay Timer + if (nSpawnDelay > 0) + { + nLootTime = GetLocalInt(oCreature, "LootTime"); + if (nLootTime == 0) + { + // first time + if (nDelayRandom == TRUE) + { + nLootTime = -1; + while (nLootTime < nDelayMinimum) + { + nLootTime = Random(nSpawnDelay) + 1; + } + } + else + { + // Setup Next Spawn + nLootTime = nSpawnDelay; + } + nLootTime += nTimeNow; + SetLocalInt(oCreature, "LootTime", nLootTime); + } + } + else + { + nLootTime = nTimeNow; + } + + if (nTimeNow >= nLootTime) + { + // Give Random Gold + if (nRandomGold > 0) + { + if (d100(1) <= nGoldChance) + { + // Calculate Gold to Drop + nGoldAmount = Random(nRandomGold + 1); + while (nGoldAmount < nRandomGoldMin) + { + nGoldAmount = Random(nRandomGold + 1); + } + // Give Gold + CreateItemOnObject("nw_it_gold001", oCreature, + nGoldAmount); + } + } + // Generate New Loot + if (nLootTable > -1) + { + LootTable(oSpawn, oCreature, nLootTable); + } + + if (nSpawnDelay > 0) + { + // Set up Delay for next time + if (nDelayRandom == TRUE) + { + nLootTime = -1; + while (nLootTime < nDelayMinimum) + { + nLootTime = Random(nSpawnDelay) + 1; + } + } + else + { + // Setup Next Spawn + nLootTime = nSpawnDelay; + } + nLootTime += nTimeNow; + SetLocalInt(oCreature, "LootTime", nLootTime); + } + } // end if time to refill + } // end if empty + } // end if placeable-type == 2 + + else if (nPlaceableType == 3) + { + nRefreshTime = GetLocalInt(oCreature, "RefreshTime"); + if (nRefreshTime == 0) + { + nRefreshTime = nTimeNow + nPlaceableRefreshPeriod; + SetLocalInt(oCreature, "RefreshTime", nRefreshTime); + } + //debug("time now: " + IntToString(nTimeNow)); + //debug("refesh at: " + IntToString(nRefreshTime)); + if (nTimeNow >= nRefreshTime) + { + if (!GetIsOpen(oCreature)) + { + // Do the refresh + + // Despawn the current placeable + //debug("despawn: placeable refresh"); + nSpawnDespawn = TRUE; + + // Override SpawnDelay for respawn + SetLocalInt(oSpawn, "OverrideSpawnDelay", 1); + + // let the system know this is gone this frame + nEmptyChildSlots++; + } + } + } + } + + // Run Heartbeat Script + if (nHeartbeatScript > -1 && nDespawning == FALSE && nSpawnDespawn == FALSE) + { + SetLocalInt(oCreature, "HeartbeatScript", nHeartbeatScript); + ExecuteScript("spawn_sc_hbeat", oCreature); + } + + // Set Facing + if (nFacing == TRUE && nDespawning == FALSE) + { + if (GetFacing(oCreature) != fChildFacing && IsInConversation(oCreature) == FALSE && GetIsInCombat(oCreature) == FALSE && GetDistanceBetweenLocations(lHome, GetLocation(oCreature)) < 1.0) + { + AssignCommand(oCreature, ActionDoCommand(SetFacing(fChildFacing))); + } + } + + // Heal Children + if (nHealChildren > 0) + { + if (GetIsInCombat(oCreature) == FALSE && (GetMaxHitPoints(oCreature) != GetCurrentHitPoints(oCreature))) + { + nHealAmount = FloatToInt(IntToFloat(GetMaxHitPoints(oCreature)) * (IntToFloat(nHealChildren) / 100.0)); + ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(nHealAmount), oCreature, 0.0); + if (nHealEffects == TRUE) + { + eEffect = GetFirstEffect(oCreature); + while (GetIsEffectValid(eEffect) == TRUE) + { + RemoveEffect(oCreature, eEffect); + eEffect = GetNextEffect(oCreature); + } + } + } + } + + // Spawn Sit + if (nSpawnSit == TRUE && nDespawning == FALSE) + { + if (GetCurrentAction(oCreature) != ACTION_SIT) + { + if (GetIsInCombat(oCreature) == FALSE && IsInConversation(oCreature) == FALSE) + { + FindSeat(oSpawn, oCreature); + } + } + } + + // Check if Item is Possessed by Someone + if (nSpawnItem == TRUE) + { + if (GetItemPossessor(oCreature) != OBJECT_INVALID) + { + // Remove Child Status + DeleteLocalObject(oSpawn, GetLocalString(oCreature, "ParentChildSlot")); + } + } + + // Population Control + if (nSpawnCount > nSpawnNumber) + { + nSpawnDespawn = TRUE; + nSpawnBlock = TRUE; + } + } + + + // Despawn Creatures + //if (GetIsDM(object) == TRUE || GetIsDM(GetMaster(object)) == TRUE) + if (nSpawnDespawn == TRUE && ! GetIsDM(oCreature) && + ! GetIsDM(GetMaster(oCreature))) + { + int nSaveState = nPCCheckDespawn && ! nPCReset; + SetLocalInt(oCreature, "Despawning", TRUE); + if (nSpawnPlot == TRUE) + { + SetPlotFlag(oCreature, FALSE); + } + if (nPlaceable == TRUE || nSpawnCamp == TRUE || nSpawnItem == TRUE + || nSpawnMerchant == TRUE) + { + if (nDespawnScript > -1) + { + SetLocalInt(oCreature, "DespawnScript", nDespawnScript); + ExecuteScript("spawn_sc_spawn", oCreature); + } + if (nSpawnCamp == TRUE) + { + // Destroy camp will save info about what in the camp is + // still present on the camp object (oCreature in this + // case) if nSaveState is true + DestroyCamp(oCreature, fCampDecay, nSaveState); + //if (! nSaveState) + //{ + // // This isn't a PC despawn, so set up SD if needed + // if (nSpawnDelay && nNextSpawnTime == 0) + // { + // nNextSpawnTime = SetupSpawnDelay(nSpawnDelay, + // nDelayRandom, nDelayMinimum, nTimeNow); + // SetLocalInt(oSpawn, "NextSpawnTime", nNextSpawnTime); + // } + //} + } + + if (nDespawnEffect > 0) + { + eDespawn = EffectVisualEffect(SpawnEffect(oSpawn, FALSE, TRUE)); + ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eDespawn, + GetLocation(oCreature), 5.0); + } + + // remove the child object from the spawn + DeleteLocalObject(oSpawn, GetLocalString(oCreature, + "ParentChildSlot")); + + if (nSaveState) + { + if (nSpawnCamp) + { + SaveCampStateOnDespawn(oCreature, oSpawn); + } + else + { + SaveStateOnDespawn(oCreature, oSpawn); + } + + } + + // saved camp states don't get destroyed; but everything else + // (including unsaved camp states do + if (! (nSaveState && nSpawnCamp)) + { + NESS_CleanInventory(oCreature); + AssignCommand(oCreature, SetIsDestroyable(TRUE, FALSE, + FALSE)); + SpawnCountDebug(oSpawn, "despawning " + ObjectToString(oCreature)); + DestroyObject(oCreature); + } + nSpawnCount--; + //debug("- spawn count to " + IntToString(nSpawnCount)); + } + else // is not placeable, camp, item, or merchant + { + if ((!GetIsInCombat(oCreature) && !IsInConversation(oCreature)) + || (nPCCheck == TRUE && nPCCount == 0)) + { + AssignCommand(oCreature, ClearAllActions()); + AssignCommand(oCreature, ActionWait(1.0) ); + if (nEntranceExit > -1) + { + if (nExit > -1) + { + if (nExitMin > -1) + { + nRndExit = Random(nExit + 1); + while (nRndExit < nExitMin) + { + nRndExit = Random(nExit + 1); + } + nExit = nRndExit; + } + sExit = "EX" + PadIntToString(nExit, 2); + oExit = GetNearestObjectByTag(sExit, oSpawn); + lExit = GetLocation(oExit); + //AssignCommand(oCreature, ClearAllActions()); + AssignCommand(oCreature, ActionMoveToLocation(lExit)); + } + else + { + // Get Creature EntranceExit + fEntranceExitX = GetLocalFloat(oCreature, "EntranceExitX"); + fEntranceExitY = GetLocalFloat(oCreature, "EntranceExitY"); + vEntranceExit = Vector(fEntranceExitX, fEntranceExitY, 0.0); + lEntranceExit = Location(OBJECT_SELF, vEntranceExit, 0.0); + //AssignCommand(oCreature, ClearAllActions()); + AssignCommand(oCreature, ActionMoveToLocation(lEntranceExit)); + } + if (nDespawnScript > -1) + { + SetLocalInt(oCreature, "DespawnScript", nDespawnScript); + ExecuteScript("spawn_sc_spawn", oCreature); + } + if (nDespawnEffect > 0) + { + eDespawn = EffectVisualEffect(SpawnEffect(oSpawn, FALSE, TRUE)); + AssignCommand(oCreature, ActionDoCommand(ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eDespawn, GetLocation(oCreature), 5.0))); + } + AssignCommand(oCreature, ActionDoCommand(DeleteLocalObject(oSpawn, GetLocalString(oCreature, "ParentChildSlot")))); + AssignCommand(oCreature, ActionDoCommand(NESS_CleanInventory(oCreature))); + if (nSaveState) + { + AssignCommand(oCreature, ActionDoCommand( + SaveStateOnDespawn(oCreature, oSpawn))); + } + + AssignCommand(oCreature, SetIsDestroyable(TRUE, FALSE, FALSE)); + SpawnCountDebug(oSpawn, "despawning " + ObjectToString(oCreature)); + + AssignCommand(oCreature, ActionDoCommand(DestroyObject(oCreature))); + } + else // doesn't have to exit at a specific place + { + if (nDespawnScript > -1) + { + SetLocalInt(oCreature, "DespawnScript", nDespawnScript); + ExecuteScript("spawn_sc_spawn", oCreature); + } + if (nDespawnEffect > 0) + { + eDespawn = EffectVisualEffect(SpawnEffect(oSpawn, FALSE, TRUE)); + ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eDespawn, GetLocation(oCreature), 5.0); + } + DeleteLocalObject(oSpawn, GetLocalString(oCreature, "ParentChildSlot")); + NESS_CleanInventory(oCreature); + if (nSaveState) + { + SaveStateOnDespawn(oCreature, oSpawn); + } + + AssignCommand(oCreature, SetIsDestroyable(TRUE, FALSE, FALSE)); + SpawnCountDebug(oSpawn, "despawning " + ObjectToString(oCreature)); + + DestroyObject(oCreature); + } + nSpawnCount--; + //debug("- spawn count to " + IntToString(nSpawnCount)); + + } + } + } + } + + if (nPCCheckDespawn && (nPCReset == TRUE)) + { + //debug("reset"); + ResetSpawn(oSpawn, nTimeNow); + } + + //++ Done processing living children + + // Record SpawnCount + SetLocalInt(oSpawn, "SpawnCount", nSpawnCount); + //SpawnCountDebug("set spawn count to " + IntToString(nSpawnCount)); + + // Recalculate spawn number if random spawn number range in use... + if (nSpawnCount == 0 && (!nPCCheckDespawn) && nSpawnNumberMin > -1 && nPCCount > 0) + { + nRndSpawnNumber = Random(nSpawnNumberMax + 1); + while (nRndSpawnNumber < nSpawnNumberMin) + { + nRndSpawnNumber = Random(nSpawnNumberMax + 1); + } + nSpawnNumber = nRndSpawnNumber; + nEmptyChildSlots = nSpawnNumber; + SetLocalInt(oSpawn, "f_SpawnNumber", nSpawnNumber); + SpawnCountDebug(oSpawn, "spawn number set to " + IntToString(nSpawnNumber)); + SpawnCountDebug(oSpawn, "empty slots is " + IntToString(nEmptyChildSlots)); + } + + // Check InitialState + if (nInitialState == 0) + { + if (GetLocalInt(oSpawn, "InitialStateProcessed") == FALSE) + { + nForceDeactivateSpawn = TRUE; + SetLocalInt(oSpawn, "InitialStateProcessed", TRUE); + } + } + + // Check to Deactivate Spawn + if (nDeactivateSpawn > -1 || nForceDeactivateSpawn == TRUE) + { + nSpawnDeactivated = FALSE; + nRunDeactivateScript = FALSE; + if (nForceDeactivateSpawn == FALSE) + { + switch (nDeactivateSpawn) + { + // Deactivate if all Children are Dead + case 0: + if (nSpawnCount == 0 && nChildrenSpawned != 0) + { + nSpawnDeactivated = TRUE; + nRunDeactivateScript = TRUE; + nSpawnBlock = TRUE; + } + break; + // Deactivate if Spawned SpawnNumber Children + case 1: + if (nChildrenSpawned >= nSpawnNumber) + { + nSpawnDeactivated = TRUE; + nRunDeactivateScript = TRUE; + nSpawnBlock = TRUE; + } + break; + // Temporary Pause until all Children are Dead + case 2: + if (nSpawnCount != 0) + { + nRunDeactivateScript = TRUE; + nSpawnBlock = TRUE; + } + break; + // Deactivate after DI00 Children Spawned + case 3: + if (nChildrenSpawned >= nDeactivationInfo) + { + nSpawnDeactivated = TRUE; + nRunDeactivateScript = TRUE; + nSpawnBlock = TRUE; + } + break; + // Deactivate after DI00 Minutes (converted to seconds) + case 4: + // Deactivate after DI00 Cycles (converted to seconds + case 5: + nSpawnAgeTime = GetLocalInt(oSpawn, "SpawnAgeTime"); + if (nSpawnAgeTime == 0) + { + // first time + nSpawnAgeTime = nTimeNow + nDeactivationInfo; + } + + if (nTimeNow >= nSpawnAgeTime) + { + nSpawnDeactivated = TRUE; + nRunDeactivateScript = TRUE; + nSpawnBlock = TRUE; + } + SetLocalInt(oSpawn, "SpawnAgeTime", nSpawnAgeTime); + break; + // Deactivate when spawn count == spawn number + case 6: + if (nSpawnCount >= nSpawnNumber) + { + nSpawnDeactivated = TRUE; + nRunDeactivateScript = TRUE; + nSpawnBlock = TRUE; + } + break; + } + } + else + { + // Force Deactivate + nSpawnDeactivated = TRUE; + nRunDeactivateScript = TRUE; + nSpawnBlock = TRUE; + SetLocalInt(oSpawn, "ForceDeactivateSpawn", FALSE); + } + + // Record Deactivated State + SetLocalInt(oSpawn, "SpawnDeactivated", nSpawnDeactivated); + + // Run Deactivation Script + if (nRunDeactivateScript == TRUE && nDeactivateScript > -1) + { + SetLocalInt(oSpawn, "DeactivateScript", nDeactivateScript); + ExecuteScript("spawn_sc_deactiv", oSpawn); + SetLocalInt(oSpawn, "DeactivateScript", -1); + } + } + + //++ Done checking deactivation + + // Check Number of Creatures against nSpawnNumber + if (nEmptyChildSlots > 0) + { + // If there are empty slots and nSpawnDelay is true and nNextSpawnTime is 0 + // (which indicates no timer is currently set) and this isn't the first time + // we've ever spawned (as indicated by nNumberChildrenSpawned) and we're not + // despawning because PCs have left we should + // set up a timer + if (nSpawnDelay && (! nSpawnDelayPeriodic) && + nChildrenSpawned > 0 && nNextSpawnTime == 0 && nPCCount > 0 ) + { + nNextSpawnTime = SetupSpawnDelay(nSpawnDelay, + nDelayRandom, nDelayMinimum, nTimeNow); + SetLocalInt(oSpawn, "NextSpawnTime", nNextSpawnTime); + SpawnDelayDebug(oSpawn, "setup spawn delay: " + IntToString(nNextSpawnTime) + + " [" + RealSecondsToString(nNextSpawnTime) + "]"); + SpawnDelayDebug(oSpawn, "current time: " + IntToString(nTimeNow) + + " [" + RealSecondsToString(nTimeNow) + "]"); + } + + SpawnCountDebug(oSpawn, IntToString(nEmptyChildSlots) + " empty slots"); + + // Check Against Spawn Unseen + if (fSpawnUnseen > 0.0 && ! nUnseenIndividual) + { + if (nEntranceExit > -1) + { + fEntranceExitX = GetLocalFloat(oCreature, "EntranceExitX"); + fEntranceExitY = GetLocalFloat(oCreature, "EntranceExitY"); + vEntranceExit = Vector(fEntranceExitX, fEntranceExitY, 0.0); + lEntranceExit = Location(OBJECT_SELF, vEntranceExit, 0.0); + oCreature = GetFirstObjectInShape(SHAPE_SPHERE, fSpawnUnseen, + lEntranceExit, FALSE, OBJECT_TYPE_CREATURE); + } + else + { + oCreature = GetFirstObjectInShape(SHAPE_SPHERE, fSpawnUnseen, + lSpawn, FALSE, OBJECT_TYPE_CREATURE); + } + while (oCreature != OBJECT_INVALID) + { + if (GetIsPC(oCreature) == TRUE) + { + nSpawnBlock = TRUE; + oCreature = OBJECT_INVALID; + } + if (nEntranceExit > -1) + { + oCreature = GetNextObjectInShape(SHAPE_SPHERE, fSpawnUnseen, + lEntranceExit, FALSE, OBJECT_TYPE_CREATURE); + } + else + { + oCreature = GetNextObjectInShape(SHAPE_SPHERE, fSpawnUnseen, + lSpawn, FALSE, OBJECT_TYPE_CREATURE); + } + } + } + + // Check Against Day or Night Only + if ((nNightOnly == TRUE && (GetIsNight() == FALSE && GetIsDusk() == FALSE)) || (nDayOnly == TRUE && (GetIsDay() == FALSE && GetIsDawn() == FALSE))) + { + nSpawnBlock = TRUE; + } + + // Check Against Day + if (nSpawnDayStart > -1) + { + nDay = GetCalendarDay(); + if (IsBetweenDays(nDay, nSpawnDayStart, nSpawnDayEnd) == FALSE) + { + nSpawnBlock = TRUE; + } + } + + // Check Against Hour + if (nSpawnHourStart > -1) + { + nHour = GetTimeHour(); + if (IsBetweenHours(nHour, nSpawnHourStart, nSpawnHourEnd) == FALSE) + { + nSpawnBlock = TRUE; + } + } + + // Check Against PCCheck + if (nPCCheck == TRUE) + { + // Check for PCs + if (CountPCsInArea(OBJECT_SELF, TRUE) == 0) + { + nSpawnBlock = TRUE; + } + } + + // Check Trigger + if (fSpawnTrigger > 0.0) + { + //debug("checking trigger"); + if (CountPCsInRadius(lSpawn, fSpawnTrigger, TRUE) == 0) + { + //debug("no one close"); + nSpawnBlock = TRUE; + } + else + { + //debug("trigger tripped"); + } + } + + // Check Spawn Check PCs + if (nSpawnCheckPCs > -1) + { + // If Spawn Cannot Proceed, Block + if (SpawnCheckPCs(oSpawn) == FALSE) + { + nSpawnBlock = TRUE; + } + } + + // Check Spawn Check Custom + if (nSpawnCheckCustom > -1) + { + // If Spawn Cannot Proceed, Block + if (SpawnCheckCustom(oSpawn) == FALSE) + { + nSpawnBlock = TRUE; + } + } + + if (nSpawnBlock == FALSE) + { + + // Check the spawn delay timer + int nOverrideSpawnDelay = GetLocalInt(oSpawn, "OverrideSpawnDelay"); + if (nSpawnDelay || nInitialDelay) + { + // need to refetch, as the death of a child may have changed it + //nNextSpawnTime = GetLocalInt(oSpawn, "NextSpawnTime"); + //debug("next spawn time: " + IntToString(nNextSpawnTime)); + //debug("time now: " + IntToString(nTimeNow)); + if ((nTimeNow >= nNextSpawnTime) && (! nPCCheck || nPCCount > 0)) + { + nSpawnDelayTimerExpired = TRUE; + + if (nInitialDelay) + { + nInitialDelay = 0; + SetLocalInt(oSpawn, "f_InitialDelay", nInitialDelay ); + } + + if (! nSpawnDelayPeriodic) + { + SpawnDelayDebug(oSpawn, "SD timer expired: " + + IntToString(nNextSpawnTime) + + " [" + RealSecondsToString(nNextSpawnTime) + "]"); + SpawnDelayDebug(oSpawn, "current time: " + IntToString(nTimeNow) + + " [" + RealSecondsToString(nTimeNow) + "]"); + + nNextSpawnTime = 0; + SetLocalInt(oSpawn, "NextSpawnTime", nNextSpawnTime); + } + } + } + + + // Check Against spawn delay (SD flag) + //debug("SpawnDelayTimerExpired: " + IntToString(nSpawnDelayTimerExpired)); + + if ( ( (!nSpawnDelay || nOverrideSpawnDelay) && ! nInitialDelay ) || + nSpawnDelayTimerExpired ) + { + //debug("respawn after delay"); + SetLocalInt(oSpawn, "OverrideSpawnDelay", 0); + + // Check RandomSpawn + if (d100() <= nRandomSpawn) + { + SpawnDelayDebug(oSpawn, "spawn!"); + //debug("periodic: " + IntToString(nSpawnDelayPeriodic)); + //debug("nChildrenSpawned: " + IntToString(nChildrenSpawned)); + // Set up periodic spawn delay if first spawn + if (nSpawnDelayPeriodic && nChildrenSpawned == 0) + { + // little kludge here. Knock a second off so it + // won't roll over when we get to the bottom of this + // function. Avoids creating yet another special flag + nNextSpawnTime = nTimeNow + nSpawnDelay - 1; + SetLocalInt(oSpawn, "NextSpawnTime", nNextSpawnTime); + //debug("setup first periodic delay: " + IntToString(nNextSpawnTime)); + } + + if (nSpawnAllAtOnce == FALSE) + { + // Spawn another Creature + DoSpawn(oSpawn, nTimeNow); + } + else + { + if (nSpawnNumberAtOnce > 0) + { + if (nSpawnNumberAtOnceMin == 0 || nEmptyChildSlots >= nSpawnNumberAtOnceMin) + { + // Spawn Sets of Creatures + for (jCount = 1; (jCount <= nEmptyChildSlots) && (jCount <= nSpawnNumberAtOnce); jCount++) + { + DelayCommand(0.0, DoSpawn(oSpawn, nTimeNow)); + } + } + } + else + { + // Spawn All Creatures + for (jCount = 1; jCount <= nEmptyChildSlots; jCount++) + { + DelayCommand(0.0, DoSpawn(oSpawn, nTimeNow)); + } + } + } + } // end RS + + else + { + SpawnDelayDebug(oSpawn, "Spawn blocked by RS"); + if (nSpawnDelay && ! nSpawnDelayPeriodic) + { + // reset spawn delay timer + nNextSpawnTime = SetupSpawnDelay(nSpawnDelay, + nDelayRandom, nDelayMinimum, nTimeNow); + SetLocalInt(oSpawn, "NextSpawnTime", nNextSpawnTime); + SpawnDelayDebug(oSpawn, "setup spawn delay: " + + IntToString(nNextSpawnTime) + + " [" + RealSecondsToString(nNextSpawnTime) + "]"); + SpawnDelayDebug(oSpawn, "current time: " + IntToString(nTimeNow) + + " [" + RealSecondsToString(nTimeNow) + "]"); + + + } + } + + } // end spawn delay test + } // end if not spawn blocked (PC check or spawn unseen, for instance) + } // end if empty slots + + // If the SD is periodic, check for rollover + if (nSpawnDelayPeriodic) + { + // if next spawn time is zero, there is no timer in play + if (nNextSpawnTime > 0 && nTimeNow >= nNextSpawnTime) + { + // Setup Next Spawn + //debug("rollover - timeNow: " + IntToString(nTimeNow) + " nNextSpawnTime: " + // + IntToString(nNextSpawnTime)); + nNextSpawnTime += nSpawnDelay; + //debug("setup new periodic delay: " + IntToString(nNextSpawnTime)); + SetLocalInt(oSpawn, "NextSpawnTime", nNextSpawnTime); + } + } +} +// + +// This Function Performs the Spawn +void DoSpawn(object oSpawn, int nTimeNow) +{ + vector vSpawnPos; + // lHome is the location of the actual spawn waypoint + location lHome; + // The location of an entrance waypoint to spawn in at instead of lHome + location lEntranceExit; + // lSpawnLocation is where we actually spawn in + location lSpawnLocation; + float fRadius, fRadiusX, fRadiusY, fSpawnAngle; + object oSpawned, oEntranceExit, oSpawnLocation, oPC; + effect eSpawn, eArea; + int nObjectType, nRadiusValid; + int nRndEntranceExit; + string sTemplate, sEntranceExit; + int nUnseenTryCount, nUnseen; + int nWalkToHome = FALSE; + + // Initialize Variables + string sSpawnName = GetLocalString(oSpawn, "f_Flags"); + string sSpawnTag = GetLocalString(oSpawn, "f_Template"); + // location lSpawn = GetLocation(oSpawn); + float fSpawnRadius = GetLocalFloat(oSpawn, "f_SpawnRadius"); + float fSpawnRadiusMin = GetLocalFloat(oSpawn, "f_SpawnRadiusMin"); + int nSpawnNearPCs = GetLocalInt(oSpawn, "f_SpawnNearPCs"); + float fSpawnFacing; + int nFacing = GetLocalInt(oSpawn, "f_Facing"); + + + int nSpawnEffect = GetLocalInt(oSpawn, "f_SpawnEffect"); + int nSpawnAreaEffect = GetLocalInt(oSpawn, "f_SpawnAreaEffect"); + float fAreaEffectDuration = GetLocalFloat(oSpawn, "f_AreaEffectDuration"); + + int nEntranceExit = GetLocalInt(oSpawn, "f_EntranceExit"); + int nEntranceExitMin = GetLocalInt(oSpawn, "f_EntranceExitMin"); + int nPlaceable = GetLocalInt(oSpawn, "f_Placeable"); + int nSpawnGroup = GetLocalInt(oSpawn, "f_SpawnGroup"); + int nSpawnCamp = GetLocalInt(oSpawn, "f_SpawnCamp"); + int nSpawnLocation = GetLocalInt(oSpawn, "f_SpawnLocation"); + int nSpawnLocationMin = GetLocalInt(oSpawn, "f_SpawnLocationMin"); + int nSpawnLocationInd = GetLocalInt(oSpawn, "f_SpawnLocationInd"); + int nSpawnItem = GetLocalInt(oSpawn, "f_SpawnItem"); + int nSpawnMerchant = GetLocalInt(oSpawn, "f_SpawnMerchant"); + + float fSpawnUnseen = GetLocalFloat(oSpawn, "f_SpawnUnseen"); + int nUnseenIndividual = GetLocalInt(oSpawn, "f_UnseenIndividual"); + int nUnseenRetryCount = GetLocalInt(oSpawn, "f_UnseenRetryCount"); + + //Initialize Cached Spawning + int nUseCache = GetLocalInt(oSpawn, "f_UseCache"); + int nCacheBucket = GetLocalInt(oSpawn, "f_CacheBucket"); + int nCacheCondition = GetLocalInt(oSpawn, "f_CacheCondition"); + int nCacheTiming = GetLocalInt(oSpawn, "CacheTiming"); + + // Start with this position for this spawn at the spawn waypoint + vSpawnPos = GetPositionFromLocation(GetLocation(oSpawn)); + + // Find facing for this spawn + if (nFacing) + { + fSpawnFacing = GetLocalFloat(oSpawn, "f_SpawnFacing"); + } + + else + { + fSpawnFacing = IntToFloat(Random(360)); + } + + // Check Spawn Location + if (nSpawnLocation > -1) + { + // Get SpawnLocation + oSpawnLocation = GetSpawnLocationObject(oSpawn, nSpawnLocationMin, + nSpawnLocation, nSpawnLocationInd); + + if (oSpawnLocation != OBJECT_INVALID) + { + vSpawnPos = GetPositionFromLocation(GetLocation(oSpawnLocation)); + } + + // kick out spawn unseen is true and SL location is in radius + if (fSpawnUnseen > 0.0 && nUnseenIndividual) + { + if (!CheckPositionUnseen(vSpawnPos, fSpawnUnseen)) + { + nUnseenTryCount = 0; + nUnseen = FALSE; + + while(nUnseenTryCount++ < nUnseenRetryCount && ! nUnseen) + { + oSpawnLocation = GetSpawnLocationObject(oSpawn, + nSpawnLocationMin, nSpawnLocation, nSpawnLocationInd); + + if (oSpawnLocation != OBJECT_INVALID) + { + vSpawnPos = GetPositionFromLocation(GetLocation( + oSpawnLocation)); + } + + if (CheckPositionUnseen(vSpawnPos, fSpawnUnseen)) + { + nUnseen = TRUE; + } + } + if (! nUnseen) + { + // do not spawn this child + return; + } + } + } + + // Adjust for New SpawnFacing + if (nFacing == TRUE) + { + fSpawnFacing = GetFacing(oSpawnLocation); + } + } + + else if (fSpawnRadius > 0.0) + { + // Check SpawnNearPCs + if (nSpawnNearPCs == TRUE) + { + oPC = GetRandomPCInArea(OBJECT_SELF, oSpawn); + if (oPC != OBJECT_INVALID) + { + vSpawnPos = GetPositionFromLocation(GetLocation(oPC)); + } + } + + vSpawnPos = GetSpawnRadiusPosition(vSpawnPos, fSpawnRadius, + fSpawnRadiusMin); + + // kick out spawn unseen is true and vSpawnPos is in range of PC + if (fSpawnUnseen > 0.0 && nUnseenIndividual) + { + if (!CheckPositionUnseen(vSpawnPos, fSpawnUnseen)) + { + nUnseenTryCount = 0; + nUnseen = FALSE; + + while(nUnseenTryCount++ < nUnseenRetryCount && ! nUnseen) + { + vSpawnPos = GetSpawnRadiusPosition(vSpawnPos, fSpawnRadius, + fSpawnRadiusMin); + + if (CheckPositionUnseen(vSpawnPos, fSpawnUnseen)) + { + nUnseen = TRUE; + } + } + + if (! nUnseen) + { + // do not spawn this child + return; + } + } + } + } // end else if SR + + else // Not SL or SR + { + if (fSpawnUnseen > 0.0 && nUnseenIndividual) + { + if (!CheckPositionUnseen(vSpawnPos, fSpawnUnseen)) + { + // do not spawn this child + return; + } + } + } + + // Home is where we spawn in OR where we WOULD spawn in if there were no + // Alternate entrance specified. + lHome = Location(OBJECT_SELF, vSpawnPos, fSpawnFacing); + + // If there's an entrance/exit, lSpawnLocation may still change to that + lSpawnLocation = lHome; + + + // Check Spawn Type + nObjectType = OBJECT_TYPE_CREATURE; + if (nPlaceable == TRUE || nSpawnCamp == TRUE || sSpawnTag == "AE") + { + nObjectType = OBJECT_TYPE_PLACEABLE; + } + if (nSpawnItem == TRUE) + { + nObjectType = OBJECT_TYPE_ITEM; + } + if (nSpawnMerchant == TRUE) + { + nObjectType = OBJECT_TYPE_STORE; + } + + // Check Spawn Group + if (nSpawnGroup == TRUE) + { + // Pull a Creature from the Group + sTemplate = SpawnGroup(oSpawn, sSpawnTag); + } + else + { + sTemplate = sSpawnTag; + } + + // Set up alternate Entrance/Exit + if (!nSpawnCamp) + { + // EntranceExit + if (nEntranceExit > -1) + { + // Get ExitEntrance + if (nEntranceExitMin > -1) + { + nRndEntranceExit = Random(nEntranceExit + 1); + while (nRndEntranceExit < nEntranceExitMin) + { + nRndEntranceExit = Random(nEntranceExit + 1); + } + nEntranceExit = nRndEntranceExit; + } + sEntranceExit = "EE" + PadIntToString(nEntranceExit, 2); + oEntranceExit = GetNearestObjectByTag(sEntranceExit, oSpawn); + lEntranceExit = GetLocation(oEntranceExit); + + lSpawnLocation = lEntranceExit; + nWalkToHome = TRUE; + } + } + + // Create Effect + if (nSpawnEffect > 0) + { + eSpawn = EffectVisualEffect(SpawnEffect(oSpawn, TRUE, FALSE)); + ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eSpawn, lSpawnLocation, + 5.0); + } + + // Check Area Effect + if (nSpawnAreaEffect > 0) + { + eArea = SpawnAreaEffect(oSpawn); + if (fAreaEffectDuration > 0.0) + { + ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eArea, lSpawnLocation, + fAreaEffectDuration); + } + else + { + ApplyEffectAtLocation(DURATION_TYPE_PERMANENT, eArea, lSpawnLocation, + 0.0); + } + + // Check Template + if (sSpawnTag == "AE") + { + sTemplate = "plc_invisobj"; + } + } + + // Validate sSpawnTag + if (sTemplate != "") + { + // Spawn + if (nSpawnCamp == TRUE) + { + oSpawned = CampSpawn(oSpawn, sTemplate, lSpawnLocation); + RecordSpawned(oSpawn, oSpawned, lHome, lEntranceExit, fSpawnFacing); + } + else + { + + //if the cache is not to be used OR the timing is after setup + if(FALSE == nUseCache || nCacheTiming == 1) + { + //**FLAG standard create + oSpawned = CreateObject(nObjectType, sTemplate, lSpawnLocation); + } + else + { + oSpawned = CreateNessObject(oSpawn, nObjectType, sTemplate, lSpawnLocation, nCacheCondition, nCacheBucket); + } + SpawnDelayDebug(oSpawn, "spawned " + ObjectToString(oSpawned)); + RecordSpawned(oSpawn, oSpawned, lHome, lEntranceExit, + fSpawnFacing); + SetupSpawned(oSpawn, oSpawned, lHome, nTimeNow, nWalkToHome); + if(TRUE == nUseCache && 1 == nCacheTiming) + { + CreateCachedObject(oSpawn, oSpawned, nCacheBucket, nCacheCondition); + } + } + } +} +// + +// This Function Spawns a Camp +object CampSpawn(object oSpawn, string sCamp, location lCamp) +{ + // Spawn in Camp Placeholder + object oCamp = CreateObject(OBJECT_TYPE_PLACEABLE, "plc_invisobj", lCamp, FALSE); + SetPlotFlag(oCamp, TRUE); + SetLocalObject(oCamp, "ParentSpawn", oSpawn); + SetCampSpawn(oCamp, sCamp, lCamp); + + // Initialize + int nCampNumP = GetLocalInt(oCamp, "CampNumP"); + int nCampNumC = GetLocalInt(oCamp, "CampNumC"); + float fSpawnRadius = GetLocalFloat(oCamp, "CampRadius"); + vector vCamp = GetPositionFromLocation(lCamp); + + object oSpawned; + int iCount; + int nRandomWalk, nSpawnFacing; + int nLootTable, nSpawnGroup, nTrapDisabled, nDeathScript; + float fCorpseDecay; + int nCorpseDecayType, nCampCenter; + string sObject, sTemplate, sFlags, sCampCenter; + + // Get Camp Center + sCampCenter = GetLocalString(oCamp, "CampCenter"); + + // Spawn Placeables + for (iCount = 1; iCount <= nCampNumP; iCount++) + { + // Initialize Values + sObject = "CampP" + IntToString(iCount - 1); + sTemplate = GetLocalString(oCamp, sObject); + nCampCenter = FALSE; + + // Check Flags + sFlags = GetLocalString(oCamp, sObject + "_Flags"); + nSpawnGroup = IsFlagPresent(sFlags, "SG"); + + // Spawn Group + if (nSpawnGroup == TRUE) + { + sTemplate = SpawnGroup(oSpawn, sTemplate); + } + + // Check Camp Center + if (sCampCenter != "") + { + if (sCampCenter == "P" + IntToString(iCount - 1)) + { + nCampCenter = TRUE; + } + } + // If no CampCenter set, Use first Placeable + else if (iCount == 1) + { + nCampCenter = TRUE; + } + + oSpawned = DoCampSpawn(oCamp, lCamp, fSpawnRadius, sTemplate, TRUE, iCount, nCampCenter); + SetLocalObject(oCamp, sObject, oSpawned); + SetupCampSpawned(oSpawn, oSpawned, vCamp, GetLocation(oSpawned), sFlags); + + } + + // Spawn Creatures + for (iCount = 1; iCount <= nCampNumC; iCount++) + { + // Initialize Values + sObject = "CampC" + IntToString(iCount - 1); + sTemplate = GetLocalString(oCamp, sObject); + + // Check Flags + sFlags = GetLocalString(oCamp, sObject + "_Flags"); + nSpawnGroup = IsFlagPresent(sFlags, "SG"); + + // Spawn Group + if (nSpawnGroup == TRUE) + { + sTemplate = SpawnGroup(oSpawn, sTemplate); + } + + // Check Camp Center + if (sCampCenter != "") + { + if (sCampCenter == "C" + IntToString(iCount - 1)) + { + nCampCenter = TRUE; + } + } + + oSpawned = DoCampSpawn(oCamp, lCamp, fSpawnRadius, sTemplate, FALSE, iCount, nCampCenter); + SetLocalObject(oCamp, sObject, oSpawned); + SetupCampSpawned(oSpawn, oSpawned, vCamp, GetLocation(oSpawned), sFlags); + } + + // Return Placeholder + return oCamp; +} +// + +// This Function Spawns the Camp Members +object DoCampSpawn(object oCamp, location lCamp, float fSpawnRadius, + string sTemplate, int nPlaceable, int nSpawnNumber, int nCampCenter) +{ + object oCampSpawned; + vector vCamp, vRadius; + float fRadius, fRadiusX, fRadiusY, fAngle; + + // Set up Location + if (nCampCenter == FALSE) + { + vCamp = GetPositionFromLocation(lCamp); + fAngle = IntToFloat(Random(361)); + fRadius = IntToFloat(Random(FloatToInt(fSpawnRadius)) + 1); + fRadiusX = fRadius * cos(fAngle); + fRadiusY = fRadius * sin(fAngle); + vRadius = Vector(fRadiusX, fRadiusY); + lCamp = Location(OBJECT_SELF, vCamp + vRadius, 0.0); + } + + // Spawn Camp Object + if (nPlaceable == TRUE) + { + oCampSpawned = CreateObject(OBJECT_TYPE_PLACEABLE, sTemplate, lCamp, FALSE); + //debug("created placeable at " + LocationToString(lCamp)); + } + else + { + +//**FLAG oCampSpawned = CreateNessObject(oCamp, OBJECT_TYPE_CREATURE, sTemplate, lCamp); + oCampSpawned = CreateObject(OBJECT_TYPE_CREATURE, sTemplate, lCamp); + } + + // Return Camp Object + return oCampSpawned; +} + diff --git a/_module/nss/spawn_oncloscrp.nss b/_module/nss/spawn_oncloscrp.nss new file mode 100644 index 0000000..5982831 --- /dev/null +++ b/_module/nss/spawn_oncloscrp.nss @@ -0,0 +1,50 @@ +// +// NESS V8.1 +// Spawn On Close Corpse +// +// Brought into the NESS distribution for Version 8.0 and beyond. Original +// header below. Added code to cause immediate decay when emptied. +// + +//////////////////////////////////////////////////////////////////////////////// +// // // +// _kb_corpse_sound // VERSION 1.0 // +// // // +// by Keron Blackfeld on 07/17/2002 //////////////////////////// +// // +// email Questions and Comments to: keron@broadswordgaming.com or catch me // +// in Bioware's NWN Community - Builder's NWN Scripting Forum // +// // +//////////////////////////////////////////////////////////////////////////////// +// // +// This script is a simple, albeit weak, attempt to mask the default DOOR // +// sounds tied to the invisible lootable object. Please this in both the // +// onOpened and onClosed Events of the "invis_corpse_obj" described in my // +// _kb_lootable_corpse script. // +// // +//////////////////////////////////////////////////////////////////////////////// + +#include "spawn_functions" + +void main() +{ + effect eQuiet = EffectSilence(); + ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eQuiet, OBJECT_SELF, 120.0f); + PlaySound("as_sw_chestcl1"); + + + object oHasInventory = GetFirstItemInInventory(OBJECT_SELF); //Check for inventory + if (oHasInventory == OBJECT_INVALID) //If no inventory found + { + /******************************************* + ** Delete empty. ** + *******************************************/ + object oHostCorpse = GetLocalObject(OBJECT_SELF, "HostBody"); + NESS_CleanCorpse(oHostCorpse); + AssignCommand(oHostCorpse,SetIsDestroyable(TRUE,FALSE,FALSE)); //Set actual corpse to destroyable + DestroyObject(oHostCorpse); //Delete the actual Creature Corpse + + DelayCommand(1.0f,DestroyObject(OBJECT_SELF)); //Delete Lootable Object (Self) + + } +} diff --git a/_module/nss/spawn_onopencrp.nss b/_module/nss/spawn_onopencrp.nss new file mode 100644 index 0000000..69a8e02 --- /dev/null +++ b/_module/nss/spawn_onopencrp.nss @@ -0,0 +1,33 @@ +// +// NESS V8.1 +// Spawn On Open Corpse +// +// Brought into the NESS distribution for Version 8.0 and beyond. Original +// header below. +// + +//////////////////////////////////////////////////////////////////////////////// +// // // +// _kb_corpse_sound // VERSION 1.0 // +// // // +// by Keron Blackfeld on 07/17/2002 //////////////////////////// +// // +// email Questions and Comments to: keron@broadswordgaming.com or catch me // +// in Bioware's NWN Community - Builder's NWN Scripting Forum // +// // +//////////////////////////////////////////////////////////////////////////////// +// // +// This script is a simple, albeit weak, attempt to mask the default DOOR // +// sounds tied to the invisible lootable object. Please this in both the // +// onOpened and onClosed Events of the "invis_corpse_obj" described in my // +// _kb_lootable_corpse script. // +// // +//////////////////////////////////////////////////////////////////////////////// + +void main() +{ + effect eQuiet = EffectSilence(); + ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eQuiet, OBJECT_SELF, 120.0f); + PlaySound("as_sw_clothop1"); + AssignCommand(GetLastOpenedBy(), ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW, 1.0f, 1.5f)); +} diff --git a/_module/nss/spawn_orig_hb.nss b/_module/nss/spawn_orig_hb.nss new file mode 100644 index 0000000..8dc98f4 --- /dev/null +++ b/_module/nss/spawn_orig_hb.nss @@ -0,0 +1,8 @@ + +#include "spawn_main" + +void main() +{ + Spawn(); +} + diff --git a/_module/nss/spawn_pseudohb.nss b/_module/nss/spawn_pseudohb.nss new file mode 100644 index 0000000..a51c3fc --- /dev/null +++ b/_module/nss/spawn_pseudohb.nss @@ -0,0 +1,40 @@ +// +// NESS V8.1 +// +// Spawn Pseudo-heartbeat +// +// This script is executed when a PC enters an otherwise empty area +// + +#include "spawn_functions" + +void main() +{ + + object oArea = OBJECT_SELF; + + // No pseudo-heartbeats scheduled, since we just fired this one + SetLocalInt( oArea, SPAWN_HEARTBEAT_SCHEDULED, FALSE ); + + // Do a heartbeat if there are PCs in the area or any spawns up + if ( NeedPseudoHeartbeat( oArea ) ) + { + // This defaults to spawn_sample_hb. You can pass the name of any script + // to use in the function Spawn_OnAreaEnter() + string sHeartbeatFunc = GetLocalString( oArea, SPAWN_HEARTBEAT_SCRIPT ); + + // start actual heartbeat code + ExecuteScript( sHeartbeatFunc, oArea ); + // end actual heartbeat code + + // This function sets SPAWN_HEARTBEAT_SCHEDULED to TRUE + ScheduleNextPseudoHeartbeat( oArea ); + } + else + { + ReleaseAreaRefs(OBJECT_SELF); + } + + +//**FLAG else here to remove refcounts +} diff --git a/_module/nss/spawn_sample_hb.nss b/_module/nss/spawn_sample_hb.nss new file mode 100644 index 0000000..8dc98f4 --- /dev/null +++ b/_module/nss/spawn_sample_hb.nss @@ -0,0 +1,8 @@ + +#include "spawn_main" + +void main() +{ + Spawn(); +} + diff --git a/_module/nss/spawn_sc_cmptrig.nss b/_module/nss/spawn_sc_cmptrig.nss new file mode 100644 index 0000000..feb9455 --- /dev/null +++ b/_module/nss/spawn_sc_cmptrig.nss @@ -0,0 +1,55 @@ +// +// NESS +// Camp Trigger Scripts v8.1.3 +// +// +#include "spawn_functions" +// +object GetChildByTag(object oSpawn, string sChildTag); +object GetChildByNumber(object oSpawn, int nChildNum); +object GetSpawnByID(int nSpawnID); +void DeactivateSpawn(object oSpawn); +void DeactivateSpawnsByTag(string sSpawnTag); +void DeactivateAllSpawns(); +void DespawnChildren(object oSpawn); +void DespawnChildrenByTag(object oSpawn, string sSpawnTag); +void DestroyCamp(object oCamp, float fCampDecay, int nSaveState); +// +// +void main() +{ + // Initialize Variables + object oSpawned; + string sObject; + int iCount, nCampNumP, nCampNumC; + + // Retrieve Script + int nCampTriggerScript = GetLocalInt(OBJECT_SELF, "CampTriggerScript"); + + // Invalid Script + if (nCampTriggerScript == -1) + { + return; + } + + object oCamp = OBJECT_SELF; + object oSpawn = GetLocalObject(OBJECT_SELF, "ParentSpawn"); + float fCampDecay = GetLocalFloat(oSpawn, "f_CampDecay"); + +// +// Only Make Modifications Between These Lines +// ------------------------------------------- + + + // Destroy Camp + if (nCampTriggerScript == 0) + { + DestroyCamp(oCamp, fCampDecay, FALSE); + } + // + + +// ------------------------------------------- +// Only Make Modifications Between These Lines +// +} diff --git a/_module/nss/spawn_sc_deactiv.nss b/_module/nss/spawn_sc_deactiv.nss new file mode 100644 index 0000000..7b551aa --- /dev/null +++ b/_module/nss/spawn_sc_deactiv.nss @@ -0,0 +1,46 @@ +// +// Deactivation Scripts +// +#include "spawn_functions" +// +object GetChildByTag(object oSpawn, string sChildTag); +object GetChildByNumber(object oSpawn, int nChildNum); +object GetSpawnByID(int nSpawnID); +void DeactivateSpawn(object oSpawn); +void DeactivateSpawnsByTag(string sSpawnTag); +void DeactivateAllSpawns(); +void DespawnChildren(object oSpawn); +void DespawnChildrenByTag(object oSpawn, string sSpawnTag); +// +// +void main() +{ + // Retrieve Script + int nDeactivateScript = GetLocalInt(OBJECT_SELF, "DeactivateScript"); + + // Invalid Script + if (nDeactivateScript == -1) + { + return; + } + +// +// Only Make Modifications Between These Lines +// ------------------------------------------- + + + // Script 00 + if (nDeactivateScript == 0) + { + // Explode with Gore when Deactivated + effect eVisual = EffectVisualEffect(VFX_COM_CHUNK_RED_LARGE); + ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eVisual, GetLocation(OBJECT_SELF), 0.0); + } + // + + +// ------------------------------------------- +// Only Make Modifications Between These Lines +// + +} diff --git a/_module/nss/spawn_sc_death.nss b/_module/nss/spawn_sc_death.nss new file mode 100644 index 0000000..69712d0 --- /dev/null +++ b/_module/nss/spawn_sc_death.nss @@ -0,0 +1,67 @@ +// +// Death Scripts +// +#include "spawn_functions" +// +object GetChildByTag(object oSpawn, string sChildTag); +object GetChildByNumber(object oSpawn, int nChildNum); +object GetSpawnByID(int nSpawnID); +void DeactivateSpawn(object oSpawn); +void DeactivateSpawnsByTag(string sSpawnTag); +void DeactivateAllSpawns(); +void DespawnChildren(object oSpawn); +void DespawnChildrenByTag(object oSpawn, string sSpawnTag); +// +// +void main() +{ + // Initialize Variables + + // Retrieve Script Number + int nDeathScript = GetLocalInt(OBJECT_SELF, "DeathScript"); + + // Invalid Script + if (nDeathScript == -1) + { + return; + } + +// +// Only Make Modifications Between These Lines +// ------------------------------------------- + + + // Script 00 + if (nDeathScript == 0) + { + } + // + + // Scared Prey + if (nDeathScript == 10) + { + object oKiller = GetLastKiller(); + if (GetLocalInt(oKiller, "Predator") == TRUE) + { + // Feed the Predator + int nCurrentHungerState = GetLocalInt(oKiller, "CurrentHungerState"); + int nKills = GetLocalInt(oKiller, "Kills"); + nKills++; + int nFed = 5 + (nKills / 25); + nCurrentHungerState = nCurrentHungerState + 1 + nFed; + SendMessageToAllDMs("Predator is Fed (" + IntToString(nFed) + ")."); + AssignCommand(oKiller, SpeakString("That's " + IntToString(nKills) + " prey I've killed! I get " + IntToString(nFed) + " more food!")); + SetLocalInt(oKiller, "Kills", nKills); + SetLocalInt(oKiller, "CurrentHungerState", nCurrentHungerState); + } + } + // + + +// ------------------------------------------- +// Only Make Modifications Between These Lines +// + + // Record that we Ran Script + SetLocalInt(OBJECT_SELF, "DeathScriptRan", TRUE); +} diff --git a/_module/nss/spawn_sc_hbeat.nss b/_module/nss/spawn_sc_hbeat.nss new file mode 100644 index 0000000..55b43cd --- /dev/null +++ b/_module/nss/spawn_sc_hbeat.nss @@ -0,0 +1,180 @@ +// +// Heartbeat Scripts +// +#include "spawn_functions" +// +object GetChildByTag(object oSpawn, string sChildTag); +object GetChildByNumber(object oSpawn, int nChildNum); +object GetSpawnByID(int nSpawnID); +void DeactivateSpawn(object oSpawn); +void DeactivateSpawnsByTag(string sSpawnTag); +void DeactivateAllSpawns(); +void DespawnChildren(object oSpawn); +void DespawnChildrenByTag(object oSpawn, string sSpawnTag); +// +// +void main() +{ + // Retrieve Script Number + int nHeartbeatScript = GetLocalInt(OBJECT_SELF, "HeartbeatScript"); + + // Invalid Script + if (nHeartbeatScript == -1) + { + return; + } + +// +// Only Make Modifications Between These Lines +// ------------------------------------------- + + + // Script 00 + if (nHeartbeatScript == 0) + { + if (d2() == 2) + { + ActionPlayAnimation(ANIMATION_FIREFORGET_PAUSE_BORED); + } + } + // + + // + if (nHeartbeatScript == 2) + { + object oCentralObject; + location lCentralObject, lLocation; + vector vCentralObject, vLocation; + float fAngle, fRadius, fLocationX, fLocationY; + + // Add Multiple Actions per HeartbeatScript + int nNth; + for (nNth = 1; nNth <= 10; nNth++) + { + // Central Object + oCentralObject = GetObjectByTag("CentralObject"); + lCentralObject = GetLocation(oCentralObject); + vCentralObject = GetPositionFromLocation(lCentralObject); + + // Retreive and Increment Angle by 10 Degrees + fAngle = GetLocalFloat(OBJECT_SELF, "Angle"); + fAngle = fAngle + 5.0; + if (fAngle >= 360.0) + { + fAngle = 0.0; + } + + // Create New Location + fRadius = 5.0; + fLocationX = fRadius * cos(fAngle); + fLocationY = fRadius * sin(fAngle); + vLocation = Vector(fLocationX, fLocationY, 0.0); + lLocation = Location(GetArea(OBJECT_SELF), vCentralObject + vLocation, 0.0); + + // Move to New Location + ActionMoveToLocation(lLocation, TRUE); + + // Record New Angle + SetLocalFloat(OBJECT_SELF, "Angle", fAngle); + } + } + // + + // Script 001 - Flavor text for dockworkers + if (nHeartbeatScript == 1) + { + ActionSpeakString("Hand me that rope, would ya?"); + } + // + + // Check if a Placeable was Used + if (nHeartbeatScript == 5) + { + object oPC = GetLastUsedBy(); + SendMessageToPC(oPC, "You were the last user."); + } + // + + // Prowling Predator + if (nHeartbeatScript == 10) + { + string sState; + int nCurrentHungerState = GetLocalInt(OBJECT_SELF, "CurrentHungerState"); + nCurrentHungerState--; + SetLocalInt(OBJECT_SELF, "Predator", TRUE); + + if (GetLocalInt(OBJECT_SELF, "Sleeping") == FALSE) + { + // Hungry Yet? + if (nCurrentHungerState <= 0) + { + if (nCurrentHungerState < -10) + { + // Death Comes to Those who Cannot Hunt + sState = "Dead from Starvation"; + ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(GetMaxHitPoints(OBJECT_SELF)), OBJECT_SELF); + } + else + { + if (nCurrentHungerState > -5) + { + // Hungry! + sState = "Hungry and Prowling"; + } + else + { + // Dying of Starvation! + sState = "Starving"; + ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(GetMaxHitPoints(OBJECT_SELF)/6), OBJECT_SELF); + } + // Prowl + if (GetIsInCombat(OBJECT_SELF) == FALSE) + { + ClearAllActions(); + ActionMoveAwayFromLocation(GetLocation(OBJECT_SELF), TRUE, 20.0); + } + } + } + else + { + if (nCurrentHungerState < 10) + { + if (nCurrentHungerState > 5) + { + // Happy and Healing. + sState = "Fat and Happy"; + ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(GetMaxHitPoints(OBJECT_SELF)/6), OBJECT_SELF, 0.0); + } + else + { + // Happy + sState = "Happy"; + } + } + else + { + sState = "Fat and Sleeping"; + ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectSleep(), OBJECT_SELF, 12.0); + ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_IMP_SLEEP), OBJECT_SELF, 0.0); + SetLocalInt(OBJECT_SELF, "Sleeping", TRUE); + DelayCommand(10.0, SetLocalInt(OBJECT_SELF, "Sleeping", FALSE)); + } + } + } + else + { + sState = "Fat and Sleeping"; + ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_IMP_SLEEP), OBJECT_SELF, 0.0); + } + SendMessageToAllDMs(sState + " (" + IntToString(nCurrentHungerState) + ")."); + SpeakString("I am " + sState + "."); + SetLocalInt(OBJECT_SELF, "CurrentHungerState", nCurrentHungerState); + } + // + + +// ------------------------------------------- +// Only Make Modifications Between These Lines +// + +} diff --git a/_module/nss/spawn_sc_patrol.nss b/_module/nss/spawn_sc_patrol.nss new file mode 100644 index 0000000..c539261 --- /dev/null +++ b/_module/nss/spawn_sc_patrol.nss @@ -0,0 +1,62 @@ +// +// NESS +// Patrol Scripts v8.1.3 +// +// +#include "spawn_functions" +// +object GetChildByTag(object oSpawn, string sChildTag); +object GetChildByNumber(object oSpawn, int nChildNum); +object GetSpawnByID(int nSpawnID); +void DeactivateSpawn(object oSpawn); +void DeactivateSpawnsByTag(string sSpawnTag); +void DeactivateAllSpawns(); +void DespawnChildren(object oSpawn); +void DespawnChildrenByTag(object oSpawn, string sSpawnTag); +// +// +void main() +{ + // Retrieve Script Number + int nPatrolScript = GetLocalInt(OBJECT_SELF, "PatrolScript"); + + // Retrieve Stop Information + int nStopNumber = GetLocalInt(OBJECT_SELF, "PR_NEXTSTOP"); + object oStop = GetLocalObject(OBJECT_SELF, "PR_SN" + PadIntToString(nStopNumber, 2)); + + // Invalid Script + if (nPatrolScript == -1) + { + return; + } + +// +// Only Make Modifications Between These Lines +// ------------------------------------------- + + + // Script 00 + if (nPatrolScript == 0) + { + ActionDoCommand(SpeakString("Example!")); + } + // + + // Turn Off Lights + if (nPatrolScript == 7) + { + object oLight = GetNearestObjectByTag("Light", oStop); + if ((GetIsDay() == TRUE && GetPlaceableIllumination(oLight) == TRUE) + || (GetIsNight() == TRUE && GetPlaceableIllumination(oLight) == FALSE)) + { + ActionDoCommand(DoPlaceableObjectAction(oLight, PLACEABLE_ACTION_USE)); + } + } + // + + +// ------------------------------------------- +// Only Make Modifications Between These Lines +// + +} diff --git a/_module/nss/spawn_sc_spawn.nss b/_module/nss/spawn_sc_spawn.nss new file mode 100644 index 0000000..76044f1 --- /dev/null +++ b/_module/nss/spawn_sc_spawn.nss @@ -0,0 +1,309 @@ +// +// Spawn and Despawn Scripts +// +#include "spawn_functions" +// +object GetChildByTag(object oSpawn, string sChildTag); +object GetChildByNumber(object oSpawn, int nChildNum); +object GetSpawnByID(int nSpawnID); +void DeactivateSpawn(object oSpawn); +void DeactivateSpawnsByTag(string sSpawnTag); +void DeactivateAllSpawns(); +void DespawnChildren(object oSpawn); +void DespawnChildrenByTag(object oSpawn, string sSpawnTag); +// +// +void main() +{ + // Retrieve Script Number + int nSpawnScript = GetLocalInt(OBJECT_SELF, "SpawnScript"); + int nDespawnScript = GetLocalInt(OBJECT_SELF, "DespawnScript"); + + // Invalid Script + if (nSpawnScript == -1 || nDespawnScript == -1) + { + return; + } + + if (nSpawnScript > 0) + { + +// +// Only Make Modifications Between These Lines +// ------------------------------------------- + + + // Script 00 + // Dummy Script - Never Use + if (nSpawnScript == 0) + { + return; + } + // + + if (nSpawnScript == 1) + { + // lamplighter + int nLit = GetLocalInt(OBJECT_SELF, "torchesLit"); + if (! nLit) + { + //SendMessageToPC(GetFirstPC(), "lighting torches"); + SetLocalInt(OBJECT_SELF, "torchesLit", 1); + + // find all objects in area with tag lightableTorch + object oArea = GetArea(OBJECT_SELF); + object oTorch = GetFirstObjectInArea(oArea); + int nCount = 0; + string sTorchTag = "lightableTorch"; + + while (oTorch != OBJECT_INVALID) + { + if (GetTag(oTorch) == sTorchTag) + { + nCount++; + AssignCommand(oTorch, PlayAnimation(ANIMATION_PLACEABLE_ACTIVATE)); + DelayCommand(0.4, SetPlaceableIllumination(oTorch, TRUE)); + SetLocalInt(oTorch,"NW_L_AMION",1); + } + + oTorch = GetNextObjectInArea(oArea); + } + + if (nCount > 0) + { + DelayCommand(0.1,RecomputeStaticLighting(oArea)); + } + + return; + } + }// end spawn script 1 + +// ------------------------------------------- +// Only Make Modifications Between These Lines +// + + } + + if (nDespawnScript > 0) + { + +// +// Only Make Modifications Between These Lines +// ------------------------------------------- + + + // Script 00 + // Dummy Script - Never Use + if (nDespawnScript == 0) + { + return; + } + // + + if (nDespawnScript == 1) + { + + // lampdouser + //SendMessageToPC(GetFirstPC(), "dousing torches"); + + // find all objects in area with tag lightableTorch + object oArea = GetArea(OBJECT_SELF); + object oTorch = GetFirstObjectInArea(oArea); + int nCount = 0; + string sTorchTag = "lightableTorch"; + + while (oTorch != OBJECT_INVALID) + { + if (GetTag(oTorch) == sTorchTag) + { + nCount++; + AssignCommand(oTorch,PlayAnimation(ANIMATION_PLACEABLE_DEACTIVATE)); + DelayCommand(0.4, SetPlaceableIllumination(oTorch, FALSE)); + SetLocalInt(oTorch,"NW_L_AMION",0); + } + + oTorch = GetNextObjectInArea(oArea); + } + + if (nCount > 0) + { + DelayCommand(0.1,RecomputeStaticLighting(oArea)); + } + + return; + } + + // Area Cleanup Example + if (nDespawnScript == 999) + { + // Settings + int nMerchantPrefixLetters = 3; + string sMerchantPrefix = "MC_"; + int nChestPrefixLetters = 3; + string sChestPrefix = "CH_"; + + // Create an Area Merchant List + int nMerchantNum; + string sMerchantNum; + int nNth = 1; + object oMerchant = GetNearestObject(OBJECT_TYPE_STORE, OBJECT_SELF, nNth); + while (oMerchant != OBJECT_INVALID) + { + if (GetStringLeft(GetTag(oMerchant), nMerchantPrefixLetters) == sMerchantPrefix) + { + nMerchantNum++; + sMerchantNum = "Merchant" + PadIntToString(nMerchantNum, 2); + SetLocalObject(OBJECT_SELF, sMerchantNum, oMerchant); + } + nNth++; + oMerchant = GetNearestObject(OBJECT_TYPE_STORE, OBJECT_SELF, nNth); + } + + // Create an Area Chest List + int nChestNum; + string sChestNum; + nNth = 1; + object oChest = GetNearestObject(OBJECT_TYPE_PLACEABLE, OBJECT_SELF, nNth); + while (oChest != OBJECT_INVALID) + { + if (GetStringLeft(GetTag(oChest), nChestPrefixLetters) == sChestPrefix) + { + nChestNum++; + sChestNum = "Chest" + PadIntToString(nChestNum, 2); + SetLocalObject(OBJECT_SELF, sChestNum, oChest); + } + nNth++; + oChest = GetNearestObject(OBJECT_TYPE_PLACEABLE, OBJECT_SELF, nNth); + } + + // Cleanup Creatures + nNth = 1; + object oCreature = GetNearestObject(OBJECT_TYPE_CREATURE, OBJECT_SELF, nNth); + while (oCreature != OBJECT_INVALID) + { + // Destroy Creatures NOT Spawned by Spawner + if (GetLocalObject(oCreature, "ParentSpawn") == OBJECT_INVALID) + { + DestroyObject(oCreature); + } + + // Cleanup Corpses + if (GetIsDead(oCreature) == TRUE) + { + AssignCommand(oCreature, SetIsDestroyable(TRUE, TRUE)); + DestroyObject(oCreature); + } + + nNth++; + oCreature = GetNearestObject(OBJECT_TYPE_CREATURE, OBJECT_SELF, nNth); + } + + // Cleanup All Items in Area + string sItemTag; + int nStack; + int nCurrentMerchant = 0; + int nCurrentChest = 0; + nNth = 1; + object oItem = GetNearestObject(OBJECT_TYPE_ITEM, OBJECT_SELF, nNth); + while (oItem != OBJECT_INVALID) + { + // Retrieve Item Information + sItemTag = GetTag(oItem); + nStack = GetNumStackedItems(oItem); + + // Destroy Item + DestroyObject(oItem); + + // Place Items on Merchants + if (nMerchantNum > 0) + { + if (nCurrentMerchant = nMerchantNum - 1) + { + nCurrentMerchant = 0; + } + oMerchant = GetLocalObject(OBJECT_SELF, "Merchant" + PadIntToString(nCurrentMerchant, 2)); + CreateItemOnObject(sItemTag, oMerchant, nStack); + nCurrentMerchant++; + } + // Place Items in Chests + else if (nChestNum > 0) + { + if (nCurrentChest = nChestNum -1) + { + nCurrentChest = 0; + } + oChest = GetLocalObject(OBJECT_SELF, "Chest" + PadIntToString(nCurrentChest, 2)); + CreateItemOnObject(sItemTag, oChest, nStack); + nCurrentChest++; + } + + nNth++; + oItem = GetNearestObject(OBJECT_TYPE_ITEM, OBJECT_SELF, nNth); + } + + // Cleanup 'Body Bags' + nNth = 1; + oItem = GetNearestObject(OBJECT_TYPE_PLACEABLE, OBJECT_SELF, nNth); + while (oItem != OBJECT_INVALID) + { + if(GetTag(oItem) == "Body Bag") + { + // Check for Inventory + if (GetHasInventory(oItem) == TRUE) + { + object oInventoryItem = GetFirstItemInInventory(oItem); + while (oInventoryItem != OBJECT_INVALID) + { + // Retrieve Item Information + sItemTag = GetTag(oInventoryItem); + nStack = GetNumStackedItems(oInventoryItem); + + // Destroy Item + DestroyObject(oInventoryItem); + + // Place Items on Merchants + if (nMerchantNum > 0) + { + if (nCurrentMerchant = nMerchantNum - 1) + { + nCurrentMerchant = 0; + } + oMerchant = GetLocalObject(OBJECT_SELF, "Merchant" + PadIntToString(nCurrentMerchant, 2)); + CreateItemOnObject(sItemTag, oMerchant, nStack); + nCurrentMerchant++; + } + // Place Items in Chests + else if (nChestNum > 0) + { + if (nCurrentChest = nChestNum -1) + { + nCurrentChest = 0; + } + oChest = GetLocalObject(OBJECT_SELF, "Chest" + PadIntToString(nCurrentChest, 2)); + CreateItemOnObject(sItemTag, oChest, nStack); + nCurrentChest++; + } + oInventoryItem = GetNextItemInInventory(oItem); + } + } + + // Destroy Body Bag + DestroyObject(oItem); + } + nNth++; + oItem = GetNearestObject(OBJECT_TYPE_PLACEABLE, OBJECT_SELF, nNth); + } + } + // + + +// ------------------------------------------- +// Only Make Modifications Between These Lines +// + + } + + // Clean Up + SetLocalInt(OBJECT_SELF, "SpawnScript", 0); + SetLocalInt(OBJECT_SELF, "DespawnScript", 0); +} diff --git a/_module/nss/spawn_smpl_onen2.nss b/_module/nss/spawn_smpl_onen2.nss new file mode 100644 index 0000000..20fd898 --- /dev/null +++ b/_module/nss/spawn_smpl_onen2.nss @@ -0,0 +1,34 @@ +// +// NESS V8.1.2 +// +// Spawn sample onEnter, version 2 +// +// If you want to use pseudo-heartbeats and do not already have an area onEnter +// script, you can use this one. Otherwise, just add Spawn_OnAreaEnter() to +// your existing onEnter handler. Note that you use this (and +// SpawnOnAreaExit()) INSTEAD OF Spawn() / spawn_sample_hb. +// + +#include "spawn_functions" + +void main() +{ + // Spawn_OnAreaEnter() can take three arguments - the name of the heartbeat + // script to execute, the heartbeat duration, and a delay for the first + // heartbeat. They default to spawn_sample_hb, 6.0, and 0.0 respectively; as + // if it were called like: + // Spawn_OnAreaEnter( "spawn_sample_hb", 6.0, 0.0 ); + + if ( GetIsAreaAboveGround( OBJECT_SELF ) && + ! GetIsAreaNatural( OBJECT_SELF ) ) + { + // Indoors - no delay on the first HB + Spawn_OnAreaEnter( "spawn_sample_hb", 10.0 ); + } + + else + { + // Outdoors or underground - do a 3 second delay on the first HB + Spawn_OnAreaEnter( "spawn_sample_hb", 10.0, 3.0 ); + } +} \ No newline at end of file diff --git a/_module/nss/spawn_smpl_onent.nss b/_module/nss/spawn_smpl_onent.nss new file mode 100644 index 0000000..18bec8a --- /dev/null +++ b/_module/nss/spawn_smpl_onent.nss @@ -0,0 +1,23 @@ +// +// NESS V8.1 +// +// Spawn sample onEnter +// +// If you want to use pseudo-heartbeats and do not already have an area onEnter +// script, you can use this one. Otherwise, just add Spawn_OnAreaEnter() to +// your existing onEnter handler. Note that you use this (and +// SpawnOnAreaExit()) INSTEAD OF Spawn() / spawn_sample_hb. +// + +#include "spawn_functions" + +void main() +{ + // Spawn_OnAreaEnter() can take three arguments - the name of the heartbeat + // script to execute, the heartbeat duration, and a delay for the first + // heartbeat. They default to spawn_sample_hb, 6.0, and 0.0 respectively; as + // if it were called like: + // Spawn_OnAreaEnter( "spawn_sample_hb", 6.0, 0.0 ); + + Spawn_OnAreaEnter(); +} \ No newline at end of file diff --git a/_module/nss/spawn_smpl_onext.nss b/_module/nss/spawn_smpl_onext.nss new file mode 100644 index 0000000..9c2c755 --- /dev/null +++ b/_module/nss/spawn_smpl_onext.nss @@ -0,0 +1,17 @@ +// +// NESS V8.1 +// +// Spawn sample onExit +// +// If you want to use pseudo-heartbeats and do not already have an area onExit +// script, you can use this one. Otherwise, just add Spawn_OnAreaExit() to +// your existing onExit handler. Note that you use this (and +// SpawnOnAreaEnter()) INSTEAD OF Spawn() / spawn_sample_hb. +// + +#include "spawn_functions" + +void main() +{ + Spawn_OnAreaExit(); +} diff --git a/_module/nss/spawn_timefuncs.nss b/_module/nss/spawn_timefuncs.nss new file mode 100644 index 0000000..a16df7e --- /dev/null +++ b/_module/nss/spawn_timefuncs.nss @@ -0,0 +1,156 @@ +// +// +// ALFA NESS +// Time functions v1.1 +// +// Do NOT Modify this File +// See 'spawn__readme' for Instructions +// +// +//:://///////////////////////////////////////////// +//:: Time Conversion Functions +//:: spawn_timefuncs +//::////////////////////////////////////////////// +/* + These functions allow Calendar y/m/d/h/m/s to + be converted to seconds of real time which can be used as + a basis for time comparisons. Time is reckoned + in seconds from the NWN Epoch - 1340 DR. + + Note that HoursToRealSeconds() is equivalent to the Bioware function + HoursToSeconds(); it is included for completeness. +*/ +//::////////////////////////////////////////////// +//:: Created By: Cereborn +//:: Created On: November 22, 2002 +//::////////////////////////////////////////////// + +int CLOCK_DEBUG = FALSE; + +int SPAWN_EPOCH = 1340; + +void clockDebug(string str) +{ + if (CLOCK_DEBUG) + { + SendMessageToAllDMs(str); + object oPC = GetFirstPC(); + if (! GetIsDM(oPC)) + SendMessageToPC(oPC, str); + WriteTimestampedLogEntry(str); + } +} + +// Get the current time (elapsed since the Epoch) in real seconds +int GetCurrentRealSeconds(); + +// Convert a calendar (game) time to real seconds +int CalendarToRealSeconds(int year, int month, int day, int hour, int minute, + int second); + +// Returns number of real seconds in the # of specified (game) years +int YearsToRealSeconds(int years); + +// Returns number of real seconds in the # of specified (game) months +int MonthsToRealSeconds(int months); + +// Returns number of real seconds in the # of specified (game) days +int DaysToRealSeconds(int days); + +// Returns number of real seconds in the # of specified (game) hours +int HoursToRealSeconds(int hours); + +int YearsToRealSeconds(int years) +{ + return MonthsToRealSeconds(years*12); +} + +int MonthsToRealSeconds(int months) +{ + return DaysToRealSeconds(months*28); +} + +int DaysToRealSeconds(int days) +{ + return FloatToInt(HoursToSeconds(days*24)); +} + +int HoursToRealSeconds(int hours) +{ + return FloatToInt(HoursToSeconds(hours)); +} + +int CalendarToRealSeconds(int year, int month, int day, int hour, int minute, + int second) +{ + if (year < SPAWN_EPOCH) + year = SPAWN_EPOCH; + if (month < 1) + month = 1; + if (day < 1) + day = 1; + + return (YearsToRealSeconds(year-SPAWN_EPOCH) + + MonthsToRealSeconds(month-1) + + DaysToRealSeconds(day-1) + + FloatToInt(HoursToSeconds(hour)) + + (minute*60) + + second); +} + + +int GetCurrentRealSeconds() +{ + //clockDebug("Converting " + IntToString(GetCalendarYear()) + " " + + // IntToString(GetCalendarMonth()) + " " + + // IntToString(GetCalendarDay()) + " " + + // IntToString(GetTimeHour()) + " " + + // IntToString(GetTimeMinute()) + " " + + // IntToString(GetTimeSecond())); + + return CalendarToRealSeconds(GetCalendarYear(), GetCalendarMonth(), + GetCalendarDay(), GetTimeHour(), GetTimeMinute(), GetTimeSecond()); +} + +string RealSecondsToString(int nRealSeconds) +{ + int nMod; + int nRem; + string sDateTime = ""; + + nMod = nRealSeconds / YearsToRealSeconds(1); + nRem = nRealSeconds % YearsToRealSeconds(1); + + sDateTime = IntToString(nMod + SPAWN_EPOCH); + + nMod = nRem / MonthsToRealSeconds(1); + nRem = nRem % MonthsToRealSeconds(1); + + sDateTime += " " + IntToString(nMod+1); + + nMod = nRem / DaysToRealSeconds(1); + nRem = nRem % DaysToRealSeconds(1); + + sDateTime += " " + IntToString(nMod+1); + + nMod = nRem / FloatToInt(HoursToSeconds(1)); + nRem = nRem % FloatToInt(HoursToSeconds(1)); + + sDateTime += " " + IntToString(nMod) + ":"; + + nMod = nRem / 60; + nRem = nRem % 60; + + if (nMod < 10) + sDateTime += "0" + IntToString(nMod) + ":"; + else + sDateTime += IntToString(nMod) + ":"; + + if (nRem < 10) + sDateTime += "0" + IntToString(nRem); + else + sDateTime += IntToString(nRem); + + return sDateTime; +} + diff --git a/_module/nss/spawn_used_corps.nss b/_module/nss/spawn_used_corps.nss new file mode 100644 index 0000000..5445eb3 --- /dev/null +++ b/_module/nss/spawn_used_corps.nss @@ -0,0 +1,29 @@ +// +// NESS V8.0 +// Spawn Used Corpse +// +// Brought into the NESS distribution for Version 8.0 and beyond. Original +// header below. +// + +//////////////////////////////////////////////////////////////////////////////// +// // // +// _kb_loot_crouch // VERSION 1.0 // +// // // +// by Keron Blackfeld on 07/27/2002 //////////////////////////// +// // +// email Questions and Comments to: keron@broadswordgaming.com or catch me // +// in Bioware's NWN Community - Builder's NWN Scripting Forum // +// // +//////////////////////////////////////////////////////////////////////////////// +// // +// PLACE THIS SCRIPT IN THE ONUSED EVENT OF YOUR "invis_corpse_obj" // +// BLUEPRINT. This script causes the PC opening the corpse to crouch down // +// and visibly reach for the corpse. // +// // +//////////////////////////////////////////////////////////////////////////////// +void main() +{ + object oPC = GetLastUsedBy(); + AssignCommand(oPC, ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW, 1.0f, 1.2f)); +} diff --git a/_module/nss/spawnb_cc_activ.nss b/_module/nss/spawnb_cc_activ.nss new file mode 100644 index 0000000..bdec254 --- /dev/null +++ b/_module/nss/spawnb_cc_activ.nss @@ -0,0 +1,16 @@ +// +// Spawn Banner +// Conversation Check +// +int StartingConditional() +{ + object oSpawn = GetLocalObject(OBJECT_SELF, "ParentSpawn"); + if (GetLocalInt(oSpawn, "SpawnDeactivated") == TRUE) + { + return TRUE; + } + else + { + return FALSE; + } +} diff --git a/_module/nss/spawnb_cc_dactiv.nss b/_module/nss/spawnb_cc_dactiv.nss new file mode 100644 index 0000000..ccdd939 --- /dev/null +++ b/_module/nss/spawnb_cc_dactiv.nss @@ -0,0 +1,16 @@ +// +// Spawn Banner +// Conversation Check +// +int StartingConditional() +{ + object oSpawn = GetLocalObject(OBJECT_SELF, "ParentSpawn"); + if (GetLocalInt(oSpawn, "SpawnDeactivated") == FALSE) + { + return TRUE; + } + else + { + return FALSE; + } +} diff --git a/_module/nss/spawnb_cc_dump.nss b/_module/nss/spawnb_cc_dump.nss new file mode 100644 index 0000000..effc78e --- /dev/null +++ b/_module/nss/spawnb_cc_dump.nss @@ -0,0 +1,15 @@ +// +// Spawn Banner +// Conversation Check +// + +#include "spawn_functions" + +int StartingConditional() +{ + if (NESS_IsModuleSpawnDumping()) + { + return FALSE; + } + return TRUE; +} diff --git a/_module/nss/spawnb_cc_nodump.nss b/_module/nss/spawnb_cc_nodump.nss new file mode 100644 index 0000000..bed4a51 --- /dev/null +++ b/_module/nss/spawnb_cc_nodump.nss @@ -0,0 +1,15 @@ +// +// Spawn Banner +// Conversation Check +// + +#include "spawn_functions" + +int StartingConditional() +{ + if (NESS_IsModuleSpawnDumping()) + { + return TRUE; + } + return FALSE; +} diff --git a/_module/nss/spawnb_cc_notrck.nss b/_module/nss/spawnb_cc_notrck.nss new file mode 100644 index 0000000..68ba005 --- /dev/null +++ b/_module/nss/spawnb_cc_notrck.nss @@ -0,0 +1,15 @@ +// +// Spawn Banner +// Conversation Check +// + +#include "spawn_functions" + +int StartingConditional() +{ + if (NESS_IsModuleSpawnTracking()) + { + return TRUE; + } + return FALSE; +} diff --git a/_module/nss/spawnb_cc_nsclog.nss b/_module/nss/spawnb_cc_nsclog.nss new file mode 100644 index 0000000..b5639e6 --- /dev/null +++ b/_module/nss/spawnb_cc_nsclog.nss @@ -0,0 +1,18 @@ +// +// Spawn Banner +// Conversation Check +// Spawn Delay Debugging off +// +int StartingConditional() +{ + object oSpawn = GetLocalObject(OBJECT_SELF, "ParentSpawn"); + object oArea = GetArea(oSpawn); + if (GetLocalInt(oArea, "SpawnCountDebug") == TRUE) + { + return TRUE; + } + else + { + return FALSE; + } +} diff --git a/_module/nss/spawnb_cc_nsdlog.nss b/_module/nss/spawnb_cc_nsdlog.nss new file mode 100644 index 0000000..55372b4 --- /dev/null +++ b/_module/nss/spawnb_cc_nsdlog.nss @@ -0,0 +1,18 @@ +// +// Spawn Banner +// Conversation Check +// Spawn Delay Debugging off +// +int StartingConditional() +{ + object oSpawn = GetLocalObject(OBJECT_SELF, "ParentSpawn"); + object oArea = GetArea(oSpawn); + if (GetLocalInt(oArea, "SpawnDelayDebug") == TRUE) + { + return TRUE; + } + else + { + return FALSE; + } +} diff --git a/_module/nss/spawnb_cc_sclog.nss b/_module/nss/spawnb_cc_sclog.nss new file mode 100644 index 0000000..7eb6873 --- /dev/null +++ b/_module/nss/spawnb_cc_sclog.nss @@ -0,0 +1,18 @@ +// +// Spawn Banner +// Conversation Check +// Spawn Delay Debugging on +// +int StartingConditional() +{ + object oSpawn = GetLocalObject(OBJECT_SELF, "ParentSpawn"); + object oArea = GetArea(oSpawn); + if (GetLocalInt(oArea, "SpawnCountDebug") == FALSE) + { + return TRUE; + } + else + { + return FALSE; + } +} diff --git a/_module/nss/spawnb_cc_sdlog.nss b/_module/nss/spawnb_cc_sdlog.nss new file mode 100644 index 0000000..39507ca --- /dev/null +++ b/_module/nss/spawnb_cc_sdlog.nss @@ -0,0 +1,18 @@ +// +// Spawn Banner +// Conversation Check +// Spawn Delay Debugging on +// +int StartingConditional() +{ + object oSpawn = GetLocalObject(OBJECT_SELF, "ParentSpawn"); + object oArea = GetArea(oSpawn); + if (GetLocalInt(oArea, "SpawnDelayDebug") == FALSE) + { + return TRUE; + } + else + { + return FALSE; + } +} diff --git a/_module/nss/spawnb_cc_trck.nss b/_module/nss/spawnb_cc_trck.nss new file mode 100644 index 0000000..b12d7cc --- /dev/null +++ b/_module/nss/spawnb_cc_trck.nss @@ -0,0 +1,15 @@ +// +// Spawn Banner +// Conversation Check +// + +#include "spawn_functions" + +int StartingConditional() +{ + if (NESS_IsModuleSpawnTracking()) + { + return FALSE; + } + return TRUE; +} diff --git a/_module/nss/spawnb_main.nss b/_module/nss/spawnb_main.nss new file mode 100644 index 0000000..6be386a --- /dev/null +++ b/_module/nss/spawnb_main.nss @@ -0,0 +1,69 @@ +// +// SpawnBanner v1.0 +// +void SpawnBanner(object oPC, object oItem, object oTarget, location lTarget) +{ + object oArea = GetArea(oPC); + + if (GetTag(oTarget) == "SpawnBanner") + { + object oSpawn = GetLocalObject(oTarget, "ParentSpawn"); + + SetCustomToken(999, "\n"); + SetCustomToken(1000, GetLocalString(oSpawn, "f_Flags")); + SetCustomToken(1001, GetLocalString(oSpawn, "f_Template")); + + AssignCommand(oPC, ActionStartConversation(oTarget, "spawn_banner")); + } + else + { + int nState = GetLocalInt(oArea, "SpawnBannerState"); + if (nState == 0) + { + // Show Spawn Banners + SendMessageToAllDMs("showing banners"); + + int nNth; + string sSpawnNum, sSpawnName; + object oSpawn, oBanner; + location lSpawn; + + int nSpawns = GetLocalInt(oArea, "Spawns"); + + for (nNth = 1; nNth <= nSpawns; nNth++) + { + sSpawnNum = "Spawn"; + if (nNth < 10) + { + sSpawnNum = sSpawnNum + "0"; + } + sSpawnNum = sSpawnNum + IntToString(nNth); + oSpawn = GetLocalObject(oArea, sSpawnNum); + lSpawn = GetLocation(oSpawn); + if (GetLocalInt(oSpawn, "SpawnDeactivated") == FALSE) + { + oBanner = CreateObject(OBJECT_TYPE_PLACEABLE, "spawn_ban_a", lSpawn); + } + else + { + oBanner = CreateObject(OBJECT_TYPE_PLACEABLE, "spawn_ban_d", lSpawn); + } + SetLocalObject(oBanner, "ParentSpawn", oSpawn); + } + SetLocalInt(oArea, "SpawnBannerState", 1); + } + else + { + // Hide Spawn Banners + int nNth = 1; + object oBanner = GetNearestObjectByTag("SpawnBanner", oPC, nNth); + while (oBanner != OBJECT_INVALID) + { + DestroyObject(oBanner); + nNth++; + oBanner = GetNearestObjectByTag("SpawnBanner", oPC, nNth); + } + SetLocalInt(oArea, "SpawnBannerState", 0); + } + } +} diff --git a/_module/nss/spawnb_sample_ai.nss b/_module/nss/spawnb_sample_ai.nss new file mode 100644 index 0000000..2d050df --- /dev/null +++ b/_module/nss/spawnb_sample_ai.nss @@ -0,0 +1,18 @@ +// +// SpawnBanner : Sample OnActivateItem Script +// +#include "spawnb_main" + +void main() +{ + object oPC = GetItemActivator(); + object oItem = GetItemActivated(); + object oTarget = GetItemActivatedTarget(); + location lTarget = GetItemActivatedTargetLocation(); + + // Rod of Spawn Banners + if (GetTag(oItem) == "RodofSpawnBanners") + { + SpawnBanner(oPC, oItem, oTarget, lTarget); + } +} diff --git a/_module/nss/spawnb_sc_activ.nss b/_module/nss/spawnb_sc_activ.nss new file mode 100644 index 0000000..140b6c5 --- /dev/null +++ b/_module/nss/spawnb_sc_activ.nss @@ -0,0 +1,17 @@ +// +// Spawn Banner +// Activate Spawn +// + +#include "spawn_functions" + +void main() +{ + object oPC = GetPCSpeaker(); + object oSpawn = GetLocalObject(OBJECT_SELF, "ParentSpawn"); + NESS_ActivateSpawn(oSpawn); + DestroyObject(OBJECT_SELF); + object oBanner = CreateObject(OBJECT_TYPE_PLACEABLE, "spawn_ban_a", GetLocation(oSpawn)); + SetLocalObject(oBanner, "ParentSpawn", oSpawn); + FloatingTextStringOnCreature("Spawn Activated", oPC); +} diff --git a/_module/nss/spawnb_sc_dactiv.nss b/_module/nss/spawnb_sc_dactiv.nss new file mode 100644 index 0000000..8ad0941 --- /dev/null +++ b/_module/nss/spawnb_sc_dactiv.nss @@ -0,0 +1,17 @@ +// +// Spawn Banner +// Deactivate Spawn +// +#include "spawn_functions" + +void main() +{ + object oPC = GetPCSpeaker(); + object oSpawn = GetLocalObject(OBJECT_SELF, "ParentSpawn"); + NESS_DeactivateSpawn(oSpawn); + DestroyObject(OBJECT_SELF); + object oBanner = CreateObject(OBJECT_TYPE_PLACEABLE, "spawn_ban_d", + GetLocation(oSpawn)); + SetLocalObject(oBanner, "ParentSpawn", oSpawn); + FloatingTextStringOnCreature("Spawn Deactivated", oPC); +} diff --git a/_module/nss/spawnb_sc_disp.nss b/_module/nss/spawnb_sc_disp.nss new file mode 100644 index 0000000..c8638c5 --- /dev/null +++ b/_module/nss/spawnb_sc_disp.nss @@ -0,0 +1,14 @@ +// +// Spawn Banner Display Text +// +void main() +{ + object oSpawn = GetLocalObject(OBJECT_SELF, "ParentSpawn"); + object oPC = GetLastUsedBy(); + + string sSpawnName = GetLocalString(oSpawn, "f_Flags"); + string sSpawnTag = GetLocalString(oSpawn, "f_Template"); + + DelayCommand(0.0, FloatingTextStringOnCreature(sSpawnName, oPC)); + DelayCommand(1.0, FloatingTextStringOnCreature(sSpawnTag, oPC)); +} diff --git a/_module/nss/spawnb_sc_dump.nss b/_module/nss/spawnb_sc_dump.nss new file mode 100644 index 0000000..da7914b --- /dev/null +++ b/_module/nss/spawnb_sc_dump.nss @@ -0,0 +1,12 @@ +// +// Spawn Banner +// Turn Spawn Tracking ON +// + +#include "spawn_functions" + +void main() +{ + NESS_DumpModuleSpawns(); + SendMessageToAllDMs("Spawn dumping enabled"); +} diff --git a/_module/nss/spawnb_sc_nodump.nss b/_module/nss/spawnb_sc_nodump.nss new file mode 100644 index 0000000..af9fd94 --- /dev/null +++ b/_module/nss/spawnb_sc_nodump.nss @@ -0,0 +1,12 @@ +// +// Spawn Banner +// Turn Spawn Tracking OFF +// + +#include "spawn_functions" + +void main() +{ + NESS_DumpModuleSpawns(FALSE); + SendMessageToAllDMs("Spawn dumping disabled"); +} diff --git a/_module/nss/spawnb_sc_notrck.nss b/_module/nss/spawnb_sc_notrck.nss new file mode 100644 index 0000000..10cb11d --- /dev/null +++ b/_module/nss/spawnb_sc_notrck.nss @@ -0,0 +1,12 @@ +// +// Spawn Banner +// Turn Spawn Tracking OFF +// + +#include "spawn_functions" + +void main() +{ + NESS_TrackModuleSpawns(FALSE); + SendMessageToAllDMs("Spawn tracking disabled"); +} diff --git a/_module/nss/spawnb_sc_nsdlog.nss b/_module/nss/spawnb_sc_nsdlog.nss new file mode 100644 index 0000000..90fe1f2 --- /dev/null +++ b/_module/nss/spawnb_sc_nsdlog.nss @@ -0,0 +1,11 @@ +// +// Spawn Banner +// Turn Spawn Delay logging ON +// + +void main() +{ + object oArea = GetArea(OBJECT_SELF); + SetLocalInt(oArea, "SpawnDelayDebug", FALSE); + SendMessageToAllDMs("Spawn delay logging disabled"); +} diff --git a/_module/nss/spawnb_sc_sclog.nss b/_module/nss/spawnb_sc_sclog.nss new file mode 100644 index 0000000..131bc8e --- /dev/null +++ b/_module/nss/spawnb_sc_sclog.nss @@ -0,0 +1,11 @@ +// +// Spawn Banner +// Turn Spawn Delay logging ON +// + +void main() +{ + object oArea = GetArea(OBJECT_SELF); + SetLocalInt(oArea, "SpawnCountDebug", TRUE); + SendMessageToAllDMs("Spawn count logging enabled"); +} diff --git a/_module/nss/spawnb_sc_sdlog.nss b/_module/nss/spawnb_sc_sdlog.nss new file mode 100644 index 0000000..af01c76 --- /dev/null +++ b/_module/nss/spawnb_sc_sdlog.nss @@ -0,0 +1,11 @@ +// +// Spawn Banner +// Turn Spawn Delay logging ON +// + +void main() +{ + object oArea = GetArea(OBJECT_SELF); + SetLocalInt(oArea, "SpawnDelayDebug", TRUE); + SendMessageToAllDMs("Spawn delay logging enabled"); +} diff --git a/_module/nss/spawnb_sc_snclog.nss b/_module/nss/spawnb_sc_snclog.nss new file mode 100644 index 0000000..8dcfeaa --- /dev/null +++ b/_module/nss/spawnb_sc_snclog.nss @@ -0,0 +1,11 @@ +// +// Spawn Banner +// Turn Spawn Delay logging ON +// + +void main() +{ + object oArea = GetArea(OBJECT_SELF); + SetLocalInt(oArea, "SpawnCountDebug", FALSE); + SendMessageToAllDMs("Spawn count logging disable"); +} diff --git a/_module/nss/spawnb_sc_trck.nss b/_module/nss/spawnb_sc_trck.nss new file mode 100644 index 0000000..bec821e --- /dev/null +++ b/_module/nss/spawnb_sc_trck.nss @@ -0,0 +1,12 @@ +// +// Spawn Banner +// Turn Spawn Tracking ON +// + +#include "spawn_functions" + +void main() +{ + NESS_TrackModuleSpawns(); + SendMessageToAllDMs("Spawn tracking enabled"); +} diff --git a/_module/nss/spawnbanner.nss b/_module/nss/spawnbanner.nss new file mode 100644 index 0000000..bcfd978 --- /dev/null +++ b/_module/nss/spawnbanner.nss @@ -0,0 +1,20 @@ +// +// SpawnBanner : Sample OnActivateItem Script +// +#include "x2_inc_switches" +#include "spawnb_main" +void main() +{ + int nResult = X2_EXECUTE_SCRIPT_END; + + if ( GetUserDefinedItemEventNumber() == X2_ITEM_EVENT_ACTIVATE ) + { + object oPC = GetItemActivator(); + object oItem = GetItemActivated(); + object oTarget = GetItemActivatedTarget(); + location lTarget = GetItemActivatedTargetLocation(); + SpawnBanner(oPC, oItem, oTarget, lTarget); + } + SetExecutedScriptReturnValue(nResult); +} + diff --git a/_module/uti/spawn_ban_rod.uti.json b/_module/uti/spawn_ban_rod.uti.json new file mode 100644 index 0000000..09b6991 --- /dev/null +++ b/_module/uti/spawn_ban_rod.uti.json @@ -0,0 +1,121 @@ +{ + "__data_type": "UTI ", + "AddCost": { + "type": "dword", + "value": 0 + }, + "BaseItem": { + "type": "int", + "value": 44 + }, + "Charges": { + "type": "byte", + "value": 50 + }, + "Comment": { + "type": "cexostring", + "value": "" + }, + "Cost": { + "type": "dword", + "value": 4 + }, + "Cursed": { + "type": "byte", + "value": 0 + }, + "DescIdentified": { + "type": "cexolocstring", + "value": { + "0": "The Rod of Spawn Banners allows you to control spawnpoints from Neshke's Extendable Spawn System.\n\nUse on the ground to Show/Hide Spawn Banners.\n\nUse on a Banner to control that spawnpoint." + } + }, + "Description": { + "type": "cexolocstring", + "value": { + "0": "" + } + }, + "Identified": { + "type": "byte", + "value": 1 + }, + "LocalizedName": { + "type": "cexolocstring", + "value": { + "0": "Rod of Spawn Banners" + } + }, + "ModelPart1": { + "type": "byte", + "value": 33 + }, + "ModelPart2": { + "type": "byte", + "value": 43 + }, + "ModelPart3": { + "type": "byte", + "value": 43 + }, + "PaletteID": { + "type": "byte", + "value": 23 + }, + "Plot": { + "type": "byte", + "value": 1 + }, + "PropertiesList": { + "type": "list", + "value": [ + { + "__struct_id": 0, + "ChanceAppear": { + "type": "byte", + "value": 100 + }, + "CostTable": { + "type": "byte", + "value": 3 + }, + "CostValue": { + "type": "word", + "value": 13 + }, + "Param1": { + "type": "byte", + "value": 255 + }, + "Param1Value": { + "type": "byte", + "value": 0 + }, + "PropertyName": { + "type": "word", + "value": 15 + }, + "Subtype": { + "type": "word", + "value": 329 + } + } + ] + }, + "StackSize": { + "type": "word", + "value": 1 + }, + "Stolen": { + "type": "byte", + "value": 0 + }, + "Tag": { + "type": "cexostring", + "value": "SpawnBanner" + }, + "TemplateResRef": { + "type": "resref", + "value": "spawn_ban_rod" + } +} diff --git a/_module/utp/invis_corpse_bdy.utp.json b/_module/utp/invis_corpse_bdy.utp.json new file mode 100644 index 0000000..d859b4f --- /dev/null +++ b/_module/utp/invis_corpse_bdy.utp.json @@ -0,0 +1,213 @@ +{ + "__data_type": "UTP ", + "AnimationState": { + "type": "byte", + "value": 0 + }, + "Appearance": { + "type": "dword", + "value": 157 + }, + "AutoRemoveKey": { + "type": "byte", + "value": 0 + }, + "BodyBag": { + "type": "byte", + "value": 4 + }, + "CloseLockDC": { + "type": "byte", + "value": 0 + }, + "Comment": { + "type": "cexostring", + "value": "" + }, + "Conversation": { + "type": "resref", + "value": "" + }, + "CurrentHP": { + "type": "short", + "value": 10 + }, + "Description": { + "type": "cexolocstring", + "value": {} + }, + "DisarmDC": { + "type": "byte", + "value": 0 + }, + "Faction": { + "type": "dword", + "value": 1 + }, + "Fort": { + "type": "byte", + "value": 5 + }, + "Hardness": { + "type": "byte", + "value": 5 + }, + "HasInventory": { + "type": "byte", + "value": 1 + }, + "HP": { + "type": "short", + "value": 10 + }, + "Interruptable": { + "type": "byte", + "value": 1 + }, + "KeyName": { + "type": "cexostring", + "value": "" + }, + "KeyRequired": { + "type": "byte", + "value": 0 + }, + "Lockable": { + "type": "byte", + "value": 0 + }, + "Locked": { + "type": "byte", + "value": 0 + }, + "LocName": { + "type": "cexolocstring", + "value": { + "0": "corpse" + } + }, + "OnClosed": { + "type": "resref", + "value": "spawn_oncloscrp" + }, + "OnDamaged": { + "type": "resref", + "value": "" + }, + "OnDeath": { + "type": "resref", + "value": "" + }, + "OnDisarm": { + "type": "resref", + "value": "" + }, + "OnHeartbeat": { + "type": "resref", + "value": "" + }, + "OnInvDisturbed": { + "type": "resref", + "value": "spawn_dist_corps" + }, + "OnLock": { + "type": "resref", + "value": "" + }, + "OnMeleeAttacked": { + "type": "resref", + "value": "" + }, + "OnOpen": { + "type": "resref", + "value": "spawn_onopencrp" + }, + "OnSpellCastAt": { + "type": "resref", + "value": "" + }, + "OnTrapTriggered": { + "type": "resref", + "value": "" + }, + "OnUnlock": { + "type": "resref", + "value": "" + }, + "OnUsed": { + "type": "resref", + "value": "" + }, + "OnUserDefined": { + "type": "resref", + "value": "" + }, + "OpenLockDC": { + "type": "byte", + "value": 0 + }, + "PaletteID": { + "type": "byte", + "value": 6 + }, + "Plot": { + "type": "byte", + "value": 1 + }, + "PortraitId": { + "type": "word", + "value": 515 + }, + "Ref": { + "type": "byte", + "value": 0 + }, + "Static": { + "type": "byte", + "value": 0 + }, + "Tag": { + "type": "cexostring", + "value": "invis_corpse_obj" + }, + "TemplateResRef": { + "type": "resref", + "value": "invis_corpse_bdy" + }, + "TrapDetectable": { + "type": "byte", + "value": 1 + }, + "TrapDetectDC": { + "type": "byte", + "value": 0 + }, + "TrapDisarmable": { + "type": "byte", + "value": 1 + }, + "TrapFlag": { + "type": "byte", + "value": 0 + }, + "TrapOneShot": { + "type": "byte", + "value": 1 + }, + "TrapType": { + "type": "byte", + "value": 0 + }, + "Type": { + "type": "byte", + "value": 0 + }, + "Useable": { + "type": "byte", + "value": 1 + }, + "Will": { + "type": "byte", + "value": 0 + } +} diff --git a/_module/utp/invis_corpse_bon.utp.json b/_module/utp/invis_corpse_bon.utp.json new file mode 100644 index 0000000..f8436f4 --- /dev/null +++ b/_module/utp/invis_corpse_bon.utp.json @@ -0,0 +1,213 @@ +{ + "__data_type": "UTP ", + "AnimationState": { + "type": "byte", + "value": 0 + }, + "Appearance": { + "type": "dword", + "value": 157 + }, + "AutoRemoveKey": { + "type": "byte", + "value": 0 + }, + "BodyBag": { + "type": "byte", + "value": 5 + }, + "CloseLockDC": { + "type": "byte", + "value": 0 + }, + "Comment": { + "type": "cexostring", + "value": "" + }, + "Conversation": { + "type": "resref", + "value": "" + }, + "CurrentHP": { + "type": "short", + "value": 10 + }, + "Description": { + "type": "cexolocstring", + "value": {} + }, + "DisarmDC": { + "type": "byte", + "value": 0 + }, + "Faction": { + "type": "dword", + "value": 1 + }, + "Fort": { + "type": "byte", + "value": 5 + }, + "Hardness": { + "type": "byte", + "value": 5 + }, + "HasInventory": { + "type": "byte", + "value": 1 + }, + "HP": { + "type": "short", + "value": 10 + }, + "Interruptable": { + "type": "byte", + "value": 1 + }, + "KeyName": { + "type": "cexostring", + "value": "" + }, + "KeyRequired": { + "type": "byte", + "value": 0 + }, + "Lockable": { + "type": "byte", + "value": 0 + }, + "Locked": { + "type": "byte", + "value": 0 + }, + "LocName": { + "type": "cexolocstring", + "value": { + "0": "corpse" + } + }, + "OnClosed": { + "type": "resref", + "value": "spawn_oncloscrp" + }, + "OnDamaged": { + "type": "resref", + "value": "" + }, + "OnDeath": { + "type": "resref", + "value": "" + }, + "OnDisarm": { + "type": "resref", + "value": "" + }, + "OnHeartbeat": { + "type": "resref", + "value": "" + }, + "OnInvDisturbed": { + "type": "resref", + "value": "spawn_dist_corps" + }, + "OnLock": { + "type": "resref", + "value": "" + }, + "OnMeleeAttacked": { + "type": "resref", + "value": "" + }, + "OnOpen": { + "type": "resref", + "value": "spawn_onopencrp" + }, + "OnSpellCastAt": { + "type": "resref", + "value": "" + }, + "OnTrapTriggered": { + "type": "resref", + "value": "" + }, + "OnUnlock": { + "type": "resref", + "value": "" + }, + "OnUsed": { + "type": "resref", + "value": "" + }, + "OnUserDefined": { + "type": "resref", + "value": "" + }, + "OpenLockDC": { + "type": "byte", + "value": 0 + }, + "PaletteID": { + "type": "byte", + "value": 6 + }, + "Plot": { + "type": "byte", + "value": 1 + }, + "PortraitId": { + "type": "word", + "value": 515 + }, + "Ref": { + "type": "byte", + "value": 0 + }, + "Static": { + "type": "byte", + "value": 0 + }, + "Tag": { + "type": "cexostring", + "value": "invis_corpse_obj" + }, + "TemplateResRef": { + "type": "resref", + "value": "invis_corpse_bon" + }, + "TrapDetectable": { + "type": "byte", + "value": 1 + }, + "TrapDetectDC": { + "type": "byte", + "value": 0 + }, + "TrapDisarmable": { + "type": "byte", + "value": 1 + }, + "TrapFlag": { + "type": "byte", + "value": 0 + }, + "TrapOneShot": { + "type": "byte", + "value": 1 + }, + "TrapType": { + "type": "byte", + "value": 0 + }, + "Type": { + "type": "byte", + "value": 0 + }, + "Useable": { + "type": "byte", + "value": 1 + }, + "Will": { + "type": "byte", + "value": 0 + } +} diff --git a/_module/utp/invis_corpse_obj.utp.json b/_module/utp/invis_corpse_obj.utp.json new file mode 100644 index 0000000..3424e3c --- /dev/null +++ b/_module/utp/invis_corpse_obj.utp.json @@ -0,0 +1,213 @@ +{ + "__data_type": "UTP ", + "AnimationState": { + "type": "byte", + "value": 0 + }, + "Appearance": { + "type": "dword", + "value": 157 + }, + "AutoRemoveKey": { + "type": "byte", + "value": 0 + }, + "BodyBag": { + "type": "byte", + "value": 0 + }, + "CloseLockDC": { + "type": "byte", + "value": 0 + }, + "Comment": { + "type": "cexostring", + "value": "" + }, + "Conversation": { + "type": "resref", + "value": "" + }, + "CurrentHP": { + "type": "short", + "value": 10 + }, + "Description": { + "type": "cexolocstring", + "value": {} + }, + "DisarmDC": { + "type": "byte", + "value": 0 + }, + "Faction": { + "type": "dword", + "value": 1 + }, + "Fort": { + "type": "byte", + "value": 5 + }, + "Hardness": { + "type": "byte", + "value": 5 + }, + "HasInventory": { + "type": "byte", + "value": 1 + }, + "HP": { + "type": "short", + "value": 10 + }, + "Interruptable": { + "type": "byte", + "value": 1 + }, + "KeyName": { + "type": "cexostring", + "value": "" + }, + "KeyRequired": { + "type": "byte", + "value": 0 + }, + "Lockable": { + "type": "byte", + "value": 0 + }, + "Locked": { + "type": "byte", + "value": 0 + }, + "LocName": { + "type": "cexolocstring", + "value": { + "0": "corpse" + } + }, + "OnClosed": { + "type": "resref", + "value": "spawn_oncloscrp" + }, + "OnDamaged": { + "type": "resref", + "value": "" + }, + "OnDeath": { + "type": "resref", + "value": "" + }, + "OnDisarm": { + "type": "resref", + "value": "" + }, + "OnHeartbeat": { + "type": "resref", + "value": "" + }, + "OnInvDisturbed": { + "type": "resref", + "value": "spawn_dist_corps" + }, + "OnLock": { + "type": "resref", + "value": "" + }, + "OnMeleeAttacked": { + "type": "resref", + "value": "" + }, + "OnOpen": { + "type": "resref", + "value": "spawn_onopencrp" + }, + "OnSpellCastAt": { + "type": "resref", + "value": "" + }, + "OnTrapTriggered": { + "type": "resref", + "value": "" + }, + "OnUnlock": { + "type": "resref", + "value": "" + }, + "OnUsed": { + "type": "resref", + "value": "" + }, + "OnUserDefined": { + "type": "resref", + "value": "" + }, + "OpenLockDC": { + "type": "byte", + "value": 0 + }, + "PaletteID": { + "type": "byte", + "value": 6 + }, + "Plot": { + "type": "byte", + "value": 1 + }, + "PortraitId": { + "type": "word", + "value": 515 + }, + "Ref": { + "type": "byte", + "value": 0 + }, + "Static": { + "type": "byte", + "value": 0 + }, + "Tag": { + "type": "cexostring", + "value": "invis_corpse_obj" + }, + "TemplateResRef": { + "type": "resref", + "value": "invis_corpse_obj" + }, + "TrapDetectable": { + "type": "byte", + "value": 1 + }, + "TrapDetectDC": { + "type": "byte", + "value": 0 + }, + "TrapDisarmable": { + "type": "byte", + "value": 1 + }, + "TrapFlag": { + "type": "byte", + "value": 0 + }, + "TrapOneShot": { + "type": "byte", + "value": 1 + }, + "TrapType": { + "type": "byte", + "value": 0 + }, + "Type": { + "type": "byte", + "value": 0 + }, + "Useable": { + "type": "byte", + "value": 1 + }, + "Will": { + "type": "byte", + "value": 0 + } +} diff --git a/_module/utp/invis_corpse_pch.utp.json b/_module/utp/invis_corpse_pch.utp.json new file mode 100644 index 0000000..2c34a17 --- /dev/null +++ b/_module/utp/invis_corpse_pch.utp.json @@ -0,0 +1,213 @@ +{ + "__data_type": "UTP ", + "AnimationState": { + "type": "byte", + "value": 0 + }, + "Appearance": { + "type": "dword", + "value": 157 + }, + "AutoRemoveKey": { + "type": "byte", + "value": 0 + }, + "BodyBag": { + "type": "byte", + "value": 6 + }, + "CloseLockDC": { + "type": "byte", + "value": 0 + }, + "Comment": { + "type": "cexostring", + "value": "" + }, + "Conversation": { + "type": "resref", + "value": "" + }, + "CurrentHP": { + "type": "short", + "value": 10 + }, + "Description": { + "type": "cexolocstring", + "value": {} + }, + "DisarmDC": { + "type": "byte", + "value": 0 + }, + "Faction": { + "type": "dword", + "value": 1 + }, + "Fort": { + "type": "byte", + "value": 5 + }, + "Hardness": { + "type": "byte", + "value": 5 + }, + "HasInventory": { + "type": "byte", + "value": 1 + }, + "HP": { + "type": "short", + "value": 10 + }, + "Interruptable": { + "type": "byte", + "value": 1 + }, + "KeyName": { + "type": "cexostring", + "value": "" + }, + "KeyRequired": { + "type": "byte", + "value": 0 + }, + "Lockable": { + "type": "byte", + "value": 0 + }, + "Locked": { + "type": "byte", + "value": 0 + }, + "LocName": { + "type": "cexolocstring", + "value": { + "0": "corpse" + } + }, + "OnClosed": { + "type": "resref", + "value": "spawn_oncloscrp" + }, + "OnDamaged": { + "type": "resref", + "value": "" + }, + "OnDeath": { + "type": "resref", + "value": "" + }, + "OnDisarm": { + "type": "resref", + "value": "" + }, + "OnHeartbeat": { + "type": "resref", + "value": "" + }, + "OnInvDisturbed": { + "type": "resref", + "value": "spawn_dist_corps" + }, + "OnLock": { + "type": "resref", + "value": "" + }, + "OnMeleeAttacked": { + "type": "resref", + "value": "" + }, + "OnOpen": { + "type": "resref", + "value": "spawn_onopencrp" + }, + "OnSpellCastAt": { + "type": "resref", + "value": "" + }, + "OnTrapTriggered": { + "type": "resref", + "value": "" + }, + "OnUnlock": { + "type": "resref", + "value": "" + }, + "OnUsed": { + "type": "resref", + "value": "" + }, + "OnUserDefined": { + "type": "resref", + "value": "" + }, + "OpenLockDC": { + "type": "byte", + "value": 0 + }, + "PaletteID": { + "type": "byte", + "value": 6 + }, + "Plot": { + "type": "byte", + "value": 1 + }, + "PortraitId": { + "type": "word", + "value": 515 + }, + "Ref": { + "type": "byte", + "value": 0 + }, + "Static": { + "type": "byte", + "value": 0 + }, + "Tag": { + "type": "cexostring", + "value": "invis_corpse_obj" + }, + "TemplateResRef": { + "type": "resref", + "value": "invis_corpse_pch" + }, + "TrapDetectable": { + "type": "byte", + "value": 1 + }, + "TrapDetectDC": { + "type": "byte", + "value": 0 + }, + "TrapDisarmable": { + "type": "byte", + "value": 1 + }, + "TrapFlag": { + "type": "byte", + "value": 0 + }, + "TrapOneShot": { + "type": "byte", + "value": 1 + }, + "TrapType": { + "type": "byte", + "value": 0 + }, + "Type": { + "type": "byte", + "value": 0 + }, + "Useable": { + "type": "byte", + "value": 1 + }, + "Will": { + "type": "byte", + "value": 0 + } +} diff --git a/_module/utp/invis_corpse_pot.utp.json b/_module/utp/invis_corpse_pot.utp.json new file mode 100644 index 0000000..be3270e --- /dev/null +++ b/_module/utp/invis_corpse_pot.utp.json @@ -0,0 +1,213 @@ +{ + "__data_type": "UTP ", + "AnimationState": { + "type": "byte", + "value": 0 + }, + "Appearance": { + "type": "dword", + "value": 157 + }, + "AutoRemoveKey": { + "type": "byte", + "value": 0 + }, + "BodyBag": { + "type": "byte", + "value": 1 + }, + "CloseLockDC": { + "type": "byte", + "value": 0 + }, + "Comment": { + "type": "cexostring", + "value": "" + }, + "Conversation": { + "type": "resref", + "value": "" + }, + "CurrentHP": { + "type": "short", + "value": 10 + }, + "Description": { + "type": "cexolocstring", + "value": {} + }, + "DisarmDC": { + "type": "byte", + "value": 0 + }, + "Faction": { + "type": "dword", + "value": 1 + }, + "Fort": { + "type": "byte", + "value": 5 + }, + "Hardness": { + "type": "byte", + "value": 5 + }, + "HasInventory": { + "type": "byte", + "value": 1 + }, + "HP": { + "type": "short", + "value": 10 + }, + "Interruptable": { + "type": "byte", + "value": 1 + }, + "KeyName": { + "type": "cexostring", + "value": "" + }, + "KeyRequired": { + "type": "byte", + "value": 0 + }, + "Lockable": { + "type": "byte", + "value": 0 + }, + "Locked": { + "type": "byte", + "value": 0 + }, + "LocName": { + "type": "cexolocstring", + "value": { + "0": "corpse" + } + }, + "OnClosed": { + "type": "resref", + "value": "spawn_oncloscrp" + }, + "OnDamaged": { + "type": "resref", + "value": "" + }, + "OnDeath": { + "type": "resref", + "value": "" + }, + "OnDisarm": { + "type": "resref", + "value": "" + }, + "OnHeartbeat": { + "type": "resref", + "value": "" + }, + "OnInvDisturbed": { + "type": "resref", + "value": "spawn_dist_corps" + }, + "OnLock": { + "type": "resref", + "value": "" + }, + "OnMeleeAttacked": { + "type": "resref", + "value": "" + }, + "OnOpen": { + "type": "resref", + "value": "spawn_onopencrp" + }, + "OnSpellCastAt": { + "type": "resref", + "value": "" + }, + "OnTrapTriggered": { + "type": "resref", + "value": "" + }, + "OnUnlock": { + "type": "resref", + "value": "" + }, + "OnUsed": { + "type": "resref", + "value": "" + }, + "OnUserDefined": { + "type": "resref", + "value": "" + }, + "OpenLockDC": { + "type": "byte", + "value": 0 + }, + "PaletteID": { + "type": "byte", + "value": 6 + }, + "Plot": { + "type": "byte", + "value": 1 + }, + "PortraitId": { + "type": "word", + "value": 515 + }, + "Ref": { + "type": "byte", + "value": 0 + }, + "Static": { + "type": "byte", + "value": 0 + }, + "Tag": { + "type": "cexostring", + "value": "invis_corpse_obj" + }, + "TemplateResRef": { + "type": "resref", + "value": "invis_corpse_pot" + }, + "TrapDetectable": { + "type": "byte", + "value": 1 + }, + "TrapDetectDC": { + "type": "byte", + "value": 0 + }, + "TrapDisarmable": { + "type": "byte", + "value": 1 + }, + "TrapFlag": { + "type": "byte", + "value": 0 + }, + "TrapOneShot": { + "type": "byte", + "value": 1 + }, + "TrapType": { + "type": "byte", + "value": 0 + }, + "Type": { + "type": "byte", + "value": 0 + }, + "Useable": { + "type": "byte", + "value": 1 + }, + "Will": { + "type": "byte", + "value": 0 + } +} diff --git a/_module/utp/invis_corpse_scr.utp.json b/_module/utp/invis_corpse_scr.utp.json new file mode 100644 index 0000000..70c5906 --- /dev/null +++ b/_module/utp/invis_corpse_scr.utp.json @@ -0,0 +1,213 @@ +{ + "__data_type": "UTP ", + "AnimationState": { + "type": "byte", + "value": 0 + }, + "Appearance": { + "type": "dword", + "value": 157 + }, + "AutoRemoveKey": { + "type": "byte", + "value": 0 + }, + "BodyBag": { + "type": "byte", + "value": 2 + }, + "CloseLockDC": { + "type": "byte", + "value": 0 + }, + "Comment": { + "type": "cexostring", + "value": "" + }, + "Conversation": { + "type": "resref", + "value": "" + }, + "CurrentHP": { + "type": "short", + "value": 10 + }, + "Description": { + "type": "cexolocstring", + "value": {} + }, + "DisarmDC": { + "type": "byte", + "value": 0 + }, + "Faction": { + "type": "dword", + "value": 1 + }, + "Fort": { + "type": "byte", + "value": 5 + }, + "Hardness": { + "type": "byte", + "value": 5 + }, + "HasInventory": { + "type": "byte", + "value": 1 + }, + "HP": { + "type": "short", + "value": 10 + }, + "Interruptable": { + "type": "byte", + "value": 1 + }, + "KeyName": { + "type": "cexostring", + "value": "" + }, + "KeyRequired": { + "type": "byte", + "value": 0 + }, + "Lockable": { + "type": "byte", + "value": 0 + }, + "Locked": { + "type": "byte", + "value": 0 + }, + "LocName": { + "type": "cexolocstring", + "value": { + "0": "corpse" + } + }, + "OnClosed": { + "type": "resref", + "value": "spawn_oncloscrp" + }, + "OnDamaged": { + "type": "resref", + "value": "" + }, + "OnDeath": { + "type": "resref", + "value": "" + }, + "OnDisarm": { + "type": "resref", + "value": "" + }, + "OnHeartbeat": { + "type": "resref", + "value": "" + }, + "OnInvDisturbed": { + "type": "resref", + "value": "spawn_dist_corps" + }, + "OnLock": { + "type": "resref", + "value": "" + }, + "OnMeleeAttacked": { + "type": "resref", + "value": "" + }, + "OnOpen": { + "type": "resref", + "value": "spawn_onopencrp" + }, + "OnSpellCastAt": { + "type": "resref", + "value": "" + }, + "OnTrapTriggered": { + "type": "resref", + "value": "" + }, + "OnUnlock": { + "type": "resref", + "value": "" + }, + "OnUsed": { + "type": "resref", + "value": "" + }, + "OnUserDefined": { + "type": "resref", + "value": "" + }, + "OpenLockDC": { + "type": "byte", + "value": 0 + }, + "PaletteID": { + "type": "byte", + "value": 6 + }, + "Plot": { + "type": "byte", + "value": 1 + }, + "PortraitId": { + "type": "word", + "value": 515 + }, + "Ref": { + "type": "byte", + "value": 0 + }, + "Static": { + "type": "byte", + "value": 0 + }, + "Tag": { + "type": "cexostring", + "value": "invis_corpse_obj" + }, + "TemplateResRef": { + "type": "resref", + "value": "invis_corpse_scr" + }, + "TrapDetectable": { + "type": "byte", + "value": 1 + }, + "TrapDetectDC": { + "type": "byte", + "value": 0 + }, + "TrapDisarmable": { + "type": "byte", + "value": 1 + }, + "TrapFlag": { + "type": "byte", + "value": 0 + }, + "TrapOneShot": { + "type": "byte", + "value": 1 + }, + "TrapType": { + "type": "byte", + "value": 0 + }, + "Type": { + "type": "byte", + "value": 0 + }, + "Useable": { + "type": "byte", + "value": 1 + }, + "Will": { + "type": "byte", + "value": 0 + } +} diff --git a/_module/utp/invis_corpse_tre.utp.json b/_module/utp/invis_corpse_tre.utp.json new file mode 100644 index 0000000..80bf189 --- /dev/null +++ b/_module/utp/invis_corpse_tre.utp.json @@ -0,0 +1,213 @@ +{ + "__data_type": "UTP ", + "AnimationState": { + "type": "byte", + "value": 0 + }, + "Appearance": { + "type": "dword", + "value": 157 + }, + "AutoRemoveKey": { + "type": "byte", + "value": 0 + }, + "BodyBag": { + "type": "byte", + "value": 3 + }, + "CloseLockDC": { + "type": "byte", + "value": 0 + }, + "Comment": { + "type": "cexostring", + "value": "" + }, + "Conversation": { + "type": "resref", + "value": "" + }, + "CurrentHP": { + "type": "short", + "value": 10 + }, + "Description": { + "type": "cexolocstring", + "value": {} + }, + "DisarmDC": { + "type": "byte", + "value": 0 + }, + "Faction": { + "type": "dword", + "value": 1 + }, + "Fort": { + "type": "byte", + "value": 5 + }, + "Hardness": { + "type": "byte", + "value": 5 + }, + "HasInventory": { + "type": "byte", + "value": 1 + }, + "HP": { + "type": "short", + "value": 10 + }, + "Interruptable": { + "type": "byte", + "value": 1 + }, + "KeyName": { + "type": "cexostring", + "value": "" + }, + "KeyRequired": { + "type": "byte", + "value": 0 + }, + "Lockable": { + "type": "byte", + "value": 0 + }, + "Locked": { + "type": "byte", + "value": 0 + }, + "LocName": { + "type": "cexolocstring", + "value": { + "0": "corpse" + } + }, + "OnClosed": { + "type": "resref", + "value": "spawn_oncloscrp" + }, + "OnDamaged": { + "type": "resref", + "value": "" + }, + "OnDeath": { + "type": "resref", + "value": "" + }, + "OnDisarm": { + "type": "resref", + "value": "" + }, + "OnHeartbeat": { + "type": "resref", + "value": "" + }, + "OnInvDisturbed": { + "type": "resref", + "value": "spawn_dist_corps" + }, + "OnLock": { + "type": "resref", + "value": "" + }, + "OnMeleeAttacked": { + "type": "resref", + "value": "" + }, + "OnOpen": { + "type": "resref", + "value": "spawn_onopencrp" + }, + "OnSpellCastAt": { + "type": "resref", + "value": "" + }, + "OnTrapTriggered": { + "type": "resref", + "value": "" + }, + "OnUnlock": { + "type": "resref", + "value": "" + }, + "OnUsed": { + "type": "resref", + "value": "" + }, + "OnUserDefined": { + "type": "resref", + "value": "" + }, + "OpenLockDC": { + "type": "byte", + "value": 0 + }, + "PaletteID": { + "type": "byte", + "value": 6 + }, + "Plot": { + "type": "byte", + "value": 1 + }, + "PortraitId": { + "type": "word", + "value": 515 + }, + "Ref": { + "type": "byte", + "value": 0 + }, + "Static": { + "type": "byte", + "value": 0 + }, + "Tag": { + "type": "cexostring", + "value": "invis_corpse_obj" + }, + "TemplateResRef": { + "type": "resref", + "value": "invis_corpse_tre" + }, + "TrapDetectable": { + "type": "byte", + "value": 1 + }, + "TrapDetectDC": { + "type": "byte", + "value": 0 + }, + "TrapDisarmable": { + "type": "byte", + "value": 1 + }, + "TrapFlag": { + "type": "byte", + "value": 0 + }, + "TrapOneShot": { + "type": "byte", + "value": 1 + }, + "TrapType": { + "type": "byte", + "value": 0 + }, + "Type": { + "type": "byte", + "value": 0 + }, + "Useable": { + "type": "byte", + "value": 1 + }, + "Will": { + "type": "byte", + "value": 0 + } +} diff --git a/_module/utp/spawn_ban_a.utp.json b/_module/utp/spawn_ban_a.utp.json new file mode 100644 index 0000000..6b491aa --- /dev/null +++ b/_module/utp/spawn_ban_a.utp.json @@ -0,0 +1,217 @@ +{ + "__data_type": "UTP ", + "AnimationState": { + "type": "byte", + "value": 0 + }, + "Appearance": { + "type": "dword", + "value": 132 + }, + "AutoRemoveKey": { + "type": "byte", + "value": 0 + }, + "BodyBag": { + "type": "byte", + "value": 0 + }, + "CloseLockDC": { + "type": "byte", + "value": 0 + }, + "Comment": { + "type": "cexostring", + "value": "Freestanding Merchant's Placard - 3" + }, + "Conversation": { + "type": "resref", + "value": "" + }, + "CurrentHP": { + "type": "short", + "value": 15 + }, + "Description": { + "type": "cexolocstring", + "value": { + "0": "A carefully constructed marker denoting a point of interest.", + "id": 14690 + } + }, + "DisarmDC": { + "type": "byte", + "value": 15 + }, + "Faction": { + "type": "dword", + "value": 4294967295 + }, + "Fort": { + "type": "byte", + "value": 16 + }, + "Hardness": { + "type": "byte", + "value": 5 + }, + "HasInventory": { + "type": "byte", + "value": 0 + }, + "HP": { + "type": "short", + "value": 15 + }, + "Interruptable": { + "type": "byte", + "value": 1 + }, + "KeyName": { + "type": "cexostring", + "value": "" + }, + "KeyRequired": { + "type": "byte", + "value": 0 + }, + "Lockable": { + "type": "byte", + "value": 0 + }, + "Locked": { + "type": "byte", + "value": 0 + }, + "LocName": { + "type": "cexolocstring", + "value": { + "0": "Active Spawn", + "id": 14688 + } + }, + "OnClosed": { + "type": "resref", + "value": "" + }, + "OnDamaged": { + "type": "resref", + "value": "" + }, + "OnDeath": { + "type": "resref", + "value": "" + }, + "OnDisarm": { + "type": "resref", + "value": "" + }, + "OnHeartbeat": { + "type": "resref", + "value": "" + }, + "OnInvDisturbed": { + "type": "resref", + "value": "" + }, + "OnLock": { + "type": "resref", + "value": "" + }, + "OnMeleeAttacked": { + "type": "resref", + "value": "" + }, + "OnOpen": { + "type": "resref", + "value": "" + }, + "OnSpellCastAt": { + "type": "resref", + "value": "" + }, + "OnTrapTriggered": { + "type": "resref", + "value": "" + }, + "OnUnlock": { + "type": "resref", + "value": "" + }, + "OnUsed": { + "type": "resref", + "value": "spawnb_sc_disp" + }, + "OnUserDefined": { + "type": "resref", + "value": "" + }, + "OpenLockDC": { + "type": "byte", + "value": 18 + }, + "PaletteID": { + "type": "byte", + "value": 12 + }, + "Plot": { + "type": "byte", + "value": 1 + }, + "PortraitId": { + "type": "word", + "value": 490 + }, + "Ref": { + "type": "byte", + "value": 0 + }, + "Static": { + "type": "byte", + "value": 0 + }, + "Tag": { + "type": "cexostring", + "value": "SpawnBanner" + }, + "TemplateResRef": { + "type": "resref", + "value": "spawn_ban_a" + }, + "TrapDetectable": { + "type": "byte", + "value": 1 + }, + "TrapDetectDC": { + "type": "byte", + "value": 0 + }, + "TrapDisarmable": { + "type": "byte", + "value": 1 + }, + "TrapFlag": { + "type": "byte", + "value": 0 + }, + "TrapOneShot": { + "type": "byte", + "value": 1 + }, + "TrapType": { + "type": "byte", + "value": 0 + }, + "Type": { + "type": "byte", + "value": 0 + }, + "Useable": { + "type": "byte", + "value": 1 + }, + "Will": { + "type": "byte", + "value": 0 + } +} diff --git a/_module/utp/spawn_ban_d.utp.json b/_module/utp/spawn_ban_d.utp.json new file mode 100644 index 0000000..652ab84 --- /dev/null +++ b/_module/utp/spawn_ban_d.utp.json @@ -0,0 +1,217 @@ +{ + "__data_type": "UTP ", + "AnimationState": { + "type": "byte", + "value": 0 + }, + "Appearance": { + "type": "dword", + "value": 136 + }, + "AutoRemoveKey": { + "type": "byte", + "value": 0 + }, + "BodyBag": { + "type": "byte", + "value": 0 + }, + "CloseLockDC": { + "type": "byte", + "value": 0 + }, + "Comment": { + "type": "cexostring", + "value": "Freestanding Merchant's Placard - 3" + }, + "Conversation": { + "type": "resref", + "value": "" + }, + "CurrentHP": { + "type": "short", + "value": 15 + }, + "Description": { + "type": "cexolocstring", + "value": { + "0": "A carefully constructed marker denoting a point of interest.", + "id": 14690 + } + }, + "DisarmDC": { + "type": "byte", + "value": 15 + }, + "Faction": { + "type": "dword", + "value": 4294967295 + }, + "Fort": { + "type": "byte", + "value": 16 + }, + "Hardness": { + "type": "byte", + "value": 5 + }, + "HasInventory": { + "type": "byte", + "value": 0 + }, + "HP": { + "type": "short", + "value": 15 + }, + "Interruptable": { + "type": "byte", + "value": 1 + }, + "KeyName": { + "type": "cexostring", + "value": "" + }, + "KeyRequired": { + "type": "byte", + "value": 0 + }, + "Lockable": { + "type": "byte", + "value": 0 + }, + "Locked": { + "type": "byte", + "value": 0 + }, + "LocName": { + "type": "cexolocstring", + "value": { + "0": "Deactivated Spawn", + "id": 14688 + } + }, + "OnClosed": { + "type": "resref", + "value": "" + }, + "OnDamaged": { + "type": "resref", + "value": "" + }, + "OnDeath": { + "type": "resref", + "value": "" + }, + "OnDisarm": { + "type": "resref", + "value": "" + }, + "OnHeartbeat": { + "type": "resref", + "value": "" + }, + "OnInvDisturbed": { + "type": "resref", + "value": "" + }, + "OnLock": { + "type": "resref", + "value": "" + }, + "OnMeleeAttacked": { + "type": "resref", + "value": "" + }, + "OnOpen": { + "type": "resref", + "value": "" + }, + "OnSpellCastAt": { + "type": "resref", + "value": "" + }, + "OnTrapTriggered": { + "type": "resref", + "value": "" + }, + "OnUnlock": { + "type": "resref", + "value": "" + }, + "OnUsed": { + "type": "resref", + "value": "spawnb_sc_disp" + }, + "OnUserDefined": { + "type": "resref", + "value": "" + }, + "OpenLockDC": { + "type": "byte", + "value": 18 + }, + "PaletteID": { + "type": "byte", + "value": 12 + }, + "Plot": { + "type": "byte", + "value": 1 + }, + "PortraitId": { + "type": "word", + "value": 494 + }, + "Ref": { + "type": "byte", + "value": 0 + }, + "Static": { + "type": "byte", + "value": 0 + }, + "Tag": { + "type": "cexostring", + "value": "SpawnBanner" + }, + "TemplateResRef": { + "type": "resref", + "value": "spawn_ban_d" + }, + "TrapDetectable": { + "type": "byte", + "value": 1 + }, + "TrapDetectDC": { + "type": "byte", + "value": 0 + }, + "TrapDisarmable": { + "type": "byte", + "value": 1 + }, + "TrapFlag": { + "type": "byte", + "value": 0 + }, + "TrapOneShot": { + "type": "byte", + "value": 1 + }, + "TrapType": { + "type": "byte", + "value": 0 + }, + "Type": { + "type": "byte", + "value": 0 + }, + "Useable": { + "type": "byte", + "value": 1 + }, + "Will": { + "type": "byte", + "value": 0 + } +} diff --git a/_release/Underworld 2 [PRC8-CEP3].7z b/_release/Underworld 2 [PRC8-CEP3].7z index 539d365..8908cce 100644 Binary files a/_release/Underworld 2 [PRC8-CEP3].7z and b/_release/Underworld 2 [PRC8-CEP3].7z differ