Results 1 to 14 of 14

Thread: Script based on buildings constructed

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 Script based on buildings constructed

    Hi I was wondering if it was possible to do this

    It is possible to have a script that if I build a building,the event is triggered let's say like this:

    "and event_counter barrack_constructed 1"

    This is for recruiting units as well certain building attributes in that specific settlement. I hope it's possible but I'm afraid it will be linked to each settlement, making the script kinda large.

    Regards.

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

    Default Re: Script based on buildings constructed

    monitor_event BuildingCompleted FactionIsLocal (or whatever)
    and SettlementBuildingFinished = blahblah

    set_event_counter blahblah_completed 1
    terminate_monitor
    end_monitor

    Should work.

    Regards
    I have no memory of this place.

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

    Default Re: Script based on buildings constructed

    Quote Originally Posted by Germanicu5 View Post
    monitor_event BuildingCompleted FactionIsLocal (or whatever)
    and SettlementBuildingFinished = blahblah

    set_event_counter blahblah_completed 1
    terminate_monitor
    end_monitor

    Should work.

    Regards
    Superb, thanks mate, really appreciate the help, +rep.

  4. #4
    /|\/|\/|\/|\/|\/|\/
    Join Date
    Jun 2005
    Posts
    10,770

    Default Re: Script based on buildings constructed

    Quote Originally Posted by St. Polycarpe View Post
    This is for recruiting units as well certain building attributes in that specific settlement.
    Not sure what you mean here

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

    Default Re: Script based on buildings constructed

    Quote Originally Posted by Taiji View Post
    Not sure what you mean here
    Got something planned, that with technologies ("building"), once it's built in that settlement, the script will trigger and then the unit or building attribute (public health) will be gained.

  6. #6
    /|\/|\/|\/|\/|\/|\/
    Join Date
    Jun 2005
    Posts
    10,770

    Default Re: Script based on buildings constructed

    Hmm, I'm not sure that's going to be possible. Event counters won't work on a per settlement basis. Good luck finding a way

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

    Default Re: Script based on buildings constructed

    Ahh... I somehow thought this'd be enough for you. It's still scriptable though, I wouldn't worry about resources.

    I'd need to run some tests to see how it works, unfortunately I don't have much spare time atm.

    Regards
    I have no memory of this place.

  8. #8
    Lazy's Avatar Biarchus
    Join Date
    Jul 2011
    Location
    Aachen
    Posts
    661

    Default Re: Script based on buildings constructed

    Why donīt you just add the public health attribut just to the building that triggers the trigger ?! ( in EDB )

    Or add the public health stuff to a building that has to exist ( like the settlements wall ) and add to its capability "public_health_bonus 1 and event_counter barrack_constructed 1"
    public_health_bonus is misspelled for sure... but the rest should work I bet...

    Or if you want to have it for every single settlement...

    set_event_counter blahblah_completed 1
    and SettlementName = Settlement1
    set_counter settlement1counter 1
    terminate_monitor
    end_monitor

    You can create an indestructible building for every settlement ( which will be constructed via desc_strat ) and give it the desired attribute like

    for settlement1
    "public_health_bonus 1 and event_counter settlement1counter 1"

    for settlement2
    "public_health_bonus 1 and event_counter settlement2counter 1"

    and so on...
    Last edited by Lazy; February 03, 2012 at 12:47 PM.
    Quote Originally Posted by SirWarts View Post
    ...the woman trampled didn't look impenetrable. So they ran through her.

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

    Default Re: Script based on buildings constructed

    I'd go for pre-placed buildings, it's the easiest way of implementing it. My initial idea was more complicated than required, but would possibly enable doing it all via already existing buildings.

    So tweaked version of Lazy's proposal would be:
    Code:
    monitor_event BuildingCompleted SettlementName = London
    and SettlementBuildingFinished = Dungeon
    
    generate_random_counter my_random_counter 1 2
    
        if I_EventCounter my_random_counter = 1
        set_event_counter London_Dungeon_bonus 1
        end_if
        if I_EventCounter g5_random_counter = 2
        set_event_counter London_Dungeon_bonus 2
        end_if
    terminate_monitor
    end_monitor 
    
    London_Dungeon (whatever):
    public_health_bonus 1 and event_counter London_Dungeon_bonus 1
    recruit_pool "Women-At-Arms"  1   0.085   1  0  requires factions {..........., } and event_counter London_Dungeon_bonus 2
    
    If you want it to circle bonuses every turn, then you need:
    monitor_event BuildingCompleted SettlementName = London
    and SettlementBuildingFinished = Dungeon
    
    set_event_counter London_Dungeon_calc 1
    
    terminate_monitor
    end_monitor
    
    monitor_event PreFactionTurnStart (or FactionTurnEnd) FactionIsLocal
        generate_random_counter my_random_counter 1 2
    
        if I_EventCounter London_Dungeon_calc = 1
         if I_EventCounter my_random_counter = 1
         set_event_counter London_Dungeon_bonus 1
         end_if
         if I_EventCounter g5_random_counter = 2
         set_event_counter London_Dungeon_bonus 2
         end_if
        end_if
    end_monitor
    Regards
    I have no memory of this place.

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

    Default Re: Script based on buildings constructed

    Very interesting, will take that into account as well, will see what the best combination I could do.

  11. #11

    Default Re: Script based on buildings constructed

    How would I go about making armourers required to recruit certain units? Do I just need to add under the proper barracks in the EDB

    and building_exists armourer

    or should it be

    and event_counter armourer exists

    ?

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

    Default Re: Script based on buildings constructed

    Code:
            recruit_pool "Lithuanian Archers"  1   0.17   2  0  requires factions { ..., } and building_present_min_level tree_name specific_building
    Should work.

    Regards
    I have no memory of this place.

  13. #13
    /|\/|\/|\/|\/|\/|\/
    Join Date
    Jun 2005
    Posts
    10,770

    Default Re: Script based on buildings constructed

    I hear it only works with the castle armourer.

  14. #14

    Default Re: Script based on buildings constructed

    Ok, thanks, Germanicu5. I took a look at the EDB and saw the line you gave. Doh!

    That's not good, since in TLK there are only cities. I will try it and report back.

    I made a building a prerequisite for a few units in the EDB and my saved game loaded but crashed soon after. I tried to start a new campaign and the game crashed. So it looks like buildings can't be prerequisites for recruitment (at least not in cities).
    Last edited by k/t; February 11, 2012 at 10:13 AM.

Posting Permissions

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