• 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!

Fixed Random Events for Disabled Towns

Grey Roger

Sea Dog
Staff member
Administrator
Storm Modder
Another oddity - tavern news showed a lot of things happening to blocked islands such as Antigua, St. Martin and an unnamed island, as well as Willemstad (good luck visiting that, Curacao is also disabled).
 
Another oddity - tavern news showed a lot of things happening to blocked islands such as Antigua, St. Martin and an unnamed island, as well as Willemstad (good luck visiting that, Curacao is also disabled).
Probably the random town event code doesn't contain a "disabled" check. :facepalm
 
PROGRAM\Towns\Towntable.c find:
Code:
void LaunchRandomTownEvent(ref ctown)
{
   int random;
   int iSize;
   int iTroops;
   int iGold;
   int iEconomy;
   string logTitle;
   string logEntry;

   if(GetTownNation(ctown.id)==PIRATE) return;
   random = rand(RANDOM_TOWN_EVENTS_QTY-1);

Replace with:
Code:
void LaunchRandomTownEvent(ref ctown)
{
   int random;
   int iSize;
   int iTroops;
   int iGold;
   int iEconomy;
   string logTitle;
   string logEntry;

//   if(ctown.id == "KhaelRoa")             return; // PB: Exclude Cozumel
//   if(IsIslandDisabled(ctown.island))         return; // PB: Exclude towns on disabled islands
   if(GetAttribute(ctown, "skiptrade") == true)   return; // PB: Exclude towns that are excluded from regular trade
//   if(GetTownNation(ctown.id)==PIRATE)         return;
This is a bit up for debate though. For one thing, WHY are pirate towns excluded from anything happening? They are real towns, after all.
My suggestion would be to use ONLY the "skiptrade" check. After all, this is used to prevent quests to that town and is set to true also for all disabled towns.
I think we might just catch ALL instances with one check instead of having several individual ones.
 
This is a bit up for debate though. For one thing, WHY are pirate towns excluded from anything happening? They are real towns, after all.
Possibly to avoid such announcements as "Pirates plunder Pirate Settlement". xD Several other announcements would also seem rather strange when applied to pirate towns.
 
Good point.

I have now replace the phrase "possible pirate attacks" to "possible attacks" so it isn't actually wrong for pirates.
Plus this change so that Indians attack a pirate settlement instead of the pirates attacking themselves:
Code:
    case RANDOM_TOWN_EVENT_PIRATES:
       if(GetTownNation(ctown.id) == PIRATE)
       {
         logTitle = "Indians attack "+FindTownName(ctown.id);
         logEntry = "A major attack of indians on "+FindTownName(ctown.id)+" has been reported by travellers. The indians seem to have plundered and massacred the civilian population as well as the local garrison. Finally the cannons of the garrison drove them away, leaving the town completely desolate.";
         iSize = GetTownSize(ctown.id);
         SetTownSize(ctown.id, abs(iSize * 1/3));
         iTroops = GetTownNumTroops(ctown.id);
         SetTownNumTroops(ctown.id, abs(iTroops *1/4));
         iGold = GetTownGold(ctown.id);
         SetTownGold(ctown.id, abs(iGold * 3/5));  // indians are not as focused on gold as are pirates
         AdjustTownEconomy(ctown, -2);
       }
       else
       {
         logTitle = "Pirates plunder "+FindTownName(ctown.id);
         logEntry = "A pirate assault on "+FindTownName(ctown.id)+" has been reported. Some pirates seem to have sneaked into town before their ships attacked the harbor in the middle of the night. Those in town took the garrison by surprise and kept the town gates open for their comrades. The whole attack didn't last much longer than two hours. The pirates escaped with a vast amount of gold, before the fort commander was able to gather his troops for defence. Several people died in the brutal attack, as they tried to defend their possesions on their own.";
         iSize = GetTownSize(ctown.id);
         SetTownSize(ctown.id, abs(iSize * 5/6));
         iTroops = GetTownNumTroops(ctown.id);
         SetTownNumTroops(ctown.id, abs(iTroops *9/10));
         iGold = GetTownGold(ctown.id);
         SetTownGold(ctown.id, abs(iGold * 1/5));
         AdjustTownEconomy(ctown, -1);
       }
     break;
Would that be a better solution than skipping pirate towns altogether?
 
People will just need to keep a critical eye during play to see if anything still appears to be wrong with the events.
 
Back
Top