Results 1 to 6 of 6

Thread: Event Counter and Faction that dies

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Polycarpe's Avatar Back into action!
    Join Date
    Feb 2010
    Location
    Quebec, Canada
    Posts
    3,338

    Default Event Counter and Faction that dies

    Hi, I am wondering if it's possible to make an event counter about a faction that die? For example let's take England and I destroy Wales

    recruit_pool "Yeoman Archers" 1 0.2 2 0 requires factions { barons_alliance, england, } and event_counter Archery_Law 1 and not event_counter_wales_destroyed

    recruit_pool "Yeoman Archers" 1 0.3 2 0 requires factions { barons_alliance, england, } and event_counter Archery_Law 1 and event_counter_wales_destroyed

    As you can see, if Wales is gone, England will get a bonus on refill rate of Yeomen archers.
    But let's say something else, more specific, that event will occur only if England eliminate Wales.
    If Wales is destroyed but not by England, that bonus will not occur and to increase it I will tag a special hidden resource like this

    recruit_pool "Yeoman Archers" 1 0.2 2 0 requires factions { barons_alliance, england, } and event_counter Archery_Law 1 and not event_counter_wales_destroyed or not hidden_resource wales_kingdom

    recruit_pool "Yeoman Archers" 1 0.3 2 0 requires factions { barons_alliance, england, } and event_counter Archery_Law 1 and event_counter_wales_destroyed or hidden_resource wales_kingdom

    So, not the hidden_resource part but the destroy counter, it's that possible? I tried to find in the docudemon and couldn't find that condition
    Regards.

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

    Default Re: Event Counter and Faction that dies

    I take it that you mean something like "and not event_counter wales_destroyed" (space not _).

    From memory you can't use a "not" with event_counter: use 0 instead... "and event_counter wales_destroyed 0".

    You might need to ensure that this event counter has actually been set to 0. Relying on it to be 0 simply because nothing has yet set it to 1 can result in strange behaviour, though this might only apply to I_EventCounter.

    And beware of using NOT combined with ANDs and ORs; it may not work as expected. I have a link somewhere... I'll try and dig it up...

    EDIT: this is the link I was thinking of.
    Last edited by Withwnar; October 18, 2011 at 10:51 AM.

  3. #3
    Polycarpe's Avatar Back into action!
    Join Date
    Feb 2010
    Location
    Quebec, Canada
    Posts
    3,338

    Default Re: Event Counter and Faction that dies

    Quote Originally Posted by Withwnar View Post
    I take it that you mean something like "and not event_counter wales_destroyed" (space not _).

    From memory you can't use a "not" with event_counter: use 0 instead... "and event_counter wales_destroyed 0".

    You might need to ensure that this event counter has actually been set to 0. Relying on it to be 0 simply because nothing has yet set it to 1 can result in strange behaviour, though this might only apply to I_EventCounter.

    And beware of using NOT combined with ANDs and ORs; it may not work as expected. I have a link somewhere... I'll try and dig it up...

    EDIT: this is the link I was thinking of.
    Strange, I've set my event counters with a not and still work? Guess to be sure I'll stick with the 0 and 1.
    Yeah, I've wrote too fast, I know that I must not put "_" in between.
    Seems the easiest option would be to just stick with an hidden resource that regroups all wales so England need to control all native wales in order to get the boost.

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

    Default Re: Event Counter and Faction that dies

    I could be wrong about the "not" but if it does work then it should be "and not event_counter whatever 1". But then you may as well just say "and event_counter whatever 0".

    The thing with event counters is that if the game can't figure out what it is you mean then it just silently gives up and thinks "this part of the condition is true". Sometimes, e.g. when you use an event counter with I_EventCounter but you have not yet set that counter to any value. Meaning that some things evaluate to true when they should be false (because it was scripted/coded wrong).

  5. #5

    Icon1 Re: Event Counter and Faction that dies

    recruit_pool "Yeoman Archers" 1 0.2 2 0 requires factions { barons_alliance, england, } and event_counter Archery_Law 1 and event_counter wales_destroyed_no 1 and not hidden_resource wales_kingdom

    recruit_pool "Yeoman Archers" 1 0.3 2 0 requires factions { barons_alliance, england, } and event_counter Archery_Law 1 and event_counter wales_destroyed_yes 1 and hidden_resource wales_kingdom
    Code:
    ;###### Yeoman Archers #######
    
    add_events
    	event	counter	wales_destroyed_no
    	event	counter	wales_destroyed_yes
    	date	0
    end_add_events
    
    set_event_counter wales_destroyed_no 1
    set_event_counter wales_destroyed_yes 0
    
    monitor_event FactionTurnStart FactionType slave
    	and I_NumberOfSettlements wales = 0
    	set_event_counter wales_destroyed_no 0
    	set_event_counter wales_destroyed_yes 1
    terminate_monitor
    end_monitor

  6. #6
    Polycarpe's Avatar Back into action!
    Join Date
    Feb 2010
    Location
    Quebec, Canada
    Posts
    3,338

    Default Re: Event Counter and Faction that dies

    Thank you TNZ, as usual, you're always the best! +rep

Posting Permissions

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