Page 2 of 3 FirstFirst 123 LastLast
Results 21 to 40 of 58

Thread: Garrison Script

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Hellvard's Avatar Senator
    Join Date
    Dec 2012
    Location
    Poland
    Posts
    1,145

    Default Re: Garrison Script

    I copied this script to teutonic campaign, replacing Rome with Magdeburg, papal_states with hre, and peasants with zweihanders. But when i attack this city, nothing happens.

    Spoiler Alert, click show to read: 
    ;=========================================================================================


    ;---------- Counter ----------

    declare_counter magdeburg_siege


    ;---------- Garrisonscript ----------

    monitor_conditions not I_SettlementUnderSiege Magdeburg
    set_counter magdeburg_siege 0
    end_monitor

    monitor_conditions I_SettlementUnderSiege Magdeburg
    and I_CompareCounter magdeburg_siege = 0

    if I_SettlementOwner Magdeburg = hre
    create_unit Magdeburg, zweihander, num 2, exp 3, arm 1, wep 0
    end_if

    set_counter magdeburg_siege 1

    end_monitor


    end_script

  2. #2
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Garrison Script

    What happened to the top part of the script (radar control etc) I hope it was there?

    Looks like a logic flaw:

    NOT under siege = counter zero
    Under siege = counter one

    Now you are asking for 'counter one' but your event is 'under_siege'

    Remove this line and try again:
    and I_CompareCounter magdeburg_siege = 0

    For an easy check increase the number of units to 20 - that will fill up the garrison completely, excess units will not be created.


    Another option would be to change the event to 'GeneralAssaultsResidence' with conditions specifying the settlement, then the compare_counter line should work.










  3. #3
    Hellvard's Avatar Senator
    Join Date
    Dec 2012
    Location
    Poland
    Posts
    1,145

    Default Re: Garrison Script

    So this tutorial is wrong? I copied weissnicht script and changed only city and faction. I thought this will work.

  4. #4
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Garrison Script

    Was the radar restriction removed?










  5. #5
    Hellvard's Avatar Senator
    Join Date
    Dec 2012
    Location
    Poland
    Posts
    1,145

    Default Re: Garrison Script

    It wasn't, i don't change anything else, just added this script.

  6. #6
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Garrison Script

    Then the script was faulty. Let me give it a shot in Bare Geomod and see if I can get an error message.

    Edit: I don't know if it was because I capitalized the name of the unit, but it works (units spawn when besieging):

    Code:
    ;
    ; Campaign script
    ;
    script
        
        restrict_strat_radar false
        
        ;---------- Counter ----------
        
        declare_counter magdeburg_siege
            
        ;---------- Garrisonscript ----------
        
        monitor_conditions not I_SettlementUnderSiege Magdeburg
            set_counter magdeburg_siege 0
        end_monitor
        
        monitor_conditions I_SettlementUnderSiege Magdeburg
            and I_CompareCounter magdeburg_siege = 0
            
            if I_SettlementOwner Magdeburg = hre 
                create_unit Magdeburg, Zweihander, num 20, exp 1, arm 1, wep 2
            end_if
            
            set_counter magdeburg_siege 1
            
        end_monitor
        
        ; keep script unfinished until last monitor termination
        wait_monitors
        
    end_script
    Last edited by Gigantus; February 16, 2013 at 09:48 AM.










  7. #7
    Hellvard's Avatar Senator
    Join Date
    Dec 2012
    Location
    Poland
    Posts
    1,145

    Default Re: Garrison Script

    Should i copy all this code or just capitalize unit's name? In fact, both ways doesn't make change.

  8. #8
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Garrison Script

    Did you check if the unit exists in the EDU of your mod?

    I tested it by using Frankfurt (instead of Magdeburg) in Bare Geomod and attacked it with a Venetian army that I had added in descr_strat (right next to the settlement).










  9. #9
    Hellvard's Avatar Senator
    Join Date
    Dec 2012
    Location
    Poland
    Posts
    1,145

    Default Re: Garrison Script

    Yes it is, no doubt about that.

  10. #10
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Garrison Script

    I have just re-read from #21 onward: you are saying you copied the script to the teutonic campaign. That is a default campaign - how do you start it?

    Have you ever run this tutorial? If not, do so from step 3 onward, including the deleting of the Med2 folder in the VirtualStore










  11. #11
    Hellvard's Avatar Senator
    Join Date
    Dec 2012
    Location
    Poland
    Posts
    1,145

    Default Re: Garrison Script

    Sorry, i have win xp, not vista or 7. And what do you mean by:"That is a default campaign - how do you start it?"?

  12. #12
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Garrison Script

    Normally the teutonic campaign is started through the desktop icon that is provided by the installation of the kingdoms campaigns. That desktop shortcut uses the CFG file in the root folder of the game which does not have the file_first command which is necessary for edited files to be recognized.

    The campaign_script is one of the files that is not effected by this as it is one the unpacked files - just a general thought of mine until I checked the original installation.

    Can you do me a favor? Download Bare Geomod (kingdoms version) and use the attached campaign_script (adjusted as I said Frankfurt-->Magdeburg) and descr_strat (Venetian army next to Frankfurt). Then play Venice and attack Frankfurt and see if it works.










  13. #13
    Hellvard's Avatar Senator
    Join Date
    Dec 2012
    Location
    Poland
    Posts
    1,145

    Default Re: Garrison Script

    Yes, i created a bat file to run this teutonic modification. I did like you said, i have this army near Frankfurt, but still no new units in city.

  14. #14
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Garrison Script

    I assume you replaced the two original files in Bare Geomod with the two from my attachment? If so, then I am out of ideas - those two files are the only changes I made in Bare Geomod and it worked fine.










  15. #15
    Hellvard's Avatar Senator
    Join Date
    Dec 2012
    Location
    Poland
    Posts
    1,145

    Default Re: Garrison Script

    Sorry i did it wrong way, now it's working in Bare Geomod. But now, how to set it right in teutonic script? Copy script and put at the bottom lines? If i replace those files, i loose original scripts like Kalmar Union, etc.

  16. #16
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Garrison Script

    In post #26 I have now marked which is your independent script part. for easy working I would suggest to copy that part into the other script right under the 'script' entry (under line 4 of he code in post #26).

    General guideline: look for a 'end_monitor' line. that is always the end of an individual script part and yu copy a new script part right under it (before the next script part begins. Most modders leave two empty lines at the end of a script part for easy identification.










  17. #17
    Hellvard's Avatar Senator
    Join Date
    Dec 2012
    Location
    Poland
    Posts
    1,145

    Default Re: Garrison Script

    Now its finally working, appreciate your help uncle Gig

  18. #18
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Garrison Script

    Glad to hear, enjoy your modding.










  19. #19
    Hellvard's Avatar Senator
    Join Date
    Dec 2012
    Location
    Poland
    Posts
    1,145

    Default Re: Garrison Script

    I wonder if i can edit my garrison script, to create additional units, after making specified building? Also, is it possible, to make "major" garrison script? That will monitor all faction citys, without scripting every settlement on the map one after another?

  20. #20
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Garrison Script

    No way around to script each settlement as the spawning of the garrison requires the settlement name.

    You can test for the presence of a minimum level of a building tree or a specific building, making it conditional for a spawn.










Page 2 of 3 FirstFirst 123 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
  •