Results 1 to 14 of 14

Thread: Campaign Script

  1. #1

    Default Campaign Script

    So I was creating a new script for my faction Balchoth (in the files known as united) in the TATW DaC mod, and the script works if I am playing as Balchoth but when i switch to any other faction and i destroy my faction the game crashes, now I dont know why this happens so I included my script if anyone has the time and wants to check it:

    http://www.mediafire.com/file/sav633...cript.txt/file

  2. #2

    Default Re: Campaign Script

    Oh and I should point out that without the script the game doesnt crash
    You can find the script by searching ctrl F "Balchoth" and it is surounded with # signs

  3. #3
    Gigantus's Avatar When all is lost, ask the I.R.S. - they'll find something
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    45,390
    Blog Entries
    20

    Default Re: Campaign Script

    It's a spawn script, player only. The only reason a crash will happen would be due to missing text for the historic events. I would also recommend a 'good housekeeping' entry - terminating the monitor when all three event counters are larger then zero.

    I can't see anything in this script that would lead to a crash when the Balchoth faction gets defeated by the player - the script terminates at game start if you don't play as that faction.



  4. #4

    Default Re: Campaign Script

    For some reason the entry that terminates the script when the player isnt Blachoth was wrong and when I deleted it I had no crashes, then I changed the second part and stated only if I am Balchoth the script goes off and it works, however now my spawning general after I kill Spain has Mumakil as his bodyguard and not elite champions, even if they are the first line below the general
    And thanks about the houseclenaing entry I never tought that terminating after everything was important

  5. #5
    Gigantus's Avatar When all is lost, ask the I.R.S. - they'll find something
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    45,390
    Blog Entries
    20

    Default Re: Campaign Script

    Not sure how defeating spain has anything to do with the first unit in a scripted spawn. In fact that's unlikely - you are spawning an army for the 'united' faction and regardless what you do the first unit in that spawn will be the bodyguard. Unless there is some formatting error which should lead to the spawn not happening at all.

    To avoid typos and reference errors I highly recommend to use squid's script checker.

    'House cleaning' helps with script processing: the more active monitors you have the longer the processing time. That's why monitors should be terminated whenever possible. Also do not use the same label for counters and event counters - bad practice as it can lead to confusion. Here my take on it with some 'beautification':

    Code:
            ;########################## Balchoth #########################
    
            declare_counter east_united
            set_counter east_united 0 - not needed, counters are always zero when declared
    
    
            monitor_event FactionTurnEnd FactionType slave
    
    
                ; terminate if faction is the AI
                if I_IsFactionAIControlled united    ; better suited for hotseat games
                    terminate_monitor
                end_if
    
    
                if I_SettlementOwner Mistrand = united
                    and I_SettlementOwner Southern_Rhun = united
                    and I_SettlementOwner Morad = united
                    and I_SettlementOwner Kelepar = united
                    and I_SettlementOwner Farest_Rhun = united
                    and I_NumberOfSettlements venice < 1
                    and I_EventCounter rhun_falls = 0
                    
                    historic_event rhun_falls
                    inc_counter east_united 1
                    
                    spawn_army
                    faction united
                        character    random_name, named character, age 22, x 390, y 285, direction N
                        traits        BadManRace 1, Brave 1, GoodCommander 2, GoodDefender 2, GoodSiegeDefender 1, Loyal 1, LoyaltyStarter 1, ReligionStarter 1
                        unit        elite champions                exp 2 armour 1 weapon_lvl 1
                        unit        Rhun Infantry Macemen        exp 0 armour 0 weapon_lvl 0
                        unit        Rhun Infantry Macemen        exp 0 armour 0 weapon_lvl 0
                    end
                end_if
    
    
                if I_SettlementOwner Harondor = united
                    and I_SettlementOwner Near_Harad = united
                    and I_SettlementOwner West_Khand = united
                    and I_SettlementOwner Harad = united
                    and I_SettlementOwner Khand = united
                    and I_SettlementOwner Far_Khand = united
                    and I_NumberOfSettlements khand < 1
                    and I_EventCounter khand_falls = 0
    
    
                    historic_event khand_falls
                        inc_counter east_united 1
    
    
                    spawn_army
                    faction united
                        character    random_name, named character, age 22, x 390, y 285, direction N
                        traits        BadManRace 1, Brave 1, GoodCommander 2, GoodDefender 2, GoodSiegeDefender 1, Loyal 1, LoyaltyStarter 1, ReligionStarter 1
                        unit        elite champions            exp 2 armour 1 weapon_lvl 1
                        unit        Khand_Windriders        exp 0 armour 0 weapon_lvl 0
                        unit        Khand_Windriders        exp 0 armour 0 weapon_lvl 0
                    end
                end_if
    
    
                if I_SettlementOwner Gobel_Ancalimon = united
                    and I_SettlementOwner Shafra = united
                    and I_SettlementOwner Amrun = united
                    and I_SettlementOwner Haradwaith = united
                    and I_SettlementOwner Chelkar = united
                    and I_NumberOfSettlements spain < 1
                    and I_EventCounter harad_falls = 0
                    
                    historic_event harad_falls
                    inc_counter east_united 1
    
    
                    spawn_army
                    faction united
                        character    random_name, named character, age 22, x 390, y 285, direction N
                        traits        BadManRace 1, Brave 1, GoodCommander 2, GoodDefender 2, GoodSiegeDefender 1, Loyal 1, LoyaltyStarter 1, ReligionStarter 1
                        unit        elite champions            exp 2 armour 1 weapon_lvl 1
                        unit        Harad Mumakil            exp 0 armour 0 weapon_lvl 0
                    end
                end_if
    
    
                if I_CompareCounter east_united = 3
                    and I_EventCounter east_united = 0
                    historic_event east_united
                    terminate_monitor            ; good house keeping
                end_if
    
    
            terminate_monitor
        end_monitor
    Last edited by Gigantus; January 22, 2019 at 11:34 PM.



  6. #6
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    5,984

    Default Re: Campaign Script

    has Mumakil as his bodyguard and not elite champions, even if they are the first line below the general
    See this: http://www.twcenter.net/forums/showt...1#post14897591

  7. #7

    Default Re: Campaign Script

    Well thank you both, it really helped, elite champions are indeed infantry and mumakil is an elephant so thats probably the problem( I tought it only did that with cav but guess not)
    About the spain defeated, I said it beacuse it is one of the conditions for the army with mumak and elite champions to spawn

    Funny how with these scripts you always learn something new
    Last edited by skylli; January 23, 2019 at 04:36 AM.

  8. #8
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    5,984

    Default Re: Campaign Script

    Elephants are still category=cavalry. That would be why.

  9. #9
    Gigantus's Avatar When all is lost, ask the I.R.S. - they'll find something
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    45,390
    Blog Entries
    20

    Default Re: Campaign Script

    Quote Originally Posted by Withwnar View Post
    Thanks for the refresher, had forgotten about the cavalry issue.



  10. #10

    Default Re: Campaign Script

    So I finally got to the part where my script should kick in but it doesnt, however it works without the condition:
    and I_NumberOfSettlements spain < 1

    with this part I wanted for my script to kick in when spain is defeated, does this make it so or is there a better way to write that?

  11. #11
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    5,984

    Default Re: Campaign Script

    That is how to test if a non-horde faction is dead. But it might depend on when (which event) you're using it, or possibly what other conditions are being tested. Impossible to say without seeing the script.

  12. #12

    Default Re: Campaign Script

    Gigantus has updated my script a couple of posts above, it is the same as that one

  13. #13
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    5,984

    Default Re: Campaign Script

    It looks fine. If there are no log errors then the only obvious answer is that not all of those other conditions were true during the slave FactionTurnEnd, e.g. one of those settlements went rebel.

  14. #14

    Default Re: Campaign Script

    Indeed Kelepar region went rebel after Venice was destroyed, what can I do to prevent 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
  •