Reverse Unit Gifting Query

FaustVs

Chieftain
Joined
Oct 5, 2007
Messages
9
I'm taking my first swing at modding, and to cut my teeth I'm trying to create a small mod switch around the 'Gift Unit' functionality for giving units to City States. The idea is City States then become a place to buy mercenary units from rather than give units to.

It was all going fairly well with re-using the Gift Unit functionality as a template, and switching around the gift from/to players, to the extent that the UI would highlight the available units for the city state, and you got a popup when you selected one saying 'Are you sure you want to gift this [unit] to [major civ]'.

And then nothing happens. No errors in logs, and the highlighted unit remains. The Lua function being modified was GiftUnit in InGame.lua. Does anyone know how I could figure out where the execution goes next? I'm assuming if the code that performs the gifting is C code, I'm out of luck on re-using this functionality?

Any pointers greatly appreciated.
 
the gift code must be for major to CS, I guess you'll have to make a custom code to change ownership from CS to major.

see my sig for an example on mercenaries unit from CS, or have a look at the code in the Denmark DLC scenario.
 
A-ha. Ha. Yes, I should have known that someone would have already done something like this, and done it considerably better ;)

Actually I'm finding having a crack at creating something, then comparing it so something a lot closer to how it 'should' be done, is really useful.

Many thanks for the tip - really appreciated.
 
but reversing the gift unit UI to buy existing units is a really good idea, I hope you'll follow that way.

With merging, you may end up giving the player the choice of buying an existing unit or a complete new one, maybe with different prices/conditions.
 
Back
Top Bottom