• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Build 12, runtime error

Bumpbert

Landlubber
I recently bought POTC, and downloaded Build 12 right away. It worked fine, but I died immediately after completing the tutorial. So I decided to give myself a boost by editing some values in buildsettings.

Then I downloaded some cheat files (a new "control" folder with "init_pc", and a new "seadogs" c file with the codes).

When I next started up POTC, I got this message:

"Runtime error!

Program: ...sBethesda SoftworksPirates of the CaribbeanENGINE.exe

abnormal program termination."

...

I restored my backup files to no avail.

I uninstalled POTC, and then reinstalled it. It worked, but Build 12 had been disabled! So I `re-downloaded` it, and after that arduous process, I ran POTC again, without editing a single buildsettings, seadogs, or start file -- and it showed the same error all over again!

I don't know what to do. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/unsure.gif" style="vertical-align:middle" emoid=":?" border="0" alt="unsure.gif" />
 
I set tracesfilesoff to 0 and found two log files created by the crash:

ERROR:

COMPILE ERROR - file: seadogs.c; line: 2
can't load file: events.h


and SYSTEM:

Scanning modules
Loading modules...
Loaded 0
Reset...
Initializing CORE...
Creating atoms space: 128
done
initializing complete
User Rised Exception
C:pROJECTSDRIVE_V2ENGINESOURCESCore.cpp line 526
fail to create program
 
The problem is that those "new" files that you downloaded overwrote some code that you need to run the Build.

The only way around this would be to reinstall the Build and then if you want those cheat files you'll have to edit the files manually to add the changes in.
 
A second reinstallation failed to correct the problem. The seadogs.c file looks like this, though: (there is one line break before it starts)
<!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->#include "events.h"
#include "globals.c"
#include "animals.c"
#include "sea_aisea.c"
#include "shipsships.c"
#include "EncountersEncounters.c"
#include "worldmapworldmap.c"
#include "locationslocations.c"
#include "Loc_aiLAi_init.c"
#include "storegoods.h"
#include "cannonscannons.c"
#include "nationsnations.c"
#include "particles.c"
#include "initinterface.c"
#include "characterscharacters.c"
#include "interfaceinterface.h"
#include "storestoreutilite.c"
#include "dialog.c"
#include "questsquests.c"
#include "islandsislands.c"
#include "reload.c"
#include "situations.c"
#include "battle_interfaceloginterface.c"
#include "calendar.c"
#include "teleport.c"
#include "utils.c"
#include "ITEMSitems.h"
#include "ITEMSitemLogic.c"
#include "ITEMSitems_utilite.c"
#include "weatherWhrWeather.c"
#include "controlscontrols.c"
#include "landencounterslandencounters.c"
#include "Reinit.c" // NK
#include "BuildSettings.h" // scheffnow - This is the renamed NK.c file
#include "modelsmodels.c" // scheffnow
#include "modelsinitModels.c" //scheffnow
#include "Charactersinitmonks.c" // scheffnow
#include "kam_generalfunctions.c" // added after build 11 by KAM
#include "kam_shipberthing_ship.c" // added after build 11 by KAM
#include "quicksave.c" // dchaley

extern void wdmInitWorldMap();
extern void InitGoods();
extern void InitStores();
extern void InitItems();
extern void InitCharactersTables();
extern void InitCharactersNames();
extern void CreateCharacters();
extern void ExecuteConsole(); // NK


// NK  so you see the defs that are in Utils.c -->
native float Bring2RangeNoCheck(float fMin1, float fMax1, float fMin2, float fMax2, float fValue);
native float Bring2Range(float fMin1, float fMax1, float fMin2, float fMax2, float fValue);
/*float Bring2Range(float fMin1, float fMax1, float fMin2, float fMax2, float fValue)
{
if(fValue < fMin2) { fValue = fMin2; }
if(fValue > fMax2) { fValue = fMax2; }
float fDelta = (fValue - fMin2) / (fMax2 - fMin2);
return fMin1 + fDelta * (fMax1 - fMin1);
}*/
native float Degree2Radian(float fDegree);
native float Clampf(float fValue);
/*float Clampf(float fClamp)
{
if(fClamp > 1.0) return 1.0;
if(fClamp < 0.0) return 0.0;
return fClamp;
}*/
// NK <--
native int RDTSC_B();
native int RDTSC_E(int iRDTSC);
#libriary "script_libriary_test"


#event_handler(NEW_GAME_EVENT,"NewGame");
#event_handler(GAME_OVER_EVENT,"GameOverE");
#event_handler("Control Activation","ProcessControls");
#event_handler("MainMenuKey","ProcessMainMenuKey");
#event_handler("InterfaceKey","ProcessInterfaceKey");
#event_handler("CameraPosAng","ProcessCameraPosAng");
#event_handler("Cheat","ProcessCheat");
#event_handler("SeaDogs_ClearSaveData", "ClearLocationsSaveData");

