Event for when Unit is gifted to a CS?

Vicevirtuoso

The Modetta Man
Joined
May 14, 2013
Messages
775
Location
The Wreckage, Brother
I have an idea for a Civilization whose trait gives it a small amount of :c5science: and :c5gold: when it gifts a unit to a Friendly or Allied City-State. I'm looking through the Lua Events and GameEvents and can't find one which would be called when a unit is gifted. Is this something that would require a custom .dll, or can it be accomplished in some way via Lua?
 
Um it's possible you could use Events.SerialEventUnitTeleportedToHex() but...I'm not too confident on that one...

Edit: Try pPlayer:GetFriendshipFromUnitGift() with arguments (PlayerTypes eMajor, bool bGreatPerson, bool bDistanceGift)

edit #2: I'm looking at the source code and trying to find a function you could use...no promises....

edit #3: I haven't found a suitable function, unfortunately. I'm sorry, I tried.

this is why I hate LUA

edit #4: you could try some fancy logic with Events.SerialEventUnitCreated(). You're really looking for something that hooks into CvMinorCivAI::DoUnitGiftFromMajor() but I see nothing that does. Sorry.
 
As a rule of thumb, events were only added if they were needed for the standard UI or a scenario.

No consideration was given to "how could modders change/improve/reuse this" - which is why I dislike Firaxis and not hate Lua ;)
 
DoUnitGiftFromMajor use the Convert function which does not track the original owner AFAIK, if it had you could have used Lua, but as it is now, this will require a DLL mod.
 
Thanks for the responses! I guess that this Civ won't come to fruition as I intended it then, since I dislike the idea of requiring a custom .dll for a single civilization. Maybe if we were able to load multiple .dlls at once...but alas, I'll probably just rethink the trait.
 
Thanks for the responses! I guess that this Civ won't come to fruition as I intended it then, since I dislike the idea of requiring a custom .dll for a single civilization. Maybe if we were able to load multiple .dlls at once...but alas, I'll probably just rethink the trait.

You can't load multiple DLLs at once, you would have to manually merge the C++ changes.
 
You can't load multiple DLLs at once, you would have to manually merge the C++ changes.

And that's exactly why I didn't want to do it for a mod that only adds a single civilization.
 
Back
Top Bottom