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

Thread: The use of destroy_units in the campaign script

  1. #21
    Gigantus's Avatar I used to be jolly, too
    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    27,310

    Default Re: destroy_units - 4 sample uses

    @Taiji
    That's what they did in the teutonic campaign

    ;3 - Disband the pagan units
    retire_characters Lithuania priest
    destroy_units Lithuania pagan_unit
    ;kill the adventure crusader
    if I_CompareCounter crusader1_active = 1
    kill_character crus1
    destroy_units teutonic_order adv_crusade_eng
    set_counter crusader1_active 0
    end_if

  2. #22
    Opifex
    Join Date
    Feb 2005
    Location
    New York, USA
    Posts
    15,959

    Default Re: destroy_units - 4 sample uses

    That's only for the individual crusaders though, nobody thought to advance the idea further. Taiji's idea focuses on disbanding whole arrays of units, wherever they may be in your armies, if you get it bad with the pope.
    Last edited by SigniferOne; April 03, 2010 at 09:31 PM.


    "If ye love wealth greater than liberty,
    the tranquility of servitude greater than
    the animating contest for freedom, go
    home from us in peace. We seek not
    your counsel, nor your arms. Crouch
    down and lick the hand that feeds you,
    and may posterity forget that ye were
    our countrymen."
    -Samuel Adams

  3. #23
    Gigantus's Avatar I used to be jolly, too
    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    27,310

    Default Re: destroy_units - 4 sample uses

    From the EDU in the teutonic campaign:

    type Adv Longbowmen
    dictionary Adv_Longbowmen ; English Longbowmen
    category infantry
    class missile
    voice_type Light
    accent English
    banner faction main_missile
    banner holy crusade
    soldier Adv_Longbowmen, 48, 0, 0.8
    attributes sea_faring, hide_forest, can_withdraw, stakes, no_custom, adv_crusade_eng, stakes
    destroy_units teutonic_order adv_crusade_eng
    There are about 8 units like that in there.

  4. #24
    Opifex
    Join Date
    Feb 2005
    Location
    New York, USA
    Posts
    15,959

    Default Re: destroy_units - 4 sample uses

    Yeah, they disband the crusader's units when he's gone. I'm talking about you hiring units throughout your campaign, units widely dispersed across all your armies, triggered by papal excommunications or other non-scripted normal changes in game's diplomacy, status, etc.

    The crusader's soldiers were made to appear by script and disappeared by script, so everyone assumed applications of this were localized to scripted triggering.
    Last edited by SigniferOne; April 03, 2010 at 09:38 PM.


    "If ye love wealth greater than liberty,
    the tranquility of servitude greater than
    the animating contest for freedom, go
    home from us in peace. We seek not
    your counsel, nor your arms. Crouch
    down and lick the hand that feeds you,
    and may posterity forget that ye were
    our countrymen."
    -Samuel Adams

  5. #25
    Gigantus's Avatar I used to be jolly, too
    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    27,310

    Default Re: destroy_units - 4 sample uses

    ....triggered by papal excommunications or other non-scripted normal changes in game's diplomacy, status, etc.
    Which then can be tested through script (IsCrusade, FactionExcommunicated, DiplomaticStanceFactions) and applied to disbandment (and recuitment obviously) of units? Or am I understanding wrongly what you meant?

  6. #26
    Tsarsies's Avatar Artifex
    Join Date
    Apr 2007
    Posts
    902

    Default Re: destroy_units - 4 sample uses

    I have to agree with gigantus. Only specific units allowable in crusades would have the attribute. All other units in the crusade would and could be regular units in your army or even mercenary units. Ifyou disband these (say a mailed knight) you may aswell say good bye to your army at home too!

    You have to be very selective of the units you give the attribute too. When giving it to crusader units you have have to be very selective. Is the unit ONLY recruitable by a crusading general? or can i simply train the unit at home?. If i can train the unit at home and then some script disbands them, that could destroy me and therefore any of the AI factions home armies. If only the units available to a crusading general had these, then only my crusading army would disband. Not including regular units that joined with the crusaders. They would be left alone.

    Using the attribute is a great idea and fantastic. But it has to be very well thought out before using it.

    When i was writing my Garrison script i wanted to use a special unit just for the garrison. Or a select few. Give them the attribute and destroy them after the siege. Noone would be able to recruit these units as they would be only available by script. That was my original idea 2 years ago. But i couldnt find anyone to make the units for me. So i wrote the script without it.
    ...longbows, in skilled hands, could reach further than trebuchets...
    TEAM MEMBER for WotW
    Working on Creating: Trade and Supply mini mod, New Event Types, Artisans Craftsmen and Entertainers mini mod

  7. #27
    Gigantus's Avatar I used to be jolly, too
    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    27,310

    Default Re: destroy_units - 4 sample uses

    Basically all you have to do is to copy an existing unit in the EDU, give it a different name, enter the attribute, add some lines in text\export_units and you are set.

  8. #28
    Gorrrrrn's Avatar Citizen
    Join Date
    Jan 2007
    Location
    here
    Posts
    5,712

    Default Re: destroy_units - 4 sample uses

    The idea of specific garrison_units is excellent - I suspect the only reason T's ideas weren't taken up at the the time was down to lack of vacant slots in the EDU.

    I'm sure there's a few units we could remove from SS (for example) to make way for specific garrison_units - 1 spear / 1 archer / 1 sword / 1 x-bow / 1 pike -
    Although they'd have to be common across all cultures / factions, or they start eating up serious amounts of EDU slots.
    (Or removing lots of units from the main faction roster.)

    --

    Re removing pirate ships - seems to work most of the time, but I'm finding odds and ends left over in some places,
    ships which originally have 25 crew are left with 2 - 5.
    I wondering if the script only removes the basic crew size (20), rather the actual number which depends on what size units you're using generally.
    I know some of the pirate ships get hit by storms so that may account for some variation in the size of the remaining crew?

    Once they are reduced to this size (2 -5) the script doesn't seem to affect them any more whenever it subsequently fires.

  9. #29
    Taiji's Avatar relaxed-system intact
    Join Date
    Jun 2005
    Posts
    9,793

    Default Re: destroy_units - 4 sample uses

    Quote Originally Posted by gigantus View Post
    @Taiji
    That's what they did in the teutonic campaign
    Oh yeah, thanks for showing me, they must be clever like me then

  10. #30
    Tsarsies's Avatar Artifex
    Join Date
    Apr 2007
    Posts
    902

    Default Re: destroy_units - 4 sample uses

    The idea of specific garrison_units is excellent - I suspect the only reason T's ideas weren't taken up at the the time was down to lack of vacant slots in the EDU.
    That is correct. The garrison script was originally written for stainless steel, and they have the 500 unit limit.

    The other way around it, which is a little hard to exaplin... is what is called a 'Dummy' faction. Its not really a faction as it does not take up a faction slot. But you can have as many 'dummy' factions as you like. Basically, Every unit (or a select few) is available to this dummy faction, All units available to the dummy faction are available to every other faction, thus creating a super 'dummy' faction. (A faction that in essence could have every unit at its disposal). In that sense, you would/could make English Longbow available to Egypt. The trick, however, is that egypt will never be able to train this unit, because it isnt specified in the EDB. But the unit can be spawned via script. The dummy faction idea simply removes the silver surfer effect you get when a unit spawns for a faction it is not otherwise meant to have.

    That same idea, except a select few uinits that are available to every faction, thus creating your dummy 'garrison' faction. These units are given the attribute to be able to destroy them. The units would only be available through script so would only be on the map at your choosing.

    The reason you would have multiple dummy factions (possibly with different units) is because there can be multiple sieges going on at once and you dont want to remove the units until after the siege. So multiple dummy factions solve that problem.

    But it is as Rozanov pointed out. If its not very well thought out, you will take up a lot of unit slots in the EDU quickly.
    ...longbows, in skilled hands, could reach further than trebuchets...
    TEAM MEMBER for WotW
    Working on Creating: Trade and Supply mini mod, New Event Types, Artisans Craftsmen and Entertainers mini mod

  11. #31
    Gorrrrrn's Avatar Citizen
    Join Date
    Jan 2007
    Location
    here
    Posts
    5,712

    Default Re: destroy_units - 4 sample uses

    Seems the problem with my not removing pirate ships is due to a terminate_monitor after the first instance of the destroy pirate ships
    (or some other problem as no line after it fires in the campaign script!!)

    will need to re-check the code on that!

  12. #32
    Taiji's Avatar relaxed-system intact
    Join Date
    Jun 2005
    Posts
    9,793

    Default Re: destroy_units - 4 sample uses

    You need to put the terminate before the end, like you neglected to do here.

    Just swap them around. I hope that helps

  13. #33
    Gorrrrrn's Avatar Citizen
    Join Date
    Jan 2007
    Location
    here
    Posts
    5,712

    Default Re: destroy_units - 4 sample uses

    Taiji - well spotted.
    found it myself as well - such a simple mistake

  14. #34
    Augustus Lucifer's Avatar Life = Like a beanstalk
    Join Date
    Aug 2006
    Location
    Up in here
    Posts
    10,268

    Default Re: destroy_units - 4 sample uses

    Quote Originally Posted by Tsarsies View Post
    The other way around it, which is a little hard to exaplin... is what is called a 'Dummy' faction. Its not really a faction as it does not take up a faction slot. But you can have as many 'dummy' factions as you like. Basically, Every unit (or a select few) is available to this dummy faction, All units available to the dummy faction are available to every other faction, thus creating a super 'dummy' faction. (A faction that in essence could have every unit at its disposal). In that sense, you would/could make English Longbow available to Egypt. The trick, however, is that egypt will never be able to train this unit, because it isnt specified in the EDB. But the unit can be spawned via script. The dummy faction idea simply removes the silver surfer effect you get when a unit spawns for a faction it is not otherwise meant to have.

    That same idea, except a select few uinits that are available to every faction, thus creating your dummy 'garrison' faction. These units are given the attribute to be able to destroy them. The units would only be available through script so would only be on the map at your choosing.

    The reason you would have multiple dummy factions (possibly with different units) is because there can be multiple sieges going on at once and you dont want to remove the units until after the siege. So multiple dummy factions solve that problem.

    But it is as Rozanov pointed out. If its not very well thought out, you will take up a lot of unit slots in the EDU quickly.
    The concept makes sense, but what exactly do you mean when you say 'dummy faction'. Adding a name to the ownership line which doesn't exist in sm_factions? And how would this mitigate EDU needs; as in, are the units being spawned under this dummy faction, rather than the faction which owns the settlement, which in turn would allow for any units to be killed off since they're localized to that faction?

  15. #35
    Gigantus's Avatar I used to be jolly, too
    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    27,310

    Default Re: destroy_units - 4 sample uses

    I think he means that you spawn units that the faction owns (EDU ownership) but cannot build (EDB). That way when you destroy this unit for the faction you can be assured that you will only destroy previously spawned units.

  16. #36
    Tsarsies's Avatar Artifex
    Join Date
    Apr 2007
    Posts
    902

    Default Re: destroy_units - 4 sample uses

    Correct. The dummy faction is just like a place holder. A place for said units to call home. Even though they are in every other factions unit roster (or atleast the factions you want to be able to spawn them). They dont appear in the EDB as no one can racruit them, and you are assured that when you kill the units via script that no other units other then the ones spawned will be removed.

    I guess 'dummy' faction is kind of misleading because it isnt really a faction. Its just a place holder.
    ...longbows, in skilled hands, could reach further than trebuchets...
    TEAM MEMBER for WotW
    Working on Creating: Trade and Supply mini mod, New Event Types, Artisans Craftsmen and Entertainers mini mod

  17. #37
    Taiji's Avatar relaxed-system intact
    Join Date
    Jun 2005
    Posts
    9,793

    Default Re: destroy_units - 4 sample uses

    Quote Originally Posted by Taiji View Post
    I just thought of some very nice ways to use it; set up catholic religious order troops with a common attribute, and then destroy them when the faction gets excommunicated.

    And also for destroying crusading mercenaries when the crusade is over.

    I think they're both great ideas and I might use them (if I can work out how ). Thanks for the inspiration, Rozanov! +rep
    Both scripts now in place, complete with recruit restriction for holy orders

    Here, if you're interested:

    Spoiler Alert, click show to read: 

    Code:
    ;crusaders go home
    
    monitor_event FactionTurnStart FactionIsLocal
    	and I_TurnsSinceLastCrusade = 4
    		destroy_units venice crusader
    		destroy_units elo crusader
    		destroy_units milan crusader
    		destroy_units sicily crusader
    		destroy_units spain crusader
    		destroy_units portugal crusader
    		destroy_units norway crusader
    		destroy_units scotland crusader
    		destroy_units denmark crusader
    		destroy_units ireland crusader
    		destroy_units poland crusader
    		destroy_units hungary crusader
    		destroy_units hre crusader
    		destroy_units flanders crusader
    		destroy_units england crusader
    		destroy_units france crusader
    		destroy_units teutons crusader
    end_monitor
    
    ;excommunication? Goodbye holy troops
    
    declare_counter xcom
    set_event_counter xcom 0
    
    monitor_event FactionTurnStart FactionType france
    	and FactionExcommunicated
    
    		destroy_units france xcom
    end_monitor
    
    monitor_event FactionTurnStart FactionType england
    	and FactionExcommunicated
    
    		destroy_units england xcom
    end_monitor
    
    monitor_event FactionTurnStart FactionType flanders
    	and FactionExcommunicated
    
    		destroy_units flanders xcom
    end_monitor
    	
    monitor_event FactionTurnStart FactionType hre
    	and FactionExcommunicated
    
    		destroy_units hre xcom
    end_monitor
    
    monitor_event FactionTurnStart FactionType hungary
    	and FactionExcommunicated
    
    		destroy_units hungary xcom
    end_monitor
    
    monitor_event FactionTurnStart FactionType poland
    	and FactionExcommunicated
    
    		destroy_units poland xcom
    end_monitor
    
    monitor_event FactionTurnStart FactionType ireland
    	and FactionExcommunicated
    
    		destroy_units ireland xcom
    end_monitor
    
    monitor_event FactionTurnStart FactionType denmark
    	and FactionExcommunicated
    
    		destroy_units denmark xcom
    end_monitor
    
    monitor_event FactionTurnStart FactionType scotland
    	and FactionExcommunicated
    
    		destroy_units scotland xcom
    end_monitor
    
    monitor_event FactionTurnStart FactionType norway
    	and FactionExcommunicated
    
    		destroy_units norway xcom
    end_monitor
    
    monitor_event FactionTurnStart FactionType portugal
    	and FactionExcommunicated
    
    		destroy_units portugal xcom
    end_monitor
    
    monitor_event FactionTurnStart FactionType spain
    	and FactionExcommunicated
    
    		destroy_units spain xcom
    end_monitor
    
    monitor_event FactionTurnStart FactionType sicily
    	and FactionExcommunicated
    
    		destroy_units sicily xcom
    end_monitor
    
    monitor_event FactionTurnStart FactionType milan
    	and FactionExcommunicated
    
    		destroy_units milan xcom
    end_monitor
    
    monitor_event FactionTurnStart FactionType venice
    	and FactionExcommunicated
    	
    		destroy_units venice xcom
    end_monitor
    
    ;Preventing recruit of holy troops
    
    monitor_event FactionTurnStart FactionExcommunicated
    
    		set_event_counter xcom 1
    end_monitor
    
    monitor_event FactionTurnEnd I_EventCounter xcom 1
    
    		set_event_counter xcom 0
    end_monitor
    The EDB event restricting recruitment, 'xcom', I've set up using 'and not event_counter xcom 1' as the condition.

    Perhaps I could have used a series of if's instead of making so many monitors for the xcom script... But it looked like a bad option. I'd rather have small monitor scripts firing in each instance than a large if statement that covers all of them firing each time. Perhaps I misunderstand something but it seems like the if statement route for this would cause a performance loss.
    Last edited by Taiji; April 09, 2010 at 07:39 PM.

  18. #38
    Hero of the West's Avatar Fellowship of the MOS
    Join Date
    Jan 2010
    Location
    The Netherlands
    Posts
    1,485

    Default Re: destroy_units - 4 sample uses

    maybe a stupid question but here it goes..

    I'm trying to make a unique mision for third age total war.. the idea is to use the reinforce region script to let the player collect elven units in grey haven.. when the conditions are met the collected units must be disbanded in order to recreate the "elven are leaving middle earth idea".. as a reward i was thinking of then giving some units of unique elven soldiers..

    i know that most of it is possible but i'm wondering if it's possible to disband all units in a certain settlement?
    and with the trigger as a certain total of units and not interfering with the reinforce region script.. so actually first trigger the reinforce region succeeded and then clean out the settlement, is this possible?

    I've been looking into this a lot but it's hard to find an answer and since i'm only a beginner in scripting it's really hard to figure this out by starting testing right away

    thx in advance
    Patronized by Eöl

  19. #39
    Tsarsies's Avatar Artifex
    Join Date
    Apr 2007
    Posts
    902

    Default Re: destroy_units - 4 sample uses

    When you disband a unit, it will disband ALL instances of that unit faction wide (or maybe it is world wide). Which means you cant just disband a single settlement of units unless those units were ONLY in that settlement.

    It is a shame we cant give 'tags' to units once they are recruited/spawned, then we could simply disband individual untis as we please. if only...
    ...longbows, in skilled hands, could reach further than trebuchets...
    TEAM MEMBER for WotW
    Working on Creating: Trade and Supply mini mod, New Event Types, Artisans Craftsmen and Entertainers mini mod

  20. #40
    Sir Arnold
    Join Date
    Mar 2009
    Location
    DAA
    Posts
    6,681

    Default Re: destroy_units - 4 sample uses

    Quote Originally Posted by Tsarsies View Post
    It is a shame we cant give 'tags' to units once they are recruited/spawned, then we could simply disband individual untis as we please. if only...
    Why can't we?

    docudemons:
    Code:
    Identifier:	create_unit
    Parameters:	<character/settlement name>, <unit label>[, num <number of units>, exp <experience>, arm <armour level>, wep <weapon level>
    Description:	creates one or more units of the specified type
    Sample use:	create_unit Foedus Chaerea, English_Knights, num 5, exp 1, arm 1, wep 2
    Class:	CREATE_UNIT
    
    
    Identifier:	label_unit
    Parameters:	alliance, army, unit, label
    Description:	Label a particular unit
    Sample use:	label_unit 0 2 4 julii_hastati_2
    Class:	LABEL_UNIT

    According to the docudemons it should be possible to label a certain unit when created by a script.
    Hence, for example for the garrison script, it should be possible to label the units of every city differently, shouldn't it?

Page 2 of 3 FirstFirst 123 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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