Page 1 of 2 12 LastLast
Results 1 to 20 of 22

Thread: UnitType examples

  1. #1

    Default UnitType examples

    I've been trying to find examples for triggers based off the condition UnitType but I can't seem to find any. Normally this wouldn't be a problem but it seems like whatever i try to do to get the condition working doesn't work. I would like to see some examples of the condition in action to see if I'm missing anything.

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

    Default Re: UnitType examples

    export_descr_guilds.txt (vanilla at least) has many examples.

    e.g.
    Code:
    ;------------------------------------------
    Trigger 0130_Recruit_Sword_Unit
        WhenToTest UnitTrained
    
        Condition UnitType Sword and Buckler Men
    
        Guild swordsmiths_guild s  15

  3. #3

    Default Re: UnitType examples

    Quote Originally Posted by Withwnar View Post
    export_descr_guilds.txt (vanilla at least) has many examples.

    e.g.
    Code:
    ;------------------------------------------
    Trigger 0130_Recruit_Sword_Unit
        WhenToTest UnitTrained
    
        Condition UnitType Sword and Buckler Men
    
        Guild swordsmiths_guild s  15
    would the condition still work if it's for a character trait?

    for example would something like this work?
    Code:
    Trait Command
    	Characters all
    
    
        Level Command
    	Description Command
        EffectsDescription Command
        GainMessage Command_Gain
    	Threshold 1
    
    
        Effect Command +5
    
    ;------------------------------------
       Trigger Commcand_0_trigger
        WhenToTest UnitTrained
    
    
        Condition UnitType Sword bodyguard
        and IsGeneral
    
    
        Affects Command  1  Chance  100

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

    Default Re: UnitType examples

    For traits and ancillaries the events (WhenToTest) must export character_record, so the game knows who to give the trait/anc to. See the Docudemons. UnitTrained doesn't so can't be used here. However, GovernorUnitTrained can: training that unit would give the governor the trait. IsGeneral wouldn't be needed there as governors are always general type characters.

  5. #5

    Default Re: UnitType examples

    Quote Originally Posted by Withwnar View Post
    For traits and ancillaries the events (WhenToTest) must export character_record, so the game knows who to give the trait/anc to. See the Docudemons. UnitTrained doesn't so can't be used here. However, GovernorUnitTrained can: training that unit would give the governor the trait. IsGeneral wouldn't be needed there as governors are always general type characters.
    how would I go about exporting character_record?

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

    Default Re: UnitType examples

    You can't. You must only use events that already do export character_record. The Docudemons show you what is exported by each event. See the Docudemons.

    What are you trying to do in that example? Who are you hoping to get the trait?

  7. #7

    Default Re: UnitType examples

    Quote Originally Posted by Withwnar View Post
    You can't. You must only use events that already do export character_record. The Docudemons show you what is exported by each event. See the Docudemons.

    What are you trying to do in that example? Who are you hoping to get the trait?
    I'm hoping that the only Governors/Generals with a certain bodyguard get the trait.

    in that example I only want Generals who have swordsmen as a bodyguard unit to get the trait

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

    Default Re: UnitType examples

    That's not possible as far as I know.

  9. #9

    Default Re: UnitType examples

    Quote Originally Posted by Withwnar View Post
    That's not possible as far as I know.
    ah ok then. Well thank you for your help anyways it was much appreciated.

  10. #10

    Default Re: UnitType examples

    Can you not do it in a roundabout way - add a custom attribute to the EDU of the unit you want, have the script check for it's presence, and use that to assign the trait instead of a normal trigger?

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

    Default Re: UnitType examples

    Script can check that a certain unit exists anywhere in the faction (I_UnitExists), or exists in a particular settlement (I_NumberUnitsInSettlement), but to assign the trait it would need to know which general and what his name is. It can't know those things.

  12. #12
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,125
    Blog Entries
    35

    Default Re: UnitType examples

    What happened to our favorite PUA condition?

    Code:
    Trigger Verpflegung
    WhenToTest CharacterTurnStart
        Condition IsGeneral
        and CharacterIsLocal
        and not EndedInSettlement
        and not Trait Verpflegung > 0
        and PercentageUnitAttribute baggage > 0
    
        Affects Verpflegung 1 chance  100
    In this case baggage (from 1648 - baggage train unit) is a custom EDU attribute. It's unreliable to test for a particular number of this unit within an army as it is percentage based, it can however in this form be used to check for a general presence. It should check bodyguards with a custom attribute as well.
    Last edited by Gigantus; December 21, 2016 at 11:18 PM.










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

    Default Re: UnitType examples

    If general A does not have the bodyguard but his army contains general B who does have the bodyguard then general A will get the trait because his army contains the unit. And general B won't get it because it's not his army so PercentageUnitAttribute won't work on him.

  14. #14
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,125
    Blog Entries
    35

    Default Re: UnitType examples

    Ah yes, that possibility will be there - so not exactly reliable in this case.










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

    Default Re: UnitType examples

    Quote Originally Posted by Bombiz View Post
    I'm hoping that the only Governors/Generals with a certain bodyguard get the trait.

    in that example I only want Generals who have swordsmen as a bodyguard unit to get the trait
    How is it that only some generals in the faction will have this bodyguard but others in the faction won't? Because they're recruitable generals?

  16. #16

    Default Re: UnitType examples

    Quote Originally Posted by Withwnar View Post
    If general A does not have the bodyguard but his army contains general B who does have the bodyguard then general A will get the trait because his army contains the unit. And general B won't get it because it's not his army so PercentageUnitAttribute won't work on him.
    Unless you have generals with different bodyguard units, that may not be an issue.

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

    Default Re: UnitType examples

    True, but if a faction's generals all have the same bodyguard type then simply give the trait to all generals of that faction. The bodyguard type would be irrelevant and PercentageUnitAttribute, UnitType, etc. wouldn't be needed.

  18. #18

    Default Re: UnitType examples

    Quote Originally Posted by Withwnar View Post
    How is it that only some generals in the faction will have this bodyguard but others in the faction won't? Because they're recruitable generals?
    yes. because they're recruit able generals.

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

    Default Re: UnitType examples

    Does the faction(s) have recruitable generals for any other type of unit?

  20. #20

    Default Re: UnitType examples

    Quote Originally Posted by Withwnar View Post
    Does the faction(s) have recruitable generals for any other type of unit?
    yes it does. it has three types in total.

Page 1 of 2 12 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
  •