void ProcessCheat()
{
string sCheatName;
ref mc;
sCheatName = GetEventData();
mc = GetMainCharacter();

switch(sCheatName)
{
 case "Immortal":
  if(LAi_IsImmortal(GetMainCharacter()))
  {
   LAi_SetImmortal(GetMainCharacter(), false);
   Log_SetStringToLog("God mode OFF");
  }else{

   LAi_SetImmortal(GetMainCharacter(), true);
   Log_SetStringToLog("God mode ON");
  }
 break;
 case "ShotGun":
  if(globalSGMode != false)
  {
   globalSGMode = false;
   Log_SetStringToLog("Shotgun mode OFF");
  }else{
   globalSGMode = true;
   Log_SetStringToLog("Shotgun mode ON");
  }
 break;

 case "Gold":
  mc.money = sti(mc.money) + 100000;
  Log_SetStringToLog(" + 100000 G");
 break;
 case "Skill":
  mc.skill.freeskill = 1;

  mc.skill.freeskill = sti(mc.skill.freeskill) + 50;
  Log_SetStringToLog(" + 50 SP");
 break;
 case "Reputation":
  mc.reputation = REPUTATION_NEUTRAL;
  Log_SetStringToLog("Reputation Set to NEUTRAL");
 break;
 case "Morale":

 break;
 case "Encounters":
  if(CheckAttribute(mc,"worldmapencountersoff") == 0)
  {
   mc.worldmapencountersoff = "1";
   Log_SetStringToLog("Worldmap encounters OFF");
  }
  else
  {
   if(mc.worldmapencountersoff == "1")
   {
    mc.worldmapencountersoff = "0";
    Log_SetStringToLog("Worldmap encounters ON");
   }
   else
   {
    mc.worldmapencountersoff = "1";
    Log_SetStringToLog("Worldmap encounters OFF");
   }
  }
 break;
 case "MainCharacter":
  mc.model = "Danielle";
  mc.sex = "woman";
  mc.FaceId = 30;
  mc.model.animation = "woman";
  mc.model.height = 1.75;
 break;
 case "soundoff":
  SendMessage(&Sound,"ll",MSG_SOUND_SET_ENABLED,0);
  Log_SetStringToLog("Sound OFF");
 break;
}
}

object Camera;

void ProcessCameraPosAng()
{
Camera.Pos.x = GetEventData();
Camera.Pos.y = GetEventData();
Camera.Pos.z = GetEventData();

Camera.Ang.x = GetEventData();
Camera.Ang.y = GetEventData();
Camera.Ang.z = GetEventData();
}

void proc_break_video()
{
trace("proc_break_video()");
InterfaceStates.videoIdx = -1;
Event("ievntEndVideo");
}

void Main()
{
// LocationTestProcess();
// return;

LayerCreate("realize", 1);
LayerCreate("sea_realize", 1);
LayerCreate("iRealize", 1);
LayerCreate("fader_realize", 1);
LayerCreate("inf_realize", 1);

ReloadProgressStart();
ControlsInit(GetTargetPlatform(),true);
nTeleportLocation = 1;
sTeleportLocName = "Falaise_de_fleur_port_01";
sTeleportLocName = "Oxbay_port";



NationsInit();
EncountersInit();
CannonsInit();
ShipsInit();
IslandsInit();
WeatherInit();
InitPerks();

if(LoadSegment("storeinitGoods.c"))
{
 InitGoods();
 UnloadSegment("storeinitGoods.c");
}

if(LoadSegment("InterfaceBaseInterface.c"))
{
 InitBaseInterfaces_main();
 InitBaseInterfaces();
 UnloadSegment("InterfaceBaseInterface.c");
}

if(LoadSegment("CharactersCharacters_names.c"))
{
 InitCharactersNames();
 UnloadSegment("CharactersCharacters_names.c");
}


SetEventHandler("Control Activation","proc_break_video",0);
InterfaceStates.Launched = false;
SetEventHandler(EVENT_END_VIDEO,"Main_LogoVideo",0);
InterfaceStates.videoIdx = 0;
Event(EVENT_END_VIDEO);
ReloadProgressEnd();
}

void Main_LogoVideo()
{

int i = sti(InterfaceStates.videoIdx);
trace("Main_LogoVideo() " + i);
switch(i)
{
case 0:
 {
  InterfaceStates.videoIdx = 1;
  StartPostVideo("WaltDisneyLogo",1);
  return;
 }
break;

case 1:
 {
  InterfaceStates.videoIdx = 2;
  StartPostVideo("BethesdaLogo",1);
  return;
 }
break;

case 2:
 {
  InterfaceStates.videoIdx = 3;
  StartPostVideo("AkellaLogo",1);
  return;
 }
break;

/*case 3:
 {
  InterfaceStates.videoIdx = 4;
  StartPostVideo("intro",1);
  return;
 }
break;*/

}

DelEventHandler(EVENT_END_VIDEO,"Main_LogoVideo");
DeleteClass(&aviVideoObj);
Event("DoInfoShower","sl","game prepare",true);
SetEventHandler("frame","Main_Start",1);
}
//*/

void Main_Start()
//void Main()
{
ReloadProgressStart();


DelEventHandler("Control Activation","proc_break_video");
DelEventHandler("frame","Main_Start");

if( GetTargetPlatform()=="pc" ) ControlsInit(GetTargetPlatform(),false);
/*
ControlsInit(GetTargetPlatform(),false);

nTeleportLocation = 1;
sTeleportLocName = "Falaise_de_fleur_port_01";
sTeleportLocName = "Oxbay_port";

NationsInit();
EncountersInit();
CannonsInit();
ShipsInit();
IslandsInit();
WeatherInit();
InitPerks();

if(LoadSegment("storeinitGoods.c"))
{
 InitGoods();
 UnloadSegment("storeinitGoods.c");
}

if(LoadSegment("InterfaceBaseInterface.c"))
{
 InitBaseInterfaces_main();
 InitBaseInterfaces();
 UnloadSegment("InterfaceBaseInterface.c");
}

if(LoadSegment("CharactersCharacters_names.c"))
{
 InitCharactersNames();
 UnloadSegment("CharactersCharacters_names.c");
}

*/

ReloadProgressUpdate();
InitGame();
ReloadProgressUpdate();

Environment.date.hour = worldMap.date.hour;
Environment.date.min = worldMap.date.min;
Environment.date.sec = worldMap.date.sec;
Environment.time = stf(worldMap.date.hour) + stf(worldMap.date.min)/60.0 + stf(worldMap.date.sec)/3600.0;
Environment.date.year = worldMap.date.year;
Environment.date.month = worldMap.date.month; //Was "w rldMap."  Typo? Garbled? ccc mar20

Environment.date.day = worldMap.date.day;


InterfaceStates.Buttons.Load.enable = true;

Event("DoInfoShower","sl","game prepare",false);

LaunchMainMenu();
//LaunchLoadGame();

CharacterIsDead(GetMainCharacter());

//SetMainCharacterIndex(1);
//LoadMainCharacterInFirstLocation("Oxbay_town", "", "");

ReloadProgressEnd();

}

