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

Thread: Scripting Questions - TurnEnds and Ancillary Removal

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Augustus Lucifer's Avatar Life = Like a beanstalk
    Patrician Citizen

    Join Date
    Aug 2006
    Location
    Mote of Dust
    Posts
    10,725

    Default Scripting Questions - TurnEnds and Ancillary Removal

    I'm trying to make some trigger changes to perform multiple different checks that can't be executed at the same time. I'm able to perform two of the three using CharacterTurnEnd and CharacterTurnStart, but what I'm wondering is if anyone knows the exact progression of TurnStart/TurnEnd's. To my knowledge Character/Settlement/Faction all happen at the start and end of every turn, not as it implies for the former two after actions are completed. But what order do they fire in? Would help if someone could provide the order like this:

    FactionTurnStart
    SettlementTurnStart
    CharacterTurnStart
    CharacterTurnEnd
    SettlementTurnEnd
    FactionTurnEnd

    Except the right way, and with any additional parameters to TurnStart/End I may have missed. Also, is there a Condition that checks for another trigger firing? As in:

    Trigger Blah
    WhenToTest CharacterTurnEnd
    Condition 1
    and 2
    and 3

    Affect Command 1

    Trigger Bleh
    WhenToTest CharacterTurnEnd
    Condition 1
    and 2
    and 3
    and (Blah has fired)

    Affect Command 1

    In order to give them an order in which to fire even when they're tested at the same juncture?

    Lastly, I need to know what the best way to remove an ancillary is. In the export_descr_ancillaries.txt all of the triggers provide the Effect "AquireAncillary". Can "RemoveAncillary" be provided as an effect in the triggers, or a similar parameter? There's also ExcludedAncillaries, does this mean once you have this ancillary, even if you're able to gain another in the excluded list, you don't(seems to be the case)? Or does it mean they alternate and it removes the old one when conditions are fulfilled for the new one? Other thing I can think of is using the campaign_script.txt to have a continual event monitor to remove an ancillary, is this perhaps the way to go, and what would it look like?

    EDIT: Also read two things in alpaca's tutorial I'm curious as to the truth of. One is it says the triggers are read top to bottom and fire in that order, if this is true than the TurnEnd stuff won't matter I'll just have to order them accordingly(though I'd like to know the order anyways). The second is that traits without NoGoingBackLevel when dropping a level drop all their levels, this isn't relevant to my current work but if that is a problem that is a very strange one indeed...

    EDIT #2: On second thought, the order of fire wouldn't fix my problem, since it fires from multiple files and needs to be sequential, so still need to know the TurnEnd order to make it work.

    Thanks in advance for any help that can be provided, creating a interchangeable ancillary line and just need to know these two things for it to work as planned.

    Cheers,
    Augustus
    Last edited by Augustus Lucifer; August 14, 2008 at 07:41 PM.

  2. #2
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,851
    Blog Entries
    10

    Default Re: Scripting Questions - TurnEnds and Ancillary Removal

    The simple one first, checking a trigger:

    Code:
    Identifier:	I_IsTriggerTrue
    Trigger requirements:	
    Parameters:	trigger name
    Sample use:	I_IsTriggerTrue sample_trigger_name
    Description:	Has this trigger been fired?
    Battle or Strat:	Strat
    Class:	TRIGGER_TRUE
    Trigger Blah
    WhenToTest CharacterTurnEnd
    and I_IsTriggerTrue TriggerName
    and 2
    and 3

    Affect Command 1


    Traits without a NoGoingBackLevel are designed to completely drop off when needed, this way the character can acquire the anti trait. You can control how many levels they drop by using -1 or -2 or -10 in the trigger.

    The only way I know of to remove an ancillary is by campaign_script, there is no command for this that will work in a trigger. There are limits on this though, the character HAS to be physically selected by the player. This might help you out a bit:
    http://www.twcenter.net/forums/showthread.php?t=141695

  3. #3
    Augustus Lucifer's Avatar Life = Like a beanstalk
    Patrician Citizen

    Join Date
    Aug 2006
    Location
    Mote of Dust
    Posts
    10,725

    Default Re: Scripting Questions - TurnEnds and Ancillary Removal

    Quote Originally Posted by GrnEyedDvl View Post
    The simple one first, checking a trigger:

    Code:
    Identifier:	I_IsTriggerTrue
    Trigger requirements:	
    Parameters:	trigger name
    Sample use:	I_IsTriggerTrue sample_trigger_name
    Description:	Has this trigger been fired?
    Battle or Strat:	Strat
    Class:	TRIGGER_TRUE
    Trigger Blah
    WhenToTest CharacterTurnEnd
    and I_IsTriggerTrue TriggerName
    and 2
    and 3

    Affect Command 1
    Okay, well that seems simple enough. Problem is if it has that Condition, does that mean it will wait for the trigger to fire, or just check if it has. If it only does the latter and doesn't re-check after the specified trigger has fired, it won't work as intended. That's why it'd be useful to know what the order of the Start/End is, so I can make one be at CharacterTurnEnd, another at FactionTurnEnd, and another at CharacterTurnStart, so there's no conflict. But just need to know what the order it tests start/end in is.

    Quote Originally Posted by GrnEyedDvl View Post
    Traits without a NoGoingBackLevel are designed to completely drop off when needed, this way the character can acquire the anti trait. You can control how many levels they drop by using -1 or -2 or -10 in the trigger.

    That seems like a terrible system if gaining points in an anti-trait instantly removes the trait even if it's the fifth tiered level with a huge threshold, it really should just subtract from the threshold of the anti-trait . What exactly do you mean about -1, -2, and -10, do they each correspond to a certain trait reduction in levels? :hmmm:


    Quote Originally Posted by GrnEyedDvl View Post
    The only way I know of to remove an ancillary is by campaign_script, there is no command for this that will work in a trigger. There are limits on this though, the character HAS to be physically selected by the player. This might help you out a bit:
    http://www.twcenter.net/forums/showthread.php?t=141695
    I read through that script at the bottom of where you first posted it as working. In my script I don't care what happens to the ancillary, the player isn't intended to have a choice, it just needs to be able to be removed if it meets certain conditions. So for instance...

    Code:
    monitor_event CharacterTurnStart CharacterIsLocal
            and IsGeneral
            and EndedInSettlement
        set_event_counter remove_guard 1
    end_monitor
    
    monitor_conditions I_EventCounter remove_guard = 1
    (blank)
    console_command remove_ancillary guard
    set_event_counter remove_guard 0
    end_monitor
    So is the above a viable usage of this remove ancillary. Don't mind the "IsGeneral" that isn't the actual script. The (blank) is because I'm trying to find a way to just remove all guard ancillaries from any general who meets the conditions, without having to select them, because that makes it more voluntary than the script seeks to achieve. Do you know of a way, or do you think with enough condition diving I might find one?

    Also, glad to see you here and responding, for a while I thought you and gigantus were kidnapped by the KGB

    Cheers,
    Augustus

  4. #4
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,851
    Blog Entries
    10

    Default Re: Scripting Questions - TurnEnds and Ancillary Removal

    Quote Originally Posted by Augustus Lucifer View Post
    Okay, well that seems simple enough. Problem is if it has that Condition, does that mean it will wait for the trigger to fire, or just check if it has. If it only does the latter and doesn't re-check after the specified trigger has fired, it won't work as intended. That's why it'd be useful to know what the order of the Start/End is, so I can make one be at CharacterTurnEnd, another at FactionTurnEnd, and another at CharacterTurnStart, so there's no conflict. But just need to know what the order it tests start/end in is.
    I have never tested how that one works exactly, you will have to do some trial and error stuff. I believe Alpaca has it right.

    Character Start > Character End >Settlement Start >Settlement End > FactionStart > Faction End




    That seems like a terrible system if gaining points in an anti-trait instantly removes the trait even if it's the fifth tiered level with a huge threshold, it really should just subtract from the threshold of the anti-trait . What exactly do you mean about -1, -2, and -10, do they each correspond to a certain trait reduction in levels? :hmmm:


    If you have leve 5 of Trait and get level 1 of AntiTrait, you are now at level 4 of Trait. Hope that makes sense.

    For the minus, consider this trigger from my recent 12 Turns per Year script:
    Code:
    Trigger WinterToSummer
        WhenToTest CharacterTurnEnd
     
        Condition not AgentType = admiral
      and Trait CampaignSeason = 2
      and I_EventCounter summer_winter == 1
     
        Affects CampaignSeason -1 Chance 100
    Basically Summer is level 1 of the CampaignSeason trait, Winter is level 2. So if trait CampaignSeason = 2 (winter) then Affects CampaignSeason -1. This knocks the trait from 2 to 1 (summer). If you have a trait with 10 levels, you can knock however many you want to off of the trait by assigning a negative value.


    I read through that script at the bottom of where you first posted it as working. In my script I don't care what happens to the ancillary, the player isn't intended to have a choice, it just needs to be able to be removed if it meets certain conditions. So for instance...

    Code:
    monitor_event CharacterTurnStart CharacterIsLocal
    Code:
        and IsGeneral
        and EndedInSettlement
    set_event_counter remove_guard 1
    end_monitor
     
    monitor_conditions I_EventCounter remove_guard = 1
    (blank)
    console_command remove_ancillary this guard  ;you missed a key word here
    set_event_counter remove_guard 0
    end_monitor
    So is the above a viable usage of this remove ancillary. Don't mind the "IsGeneral" that isn't the actual script. The (blank) is because I'm trying to find a way to just remove all guard ancillaries from any general who meets the conditions, without having to select them, because that makes it more voluntary than the script seeks to achieve. Do you know of a way, or do you think with enough condition diving I might find one?
    You can remove a trait anytime you want, as long as the player has the character physically selected on the campaign map by clicking on him. This is the only way. Otherwise the game does not know who to remove it from because the event does not export a character name. This means that you have to check your events on CharacterSelected (well thats the easiest way) so you KNOW which character the player has clicked on.

    Something like this:
    Code:
    monitor_event CharacterSelected CharacterIsLocal
    and OtherConditions
     
    console_command remove_ancillary this Ancillaryname
    end_monitor
    Also, glad to see you here and responding, for a while I thought you and gigantus were kidnapped by the KGB

    Actually I have been kind busy, my daughter has strep throat and there is a surpise coming soon from a small group of modders...

  5. #5
    Augustus Lucifer's Avatar Life = Like a beanstalk
    Patrician Citizen

    Join Date
    Aug 2006
    Location
    Mote of Dust
    Posts
    10,725

    Default Re: Scripting Questions - TurnEnds and Ancillary Removal

    Quote Originally Posted by GrnEyedDvl View Post
    I have never tested how that one works exactly, you will have to do some trial and error stuff. I believe Alpaca has it right.

    Character Start > Character End >Settlement Start >Settlement End > FactionStart > Faction End
    :hmmm:

    So.. the Character turn both starts and ends before the Settlement turn, which starts and ends before the faction turn? That doesn't quite make sense . I'd think it would just fire the three starts, and then at the end fire the three finishes...? Like a quote within a quote within a quote. Like...

    FactionTurnStart
    V
    SettlementTurnStart
    V
    CharacterTurnStart

    (Turn Actions)

    (Press End Turn)

    CharacterTurnEnd
    V
    SettlementTurnEnd
    V
    FactionTurnEnd

    (AI Turns)

    (Repeat)

    Is this not the case? Or was that what you meant by the progression listed. Maybe a link to where you're referencing alpaca would help.


    Quote Originally Posted by GrnEyedDvl View Post
    If you have leve 5 of Trait and get level 1 of AntiTrait, you are now at level 4 of Trait. Hope that makes sense.

    For the minus, consider this trigger from my recent 12 Turns per Year script:
    Code:
    Trigger WinterToSummer
        WhenToTest CharacterTurnEnd
     
        Condition not AgentType = admiral
      and Trait CampaignSeason = 2
      and I_EventCounter summer_winter == 1
     
        Affects CampaignSeason -1 Chance 100
    Basically Summer is level 1 of the CampaignSeason trait, Winter is level 2. So if trait CampaignSeason = 2 (winter) then Affects CampaignSeason -1. This knocks the trait from 2 to 1 (summer). If you have a trait with 10 levels, you can knock however many you want to off of the trait by assigning a negative value.
    Wasn't aware of the ability to add negative numbers to a trait. Do these negative numbers directly effect the threshold like they should, or effect based on level? As in, to go from:

    Level2Commander
    Threshold 2

    to

    Level1Commander
    Threshold 1

    I'd use

    Affects Commander -1 Chance 100

    but if the traits were like

    Level2Commander
    Threshold 4

    to

    Level1Commander
    Threshold 2

    I'd use

    Affects Commander -2

    or would I use

    Affects Commander -1

    My impression was the former, that you just subtracted from the threshold, but it keeps sounding like you're referring to levels, so just wondering which is the case. Also, it was my impression that adding 1 in an AntiTrait worked the same way as minus -1 in a trait, if that isn't the case it makes things a lot less helpful, since it's indefinitely buggy .


    Quote Originally Posted by GrnEyedDvl View Post
    You can remove a trait anytime you want, as long as the player has the character physically selected on the campaign map by clicking on him. This is the only way. Otherwise the game does not know who to remove it from because the event does not export a character name. This means that you have to check your events on CharacterSelected (well thats the easiest way) so you KNOW which character the player has clicked on.

    Something like this:
    Code:
    monitor_event CharacterSelected CharacterIsLocal
    and OtherConditions
     
    console_command remove_ancillary this Ancillaryname
    end_monitor
    Well that's a shame . It seems kind of odd really that you can have trait triggers that look like this:

    Code:
    Trigger corruption2
        WhenToTest CharacterTurnEnd
    
        Condition EndedInSettlement
              and Treasury > 100000
    
        Affects Corrupt  1  Chance  3 
        Affects Aesthetic  1  Chance  3 
        Affects ExpensiveTastes  1  Chance  3 
        Affects Epicurean  1  Chance  3 
        Affects Embezzler  1  Chance  5
    Which don't export the character it's affecting(and I think based on that script, it is meant for all the characters that meet those conditions), but you have to have the character selected to remove an ancillary :hmmm:. I'll look into ways to twist the conditions to fit my situation, so far no luck, this trigger set/script I'm trying to make is turning out more complicated than originally thought .



    Quote Originally Posted by GrnEyedDvl View Post
    Actually I have been kind busy, my daughter has strep throat and there is a surpise coming soon from a small group of modders...
    Sorry to hear that, hope she gets better soon. And looking forward to this "surprise", though I must admit I hate surprises!

    Update:

    I've got the first portion of the script working(not exactly how I intended it, but as good as it gets), now working on getting the second portion to work...

    Something I'm wondering. I'm using this condition to run my script:

    CharacterNumTurnsIdle

    It works as it says, but it seems like it doesn't stop counting a character as idle. The script is intended to be continuous, but shouldn't the number of turns idle reset after moving the character? If this doesn't count as not being idle and you have to enter a battle or something, is there a way to change it so that moving counts(doubt it)? I tested the script and it works as intended 2/3 of it at least, the only problem is that it keeps adding to the trait even after I've moved. I wait the requisite turns without moving the character, then select it to fire the trigger, and it provides the appropriate affect. But then if I move him and select him again next turn, it will just keep stacking the affect ad infinitum. Is there anything similar to CharacterNumTurnsIdle or another condition that can stop this(not talking about terminating the monitor).

    The "RemainingMPPercentage" won't work on its own, because you have full MP every time your turn starts, so every time you select the character it would fire. There's one called "NoActionThisTurn", but if "CharacterNumTurnsIdle" isn't considering the moving of the character to take it out of being idle, I have a feeling that would just return the character as idle every turn . Any suggestions to additional conditions or ways to make the aforementioned ones work like intended?

    The alternative to it keeping it as idle after moving, is that in checking the panel, and then selecting the character again to move it, it fires the trigger again. Is there a condition that insures a trigger only fires a maximum of once per turn?

    Also I'm beginning to wonder if my script is working or if the event CharacterPanelOpened is not working :hmmm which panel might it be referring to and has anyone had errors with it?

    Cheers,
    Augustus
    Last edited by Augustus Lucifer; August 16, 2008 at 12:57 AM.

  6. #6
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,851
    Blog Entries
    10

    Default Re: Scripting Questions - TurnEnds and Ancillary Removal

    Ok lots of stuff in your post, I will try to address it all. Here is Alpacas list of start/end

    http://forums.totalwar.org/vb/showthread.php?t=84687

    The reason the turn start/ends fire the way they do is simple. It has to complete one action before it starts another, because a character moves, it may be referencing one region at turn start and another at turn end. If you try to do that inside a loop its going to get screwed up fast. The same with settlements, they can change factions.

    I think you and I have a different understanding of how the threshold works. The negative numbers will move the trait level and I dont think they effect the threshold.


    With the trigger, yes its designed to catch all characters that fit that condition, but the event does not export the characters name. The reason you cant remove an ancillary by trigger is very simple, CA didnt anticipate the need for it so they didnt build a command to do it like they did with traits. However they (try to) did implement the e_select_character so you could single out a character/settlement by event context. Unfortunately it doesnt work.


    With the turns idle issue, I would say that yes it should reset that number after the character moves. If it doesnt then its the first I have heard of it. I have never used that one.

    If its truly broken I would have thought someone would have mentioned it before, but maybe not. Another thing you could do is check movement points at turn end. If its over 95 then they were idle, start a counter. When counter hits x then apply trait. Restart the counter if movement points are under 95 at turn end.

    I have not had any issues with the character scrolls and panels, and I have used them quite a bit.

  7. #7
    Augustus Lucifer's Avatar Life = Like a beanstalk
    Patrician Citizen

    Join Date
    Aug 2006
    Location
    Mote of Dust
    Posts
    10,725

    Default Re: Scripting Questions - TurnEnds and Ancillary Removal

    Quote Originally Posted by GrnEyedDvl View Post
    Ok lots of stuff in your post, I will try to address it all. Here is Alpacas list of start/end

    http://forums.totalwar.org/vb/showthread.php?t=84687

    The reason the turn start/ends fire the way they do is simple. It has to complete one action before it starts another, because a character moves, it may be referencing one region at turn start and another at turn end. If you try to do that inside a loop its going to get screwed up fast. The same with settlements, they can change factions.

    I think you and I have a different understanding of how the threshold works. The negative numbers will move the trait level and I dont think they effect the threshold.


    With the trigger, yes its designed to catch all characters that fit that condition, but the event does not export the characters name. The reason you cant remove an ancillary by trigger is very simple, CA didnt anticipate the need for it so they didnt build a command to do it like they did with traits. However they (try to) did implement the e_select_character so you could single out a character/settlement by event context. Unfortunately it doesnt work.


    With the turns idle issue, I would say that yes it should reset that number after the character moves. If it doesnt then its the first I have heard of it. I have never used that one.

    If its truly broken I would have thought someone would have mentioned it before, but maybe not. Another thing you could do is check movement points at turn end. If its over 95 then they were idle, start a counter. When counter hits x then apply trait. Restart the counter if movement points are under 95 at turn end.

    I have not had any issues with the character scrolls and panels, and I have used them quite a bit.
    Okay thanks, will try some of that in the morning, time to catch some shuteye now. There's an alternative way to make it work that doesn't involve ancillaries, so if I end up not figuring that out I should be able to work around that portion, it's more for the aesthetic value and the context of the script.

    Cheers,
    Augustus

  8. #8
    Germanicu5's Avatar Will buy spare time...
    Join Date
    Feb 2009
    Location
    Not Zee Germany
    Posts
    2,101

    Default Re: Scripting Questions - TurnEnds and Ancillary Removal

    The actual order (in a simple and clear version), tested by adding all relevant monitors and watching when they launch on AI's turn:

    France AI:
    02:02:45.968 PFTS launch
    02:02:45.968 CTS launch, then all faction characters start up one by one
    02:02:46.000 STS launch, one by one
    02:02:46.140 FTS
    02:02:48.718 CTE, one by one
    02:02:48.828 STE, one by one
    02:02:48.843 FTE

    Regards
    Last edited by Germanicu5; November 13, 2009 at 07:38 PM.
    I have no memory of this place.

  9. #9
    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: Scripting Questions - TurnEnds and Ancillary Removal

    Also, glad to see you here and responding, for a while I thought you and gigantus were kidnapped by the KGB
    I have been following this, but I must admit it is a bit out of my league (until 3 months I didn't even know how to spell "end_monitor"), but this thread provides a good insight.










  10. #10
    gracul's Avatar 404 Not Found
    Artifex

    Join Date
    Dec 2007
    Location
    Poland
    Posts
    2,009

    Default Re: Scripting Questions - TurnEnds and Ancillary Removal

    Additionally to monitor sequence: (PFTS > CTS > STS > FTS > CTE > STE > FTE)
    -first character to have his triggers fired is the leader, next heir
    -STS sequence is the same as the sequence in descr_strat. Conquered settlements are added at the bottom of the list.
    -STE sequence is the reverse of the descr_strat
    -AI processes the building and recruitment queue's shortly before the CTE event. The manner at which the AI adds to the construction and recruitment queue's is completely random.
    -After the AddedToBuildingQueue and AddedToTrainingQueue events, UnitTrained and BuildingCompleted events are fired in the same settlement order as the STS shows.
    -Directly after the AI has its priorities made the AI fires FTS and starts moving characters on campaign map.
    -PFTS allows EDB event changes to work correctly.
    -PFTS works same as CTS, only that it fires once for each faction instead for once for every character, and fires directly before CTS.
    -When on the edge of bankrupcy, the AI tries to construct buildings, and recruitment is only held at the capital settlement.
    -The AI can add building and units beyond the normal queue, just like the player can.
    Last edited by gracul; November 14, 2009 at 09:12 AM.

  11. #11
    Pnutmaster's Avatar Dominus Qualitatium
    Join Date
    Jan 2006
    Location
    Brooklyn, NY
    Posts
    1,572

    Default Re: Scripting Questions - TurnEnds and Ancillary Removal

    Reviewing uses of ancillary_removal, is anything blatantly wrong with the following code?

    monitor_event CharacterTurnEnd IsFactionHeir
    and HasAncType inherit
    and not EndedInSettlement
    console_command remove_ancillary this heir_orb
    end_monitor
    Under the patronage and bound to the service of the
    artist formerly known as Squeakus Maximus
    Stoic Pantheist of S.I.N

  12. #12
    gracul's Avatar 404 Not Found
    Artifex

    Join Date
    Dec 2007
    Location
    Poland
    Posts
    2,009

    Default Re: Scripting Questions - TurnEnds and Ancillary Removal

    yes, this cannot be used, you would have to know the name of the character.
    See post 4.

    Something like this should apply
    Code:
    monitor_event CharacterTurnEnd IsFactionHeir
            and HasAncType inherit
            and not EndedInSettlement
    
            set_counter remove_orb 1
    end_monitor                      
    
    monitor_event CharacterSelected IsFactionHeir
    and I_CompareCounter remove_orb = 1
    
          console_command remove_ancillary this heir_orb
          set_counter remove_orb 0
    end_monitor

  13. #13
    konny's Avatar Artifex
    Join Date
    Jul 2007
    Location
    Germania Inferior
    Posts
    3,631

    Default Re: Scripting Questions - TurnEnds and Ancillary Removal

    Quote Originally Posted by gracul View Post
    yes, this cannot be used, you would have to know the name of the character.
    You can use This with remove_ancillary, but it only applies to a character selected by the player (there is also e_select, but that's not really working as it should).

    Example:
    Code:
    monitor_event CharacterSelected IsFactionLeader
    and HasAncType FH_Title
    
          remove_ancillary this Prince_of_Wales
          
    end_monitor
    This should remove the anc Prince of Wales from the FL as soon as the player has selected him.

    Team member of: Das Heilige Römische Reich, Europa Barbarorum, Europa Barbarorum II, East of Rome
    Modding help by Konny: Excel Traitgenerator, Setting Heirs to your preference
    dHRR 0.8 beta released! get it here
    New: Native America! A mini-mod for Kingdoms America

  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: Scripting Questions - TurnEnds and Ancillary Removal

    Esoteric stuff like this always gets me excited - there must have been an easier way, but then programmers must have been sadists in a previous life.










  15. #15
    gracul's Avatar 404 Not Found
    Artifex

    Join Date
    Dec 2007
    Location
    Poland
    Posts
    2,009

    Default Re: Scripting Questions - TurnEnds and Ancillary Removal

    I mean that this cannot be used in the specific script context. As you can see in the code i gave, i was using this also.

  16. #16
    konny's Avatar Artifex
    Join Date
    Jul 2007
    Location
    Germania Inferior
    Posts
    3,631

    Default Re: Scripting Questions - TurnEnds and Ancillary Removal

    Quote Originally Posted by gracul View Post
    I mean that this cannot be used in the specific script context. As you can see in the code i gave, i was using this also.
    Yes, but you don't need the counter.

    Code:
    monitor_event CharacterSelected IsFactionHeir
            and HasAncType inherit
    
          remove_ancillary this heir_orb
    
    end_monitor
    That way you always can remove ancilaries from local characters, but not from characters run by the AI. On the other hand, this isn't really needed because how often do you check AI characters for their ancillaries? When you have these monitors running for the local characters, the player usually wouldn't notice that you are not able to remove wrong ancillaries by EDA.

    Team member of: Das Heilige Römische Reich, Europa Barbarorum, Europa Barbarorum II, East of Rome
    Modding help by Konny: Excel Traitgenerator, Setting Heirs to your preference
    dHRR 0.8 beta released! get it here
    New: Native America! A mini-mod for Kingdoms America

  17. #17
    Pnutmaster's Avatar Dominus Qualitatium
    Join Date
    Jan 2006
    Location
    Brooklyn, NY
    Posts
    1,572

    Default Re: Scripting Questions - TurnEnds and Ancillary Removal

    Quote Originally Posted by konny View Post
    end_monitor
    [/code]That way you always can remove ancilaries from local characters, but not from characters run by the AI.
    Will the event "CharacterSelected" ever fire for the AI? When the AI moves a character, is it selecting said character before the move is issued?

    If it does fire, I can modify my script as such--

    monitor_event CharacterSelected IsFactionLeader
    and HasAncType inherit
    and not EndedInSettlement
    console_command remove_ancillary this heir_orb
    end_monitor

    monitor_event CharacterSelected IsFactionHeir
    and HasAncType inherit
    and not EndedInSettlement
    console_command remove_ancillary this heir_orb
    end_monitor
    Under the patronage and bound to the service of the
    artist formerly known as Squeakus Maximus
    Stoic Pantheist of S.I.N

  18. #18
    Pnutmaster's Avatar Dominus Qualitatium
    Join Date
    Jan 2006
    Location
    Brooklyn, NY
    Posts
    1,572

    Default Re: Scripting Questions - TurnEnds and Ancillary Removal

    I wanted the AI factions to recycle their heir_orb ancillary (grants +10 to Authority, hehe) once the holder became heir or faction leader. As it stands, this only occurs when said holder dies.

    Most unfortunate if I have no way to select these AI characters through scripts
    Under the patronage and bound to the service of the
    artist formerly known as Squeakus Maximus
    Stoic Pantheist of S.I.N

  19. #19
    konny's Avatar Artifex
    Join Date
    Jul 2007
    Location
    Germania Inferior
    Posts
    3,631

    Default Re: Scripting Questions - TurnEnds and Ancillary Removal

    Quote Originally Posted by Pnutmaster View Post
    I wanted the AI factions to recycle their heir_orb ancillary (grants +10 to Authority, hehe) once the holder became heir or faction leader. As it stands, this only occurs when said holder dies.
    Use an event_counter:

    Requirment for getting this ancillary for the AI is

    event_counter Get_Anc 0

    set_event_counter Get_Anc 1
    whenever a character holds the ancillary who is not FL or FH. You would also need to reset it each turn.

    That way the ancillary can be acquired when it is held by someone else but this is the faction leader or faction heir.

    Team member of: Das Heilige Römische Reich, Europa Barbarorum, Europa Barbarorum II, East of Rome
    Modding help by Konny: Excel Traitgenerator, Setting Heirs to your preference
    dHRR 0.8 beta released! get it here
    New: Native America! A mini-mod for Kingdoms America

  20. #20
    gracul's Avatar 404 Not Found
    Artifex

    Join Date
    Dec 2007
    Location
    Poland
    Posts
    2,009

    Default Re: Scripting Questions - TurnEnds and Ancillary Removal

    CharacterSelected is a player thing only.

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
  •