Results 1 to 17 of 17

Thread: Unique Building

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Elbadruhel's Avatar Centenarius
    Join Date
    May 2011
    Location
    Spain
    Posts
    897

    Default Unique Building

    Could i limit a building so i could only build it in one city? Like the top guild level.

  2. #2
    kevindrosario's Avatar Ordinarius
    Join Date
    Jan 2011
    Location
    New Jersey
    Posts
    791

    Default Re: Unique Building


  3. #3
    Elbadruhel's Avatar Centenarius
    Join Date
    May 2011
    Location
    Spain
    Posts
    897

    Default Re: Unique Building

    I dont want a building that you can build only where you have added the hidden resource, i want that you could buld it in every settlement, but when you build it in one of your settlements, you cant build it again in other one.

  4. #4
    Squid's Avatar Opifex
    Patrician Artifex Technical Staff

    Join Date
    Feb 2007
    Location
    Frozen waste lands of the north
    Posts
    17,751
    Blog Entries
    3

    Default Re: Unique Building

    Yes, use an event counter to track when the building is built and in the building conditions add a condition for when the event counter is not been set.
    Under the patronage of Roman_Man#3, Patron of Ishan
    Click for my tools and tutorials
    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." -----Albert Einstein

  5. #5
    Elbadruhel's Avatar Centenarius
    Join Date
    May 2011
    Location
    Spain
    Posts
    897

    Default Re: Unique Building

    I dont know nothing about events, conditions, triggers, counters and os on. Could you helpe me with this? Thx.

  6. #6
    AJStoner's Avatar Lord of Entropy
    Join Date
    Dec 2010
    Location
    Currently exiled to Florida
    Posts
    1,746

    Default Re: Unique Building

    In data/world/maps/campaign/imperial_campaign/campaign_script:

    1) You must set up the event counter:

    Code:
    add_events
            event    your_building
                 date    0
             end_add_events
    2) You then add the script that will trigger once the building has been made

    Code:
    monitor_event FactionTurnStart FactionIsLocal
        and FactionBuildingExists >= your_building
        and I_EventCounter your_building = 0
    
        set_event_counter your_building = 1
    
    end_monitor
    3) Then you must make the counter a requirement for making the building:

    In data/export_descr_buildings:


    Code:
    building your_building
    {
        levels your_building 
        {
            your_building city requires factions { factionA, }  and event_counter your_building 0
    ...

    *MEMBER OF THE HOUSE OF HADER* *UNDER THE CRUEL & MERCILESS PATRONAGE OF y2day*

  7. #7
    SpyrosM91's Avatar Despotes
    Join Date
    Aug 2010
    Location
    Patras, Greece
    Posts
    3,675

    Default Re: Unique Building

    AJStoner, it won't be good.... because before the building is completed, he will be able to build another one.... thus, ruining the effect...


    so, it's better to have this:

    Code:
        monitor_event PreFactionTurnStart FactionType faction1
        and not FactionBuildingExists = your_building
    
            set_event_counter your_building_buildable 1
    
        end_monitor
    
    
        monitor_event AddedToBuildingQueue BuildingName = your_building
        and FactionType faction1
    
            set_event_counter your_building_buildable 0
    
        end_monitor
    Proud Tsardoms Total War: Historian - Coder - Scripter - Mapper

  8. #8
    SpyrosM91's Avatar Despotes
    Join Date
    Aug 2010
    Location
    Patras, Greece
    Posts
    3,675

    Default Re: Unique Building

    PS: also, the building must have 1 turn of construction....

    and there must be anothert monitor event for "buildingCompleted".... because without this, there must another turn (after the building is built) for the counter to turn to 0....
    PS2: what is the syntax of that monitor event??
    Proud Tsardoms Total War: Historian - Coder - Scripter - Mapper

  9. #9
    Elbadruhel's Avatar Centenarius
    Join Date
    May 2011
    Location
    Spain
    Posts
    897

    Default Re: Unique Building

    Thx for your help!!!

    And if it isnt too much work for you.... How i must do the script if the building takes X turns to build?

    Thanks again!

  10. #10
    SpyrosM91's Avatar Despotes
    Join Date
    Aug 2010
    Location
    Patras, Greece
    Posts
    3,675

    Default Re: Unique Building

    a situation i ecountered (with the example i gave you) was this:

    the construction time was 1 turn.... the problem is that (due to the script possibly... i don't know) in the next turn, the building was not built [it was still 0% complete....!!!]... i think that it was built in the turn after that (but i think, with the condition i didn't clicked the settlement... strange eeehh???)


    So in order to eliminate the possibilty that, in the turn in between, the building can be built by another settlement [because it didn't existed yet...], i did this:


    Code:
        monitor_event PreFactionTurnStart FactionType faction1
        and not FactionBuildingExists = building
        and I_EventCounter building_under_construction = 0
     
            set_event_counter building_buildable 1
    
        end_monitor
    
    
    
        monitor_event AddedToBuildingQueue BuildingName = building
        and FactionType faction1
    
            set_event_counter building_buildable 0
            set_event_counter building_under_construction 1
    
        end_monitor
    
    
        monitor_event BuildingCompleted SettlementBuildingFinished = building
        and FactionType faction1
    
            set_event_counter building_under_construction 0
    
        end_monitor
    this could work with buildings that have more than 1 turn of construction...


    BUT, now the building is under construction for ever, with the building process stuck at 0%...


    Can anyone help????
    Proud Tsardoms Total War: Historian - Coder - Scripter - Mapper

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

    Default Re: Unique Building

    It might be because the second monitor is setting it to [building_buildable 0] which means that it is no longer available to the EDB (I assume that the EDB uses this event counter as a condition?). So even though construction has been queued it can't be built because it is no longer a 'legal' building. Just a guess.

    Also be wary of using I_EventCounter on event counters that have not been 'initialised' yet. In that first monitor you're testing the value of building_under_construction but it won't have any value (not 1, not 0, it doesn't yet exist) until it is set in either the second or third monitors. Just put a [set_event_counter building_under_construction 0] before that first monitor to define and initialise it.

    What happens if the construction is canceled? I think that building_under_construction will be stuck on 1. Is there even an event like BuildingConstructionAborted?

  12. #12
    AJStoner's Avatar Lord of Entropy
    Join Date
    Dec 2010
    Location
    Currently exiled to Florida
    Posts
    1,746

    Default Re: Unique Building

    A "not FactionBuildingExists" line could be used as a reset in case it is cancelled or destroyed.

    *MEMBER OF THE HOUSE OF HADER* *UNDER THE CRUEL & MERCILESS PATRONAGE OF y2day*

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

    Default Re: Unique Building

    If it's part way through construction then "not FactionBuildingExists" will be true (I think?), but a reset is unwanted at that point.

  14. #14
    SpyrosM91's Avatar Despotes
    Join Date
    Aug 2010
    Location
    Patras, Greece
    Posts
    3,675

    Default Re: Unique Building

    Quote Originally Posted by Withwnar View Post
    If it's part way through construction then "not FactionBuildingExists" will be true (I think?), but a reset is unwanted at that point.
    yes, the building does not "physically exists" yet.... for the condition to be true (and not FactionBuildingExists) the building must be completed...

    therefore, how the script should be written???

    Code:
    FactionTurnStart
    and not FactionBuildingExists           =====> set buildable 1 
    
    
    AddedToBuildingQueue                    =====> set buildable 0
    (so that another construction is not allowed in your turn)
    
    FactionTurnEnd                          =====> set buildable 1 
    (so that the building can be built)
    
    (Pre?)FactionTurnStart or BuildingCompleted      =====> set buildable 0 
    (so that the counter can be reset to 0 )
    can anyone give me a hint??
    Proud Tsardoms Total War: Historian - Coder - Scripter - Mapper

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

    Default Re: Unique Building

    I don't know Spyros. I think to work correctly you would also need to handle the case for the building being "currently under construction". And I can't see any events or conditions that would tell you this.

    Perhaps using a counter to count turns since AddedToBuildingQueue. If after that amount of turns (the number it takes to build it) the building does not exist then assume that it was aborted? But even this doesn't allow for stalled construction due to lack of funds. Plus (I think) AddedToBuildingQueue only tells you that it has been added to the queue, NOT that it is first in the queue and will therefore start construction now. So when to start the counter?

    To me it seems full of potential pitfalls that won't let it work quite as it should.

  16. #16
    Elbadruhel's Avatar Centenarius
    Join Date
    May 2011
    Location
    Spain
    Posts
    897

    Default Re: Unique Building

    Oh my God, what i have done! XD

    Waiting for the final script ^^.

    One thing... How the Guild headquarters do this? can exist only one in all the world.

  17. #17
    SpyrosM91's Avatar Despotes
    Join Date
    Aug 2010
    Location
    Patras, Greece
    Posts
    3,675

    Default Re: Unique Building

    Quote Originally Posted by Elbadruhel View Post
    One thing... How the Guild headquarters do this? can exist only one in all the world.
    it's a guild.... it's not a regular building... the building is offered to you, you do not build it yourself....and the building has no construction time....


    guys, when the building are built/completed??? before the CharacterTurnEnd & FactionTurnEnd or after???



    EDIT: and let's assume that you have enough money and the building is first in line...
    Proud Tsardoms Total War: Historian - Coder - Scripter - Mapper

Posting Permissions

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