void SaveGame()
{
DelEventHandler("evntSave","SaveGame");
string saveName = GetEventData();
string saveData = GetEventData();
SaveEngineState(saveName);
ISetSaveData(saveName,saveData);
PostEvent("DoInfoShower",1,"sl","save game",false);
}

void LoadGame()
{
string saveName = GetEventData();

DeleteEntities();
ClearEvents();
ClearPostEvents();

CreateEntity(&LanguageObject,"obj_strservice");
CreateEntity(&reload_fader, "fader");
if(LanguageGetLanguage()=="English")
{ SendMessage(&reload_fader, "ls",FADER_PICTURE,"loadingload.tga");
} else
{ SendMessage(&reload_fader, "ls",FADER_PICTURE,"loadingload_rus.tga");
}
SendMessage(&reload_fader, "lfl", FADER_IN, RELOAD_TIME_FADE_IN, true);
ReloadProgressStart();
Characters[0].savegamename = saveName;
SetEventHandler("frame","LoadGame_continue",1);
}

void LoadGame_continue()
{
DelEventHandler("frame","LoadGame_continue");
LoadEngineState(Characters[0].savegamename);
}

void InterfaceDoExit()
{
DelEventHandler("frame","InterfaceDoExit");
InterfaceStates.Launched=false;
if(sti(InterfaceStates.doUnFreeze)==true)
{
 SendMessage(&GameInterface,"l",MSG_INTERFACE_RELEASE);
 if(!IsEntity(&aviVideoObj))
 {
  if( bSeaActive && !bAbordageStarted )
  {
   LayerFreeze("sea_realize",false);
   LayerFreeze("sea_execute",false);
  }
  else
  {
   LayerFreeze("realize",false);
   LayerFreeze("execute",false);
  }
 }
 DeleteAttribute(&GameInterface,"");
}
switch(interfaceResultCommand)
{
 case RC_INTERFACE_FORTCAPTURE_EXIT:
  ReloadAfterFortCapture();
  break;

 case RC_INTERFACE_DO_NOTHING:
  break;
 case RC_INTERFACE_MAIN_MENU_EXIT:
  break;
 case RC_INTERFACE_DO_NEW_GAME:
  InterfaceStates.doUnFreeze = false;
  DeleteEntities();
  //DeleteSeaEnvironment();
  musicName = "";
  oldMusicName = "";
  ResetSoundScheme();
  StopSound(0,0);
  ReleaseSound(0);
  ClearEvents();
  ClearPostEvents();

  if(LoadSegment("InterfaceBaseInterface.c"))
  {
   InitBaseInterfaces_main();
   InitBaseInterfaces();
   UnloadSegment("InterfaceBaseInterface.c");
  }


  LaunchSelectCharacter();

  //SetEventHandler("frame","NewGame",1);
  break;
 case RC_INTERFACE_DO_LOAD_GAME:
  //LoadGame();
  LaunchLoadGame();
  break;
 case RC_INTERFACE_DO_SAVE_GAME:
  LaunchSaveGame();
  break;

 case RC_INTERFACE_DO_OPTIONS:
  LaunchOptionScreen();
  break;
 case RC_INTERFACE_DO_CONTROLS:
  LaunchControlsScreen();
  break;
 case RC_INTERFACE_DO_CREDITS:
  break;
 case RC_INTERFACE_DO_RESUME_GAME:
  break;
 case RC_INTERFACE_RANSACK_MAIN_EXIT:
  Return2SeaAfterAbordage();
  //wdmCreateMap(0.0,0.0,0.0);
  break;
 // boal Cabin 09.09.03 -->
 case RC_INTERFACE_CABIN_MAIN_EXIT:
  Return2SeaAfterCabin();
  break;
 // boal Cabin 09.09.03 <--
 case RC_INTERFACE_CHARACTER_SELECT_EXIT:
  DeleteEntities();
  ClearEvents();
  SetEventHandler("frame","NewGame",1);
  InterfaceStates.doUnFreeze = false;
  break;
}
}

void EngineLayersOffOn(bool on)
{
//LayerSetRealize("realize",on);
//LayerSetExecute("execute",on);
on = !on;
LayerFreeze("realize",on);
LayerFreeze("execute",on);
LayerFreeze("sea_realize",on);
LayerFreeze("sea_execute",on);
//LayerFreeze("sun_trace",on);
//LayerFreeze("sea_reflection",on);
//LayerFreeze("shadow",on);
//LayerFreeze("ship_cannon_trace",on);
//LayerFreeze("hull_trace",on);
//LayerFreeze("mast_ship_trace",on);
//LayerFreeze("sails_trace",on);
}

string seadogs_saveFrom = "";

void OnSave()
{
seadogs_saveFrom = "";
if(IsEntity(&worldMap) != 0)
{
 seadogs_saveFrom = "world map";  //Was "seadogs_sav From"  ccc mar20
}else{
 int ldLoc = FindLoadedLocation();
 if(ldLoc >= 0)
 {
  seadogs_saveFrom = "location";
  SendMessage(&Locations[ldLoc], "l", MSG_LOCATION_SETCHRPOSITIONS);
  LAi_SaveInfo();
  PostEvent("SeaDogs_ClearSaveData", 400, "a", &Locations[ldLoc]);
 }else{
  Trace("OnSave() -> unknow character location");
 }
}

}

