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

Need Help Warfleet retaliating after capture/plunder a colony

Wolve

Sailor
I'd like to try and script a chance of spawning a warfleet comming to rescue/liberate a colony after you captured or plundered it. As Pieter mentioned this could be done by copying and reworking the coastguard script. My idea is:
- After plundering a colony there is a chance which increases with time (say you stay for repairs) that the country to which that colony belongs sends a warfleet to deal with you.
- After capturing a colony there is a chance that a warfleet appears near the island/harbor to liberate the colony again. (not sure if fixed, or also increases with time as news would probably take some time to reach other colonies so that would be more realistic).
Anyone got suggestions/remarks on this? :) (e.g. if you like this as a feature or not)

Also @Pieter Boelen where can I find the required coastguard scripts so I can modify them? :) figured this idea would be the easiest modding to get the hang of it.
 
This is the simplest example I can think of that generates an enemy ship:
Code:
         GenerateQuestShip("Convoy Pirate", GetServedNation()); // PB: Use Generic Function
         Group_CreateGroup("Convoy_Pirate");
         Group_AddCharacter("Convoy_Pirate", "Convoy Pirate");
         Group_SetGroupCommander("Convoy_Pirate", "Convoy Pirate");
         Group_SetTaskAttack("Convoy_Pirate", PLAYER_GROUP, true);
         Group_LockTask("Convoy_Pirate");
         Group_SetPursuitGroup("Convoy_Pirate", PLAYER_GROUP);
         Group_SetAddress("Convoy_Pirate", sIsland, "", "");
This one is for the enemy you sometimes get during Escort Quests, but the Coastguard basically works exactly the same.

Instead of "Conyoy_Pirate", use a different group name.

"Convoy Pirate" (WITHOUT the "_"!) is the captain ID that is reused.
This character needs to be added to PROGRAM\Characters\init\CommonQuest.c so he exists.

sIsland should be the island ID where the ship is to be generated.

The GenerateQuestShip function creates an enemy in relation to the player rank.
So low level players will get only small enemies.


Other interesting stuff for you is RandomNationsRelationsChange() at the bottom of PROGRAM\NATIONS\nations.c .

And PROGRAM\Towns\Towntable.c:
Code:
void TownUpdate(ref ctown, bool instant)
{
  // Error handling
  if(!CheckAttribute(ctown, "name")) return;

   int random = 0;   
  int economy = GetTownEconomy(ctown);
  bool captured = false;  
 
  // Random Town Events
   random = rand(RANDOM_TOWN_EVENT_PROBABILITY);
   if(random == RANDOM_TOWN_EVENT_PROBABILITY) LaunchRandomTownEvent(ctown);

And:
Code:
CaptureTownForNation("Tortuga", PIRATE);
 
Ok, but how would I make sure the guy is of the nation to which the island belongs or belonged? Do i need to set a captain for every nation?
 
Ok, but how would I make sure the guy is of the nation to which the island belongs or belonged? Do i need to set a captain for every nation?
Instead of GetServedNation() as input for GenerateQuestShip, use the former nationality of the town instead.
 
Back
Top