1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Lua when a building is built?

Discussion in 'Civ5 - SDK / LUA' started by Tomatekh, Dec 5, 2012.

  1. Tomatekh

    Tomatekh Sahib-i-Qirani

    Joined:
    Aug 6, 2012
    Messages:
    1,374
    Is there a way to run a function after a specific building is built?
     
  2. Spatzimaus

    Spatzimaus Mad Scientist

    Joined:
    Sep 21, 2005
    Messages:
    3,063
    Location:
    Los Angeles, CA
    No.

    Most things like this require a start-of-turn event, because even the ones that DO have an Event for triggering often have... issues. Like how the Improvement Created event only triggers if the active player (you) SEES the improvement being created. But there's not even anything close to that for building completion.
     
  3. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,274
    Location:
    France
    Thalassicus has made one Lua events for that in CivUP IIRC.
     
  4. Tomatekh

    Tomatekh Sahib-i-Qirani

    Joined:
    Aug 6, 2012
    Messages:
    1,374
    Shame, and after Civ IV had such a convenient self.onBuildingBuilt in its python (which was really nice for new python based wonders).

    Thanks for the help.
     
  5. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,274
    Location:
    France
    I just checked, have a look at MT_LuaEvents.lua in CiVUP.
     
  6. Tomatekh

    Tomatekh Sahib-i-Qirani

    Joined:
    Aug 6, 2012
    Messages:
    1,374
    Thanks a lot. I'll see if I can make it work.
     
  7. Drawmeus

    Drawmeus Emperor

    Joined:
    Jul 25, 2007
    Messages:
    1,213
    I have something similar working in Epochs in the ISEventHandler/ISEvents files if Gedemon's solution doesn't work.

    Not the cleanest code but it's getting there.
     
  8. Spatzimaus

    Spatzimaus Mad Scientist

    Joined:
    Sep 21, 2005
    Messages:
    3,063
    Location:
    Los Angeles, CA
    Nice. I'm glad to see the community adding the events that Firaxis should have given us TWO YEARS AGO. But obviously they were busy adding a few more DLC civilizations. (No, I'm not bitter.)
     

Share This Page