void ClearLocationsSaveData()
{
aref loc = GetEventData();
SendMessage(loc, "l", MSG_LOCATION_CLRCHRPOSITIONS);
}

int actLoadFlag = 0;
void OnLoad()
{
actLoadFlag = 1;


//NationsInit();
ResetSound();

//CreateClass("dummy");

if(LoadSegment("InterfaceBaseInterface.c"))
{
 //InitBaseInterfaces_main();
 InitBaseInterfaces();
 UnloadSegment("InterfaceBaseInterface.c");
}

ReloadProgressUpdate();

DialogsInit();
//IslandsInit();
//LocationInit();

ReloadProgressUpdate();

InitCharacterEvents();
ReloadProgressUpdate();
QuestsInit();
ReloadProgressUpdate();
InitTeleport();
ReloadProgressUpdate();
InitParticles();
ReloadProgressUpdate();
//ImportFuncTest();


InterfaceStates.Buttons.Resume.enable = true;
InterfaceStates.Buttons.Save.enable = true;
InterfaceStates.Buttons.Load.enable = true;

if(seadogs_saveFrom == "location")
{
 ref mainchar;
 mainchar = GetMainCharacter();
 LoadMainCharacterInFirstLocation(mainchar.location,"", mainchar.location.from_sea);
 //LoadMainCharacterInFirstLocation(sTeleportLocName, "", "Falaise_de_fleur_location_01");
 int ldLoc = FindLoadedLocation();
 if(ldLoc >= 0)
 {
  SendMessage(&Locations[ldLoc], "l", MSG_LOCATION_TLPCHRPOSITIONS);
 }
}else{
 if(seadogs_saveFrom == "world map")
 {
  wdmLoadSavedMap();
 }else{
  Trace("Unknow seadogs_saveFrom == " + seadogs_saveFrom);
 }
}

//ReloadEndFade();
EngineLayersOffOn(true);
//NewGame();
DialogRun = false;
InterfaceStates.Launched = false;

ReloadProgressUpdate();

PerkLoad();

ReloadProgressUpdate();
LoadGameOptions();

ReloadProgressEnd();

actLoadFlag = 0;
}

void NewGame()
{
DeleteEntities();
DelEventHandler("frame","NewGame");

CreateEntity(&LanguageObject,"obj_strservice");
CreateEntity(&reload_fader, "fader");
if(LanguageGetLanguage()=="English")
{ SendMessage(&reload_fader, "ls",FADER_PICTURE,"loadingnew_game.tga");
} else
{ SendMessage(&reload_fader, "ls",FADER_PICTURE,"loadingnew_game_rus.tga");
}
SendMessage(&reload_fader, "lfl", FADER_IN, RELOAD_TIME_FADE_IN, true);

SetEventHandler("frame","NewGame_continue",1);
}

void NewGame_continue()
{

ReloadProgressStart();

DelEventHandler("frame","NewGame_continue");

if(LoadSegment("InterfaceBaseInterface.c"))
{
 InitBaseInterfaces();
 UnloadSegment("InterfaceBaseInterface.c");
}

InitGame();

Environment.date.hour = worldMap.date.hour;
Environment.date.min = worldMap.date.min;
Environment.date.sec = worldMap.date.sec;
Environment.time = stf(worldMap.date.hour) + stf(worldMap.date.min)/60.0 + stf(worldMap.date.sec)/3600.0;
Environment.date.year = worldMap.date.year;
Environment.date.month = worldMap.date.month;
Environment.date.day = worldMap.date.day;

InterfaceStates.Buttons.Resume.enable = true;
InterfaceStates.Buttons.Save.enable = true;
InterfaceStates.Buttons.Load.enable = true;
//PlayMusic("MW battle2.mp3");


if(ENABLE_POTCMODHELPER == 1)
{
 ref PChar = GetMainCharacter();
 ReloadProgressUpdate();
 LoadMainCharacterInFirstLocation(POTCMODHELPER_LOCATION, "reload1",POTCMODHELPER_HARBOUR );
 if(POTCMODHELPER_LOCATION != "Tutorial_deck")
 {
  GiveItem2Character(PChar, BLADE_SABER);
  EquipCharacterByItem(PChar, BLADE_SABER);
  GiveItem2Character(PChar, GUN_COMMON);
  EquipCharacterByItem(PChar, GUN_COMMON);
  GiveItem2Character(PChar, COMMON_SPYGLASS);
  EquipCharacterByItem(PChar, COMMON_SPYGLASS);
  GiveItem2Character(PChar, POTION);
  GiveItem2Character(PChar, POTION);
  GiveItem2Character(PChar, POTION);
 } // NK
 ReloadProgressUpdate(); // NK
 LAi_QuestDelay("do_reinit", 3); // NK
 //SD_Reinit(); // NK
 ReloadProgressEnd();
 }
else
{
 sTeleportLocName = "Tutorial_deck";

 ReloadProgressUpdate();

 LoadMainCharacterInFirstLocation(sTeleportLocName, "reload1", "Oxbay_port");
 ReloadProgressUpdate(); // NK
 //SD_Reinit(); // NK

 ReloadProgressEnd();
}
}

