[MODCOM]Pirates Mod

jenks said:
cant seem to get it to work either in the privateers mod or on its own ...

... Using the 0.3 Warlords version, its AD 500 on raging barbarians and still yet to see a barbarian ship with or without crew ... :(

What era are you in?
 
I am bewildered. I've just spent like 20 minutes scanning through the GlobalDefines.xml, fully expecting to find a value I can change to make barbs spawn more frequently, but I came up empty handed..

Am I missing somthing? Is there no way to control how often barbs spawn?

I thought I remembered seeing somthing, sowe where, some time, can anyone point me to the right place? :crazyeye:
 
NikNaks93 said:
@ The Lopez

Can I use this in my mod (with credit, of course!)?

Sure, that's what its here for :D
 
Just wondering... have you read the book called "The World Trade Created: Society, Culture, And the World Economy" by Kenneth Pomeranz and Steven Topik?

Well anyways they have a pretty good section in that book about pirates if your interested :) (they discribe pirates as merchants that "coerce trade at gunpoint".)
 
You set them through the CIV4CivilizationInfos.xml file. You need to change what units the barbarian civilization can have in their definition typically found at the end of the file. So for example if you want to allow pirates to have explorers then you would remove this block:
Code:
				<Unit>
					<UnitClassType>UNITCLASS_EXPLORER</UnitClassType>
					<UnitType>NONE</UnitType>
				</Unit>
from the <units> tag.
 
TheLopez said:
You set them through the CIV4CivilizationInfos.xml file. You need to change what units the barbarian civilization can have in their definition typically found at the end of the file. So for example if you want to allow pirates to have explorers then you would remove this block:
Code:
				<Unit>
					<UnitClassType>UNITCLASS_EXPLORER</UnitClassType>
					<UnitType>NONE</UnitType>
				</Unit>
from the <units> tag.
Ok but I don't want pirates to be any kind of barbs but have special pirate units for different eras only.
 
My idea would be positivly defining one ship and 1-3 possible crewunits for each era. Something like(just an example not ment to be exactly like that):
era_ancient
vikinggalley
norseaxeman

era_classical
arabian djunk
arabian pirate

era_medieval
Galleon
Pirates

etc.

How difficult would it be to implement the like in your code?
 
Updated Warlords version to be compatible with the v2.0.8.0 patch.
 
The pirate ships do not unload their carried units (when present) in 2.08. I know you have these lines from the older version commented out:

objNewUnit.doCommand(CommandTypes.COMMAND_LOAD, objNewUnit.getOwner(), unit.getID())
objNewUnit.getGroup().pushMission(MissionTypes.MISSION_SLEEP, 0, 0, 0, false, true, MissionAITypes.MISSIONAI_LOAD_ASSAULT, unit.plot(), unit)

And they indeed don't work in 2.08 (I tried just for the heck of it :)). Here's a quick fix to get them to unload: after "objNewUnit.setTransportUnit(unit)", add:

unit.setUnitAIType(UnitAITypes.UNITAI_ASSAULT_SEA)

I don't know if this will cause the parent/transport ships, after unloading, to go look for and pick up new existing barb land units or just what, but to change the parent AI back to Attack you'd have to add code to some sort of "onUnitUnload" event, if such even exists. Besides which, while you might want earlier transports like galleys to switch to UNITAI_ATTACK after unloading, the galleon only has Escort as an additional standard AI and the industrial/modern unit "transport" *only* has Assault and Settler AIs (assuming barb ships can still spawn in industrial/modern, which they probably can't but people might make mods where they do).

Also, to keep barb ships that would otherwise be on AI's like Attack or Escort from changing to Assault in most of the cases, I'm changing it slightly in my version to roll crew/cargo/landunit creation chance just once per ship (rather than once per ship cargo slot), and if successful to fill all the cargo slots, otherwise none. That way, if the spawn &#37; is at the default/standard 50%, half the barb galleys will stay on whatever AI they started with when they spawned (hopefully all Attack but I haven't checked the SDK code), rather than a quarter of them (two cargo slots, 50% crew spawn chance per slot = only 25% chance no crew will spawn on any given barb galley in your code; worse with ships with more cargo slots).
 
Incidentally, there's a slightly related bug of minimal consequence I found while testing this: if a human player gifts a transport to an AI which was carrying land units at the time, the AI doesn't seem to know they're there and ever make any use of them. An ideal fix for this would probably involve changing the AI code (since Assault targets enemy cities not your own and there's no existing script to "come drop off new acquisitions"), but it might work to detect the gift event and just call the warp to nearest valid tile thing on any carried units instead. (Once they're on land and out of the ship it may instantly start using them, though I'm not positive.)
 
The pirate ships do not unload their carried units (when present) in 2.08.

:bump: Do the barbarians unload their units onto your land yet, TheLopez? I really want to add this, looks like a really good component. Sorry for being impatient.
 
:bump: Do the barbarians unload their units onto your land yet, TheLopez? I really want to add this, looks like a really good component. Sorry for being impatient.
Uhh, they do with my change... just add that line at the end of onUnitCreated() in CvPiratesModEventManager.py with Notepad or Wordpad, can be done in a matter of seconds.

If you still need help I suppose I can host the file til Lopez updates his.
 
Okay so I forgot about the all-or-nothing crew loading (which has a potential advantage, see above) and a minor efficiency improvement I had made. Sorry, am kinda rushed atm. Anyway here's the file:

http://homepage.mac.com/klwelch/Civ4/CvPiratesModEventManager.py

Download that, and use it to replace the one in Lopez's mod with the same name. It goes in "Assets/Python/PirateModUtils".
 
Okay so I forgot about the all-or-nothing crew loading (which has a potential advantage, see above) and a minor efficiency improvement I had made. Sorry, am kinda rushed atm. Anyway here's the file:

http://homepage.mac.com/klwelch/Civ4/CvPiratesModEventManager.py

Download that, and use it to replace the one in Lopez's mod with the same name. It goes in "Assets/Python/PirateModUtils".


Sorry didn't mean to rush you or anything, I can't have read your other posts thoroughly or I would have at least tried to fix it using the python line you posted :p Thanks for your time :thumbsup:
Now TheLopez needs to update his version with your line.
 
Updated to be compatible with BtS v3.19
 
Any chance you could do a SDK-only version? :)
 
Top Bottom