Need Help Coding Custom Unit

FrenchCorsair

Chieftain
Joined
Jul 18, 2012
Messages
7
Location
Canada
OK, here's the plan...

I'm currently making a Canadian civilization, and like any good civ, it needs a unique unit to use in-game. Given Canada's history with UN Peacekeeping, I figured using a peacekeeper would be a nice touch. But there's the rub.

Most unique combat units simply recieve a boost to their movement or combat strength, which makes sense since they are indeed combat units. However, combat is a peacekeeper's last resort. As such, I want to mod the standard (Gods and Kings) Paratrooper to bring a cool twist to the unit...

When a city-state is fighting a foreign civilization, for every Peacekeeper unit that you have positioned within the city-state's territory, you gain x-amount of repuation with that city-state -- as long as you remain friendly towards the city-state and its enemy (in other words, remain neutral in the conflict).

Obviously, this is much more complex and adding an extra movement point to a unit and calling it "unique." I've done mods before, but I have no idea how to structure the syntax for this particular mod.

I welcome any advice or input,
Thanks!
Moderator Action: Moved to appropriate forum.
 
Hello.

Through LUA it is pretty simple. A basic approach is to register a LUA event on each end of turn, then scan all of the units of the Canadian player (player:Units()) then, for each peacekeeper, check the plot's owner, then grant reputation to the city state if it belongs to one.

But you need to use LUA, there is no other way I think.
 
Wow... I greatly underestimated how complex LUA is compared to XML. I've code HTML a lot, so XML is simple for me, but LUA is another beast entirely.

Maybe I'll scale back my ambitions for the Peacekeeper for now.
 
Well, if you're at ease with javascript it should not be that hard but if you only know html+css, indeed, it is not programming. Now if you want to I can give you an incomplete code that you will need to fill with the functions listed on the 2k wiki - there are some functions names I don't remember.
 
Back
Top Bottom