Results 1 to 6 of 6

Thread: Add custom missions in ETW campaign

  1. #1

    Icon3 Add custom missions in ETW campaign


    Prerequisites:

    • Pack File Manager (I use 4.1.2 for Attila)
    • Make a backup of: ETW/data/main.pack, ETW/data/patch_en.pack and ETW/data/campaigns/main/scripting.lua


    Step 1: Create unique mission key

    All missions need their own unique key, therefore it is important to create one for each mission.

    1. Open with PFM: main.pack -> db -> mission_tables
    2. Go to options in top left corner -> click "CA Are Read Only" to toggle edit mode
    3. Select number 1 in the top-left corner (the first row), right-click and choose: "Insert Row"
    4. In the first column that appears empty add: "test_mission" as key and copy paste the rest from the row below which is from key "ep1_build_farm"
    5. Save file
    Spoiler Alert, click show to read: 



    Step 2: Add mission description text
    1. Open with PFM: patch_en.pack -> text -> localisation.loc
    2. Scroll to the bottom and select, click "Add New Row" and simply add tag: "mission_test_text", and some description, e.g: "This is a text description in the purpose of a tutorial."
    3. Select "Save As" to overwrite existing file

    Spoiler Alert, click show to read: 


    Step 3: Add mission to campaign
    1. Open main/scripting.lua (preferably with a code editor like VS Code or Atom)
    2. Paste following code under function OnFactionTurnStart() on line 9
    Code:
    elseif conditions.FactionName("sweden", context) and conditions.FactionIsHuman("sweden", context) then
      scripting.game_interface:trigger_custom_mission("test_mission", "sweden", "build_building", 3, "corn_peasant_farms", "", "mission_test_text", "", 500, "", context)
    end
    3. Save file

    Spoiler Alert, click show to read: 



    Results:


    Conclusion:
    We just created a build mission for Sweden which happens on the first turn, has three turns as time limit and a reward of 500 coins. All these parameters can easily be changed in the code pasted above. There are many different types of missions to trigger and you can find complete list inside: main.pack -> db -> mission_activities_tables. Some examples are: blockade_port, capture_city, make_alliance, recruit, research, etc.

    Happy modding!

  2. #2

    Default Re: Add custom missions in ETW campaign

    Here are some similar info from NTW: https://www.twcenter.net/forums/show...ustom-missions

  3. #3

    Default Re: Add custom missions in ETW campaign

    Quote Originally Posted by scaniavikings View Post

    Prerequisites:

    • Pack File Manager (I use 4.1.2 for Attila)
    • Make a backup of: ETW/data/main.pack, ETW/data/patch_en.pack and ETW/data/campaigns/main/scripting.lua


    Step 1: Create unique mission key

    All missions need their own unique key, therefore it is important to create one for each mission.

    1. Open with PFM: main.pack -> db -> mission_tables
    2. Go to options in top left corner -> click "CA Are Read Only" to toggle edit mode
    3. Select number 1 in the top-left corner (the first row), right-click and choose: "Insert Row"
    4. In the first column that appears empty add: "test_mission" as key and copy paste the rest from the row below which is from key "ep1_build_farm"
    5. Save file
    Spoiler Alert, click show to read: 



    Step 2: Add mission description text
    1. Open with PFM: patch_en.pack -> text -> localisation.loc
    2. Scroll to the bottom and select, click "Add New Row" and simply add tag: "mission_test_text", and some description, e.g: "This is a text description in the purpose of a tutorial."
    3. Select "Save As" to overwrite existing file

    Spoiler Alert, click show to read: 


    Step 3: Add mission to campaign
    1. Open main/scripting.lua (preferably with a code editor like VS Code or Atom)
    2. Paste following code under function OnFactionTurnStart() on line 9
    Code:
    elseif conditions.FactionName("sweden", context) and conditions.FactionIsHuman("sweden", context) then
      scripting.game_interface:trigger_custom_mission("test_mission", "sweden", "build_building", 3, "corn_peasant_farms", "", "mission_test_text", "", 500, "", context)
    end
    3. Save file

    Spoiler Alert, click show to read: 



    Results:


    Conclusion:
    We just created a build mission for Sweden which happens on the first turn, has three turns as time limit and a reward of 500 coins. All these parameters can easily be changed in the code pasted above. There are many different types of missions to trigger and you can find complete list inside: main.pack -> db -> mission_activities_tables. Some examples are: blockade_port, capture_city, make_alliance, recruit, research, etc.

    Happy modding!
    And what do i gotta do if it doesn’t show up?? I tried to create alliance mission but doesn’t show up however it doesn’t screw up the faction handover scripts

  4. #4

    Default Re: Add custom missions in ETW campaign

    Did you try on vanilla ETW?

    Please send me the code, did you paste it correct? Which turn?

  5. #5

    Default Re: Add custom missions in ETW campaign

    Quote Originally Posted by scaniavikings View Post
    Did you try on vanilla ETW?

    Please send me the code, did you paste it correct? Which turn?
    okay Ive made the code show up but when i complete it doesn't complete
    Attached Thumbnails Attached Thumbnails 20221107151105_1.jpg  

  6. #6

    Default Re: Add custom missions in ETW campaign

    Quote Originally Posted by rohan97 View Post
    okay Ive made the code show up but when i complete it doesn't complete
    Attached Thumbnails Attached Thumbnails 20221107151105_1.jpg   ots.png  

Posting Permissions

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