Page 2 of 3 FirstFirst 123 LastLast
Results 21 to 40 of 54

Thread: Buildings and AoR

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

    Default Re: Buildings and AoR

    From right to left that reads...
    (barracks AND denmark) OR france,england
    ...which matches your findings.

    I don't think that there is a way to do "(A AND B) OR (C AND D)", not in one line anyway, so not if it is the first tier building. If library is an upgrade then you can split the conditions into two different upgrade lines.

  2. #22
    Senator
    Join Date
    Mar 2013
    Location
    Home
    Posts
    1,050

    Default Re: Buildings and AoR

    Quote Originally Posted by Arandir Tur-Anion View Post
    So here is my problem. I've done an unit AoR for my mod, using the region-area method, so that every region has an unique ID.
    I hate to make new threads, so How exactly did you use that?

  3. #23

    Default Re: Buildings and AoR

    This is quite esay, and it i a a known method. For that you use two set of aor :

    20 area (for DaC it is Luneland, Breeland, Arnor, Misty, Miniriath, Enedwaith, NorthEriador, Rohan, Vale, Mirkwood, EastGondor, WestGondor, Celduin, SouthAnduin, NorthEast, Mordor, Khand, Rhovanion, Harad and LastRegion),
    and 10 locale HR (HiddenA, HiddenB ... HiddenJ)
    And to each Region you give an unique combinaison of both :
    Lunneland and HiddenA, Breeland and HiddenI? Breeland and HiddenB...

  4. #24
    Senator
    Join Date
    Mar 2013
    Location
    Home
    Posts
    1,050

    Default Re: Buildings and AoR

    Ah ok thanks. I hate to drag this any further but I cannot find any tutorial that explains the declaration and use of hidden resources. If someone could direct me to a tutorial or tell me what files to modify, in some detail, I would be grateful.

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

    Default Re: Buildings and AoR

    There's bound to be a tutorial somewhere but anyway...

    They are:
    - declared at the top of EDB: "hidden_resources" line
    - defined in descr_regions.txt along with other resources
    - used in EDB conditions via "hidden_resource"

    If you search both those files for "america" in vanilla grand campaign then you'll see examples.

  6. #26

    Default Re: Buildings and AoR

    Quote Originally Posted by Withwnar View Post
    There's bound to be a tutorial somewhere but anyway...

    They are:
    - declared at the top of EDB: "hidden_resources" line
    - defined in descr_regions.txt along with other resources
    - used in EDB conditions via "hidden_resource"

    If you search both those files for "america" in vanilla grand campaign then you'll see examples.
    ^^ he's right... also don't forget if you do any of those; delete your campaign's map.rwm (from /base or the custom campaign folder) otherwise it won't work properly

    and Withwnar thanks for the "(A AND B) OR (C AND D)", confirmation bit that definitely confirms what I found with min building's in M2. I was confused because I'm fairly sure I had
    stables requires factions { barbarian, eastern, ostrogoths, roman, } or factions { burgundii, roxolani, saxons, franks, } and hidden_resource woodsmen or factions { burgundii, roxolani, saxons, franks, } and hidden_resource desert or factions { burgundii, roxolani, saxons, franks, } and hidden_resource souleater or factions { burgundii, roxolani, saxons, franks, } and hidden_resource ghost or factions { burgundii, roxolani, saxons, franks, } and hidden_resource zombie or factions { burgundii, roxolani, saxons, } and hidden_resource tala or factions { burgundii, roxolani, saxons, } and hidden_resource rahala or factions { burgundii, roxolani, saxons, } and hidden_resource lycan or factions { burgundii, roxolani, saxons, } and hidden_resource severin
    working in RTW...

    need to check if I was actually right on that! then if it's a RTW v M2 thing or a HR versus building thing

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

    Default Re: Buildings and AoR

    I don't think that it's a RTW vs M2TW thing because it was this RTW thread that suggests that things are read from right to left (Simetrical, page 2): http://forums.totalwar.org/vb/showth...uilding/page2&

    Every example in that thread seems to confirm the rule.

    I see that you also make an appearance makanyane , or your doppelganger does.

  8. #28
    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: Buildings and AoR

    So as along as I start a section with faction I'll be ok to use the or condition?


    requires factions { xxx, } and condition1 or factions {yyy, } and condition2 or factions { zzz, } and condition3










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

    Default Re: Buildings and AoR

    As I understand it: no. Even the simpler example of...

    Code:
    requires factions { xxx, } and condition1 or factions {yyy, } and condition2
    ...which I assume you mean to be read as...
    Code:
    requires ( factions { xxx, } and condition1 ) or ( factions {yyy, } and condition2 )
    ...will actually be read as...
    Code:
    requires ( ( condition2 and factions {yyy, } ) or condition1 ) and factions { xxx, }
    e.g. If factions { xxx, } is false then so is the entire result, regardless of what else in there is true.

    It's like maths:

    1 + 3 x 5

    Is the answer 20 or 16? It depends on how we read it - whether we do the + or the x first - so to avoid ambiguity we use brackets:

    (1 + 3) x 5 = 20
    1 + (3 x 5) = 16

    If the game let us use brackets like that then we could do whatever we wanted.

    Your example, Gigantus, highlights a logical trap. That...

    Code:
    factions { xxx, } and condition1 or factions {yyy, } and condition2 or factions { zzz, } and condition3
    ...somehow automatically means...
    Code:
    factions { xxx, } and condition1
      OR
    factions {yyy, } and condition2  
      OR
    factions { zzz, } and condition3
    (I assume that is what you did mean.)

    If the game gave precedence/priority to ANDs before ORs - and programming languages typically do just that - then it would be valid. But apparently the game's EDB parser does not behave this way.

    I suspect that it is a natural way of looking at things, for us mere humans: "this and this ... or ... this and this ... or ... this and this". i.e. To bunch the ANDs together like that. But to a program who hasn't been told to behave that way it is not logical at all. It could just as happily read that example as...
    Code:
    factions { xxx, } 
      AND
    condition1 or factions {yyy, }
      AND
    condition2 or factions { zzz, }
      AND
    condition3
    ...or some other way that to us might seem bizarre.

    Or, on the other hand, it may turn out that that is indeed precisely the way that the EDB parser does it and everything I have said on the subject is total bollocks. I don't think so but I find myself dreading Makanyane's test results. I have my apology speech at the ready.

  10. #30

    Default Re: Buildings and AoR

    Quote Originally Posted by Withwnar View Post
    I don't think so but I find myself dreading Makanyane's test results. I have my apology speech at the ready.
    Don't think you'll need it!

    just tried both of ;
    library requires factions { england, } or factions { denmark, } and building_present_min_level hinterland_farms farms or factions { france, } and building_present_min_level hinterland_roads roads

    and;

    library requires factions { england, } or factions { denmark, } and hidden_resource hrdenmark or factions { france, } and hidden_resource hrfrance
    for both I'm getting denmark works with its condition, and england works (no condition) building doesn't appear for france at all.

    the string of and/or s I quoted earlier was from the RTW mod I was working on when that .org thread was being discussed - am fairly sure it must have tested as working at that stage (would be suprised if I managed to stick something that complicated in and not check it worked...) now need to try and find/re-install RTW to satisfy my curiousity


    EDIT; Oh nevermind, I think I can see what I've done! RTW may be slightly different but I basically had something like
    library requires factions { england, france, } or factions { denmark, } and hidden_resource hrdenmark or factions { denmark, } and hidden_resource hrfrance
    which is fine, but works the same as
    library requires factions { england, france, } or factions { denmark, } and hidden_resource hrdenmark or hidden_resource hrfrance
    england and france can build anywhere, denmark can build only with hrdenmark or hrfrance resource

    interestingly
    library requires factions { england, france, } or factions { denmark, } and hidden_resource hrdenmark or building_present_min_level hinterland_roads roads
    works for denmark to build either with the resource or with the building, which I didn't realise you could do

    but no apparently there isn't a way of having two different groups of factions using different conditions. Bah!

  11. #31

    Default Re: Buildings and AoR

    Quote Originally Posted by makanyane View Post
    but no apparently there isn't a way of having two different groups of factions using different conditions. Bah!
    OK proved self wrong, and that I wasn't totally mad when I did that RTW mod... Putting this as separate post as it might be important (maybe)

    library requires factions { england, } or factions { denmark, france, } and hidden_resource hrdenmark or factions { denmark, } and hidden_resource hrfrance


    does seem to work as I intended; england can build anywhere, denmark can build with hrdenmark OR hrfrance, france can only build with hrdenmark
    (that probably wasn't the best things to call the test resources...)

    so presumably you can apply a more restrictive condition to the second set of factions, then add looser OR clauses to a reduced set of them? if anyone can explain how/why that'd seem to work on the right to left thingy I'd appreciate it


    EDIT to explain what I think works you can have

    (factions X Y Z + no condition) or (factions B C D + condition1) or (factions B C + condition2) or (factions C + condition3)
    which should get you factionD can build with condition 1 only - factionC can build with conditions 1 or 2 or 3
    once you've applied a condition to a set of factions, any factions added after that point get ignored, so you couldn't stick an 'or factions E' at the end

    does this make any sense whatsoever?

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

    Default Re: Buildings and AoR

    library requires factions { england, } or factions { denmark, france, } and hidden_resource hrdenmark or factions { denmark, } and hidden_resource hrfrance

    england can build anywhere, denmark can build with hrdenmark OR hrfrance, france can only build with hrdenmark
    This is consistent with the right-to-left hypothesis. So are all of your other examples, except the one that said "something like...". Goodo.

    I'll abbreviate it a bit to save room, write it backwards and add some brackets to mimic how the game reads it...

    ( ( ( hrfrance AND factions{denmark} ) OR hrdenmark ) AND factions{denmark,france} ) OR factions{england}

    I don't know whether the brackets are helping or hindering my explanations. I think they're important because here, for example, it demonstrates that factions{england} is not OR'd with factions{denmark,france}, it is OR'd with everything in that outer set of brackets. i.e. OR'd with the result of everything that comes before it.

    BTW, these are the rules of logic:

    True AND True = True
    True AND False = False
    False AND True = False
    False AND False = False
    True OR True = True
    True OR False = True
    False OR True = True
    False OR False = False

    e.g. denmark faction with only the hrdenmark hidden resource...

    Code:
    hrfrance = false
    factions{denmark} = true
    hrdenmark = true
    factions{denmark,france} = true
    factions{england} = false
    
      ( ( ( hrfrance AND factions{denmark} ) OR hrdenmark ) AND factions{denmark,france} ) OR factions{england} 
    = ( ( ( false    AND true              ) OR true      ) AND true                     ) OR false
    = ( (             false                  OR true      ) AND true                     ) OR false
    = (                            true                     AND true                     ) OR false
    =                                              true                                    OR false
    = true
    = library allowed
    e.g. france faction with only the hrfrance hidden resource...

    Code:
    hrfrance = true
    factions{denmark} = false
    hrdenmark = false
    factions{denmark,france} = true
    factions{england} = false
    
      ( ( ( hrfrance AND factions{denmark} ) OR hrdenmark ) AND factions{denmark,france} ) OR factions{england} 
    = ( ( ( true     AND false             ) OR false     ) AND true                     ) OR false
    = ( (              false                 OR false     ) AND true                     ) OR false
    = (                       false                         AND true                     ) OR false
    =                                           false                                      OR false
    = false
    = library not allowed
    e.g. england faction...

    Well, that's easy. It doesn't matter whether anything else evaluates to true or false because it's always going to boil down to either...
    = false OR true
    ...or...
    = true OR true
    ...and both give a result of true. england can build it anywhere.

    so presumably you can apply a more restrictive condition to the second set of factions, then add looser OR clauses to a reduced set of them? if anyone can explain how/why that'd seem to work on the right to left thingy I'd appreciate it

    (factions X Y Z + no condition) or (factions B C D + condition1) or (factions B C + condition2) or (factions C + condition3)
    which should get you factionD can build with condition 1 only - factionC can build with conditions 1 or 2 or 3
    once you've applied a condition to a set of factions, any factions added after that point get ignored, so you couldn't stick an 'or factions E' at the end

    does this make any sense whatsoever?
    It isn't really to do with right-to-left, more to do with what I said above about bracketing: that every condition is AND'd/OR'd with the result of everything to its right (or to its left when written out backwards). Also, "factions" is a bit of a special condition because its content factions are OR'd with each other - within brackets. That is significant but my brain's failing to put it into words.

    Your factions B,C,D + condition 1,2,3 example is interesting. It depends on how it is written.

    condition1 AND factions{B,C,D} OR condition2 AND factions{B,C} OR condition3 AND factions{C}

    ...written in backwards form would be...

    ( ( ( ( factions{C} AND condition3 ) OR factions{B,C} ) AND condition2 ) OR factions{B,C,D} ) AND condition1

    --> Faction C would only be able to build if condition 1, 2 and 3 are all true. Faction B would need condition 1 and 2 to both be true.


    But this way...

    factions{B,C,D} AND condition1 OR factions{B,C} AND condition2 OR factions{C} AND condition3

    ...written in backwards form would be...

    ( ( ( ( condition3 AND factions{C} ) OR condition2 ) AND factions{B,C} ) OR condition1 ) AND factions{B,C,D}

    --> As you described: Faction C would be able to build if either condition 1, 2 or 3 is true. Faction B would need either condition 1 or 2 to be true.
    Last edited by Withwnar; August 19, 2019 at 04:36 AM.

  13. #33

    Default Re: Buildings and AoR

    --> As you described: Faction C would be able to build if either condition 1, 2 or 3 is true. Faction B would need either condition 1 or 2 to be true.
    that's what I was getting, I switched from game type code to () to attempt to explain the result... in game type code it'd be

    library requires factions { X, Y, Z, } or factions { B, C, D, } and condition 1 or factions { B, C, } and condition 2 or factions { C, } and condition 3

    so yeah

    ( ( ( ( factions{C} AND condition3 ) OR factions{B,C} ) AND condition2 ) OR factions{B,C,D} ) AND condition1
    probably does explain that, if I can only get my brain to work! and it does allow a bit of a variation on requirements per faction, so long as you can apply something that B,C & D can have that then can then be extended to provide the requirements to allow more/easier access for B,C / C
    then they can have different requirements... just not totally independent ones, e.g. if condition 1 only works for faction D generally, then B, C, should be able to build on their requirement...

    (I want to go to sleep now!)

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

    Default Re: Buildings and AoR

    That's right, except it is this one...

    ( ( ( ( condition3 AND factions{C} ) OR condition2 ) AND factions{B,C} ) OR condition1 ) AND factions{B,C,D}
    ...instead of the one you quoted. It's a brain hurter all right. Trying to apply the logic when it's in its normal EDB (back-to-front) order is even worse. And trying to explain why/how it works is the hardest of all.

    I tried playing with that "factions" trick to see if there is a way to somehow do this...

    (factions{A} and condition1) or (factions{B} and condition2)

    No luck. As far as I can tell it is impossible to do this at all...

    (A and B) or (C and D)

    ...where A,B,C & D are any kind of condition, including "factions". Such a simple expression but the EDB parser's limitations won't allow it.

  15. #35

    Default Re: Buildings and AoR

    Quote Originally Posted by Withwnar View Post
    You are right. Edited.



    As far as I know the conditions are read from right to left, with each next condition (to the left) AND'd/OR'd with the result so far.
    Code:
    condition1 and condition2 or condition3
    is read as
    Code:
    (condition3 or condition2) and condition1
    Code:
    condition1 and condition2 or condition3 and condition4
    is read as
    Code:
    ((condition4 and condition 3) or condition2) and condition1
    This conclusion is based on something I read once and seems to be right from my experiences so far.



    It would work when written as:
    condition3 or condition1 and condition2

    The more ANDs and ORs there are the more difficult it is to arrange it into a form that works. Some combinations would be impossible I'd say.
    Sorry to necropost @Withmar, but I wish to be sure I understand well what you said and that there has been no new infos.

    Is it right is I redo those
    Code:
    recruitment_slots 2 requires not event_counter freeze_recr_pool 1 and building_present_min_level farms farms+2 and not building_present_min_level city_hall council_chambers
    recruitment_slots 2 requires not event_counter freeze_recr_pool 1 and building_present_min_level city_hall council_chambers and not building_present_min_level farms farms+2
    like this?
    Code:
    recruitment_slots 2 requires building_present_min_level farms farms+2 or building_present_min_level city_hall council_chambers and not event_counter freeze_recr_pool 1
    For the engine it should be read as: "require (BUIDLING1 OR BUILDING2) AND NOT COUNTER" right?
    So:
    - if COUNTER = false => return false
    - if COUNTER = true and one of BUILDING = true => return true
    - if COUNTER = true and both of BUILDING = false => return false
    Belovèse's Toolbox: export text files to spreadsheet, detailed unit stats
    Stainless Steel Historical Improvement Project (SSHIP) team member.
    Mini-mods: diplomacy and relation/reputation - detailled unit stats

  16. #36
    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: Buildings and AoR

    Quintus Sertorius from EBII is a wizard with this, some of the conditions they use are the stuff of night mares. Maybe ask him to participate\comment?










  17. #37
    Jadli's Avatar The Fallen God
    Gaming Emeritus

    Join Date
    Dec 2013
    Location
    Czech Republic
    Posts
    8,528

    Default Re: Buildings and AoR

    Yay, hard to read . Well I remember i somehow mixed "and" and "or" and it worked the way I intended, so didnt have to dive deeper into it fortunately.

    Though, if you intend to make building prerequisite for certain things, you should be careful, because the AI doesnt understand it needs to build something in order to build something else... so preferrably for AI you should make separate recruitment pools/trees, and keep the complex version only for a player. As otherwise AI may easily end up not being able to recruit certain unit types or build certain things entirely.

    BTW, considering the limited amount of hidden resources its very useful to make hinterland regional buildings, which you can use instead of hidden resources, or combine it with them.

  18. #38

    Default Re: Buildings and AoR

    Quote Originally Posted by Gigantus View Post
    Quintus Sertorius from EBII is a wizard with this, some of the conditions they use are the stuff of night mares. Maybe ask him to participate\comment?
    Thanks for the idea, I'll do that next time.

    The solution I posted seemed to work, for the player at least, but the meantime I solved it differently. The problem was that the display in unit cards about recruitment slots became confusing for the player, it is clearer to have the original version.
    Problem is for certain level of walls it was working, for other not, and I didn't find out why. But removing the "and not" condition seems to work fine, so now it'll look like this in our EDB:
    Code:
    recruitment_slots 2 requires not event_counter freeze_recr_pool 1 and building_present_min_level farms farms+2
    recruitment_slots 2 requires not event_counter freeze_recr_pool 1 and building_present_min_level city_hall council_chambers
    Belovèse's Toolbox: export text files to spreadsheet, detailed unit stats
    Stainless Steel Historical Improvement Project (SSHIP) team member.
    Mini-mods: diplomacy and relation/reputation - detailled unit stats

  19. #39
    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: Buildings and AoR

    Quote Originally Posted by Jadli View Post
    BTW, considering the limited amount of hidden resources its very useful to make hinterland regional buildings, which you can use instead of hidden resources, or combine it with them.
    I have lately fallen in love with the idea of using building plugins as 'variable' (and unlimited) hidden resources.










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

    Default Re: Buildings and AoR

    For the record, Belovèse, your original proposed code looks right to me.

Page 2 of 3 FirstFirst 123 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
  •