Colonist and Sponsor modifications

BlossomPone

Chieftain
Joined
Oct 25, 2014
Messages
23
So, one thing that I am having a tough time with is figuring out what the bonuses that we can give to a sponsor or a colonist. Based on the table definitions, colonists are very limited in what they can do (from what i can see, they can only grant yields, and health per city). And as for the sponsor, they can do quite a lot, but at the same time they're very specific with what they can do.

Realistically, i do believe i'll be needing to make some lua files to do the fancy things that i want. My goal here is to create a specialized explorer unit as a colonist bonus, and modify the outcome of supply caches/expeditions for the sponsor bonus.

I'm not quite sure how to start doing this kind of thing, is there any direction anyone could point me in to start working with scripting in civbe?
 
I don't know how much Lua you know, but I recently helped OranHarken with a similar question, i.e., how to give a special bonus based on the loadout when there there isn't an appropriate database entry. In this case he wanted an IntrigueCapChange with his special colonist, but using similar logic, you can give whatever bonus you like. In this case, rather than using the line with SetNumRealBuilding, you'd be using InitUnit to place your unit (and then you'd throw in a JumpToNearestValidPlot).

You need to create an invisible building (Cost=-1) with your change to IntrigueCapChange. You also need to create a BuildingClass (with MaxPlayerInstances set to 1, for good measure).

The problem is how to give this building to the player when your collectivist colonist is chosen. Unfortunately, there's no built-in method for just this situation, but Lua comes to the rescue. Note I'm not a Lua expert, so it took me a while to figure out just this short bit of code:
Code:
Events.SerialEventCityCreated.Add(function(hexPos, playerID, cityID, cultureType, eraType, continent, populationSize, size, fowState)
	local currentColonists = PreGame.GetLoadoutColonist(playerID);
	if ( cityID == (Players[playerID]:GetCapitalCity()):GetID() ) then
		if ( currentColonists == GameInfoTypes["COLONIST_ESO_COLLECTIVISTS"] ) then
			Players[playerID]:GetCityByID(cityID):SetNumRealBuilding(GameInfoTypes["BUILDING_ESO_COLLECTIVISTS"], 1);
		end
	end
end);
 
Thanks for the heads up :] I'm trying to work through the civ v documentation, but its pretty rough (the modiki seems broken to hell at the moment).

Is there a location where we can find the actual source files for CivBE lua? i'd hate to have to troubleshoot by guessing, considering there may be functions changing names or missing between civ v and be.

I can find lua files in the game itself, but as far as the events systems go, i have not been able to find any from the wiki >_<
 
The modiki's not as broken as it appears.

It looks like Firaxis didn't rename anything, and the missing BE-only functions have to be gleaned from grep'ing the game's Lua files until someone adds them to the modiki.
 
The modiki's not as broken as it appears.

It looks like Firaxis didn't rename anything, and the missing BE-only functions have to be gleaned from grep'ing the game's Lua files until someone adds them to the modiki.

Sounds good, i'll probably hang back and stick to what i can manage in XML for a while then, to get my feet wet ^__^ Thank you for your helpfulness, Nutty, you're a credit to civ modders everywhere! :goodjob:
 
Top Bottom