/*
void NewGame()
{
DeleteEntities();
Environment.date.hour = 14.0;
Environment.date.min = 0.0;
Environment.date.sec = 0.0;
Environment.time = 14.0;
Environment.date.year = 1690;   //changed by KAM
Environment.date.month = 8;
Environment.date.day = 15;

DelEventHandler("frame","NewGame");
if(LoadSegment("InterfaceBaseInterface.c"))
{
 InitBaseInterfaces();
 UnloadSegment("InterfaceBaseInterface.c");
}
InitGame();

InterfaceStates.Buttons.Resume.enable = true;
InterfaceStates.Buttons.S ve.enable = true;
InterfaceStates.Buttons.Load.enable = true;
//PlayMusic("MW battle2.mp3");
sTeleportLocName = "Oxbay_port";
LoadMainCharacterInFirstLocation(sTeleportLocName, "reload2", sTeleportLocName);

}
*/
void InitGame()
{
LayerCreate("realize", 1);
LayerCreate("sea_realize", 1);
LayerCreate("iRealize", 1);
LayerCreate("fader_realize", 1);
LayerCreate("inf_realize", 1);

if(LoadSegment("storeinitStore.c"))
{
 InitStores();
 UnloadSegment("storeinitStore.c");
}
InitSound();

ReloadProgressUpdate();

DeleteSeaEnvironment();
//CharactersInit();
if(LoadSegment("worldmapworldmap_init.c"))
{
 wdmInitWorldMap();
 UnloadSegment("worldmapworldmap_init.c");
}

IslandsInit();
ReloadProgressUpdate();
//return;
LocationInit();
ReloadProgressUpdate();
DialogsInit();
ReloadProgressUpdate();
InitTeleport();
ReloadProgressUpdate();
InitParticles();
ReloadProgressUpdate();

if(LoadSegment("itemsinitItems.c"))
{
 InitItems();
 UnloadSegment("itemsinitItems.c");
}

ReloadProgressUpdate();
CharactersInit();
ReloadProgressUpdate();
QuestsInit();
ReloadProgressUpdate();
SeaAIGroupsInit();
ReloadProgressUpdate();
InitQuestMapEncounters();
ReloadProgressUpdate();
InitLandRandomEncounters();
ReloadProgressUpdate();

SetNextWeather("Blue Sky");
//SetNextWeather("Violet Sky");


ResetQuestMovie();

ReloadProgressUpdate();

LoadGameOptions();

ReloadProgressUpdate();
InfoShowSetting();
}

