Results 1 to 2 of 2

Thread: Trigger dilemma at turn start

  1. #1

    Default Trigger dilemma at turn start

    I want the nanban trade dilemma to appear on first turn for the human player only. For this, I tried adding this text at the end of the OnFactionTurnStart (just to test, i know it would be every turn) function:

    Code:
    if conditions.FactionIsHuman(context)
       scripting.game_interface:trigger_dilemma(context, s_nanban_trade_centre)
    end
    Removing the if and doing it raw doesnt work. Changing the context for a specific clan and trying that clan does not work either (ex: "mori"). Switching the scripting.game_interface for campaign_manager does not work either...

    Nothing that I have tried works and I dont know what to do...

  2. #2

    Default Re: Trigger dilemma at turn start

    After several hours of nonsense... I ended up just enabling the nanban trade port for the player and not the AI at the first turn. The condition the FactionIsHuman(context) is a bit strange... Specially the "context" thing. I tried enabling like "enable building (nanban_port, context)", but it will just not take it. I ended up having to do 7 or 8 ifs or elseifs to enable for each specific clan.

    The code wont work either on the function OnCampaignStart. i think it is because the "factionishuman" is still not loaded or something like that. I could also not use the elseifs with the condition of not being multiplayer, but the ifs worked fine. Anyway, here is the final code just below "TURN ONE EVENTS":

    Code:
        if conditions.FactionName("date", context) and conditions.FactionIsHuman("date", context) then      scripting.game_interface:remove_restricted_building_level_record_for_faction("SHO_Port_3_Nanban_Trade_Port", "date")
        elseif conditions.FactionName("mori", context) and conditions.FactionIsHuman("mori", context) then
          scripting.game_interface:remove_restricted_building_level_record_for_faction("SHO_Port_3_Nanban_Trade_Port", "mori")
        elseif conditions.FactionName("chosokabe", context) and conditions.FactionIsHuman("chosokabe", context) then
          scripting.game_interface:remove_restricted_building_level_record_for_faction("SHO_Port_3_Nanban_Trade_Port", "chosokabe")
        elseif conditions.FactionName("oda", context) and conditions.FactionIsHuman("oda", context) then
          scripting.game_interface:remove_restricted_building_level_record_for_faction("SHO_Port_3_Nanban_Trade_Port", "oda")
        elseif conditions.FactionName("takeda", context) and conditions.FactionIsHuman("takeda", context) then
          scripting.game_interface:remove_restricted_building_level_record_for_faction("SHO_Port_3_Nanban_Trade_Port", "takeda")
        elseif conditions.FactionName("tokugawa", context) and conditions.FactionIsHuman("tokugawa", context) then
          scripting.game_interface:remove_restricted_building_level_record_for_faction("SHO_Port_3_Nanban_Trade_Port", "tokugawa")
        elseif conditions.FactionName("iga_ninja", context) and conditions.FactionIsHuman("iga_ninja", context) then
          scripting.game_interface:remove_restricted_building_level_record_for_faction("SHO_Port_3_Nanban_Trade_Port", "iga_ninja")
        elseif conditions.FactionName("hojo", context) and conditions.FactionIsHuman("hojo", context) then
          scripting.game_interface:remove_restricted_building_level_record_for_faction("SHO_Port_3_Nanban_Trade_Port", "hojo")
        elseif conditions.FactionName("uesugi", context) and conditions.FactionIsHuman("uesugi", context) then
          scripting.game_interface:remove_restricted_building_level_record_for_faction("SHO_Port_3_Nanban_Trade_Port", "uesugi")
        elseif conditions.FactionName("ikko_ikki", context) and conditions.FactionIsHuman("ikko_ikki", context) then
          scripting.game_interface:remove_restricted_building_level_record_for_faction("SHO_Port_3_Nanban_Trade_Port", "ikko_ikki")
         end
    Does what I want but its not elegant... I think my first code should have worked... I also dont like to modify the entire script to add this, but there seems to be no other way... Altho Im not a pro in this

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •