Page 1 of 4 1234 LastLast
Results 1 to 20 of 80

Thread: Replacing the grand campaign

  1. #1
    alpaca's Avatar Harbinger of saliva
    Join Date
    Sep 2005
    Location
    Germany
    Posts
    4,811

    Default Replacing the grand campaign

    Replacing the grand campaign

    One of the more annoying issues of the ETW modding mechanism is how the map files are handled. They can not be added to the mod pack but have instead to be put on the disk to work properly. So far, the usual way if you wanted to supply a modified startpos.esf or scripting.lua was to overwrite the vanilla versions - obviously, this is not a completely safe thing to do.

    Thanks to an idea by husserlTW I was able to develop a mechanism that allows you to copy the campaign map and then tell the game to use this new map instead of the original. This is definitely preferable to the old method and actually pretty easy to do, so let's get cracking.


    Step 1: Copying the files
    First, we need to copy the map files to a new location. So go to your data/campaigns directory and copy the main folder. I will be doing this for APE:TI so I chose apeti_main as the name for the copy but you can use anything you like.


    Step 2: Editing startpos.esf
    Before the game can properly work with the files, we need to tell it that the campaign it's loading when using our newly-copied startpos has another name. So open the file in ESFEditor.

    We have to edit two entries, marked red in the image below.



    In CAMPAIGN_PREOPEN_MAP_INFO change the first entry from main to apeti_main or whichever name you chose for your campaign. The same has to be done for the first entry in CAMPAIGN_ENV/CAMPAIGN_SETUP, then we're already done here. Save and exit.


    Step 3: Teaching the UI
    Now, please download the attached custom_campaign.rar archive. It contains a movie type pack that should be compatible to most mods but you can export the files and re-import them to your mod pack if you prefer that. Please put the pack into your data folder now, then open it with PFM.

    The ui/frontend ui/grand_campaign_scripts/grand_campaign.luac doesn't and shouldn't be changed by you but it's required for this to work: I modified it so that it loads another, easy-to-edit, file that tell the game which campaign it should load when the player clicks on grand campaign. This is the second file included in custom_campaign.pack, called custom_campaign.lua.

    The last step is to export custom_campaign.lua, open it with a text editor and replace "apeti_main" with the name of your map. Be sure to put the name in quotation marks (") because otherwise things will stop working. Now re-import custom_campaign.lua to custom_campaign.pack (right-click, replace) or put it into your own pack and all should be set.

    Code:
    return "apeti_main"

    Step 4: Enabling Roads

    There are two small things that cause problems with the above: Firstly, it will remove roads and secondly the gold borders around the map transition zones will be gone. The first problem can be fixed, the second not but it's not very tragic. So to get roads back, open models.pack and extract the rigidmodels/campaignroads/main folder. Rename that folder on the disk to whatever the name of your custom campaign is (in my case apeti_main) and re-import it to your mod pack. You should then have roads back.


    Step 5: Testing the changes
    It can sometimes be hard to test the changes you did. An easy way to do this here is to open scripting.lua in your new map folder with a text editor and add the following to the OnFactionTurnStart function:

    effect.adjust_treasury(100000,context)

    Start a game and you should have 100k more in the treasury if things work correctly. Otherwise, please try again.




    That's it, gents. You should now be set up with your very own modfoldered campaign. One last word of warning: Be sure to delete any files you extract to your data folder from the hard-disk because the game will sometimes take them rather than files in your pack (usually if the files on the disk have a newer timestamp).


    References
    ESF Editor 1.4.3
    PFM 1.12
    Startpos.esf analysis and modifications (not necessary but useful if you want to do startpos editing)
    lrmo's tutorial about mod-foldering the other campaign map files
    Last edited by alpaca; September 25, 2009 at 03:13 PM.

    No thing is everything. Every thing is nothing.

  2. #2

    Default Re: Replacing the grand campaign

    Congratulations . You have done an amazing work!! .

    So...the ideia of modding the UI files was not bad at all :


    Quote Originally Posted by Birdofilo View Post
    Interesting...

    So, I supose if you can mod the UI you are in conditions to change the path to the "startpos.esf". This way it's possible to create an unique mod folders inside the folder "data/campaigns". Am I right?

  3. #3

    Default Re: Replacing the grand campaign

    Excellent alpaca, thanks again!

    Irmo has make a tutorial for regions.esf also which is simpler since has nothing to do with UI but only with one startpos line change. It can be combined with your new mod packaging procedure for a more complete mod package and less overnighting of vanilla files.




  4. #4

    Default Re: Replacing the grand campaign

    +rep Alpaca! Nice breakthrough!

  5. #5

    Default Re: Replacing the grand campaign

    nice indeed.

    With Irmos Tutorial Husserl posted there should be no need to override vanilla files anymore
    Last edited by Lazy Knight; September 04, 2009 at 10:45 AM.


  6. #6

    Default Re: Replacing the grand campaign

    +rep

    Great job going to use this right away.
    http://www.twcenter.net/forums/showthread.php?t=260572

    Game Scripter @ Reverie World Studios

  7. #7
    alpaca's Avatar Harbinger of saliva
    Join Date
    Sep 2005
    Location
    Germany
    Posts
    4,811

    Default Re: Replacing the grand campaign

    Added a link to lrmo's tutorial to the references.

    Birdofilo: Yes, the idea was good, I just didn't put all the pieces together before reading husserl's suggestion about changing the campaign name in startpos.esf

    No thing is everything. Every thing is nothing.

  8. #8

    Default Re: Replacing the grand campaign

    I've tried with some of my startpos and works perfectly.




  9. #9

    Default Re: Replacing the grand campaign

    Good job Husserl and alpaca

  10. #10
    l33tl4m3r's Avatar A Frakkin' Toaster
    Join Date
    Mar 2009
    Location
    Soldier of Fortune
    Posts
    6,330

    Default Re: Replacing the grand campaign

    Fantastic stuff, to everyone involved.
    [House of Caesars|Under the Patronage of Carl von Döbeln]

  11. #11

    Default Re: Replacing the grand campaign

    You may call me mad, but I have to report a bug:

    Roads are gone.
    (and since this means we missed something there may be more)

    I have two identical Startpos.esf files, just differing in the two lines from the tutorial. (Both refering to "global_map")
    If I import the .lua returning "main" (or just delete the 2 packed files) I get roads . If I import the one returning "imperial_splendour" i get no roads.

    ...help?

    For those who think I smoke something, I attached screenies (At least that was my reaction when my team told me roads were gone)
    Spoiler Alert, click show to read: 



    Edit: I also think you should include in your tutorial a hint, that having a "custom_campaign.lua" file in your data folder will overrride changes contained in a pack file.
    Last edited by Lazy Knight; September 07, 2009 at 04:06 AM.


  12. #12
    alpaca's Avatar Harbinger of saliva
    Join Date
    Sep 2005
    Location
    Germany
    Posts
    4,811

    Default Re: Replacing the grand campaign

    Quote Originally Posted by Lazy Knight View Post
    You may call me mad, but I have to report a bug:

    Roads are gone.
    (and since this means we missed something there may be more)

    I have two identical Startpos.esf files, just differing in the two lines from the tutorial. (Both refering to "global_map")
    If I import the .lua returning "main" (or just delete the 2 packed files) I get roads . If I import the one returning "imperial_splendour" i get no roads.

    ...help?

    For those who think I smoke something, I attached screenies (At least that was my reaction when my team told me roads were gone)
    Spoiler Alert, click show to read: 



    Edit: I also think you should include in your tutorial a hint, that having a "custom_campaign.lua" file in your data folder will overrride changes contained in a pack file.
    I might call you mad for other reasons but the roads are indeed missing. Just goes to show how much you notice them in the game

    This probably means there's some backreference from wherever the roads are defined to the campaign startpos. I'll have a look and insert a "take care" note in the tutorial

    No thing is everything. Every thing is nothing.

  13. #13

    Default Re: Replacing the grand campaign

    Just in case that helps you: The problem doesn't exist in my startpos that are based on RTI 4 (main_2) vanilla startpos (main_2 was not changed after the CA's June major update).

    EDIT: This was not the case. There are sometimes that happens and sometimes that is not with other startpos also. Can't find a connection so far..
    Last edited by husserlTW; September 08, 2009 at 04:15 PM.




  14. #14

    Default Re: Replacing the grand campaign

    do trade routes exist when you do this?

  15. #15

    Default Re: Replacing the grand campaign

    the game works perfectly. It is just that roads are not displayed. The trade still works.
    Naval trade routes are also still visible.


  16. #16

    Default Re: Replacing the grand campaign

    Quote Originally Posted by Cinnead View Post
    Found some more bugs

    -The transportation zones on the campaign map (for switching between Europe & America) have lost their golden line thingies ..
    I have not properly tested if this is caused by this, but i can not imagine what else would cause it.


  17. #17

    Default Re: Replacing the grand campaign

    Also no problem running the original startpos with a custom_campaign.pack.

    Edit: I've done a mistake before which I think leads to solve the problem (as many times before). I didn't change anything to startpos!!!. So I returned to another startpos that I've got the problem and changed back the two entries to "main". Instead of an expected CTD, that's it, no problems with that also. I changed back in both of startpos I was testing the entries that should be according to alpaca's instructions (based on an idea of mine!!!) and the problem returned. So there is no need to change anything in startpos making the procedure easier.

    Thanks again alpy!
    Last edited by husserlTW; September 09, 2009 at 09:04 AM.




  18. #18
    alpaca's Avatar Harbinger of saliva
    Join Date
    Sep 2005
    Location
    Germany
    Posts
    4,811

    Default Re: Replacing the grand campaign

    Quote Originally Posted by husserlTW View Post
    Also no problem running the original startpos with a custom_campaign.pack.

    Edit: I've done a mistake before which I think leads to solve the problem (as many times before). I didn't change anything to startpos!!!. So I returned to another startpos that I've got the problem and changed back the two entries to "main". Instead of an expected CTD, that's it, no problems with that also. I changed back in both of startpos I was testing the entries that should be according to alpaca's instructions (based on an idea of mine!!!) and the problem returned. So there is no need to change anything in startpos making the procedure easier.

    Thanks again alpy!
    Hmm so does it then take the changed startpos or the old one? It's certainly possible the command in the UI only tells the game to load the files in a certain folder... I'll give it a shot, see what happens

    No thing is everything. Every thing is nothing.

  19. #19

    Default Re: Replacing the grand campaign

    Quote Originally Posted by alpaca View Post
    It's certainly possible the command in the UI only tells the game to load the files in a certain folder...
    From the other hand it was some kind of strange the game to go in folder X and read from startpos that it is in folder X.




  20. #20
    alpaca's Avatar Harbinger of saliva
    Join Date
    Sep 2005
    Location
    Germany
    Posts
    4,811

    Default Re: Replacing the grand campaign

    Quote Originally Posted by husserlTW View Post
    From the other hand it was some kind of strange the game to go in folder X and read from startpos that it is in folder X.
    Well it doesn't work for me. If I try to run the vanilla campaign in my game the game crashes because I'm using custom AOR resources. If I change the second entry to main, it tries to load the vanilla campaign apparently - which is pretty weird, all things considered.

    Anyways, I'm not sure if it's a big problem that roads are gone since they have no effect on movement points at all and the other building bonuses are handled differently. However, there could be other problems that are not purely visual.

    The gold border is gone in the RTI grand campaign, too, I think. It could be some of the visuals only apply to certain campaigns?

    No thing is everything. Every thing is nothing.

Page 1 of 4 1234 LastLast

Posting Permissions

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