int counter = 0;
void ProcessControls()
{
string ControlName;
ControlName = GetEventData();
//trace("ProcessControls() : " + ControlName);
//if(ControlName == "WhrPrevWeather") { Whr_LoadNextWeather(-1); }
//if(ControlName == "WhrNextWeather") { Whr_LoadNextWeather(1); }
//if(ControlName == "WhrUpdateWeather") { Whr_UpdateWeather(true); } // NK `04-09`-21 add bool to Whr_UpdateWeather

if(ControlName == "Help") RunHelpChooser();

// Scheffnow -->
if(ENABLE_RUSHMOD == 1)
{
 if(ControlName == "SCHEFFNOW_RUSH")
 {
  if(CheckCharacterPerk(GetMainCharacter(),"Rush"))
  {
   ActivateCharacterPerk(GetMainCharacter(),"Rush");
  }
 }
}
// scheffnow <--

ref PChar = GetMainCharacter(); // NK moved here
switch(ControlName)
{
 // NK -->
 case "NK_NameChange": ChangeName(GetMainCharacter()); break;

 case "`NK_Re-init`": Reinit(false, true); break;
 
 case "NK_AlwaysRunToggle":
  AlwaysRunToggle = !AlwaysRunToggle;
  BeginChangeCharacterActions(GetMainCharacter()); // NK `04-09`-17 have it change now.
  SetDefaultNormWalk(GetMainCharacter());
  SetDefaultFight(GetMainCharacter());
  EndChangeCharacterActions(GetMainCharacter()); // NK ditto
  if(AlwaysRunToggle) Log_SetStringToLog("Always run is now on");
  else Log_SetStringToLog("Always run is now off");
 break;

 case "NK_LogsToggle":
  LogsToggle = !LogsToggle;
  if(LogsToggle) Log_SetStringToLog("Various logs are now on"); //bugfix `04-08`-28
  else Log_SetStringToLog("Various logs are now off");
 break;

 case "executeconsole":
  if(LoadSegment("console.c"))
  {
   ExecuteConsole();
   UnloadSegment("console.c");
  }
 break;

 case "Sidestep_left": if(FindLoadedLocation() != -1) SideStep(GetMainCharacter(), -SIDESTEP_DIST); break; // `04-09`-17
 case "Sidestep_right": if(FindLoadedLocation() != -1) SideStep(GetMainCharacter(), SIDESTEP_DIST); break; //same
   
 // NK <--
 // boal -->
 case "BOAL_UsePotion":
  // NK `04-09`-08 to allow toggle between using min or max potion
  /*aref arItm;
  int itmIdx;
  itmIdx = FindPotionFromChr(PChar, &arItm, 0);
  while(itmIdx>=0)
  {
   if(CheckAttribute(arItm,"potion.health"))
   {
    DoCharacterUsedItem(PChar,arItm.id);
    Log_SetStringToLog("Use potion");
    break;
   }
   itmIdx = FindPotionFromChr(PChar, &arItm, itmIdx+1);
  }*/
  int idx = -1;
  if(USEMAXPOTION_ONKEYPRESS)
  {
   MaxHealthPotionForCharacter(PChar, &idx);
  }
  else
  {
   MinHealthPotionForCharacter(PChar, &idx);
  }
  if(idx != -1)
  {
   DoCharacterUsedItem(PChar, Items[idx].id);
   Log_SetStringToLog("Used potion");
  }
  // NK <--
 break;

 case "BOAL_Control":
  //Log_SetStringToLog("TestF11");
  if(IsPerkIntoList("TimeSpeed"))
  {
   SetTimeScale(1.0);
   DelPerkFromActiveList("TimeSpeed");
   Log_SetStringToLog("Time x1");
   PChar.timeaccel1030 = "30";
  }
  else
  {
   SetTimeScale(3.0);
   Log_SetStringToLog("Time x3");
   AddPerkToActiveList("TimeSpeed");
   PChar.timeaccel1030 = "30";
  }
 break;
 
 case "BOAL_Control0":
  //Log_SetStringToLog("TestF11");
  // NK Fixed `04-09`-08 to actually toggle.
  if(!IsPerkIntoList("TimeSpeed")) { AddPerkToActiveList("TimeSpeed"); }
  if(!CheckAttribute(PChar, "timeaccel1030")) PChar.timeaccel1030 = "30";
  if(PChar.timeaccel1030 != "30")
  {
   PChar.timeaccel1030 = "30";
   SetTimeScale(30.0);
   Log_SetStringToLog("Time x30");
  }
  else
  {
   PChar.timeaccel1030 = "10";
   SetTimeScale(10.0);
   Log_SetStringToLog("Time x10");
  }
 break;

 case "BOAL_Control2":
  /*if(PChar.nation == ENGLAND)
  {
   PChar.nation = PIRATE;
  }
  else
  {
   PChar.nation = ENGLAND;
  }*/
  //Log_SetStringToLog("Set Nation to " + PChar nation);
  //DeleteAttribute(PChar, "quest.generate_kill_quest");
  //int num = FindNearCharacters(PChar, 1, 1, 90, 0.50, true, false);
  // = GetCharacter(num);

  int res = LAi_FindNearestVisCharacter(PChar, 20);
  ref findCh;
  if(res != -1)
  {
   findCh = GetCharacter(res);
   res = findCh.chr_ai.hp;
   Log_SetStringToLog("You see " + findCh.name + " " + findCh.lastname + " Fencing " + findCh.skill.Fencing + " HP "+res );
   if(DEBUGINFO) Log_SetStringToLog("Fame (with " + GetNationNameByType(sti(findCh.nation)) + "): " + GetFame(PChar, sti(findCh.nation)) + "; Her TalkP: " + findCh.talkpoints + ", MarP: " + findCh.marpoints + "; (fame is " + makeint(MRCanMarryRatio(PChar, findCh, false)*100) + "%)");
   //if(DEBUGINFO) Log_SetStringToLog("If an MR were generated now, her marpoints might be: " + makeint(MRCalcMarpoints(&PChar, sti(findCh.nation))));
   /*if(DEBUGINFO)
   {
    float px,py,pz;
    float mx,my,mz;
    bool temp = GetCharacterPos(&findCh, &px, &py, &pz);
    GetCharacterPos(GetMainCharacter(), &mx, &my, &mz);
    TeleportCharacterToPos(findCh, mx, my, 1.25+mz);
    Log_SetStringToLog("Mypos: (" + mx+","+my+","+mz + ");  other" + temp + ": (" +px+","+py+","+pz+")");
    float chay;
    if(CheckAttribute(PChar,"chay"))  chay = stf(PChar.chay) + PI/4;
    PChar.chay = chay;
    CharacterTurnAy(findCh, chay);
   }*/
   //DebugLog("Group: " + findCh.chr_ai.group + "; should be " + GetSoldiersName(sti(findCh.nation)) + "_SOLDIERS");
   //DebugLog("Soldiers killed: " + GetRMKills(PChar, ENGLAND));
  }

  //DebugLog("sn: " + ShipsTypes[GetShipIndex("Corvette3_"+PIRATE)].sname + ", xi: " + XI_ConvertString(ShipsTypes[GetShipIndex("Corvette3_"+PIRATE)].sname));

  /*NK - THIS WILL PRINT ALL LOCATORS IN THE CURRENT LOCATION.
  ref location = &Locations[FindLoadedLocation()];
  aref tempar, basear;
  makearef(basear,location.locators);
  int y, z;
  string tmp;
  for(y = 0; y < GetAttributesNum(basear); y++)
  {
   tmp = GetAttributeName(GetAttributeN(basear, y));
   makearef(tempar, basear.(tmp));
   for(z = 0; z < GetAttributesNum(tempar); z++)
   {
    Log_SetStringToLog(tmp + "." + GetAttributeName(GetAttributeN(tempar,z)));
   }
  }*/


  /*findCh = CharacterFromID("Dark Captain");
  if(findCh.ship.type == "Frigate_sat") { findCh.ship.type = "Frigate_sat_" + PIRATE; } //bugfix.

  //UpdateAllTowns(false);
  //StoreDayUpdateStart();
  if(Group_FindGroup("Coastal_Guards") != -1)
  {
   if(GetCharacterShipType("Coastal_Captain01") >= 0 && GetCharacterShipType("Coastal_Captain01") < SHIP_TYPES_QUANTITY)
   { GetCharacterShipType("Coastal_Captain01") }
   else { SetCoastalGuardPursuit(); Log_SetStringToLog("Fixing Coastguard."); }
  }*/
  if(CheckAttribute(PChar,"quest.prepare_for_kill_pirate.win_condition") || CheckAttribute(PChar,"quest.kill_pirate_complete.win_condition"))
  {
   if(GetCharacterShipType(CharacterFromID("Quest pirate")) >= SHIP_TYPES_QUANTITY)
   {
    ref rFantom = CharacterFromID("Quest Pirate");
    int iShipType = Force_GetShipType(GetCharacterShipClass(GetMainCharacter()),GetCharacterShipClass(GetMainCharacter()), "pirate", PIRATE);
    rFantom.Ship.Type = GetShipID(iShipType);
    rFantom.Ship.idx = iShipType;
    SetUpShip(rFantom, "pirate", true);
    ref Shiptype = GetShipByType(iShipType);

    //NK edit trademoney
    //Log_SetStringToLog("CanQ " + sti(Shiptype.CannonsQuantity));
    aref arship; makearef(arship, rFantom.ship); // PRS3
    float shipmult = 5.0 * sqrt(intRet(sti(Shiptype.CannonsQuantity),sti(Shiptype.CannonsQuantity),1) * sti(GetLocalShipAttrib(arship, Shiptype, "HP")) * stf(GetLocalShipAttrib(arship, Shiptype, "SpeedRate"))); // PRS3
    float commult = 1.0 + makeint(GetSummonSkillFromName(PChar, SKILL_COMMERCE))/20.0;
    //Log_SetStringToLog("SM " + shipmult);
    //Log_SetStringToLog("CM " + commult);


    int iTradeMoney = makeint(sqrt(sti(rFantom.rank)) * shipmult * commult/25)*25;
    //Log_SetStringToLog("TM " + iTradeMoney);
    if(iTradeMoney < 100) iTradeMoney = 100;
    //iTradeMoney = irank*1000+makeint(pchar.skill.commerce)*100;

    PChar.quest.killmoney = iTradeMoney;
    Log_SetStringToLog("Fixing Pirate Hunting Quest: new reward is " + iTradeMoney + "gp.");
   }
  }
 break;
}
// boal <--


// dchaley -->
switch ( ControlName )
{
 case "DCH_Quicksave": ProcessQuicksave(); break;
 case "DCH_Quickload": ProcessQuickload(); break;
}
// dchaley <--
 
if(bSeaActive && !bAbordageStarted)
{
 switch(ControlName)
 {
  case "MainMenu": ProcessMainMenuKey(); break;
  case "Interface": ProcessInterfaceKey();break;

  case "Sea_CameraSwitch": SeaCameras_Switch(); break;
  case "Ship_Fire": Ship_DoFire(); break;

  //case "Tele": Sea_ReloadStart(); break;
 }
}
else
{
 switch(ControlName)
 {
  case "MainMenu": ProcessMainMenuKey(); break;
  case "Interface": ProcessInterfaceKey();break;
  case "Tele":
   StartQuickTeleport();
   break;
  case "TeleBack": Teleport(-1); break;
  case "Action":
   //DumpAttributes(loadedLocation/*loadedLocation.reload.reload1.x*/);
   //trace("Y: " + loadedLocation.reload.reload1.y);
   //trace("Z: " + loadedLocation.reload.reload1.z);
  break;
 }
}


/*switch(ControlName)
{
 counter++;
 if(counter > 3) counter = 0;
 case "CameraSwitch":
  switch(counter)
  {
  case 0: SetDayTime(DAY_TIME_NIGHT); break;
  case 1: SetDayTime(DAY_TIME_MORNING); break;
  case 2: SetDayTime(DAY_TIME_DAY); break;
  case 3: SetDayTime(DAY_TIME_EVENING); break;
  }
 break;
}*/

}

