1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  3. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  4. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  5. Dismiss Notice
  6. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

player:HasPerk doesn't work in quests?

Discussion in 'CivBE - Modding Help & Mod Creation' started by Machiavelli24, Jul 31, 2016.

  1. Machiavelli24

    Machiavelli24 Mod creator

    May 9, 2012

    I worked around the issue by using LuaEvents to pass the input & outputs. The outputs were added by side effect in normal lua code that listened for the event.
    There are some lua functions that work fine when I use them as part of normal lua files but don't work when I use them as part of quests. For example, player:HasPerk doesn't seem to work. Add and remove perks work, but not evaluating.

    There also doesn't seem to be a way to tell what cargo loadouts a player has within a quest. PreGame (for PreGame.GetLoadoutCargo(playerID)) doesn't work. There is a Game.GetLoadoutSpacecraft(playerID) but no similar method for Cargo.

    Is there any known way to work around these limitations?
  2. Ryika

    Ryika Lazy Wannabe Artist

    Aug 30, 2013
    Are you sure checking for perks doesn't work? Wouldn't know of any reason why a quest script wouldn't be able to use a global function, and I don't think I ever ran into such limitations when playing around with custom quests.

    But if there's indeed a limitation that I'm not aware of you can always workaround by using persistent data, those can be shared around different lua scripts. So you can just index and keep it updated in one script and then load that global variable by the quest script.

Share This Page

Ebates: Get Paid to Shop