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

Is there an event for new playerperks ?

Discussion in 'CivBE - Modding Help & Mod Creation' started by Gokudo01, Sep 3, 2015.

  1. Gokudo01

    Gokudo01 Emperor

    Joined:
    Apr 12, 2014
    Messages:
    1,038
    Location:
    Toulouse(France)
    Because playerperk wasn't in civ 5 . I want to catch an event where the player unlocks/is granted a new playerperk. ( the ones from the Table "PlayerPerks" that you get when you reach some affinity levels or with wonders. ).

    And if I can't catch new perks with an event, how can I loop though the active player perks.
     
  2. lilgamefreek

    lilgamefreek Warlord

    Joined:
    Oct 30, 2014
    Messages:
    229
    There is no event for this. Player perks are pretty flexible and can be earned through a wide variety of ways. I don't know what you intend for this event, but it may be more specific or concise to monitor wonder completion, affinity level, or building quests instead (not a simple task, but a little more straightforward than looping through the player's perks).
     
  3. HandyVac

    HandyVac Gentleman

    Joined:
    Apr 24, 2014
    Messages:
    270
    Gender:
    Male
    Location:
    The shire where the oxen cross the river. UK.
    As lilgamefreek says, there is no event for this.

    You can check if the player has a specific perk using:
    Code:
    if pPlayer:HasPerk(iPerkID) then
      -- do something
    end
    So you could loop through every entry in the PlayerPerks table, and check whether or not the player has that perk:
    Code:
    for row in GameInfo.PlayerPerks() do
       if pPlayer:HasPerk(row.ID) then
          -- do something
       end
    end
    
     
  4. Machiavelli24

    Machiavelli24 Mod creator

    Joined:
    May 9, 2012
    Messages:
    818
    It may be possible to detect when a perk is gained by having perks give free buildings and detecting (then deleting) those buildings. The structure would be similar to the old civ5 building created event I made (before there was a supported building created event).

    I haven't investigated exactly how free buildings on perks interact through so I can't promise this method will work.
     
  5. Gokudo01

    Gokudo01 Emperor

    Joined:
    Apr 12, 2014
    Messages:
    1,038
    Location:
    Toulouse(France)
    Ok I'm trying to link virtue table with the playerperk one.

    An example ? :

    + 5 global health at lvl 5 Supremacy
    or
    -25% unhappiness from citycount at lvl 5 Harmony :

    you can't do it with the perk table but the virtue table has got it.
    So I want to be able to create an invisible virtue. And give to to the player once he's got the perk.
     

Share This Page