///////////////////////// // GOF 1.2 ///////////////////////// #define DIRECTSAILDEBUG 1; // #define DIRECTENCOUNTERCHANCE 50 // chance in percent that an encounter fleet appears every hour #define DIRECTENCOUNTERDISTANCE 1000 // distance from player at which random ships appear float wmDistanceNow = 75000.0; //Boyer POTC change string DiscoveredIsland(float discoveryDistance) { if (DIRECTSAILDEBUG) trace("DiscoveredIsland worldMap.playerShipX = " + worldMap.playerShipX); string sReturn = WDM_NONE_ISLAND; int nextisland = getWMclosestIsland(); if(nextisland < 0) return sReturn; if (DIRECTSAILDEBUG) trace("DiscoveredIsland distance = " + wmDistanceNow); if(wmDistanceNow > discoveryDistance) return sReturn; sReturn = Islands[nextisland].id; if (DIRECTSAILDEBUG) trace("DiscoveredIsland found: " + sReturn); return sReturn; } void CheckIslandChange() { int nextisland = getRTclosestIsland(); if (DIRECTSAILDEBUG) trace("CheckIslandChange: nextisland=" + nextisland); if (nextisland != FindIsland(worldMap.island)) { //only switch if pretty close ref rIsland = GetIslandByIndex(nextisland);//makeref(rIsland, Islands[inum]); string sNewIslandId = rIsland.id; string sIslandNow = worldMap.island; float RTplayerShipX = getRTplayerShipX(); float RTplayerShipZ = getRTplayerShipZ(); float distToCurIsland; if (worldMap.island == WDM_NONE_ISLAND) distToCurIsland = 50000.0; else distToCurIsland = GetDistance2D(RTplayerShipX, RTplayerShipZ, stf(worldMap.islands.(sIslandNow).position.x), stf(worldMap.islands.(sIslandNow).position.z)); float distToClosestIsland = GetDistance2D(RTplayerShipX, RTplayerShipZ, stf(worldMap.islands.(sNewIslandId).position.x), stf(worldMap.islands.(sNewIslandId).position.z)); if (DIRECTSAILDEBUG) trace("CheckIslandChange: distToCurIsland=" + distToCurIsland + ", distToClosestIsland=" + distToClosestIsland); //only change if getting close if (distToClosestIsland * 2 > distToCurIsland) { return; } // aborts function if enemyships near, so that you aren't teleported out of an engagement int enemydist = 0; int nextenemy = 0; int enemyDistLimit = 1000; int neutralDistLimit = 1000; nextenemy = FindClosestShipofRel(GetMainCharacterIndex(), &enemydist, RELATION_ENEMY); if (DIRECTSAILDEBUG) trace("DirectsailCheck; next enemy: "+nextenemy + " dist: "+enemydist); if(nextenemy!= -1 && enemydist