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 - Change triggers from Civ specific to Trait specific

Discussion in 'Community Patch Project' started by bahamut19, Aug 4, 2020.

  1. bahamut19

    bahamut19 Chieftain

    Jun 15, 2020
    I've been working on a personal Mod based on the Koopa Troop Civ made by Typhlomence and calling it the Chameleon Koopa. The idea is when the game loads, it will randomly select from 2 unique buildings, 2 unique units, and 1 unique leader trait. The Civs it chooses from is from a list of all VP uniques and from many other Civs I keep in my Mods list. Overall it has been fun to play with because after each load, you get an entirely new set of uniques, hence the chameleon name.

    There is one thing limiting my ability to fully integrate all of the unique traits available. On some Civs which are not part of the base VP experience, many of the UA's are not created with XML or SQL, but with Lua. The triggers for the Lua are conditional statements checking to see if the particular Civ is in the game. If the Civ is in, the function will run. If not, the function will not run. If I change the Lua to look for Chameleon Koopa, the functions will run regardless of my randomly selected trait. I only want the unique function to run if Chameleon Koopa has the trait selected.

    I was thinking I could change these Lua conditional statements to look for the unique trait, instead of the unique Civ. I'm not sure how to change the conditional IF statement to run only if the player has the particular leader trait, instead of the particular Civ. Any suggestions? Also, I wasn't sure where exactly to post this, most of the other Civ V modding communities are inactive and I know the VP community has a great amount of experience.
    vyyt likes this.

Share This Page