void Teleport(int step)
{
nTeleportLocation = nTeleportLocation + step;
if(nTeleportLocation >= nLocationsNum) nTeleportLocation = 1;
if(nTeleportLocation <= 0) nTeleportLocation = nLocationsNum - 1;

sTeleportLocName = Locations[nTeleportLocation].id;
Trace("Teleport to '" + sTeleportLocName + "'");

ReleaseSound(0);
ClearEvents();
ClearPostEvents();
DeleteEntities();
SetEventHandler("frame","NewGame",1);
}

void ProcessMainMenuKey()
{
LaunchMainMenu();
}

void ProcessInterfaceKey()
{
if(bSeaActive && !bAbordageStarted)
{
 if( CheckAttribute(&BattleInterface,"ComState") && sti(BattleInterface.ComState) != 0 )
  {return;}
}
else
{
 if( SendMessage(GetMainCharacter(),"ls",MSG_CHARACTER_EX_MSG,"IsFightMode") != 0 )
  {return;}
 if( CheckAttribute(&objLandInterface,"ComState") && sti(objLandInterface.ComState) != 0 )
  {return;}
}
if( IsEntity(&worldMap) ) return;
LaunchSelectMenu();
//LaunchCharacter(GetMainCharacter());
}

//ccc survival ->
void GameOverE()
{
ref mc;
mc = GetMainCharacter();
if(rand(100) + (makeint(mc.skill.Sneak)*3) > DEATHRATE) // BF mar05
{ //ccc new survival section
 LAi_SetCurHPMax(mc);
 mc.ship.type = "Tartane1";
 Ship_CreateForCharacter(mc, 0, "Lifeboat") // ccc apr03
 Sea_ReloadStart();
 PlaySound("objectsshipcharge_abandon0.wav");  //ccc mar20
 Log_SetStringToLog("You manage to launch a boat in the last moment."); //ccc mar20
 Log_SetStringToLog("With a few mates you escape from disaster."); //ccc mar20

}
else
{ //ccc call original GameOver function
 GameOverOrg("sea");
 DeleteSeaEnvironment();
}
}

