Events.AddPopupTextEvent

Discussion in 'Community Patch Project' started by adan_eslavo, Jan 7, 2018.

  1. adan_eslavo

    adan_eslavo Archmage of all Pixels Supporter

    Joined:
    Apr 23, 2017
    Messages:
    2,501
    Gender:
    Male
    Location:
    Łódź, Poland
    Do someone know how to restrict pop up messages from:
    Code:
    Events.AddPopupTextEvent.Add( AddPopupText );
    to be shown only for one player like it is done in VP?

    For now I have situation where info should be visible only for one player, but every one can see that message even if he didn't found that civilization on the map.
     
  2. adan_eslavo

    adan_eslavo Archmage of all Pixels Supporter

    Joined:
    Apr 23, 2017
    Messages:
    2,501
    Gender:
    Male
    Location:
    Łódź, Poland
    Anyone knows some solution?
     
  3. Enginseer

    Enginseer Salientia of the Community Patch Supporter

    Joined:
    Nov 7, 2012
    Messages:
    3,229
    Gender:
    Male
    Location:
    Somewhere in California
    What exactly are you trying to do with the pop up message? What triggers the pop-up message? Kris Swordman/Bushido promotion text will even appear over fog(because they use the same popup)

    tsk tsk.
     
  4. adan_eslavo

    adan_eslavo Archmage of all Pixels Supporter

    Joined:
    Apr 23, 2017
    Messages:
    2,501
    Gender:
    Male
    Location:
    Łódź, Poland
    There are many popup messages triggers:
    • at the begginning of the turn:
      • over unit with new promotion
      • after resource creating
      • after grabing tile
      • on unit levelling
      • just for being inside enemy territory
      • on new Era
      • on each B'ak'tun
    • on attack
    • after triggering diplomatic mission with diplomatic unit having unique promotion
    • after move of a unit
      • normal move,
      • taking goody hut (special bonus)
    • on Kill (specific which could not be coded with sql table)
    • on building construction.
    They are moslty information about specific damage or heal of a unit or one-time yield gain by the unit or city. They should look like effect with UnitPromotion_YieldFromKills table which is visible only for one player.

    I though about adding IsHuman() function but it doesn't resolve problem if there are 2 humans playing and one of them triggers such message (second should not see it).

    You can check Montezuma's faith and gold for kill. I put with IGE enemy units and waited to kill mine and I couldn;t see his faith and gold yield income for that particular kill.
     
    Last edited: Jan 11, 2018
  5. Enginseer

    Enginseer Salientia of the Community Patch Supporter

    Joined:
    Nov 7, 2012
    Messages:
    3,229
    Gender:
    Male
    Location:
    Somewhere in California
    @JFD

    I could recall you had an issue with this kind of Lua where some messages would appear through fog and basically other players could see, but you managed to fix it in your mod.
     
  6. Blue Ghost

    Blue Ghost King

    Joined:
    Sep 5, 2016
    Messages:
    689
    Maybe try IsActivePlayer()? I haven’t tested that in multiplayer, but it sounds like the kind of thing that might help i this situation.
     
  7. JFD

    JFD Kathigitarkh

    Joined:
    Oct 19, 2010
    Messages:
    9,130
    Location:
    The Kingdom of New Zealand
    Use (IsHuman() and player:IsActivePlayer()) before invoking the event, that should do it. IsActivePlayer is specifically for MP, though it probs works alone in SP.
     
    pineappledan and adan_eslavo like this.
  8. adan_eslavo

    adan_eslavo Archmage of all Pixels Supporter

    Joined:
    Apr 23, 2017
    Messages:
    2,501
    Gender:
    Male
    Location:
    Łódź, Poland
    Ok, thank you guys for help. I will try to impement it soon.
     

Share This Page