void GameOver(string sName)
{
ref mc;
ref chr;
string loc;
mc = GetMainCharacter();

if(rand(100) + (makeint(mc.skill.Sneak)*3) < DEATHRATE) {GameOverOrg(sName)} //ccc call original GameOver function / BF mar05
else //ccc new survival section
{
 switch(sName)
 {
 case "boarding":
  GameOverOrg(sName);
 break;

 case "mutiny":
  PlaySound("voiceDut_m_a_054.wav");  //ccc mar20
  Log_SetStringToLog("MUTINY!");  //ccc mar20
  Log_SetStringToLog(" 'Cap'n, we are giving you and your cronies this boat.");  //ccc mar20
  Log_SetStringToLog(" If youre careful, you just might make it.");  //ccc mar20
  Log_SetStringToLog("But given your past performance you'll all starve'");  //ccc mar20

  GameOverE();
 break;

 //default:
  PlaySound("trepskeletonskeleton01.wav"); //ccc mar20
  StartVideo("artefact"); //ccc mar20
  string islandID;
  int jopa;
  jopa = GetCharacterCurrentIsland(mc);
  IslandID = Islands[jopa].id;
  if(mc.location == "Redmond_town_01") IslandID = "Redmond"; //Island ID bugfix
  if(mc.location == "Oxbay_port") IslandID = "Oxbay"; //Island ID bugfix

 switch(IslandID)
 {
  case "FalaiseDeFleur":
  loc = "Falaise_de_fleur_Tavern_upstairs";
  chr = characterFromID("Falaise_de_fleur_officiant");
  break;

  case "Redmond":
  loc = "Redmond_Tavern_upstairs";
  chr = characterFromID("Redmond_officiant");
  break;

  case "Conceicao":
  loc = "Conceicao_Tavern_upstairs";
  chr = characterFromID("Conceicao_officiant");
  break;

  case "Douwesen":
  loc = "Douwesen_Tavern_upstairs";
  chr = characterFromID("Douwesen_officiant");
  break;

  case "Oxbay":
  loc = "Greenford_Tavern_upstairs"
  chr = characterFromID("Greenford_officiant");
  break;

  case "IslaMuelle":
  loc = "Muelle_Tavern_upstairs";
  chr = characterFromID("Muelle_officiant");
  break;

  //default: // scheffnow - bfd
  loc = "QC_Tavern_upstairs";
  chr = characterFromID("QC_officiant");
   setCharacterShipLocation(mc, "QC_port");
 }
  //apply damage and losses
 mc.chr_ai.hp_max = makeint(sti(mc.chr_ai.hp_max) * 0.9);
 mc.ship.hp = makeint(sti(mc.ship.hp) * rand(6)/10)+50;
 mc.Ship.crew.quantity = makeint(sti(mc.Ship.crew.quantity) * rand(6)/10)+5;
 mc.money = makeint(sti(mc.money) * rand(4)/10);
 string gun = mc.equip.gun;
 RemoveCharacterEquip(mc, GUN_ITEM_TYPE);
 TakeItemFromCharacter(mc, gun);
 string blade = mc.equip.blade;
 RemoveCharacterEquip(mc, BLADE_ITEM_TYPE);
 TakeItemFromCharacter(mc, blade);

  //start bedroomscene
 WaitDate("", 0,0,4,0,0);
 ChangeCharacterAddress(chr, loc, "goto3");
 DoReloadCharacterToLocation(loc, "goto", "goto2");
 Locations[FindLocation(loc)].reload.l1.disable = 0;
 Log_SetStringToLog("You regain consciousness after a long feverish sleep");
 PlaySound("AMBIENTSHOPsigh2.wav");
 Lai_SetActorType(chr);
 LAi_ActorTurnToCharacter(chr, mc);
 LAi_ActorDialog(chr,mc, "", 4.0, 1.0);
 }
}
}

void GameOverOrg(string sName) //ccc original GameOver function
{
ref mc;
int nSelect;
string sFileName;
//ResetSoundScheme();
//PauseAllSounds();
 ResetSound();
 EngineLayersOffOn(false);

mc = GetMainCharacter();

 ClearEvents();
 ClearPostEvents();
 DeleteEntities();

 if(sti(InterfaceStates.Launched)) {
  UnloadSegment(Interfaces[CurrentInterface].SectionName);
 }

 if(LoadSegment("InterfaceBaseInterface.c"))
 {
  InitBaseInterfaces();
  UnloadSegment("InterfaceBaseInterface.c");
 }
 InitSound();

 SetEventHandler(EVENT_END_VIDEO,"LaunchMainMenu_afterVideo",0);


 switch(sName)
 {
 case "sea":
  nSelect = rand(1);
  sFileName = "skeleton_on_beach";
  switch(nSelect)
  {
   case 0: sFileName = "skeleton_on_beach"; break;
   case 1: sFileName = "undersea"; break;
  }
  StartPostVideo(sFileName,1);
 break;

 case "boarding":
  StartPostVideo("skeleton_on_beach",1);
 break;

 case "land":
  StartPostVideo("blaze_land_dead",1);
 break;

 case "mutiny":
  StartPostVideo("blaze_mutiny_dead",1);
 break;
 }
 InterfaceStates.Buttons.Resume.enable = false;
 InterfaceStates.Buttons.Save.enable = false;
}
//ccc survival <-

// NK temp fix for reinit -->
void SD_Reinit()
{
Reinit(true, true);
}
// NK <--<!--QuoteEnd--></div><!--QuoteEEnd-->

UPDATE:

I found "events" in a backup folder I created manually (not with the BUIld 12 install) and put it in Programs. The error is still there, but the messaged changed. NOw i need to find "animals.c."

I may just have to manyually put in all these files. But at least I'm on to something.

EDIT: Build 12 didn't replace them, BTW. It deleted them, I think.

I don't suppose there's a way I can copy the Backup "Programs" into the current "Programs" without replacing the files that *are* there?

Another question: will Build 12 work now that I'm having to put the files in that were lacking? I can't remember if I made the backup before or after installing Build 12, or if they are files it edited.
 
OK, now it appears to work. I've loaded an old Build 12 game and I can play it. I hope that means everything is fixed!
 
Oh good, glad you got it working! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/onya.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="onya.gif" />

Something you should remember - save often - especially at the beginning of the game when your stats are not too high yet. It'll save ya from having to start over again. I remember starting this game over about six times, when I first got it... <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/rolleyes.gif" style="vertical-align:middle" emoid=":rolleyes:" border="0" alt="rolleyes.gif" />

With B12 there are 40 savegame slots, so you have ample room before you have to delete or overwrite any of them. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/poet.gif" style="vertical-align:middle" emoid=":hmm" border="0" alt="poet.gif" />

Hope this helps! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />
 
Thanks for the advice, guys.

I am finding that I have to restart a lot. But that's okay. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />
 
I believe someone released the cheats in POTC Patcher form, so they can be applied `post-build`. Should be on the mod server (you'll need Viper's Patcher to install it).
 
Back
Top