Results 1 to 8 of 8

Thread: Questions on EDB

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Re: Questions on EDB

    I think I am on to something. Well, something worked. I managed to use the NOT conditional without the buildings disappearing from the browser. I'll explain:

    As I said, there's a group of 3 buildings and once you build one the other two should become unavailable. The buildings are Workshop, Hospital and Library. This is my first requirement design:

    The workshop has the following requirements: "requires factions { roman, } and not building_present hospital and not building_present library".
    The hospital has the following requirements: "requires factions { roman, } and not building_present workshop and not building_present library".
    The library has the following requirements: "requires factions { roman, } and not building_present workshop and not building_present hospital".

    Normally this would work but the 3 buildings would not show up in the building browser. As we know, the "not" conditional somehow confuses the building browser and it simply skips the buildings all together. This is the design I tried just now:

    The workshop has the following requirements: "requires factions { roman, } and building_present workshop or not building_present hospital and not building_present library".
    The hospital has the following requirements: "requires factions { roman, } and building_present hospital or not building_present workshop and not building_present library".
    The library has the following requirements: "requires factions { roman, } and building_present library or not building_present workshop and not building_present hospital".

    It appears that by first adding a requirement that doesn't start with "not" the building browser displays the building correctly. The first requirement is a non-sense and can never be met (the building requires it's self to be already built) but the second one is the real requirement and works as intended. The downside is that if you hover over the buildings in the browser it will show the requirements in a messy unintelligible fashion.

    This is what I've got so far. I am still a bit skeptical and expecting nasty surprises that will render this useless for my mod so if anyone is curious to test it let me know how it went. If it works like it did for me a few minutes ago it could prove to be a very useful technique for mods that involve complex building trees. I will report anything else I find on this as I use it for my buildings.

  2. #2
    Arrogant Ashigaru Moderator Ludens's Avatar
    Join Date
    Nov 2003
    Posts
    9,063
    Blog Entries
    1

    Lightbulb Re: Questions on EDB

    Thanks for letting us know. I am somewhat puzzled by the ordering of the conditionals, though. I am not sure how R:TW parses the conditionals, but the first requirment is the faction, not the presence of the workshop/hospital/library. So there are two ways this could be parsed:

    Requires: (faction Roman AND workshop) OR (not-hospital AND not-library)

    or

    Requires: faction Roman AND (workshop OR not-hospital) AND not-library

    Are you sure it works as intended?
    Looking for a good read? Visit the Library!

  3. #3

    Default Re: Questions on EDB

    The problem with the "not" conditional might come from using it in the first group of requirements linked by "and". If you create a bogus group that has no effect and doesn't contain "not", the problem seems to vanish. And even though the first group containing the non-sense requirement also contains the faction, that doesn't seem to cause problems. I tested this with other factions and my buildings hadn't become available to all like I suspected they might. They were still only available for the factions specified in the first group of requirements.

    It has worked and it continues to work for me. I have applied it to multiple groups of buildings that were supposed to work the same way as the group I mentioned above. However I use the word "seems" a lot because I like to stay skeptical until I manage to apply this trick to all my buildings and have everything working smoothly. I've learned you never know what other problems you may encounter in EBD.

    Also, I suspect the trick I came across would still work if the non-sense self-requirement in the first group would be changed with a hidden resource that isn't available in any region just so that it can't be met and only the second group of requirements, the one that actually counts will be relevant. I haven't tested this however but if it does work it could make it less confusing than a building that requires it's own presence.

    EDIT:

    I see you used brackets in your examples. I never used brackets in my requirements because I thought they didn't work. Am i wrong? (I hope so, they would be useful). The only way I've managed to create requirement groups is through "and" conditionals. As soon as you use "or" it becomes the start of an alternative requirement/group of requirements. To make my requirements more clear I think they could be reformulated as:

    For the workshop f.e.: requires factions { roman, } and building_present workshop or factions { roman, } and not building_present hospital and not building_present library

    This will only work if the "not" conditional causes problems when used in the first group of requirements like I stated earlier. If the problem actually comes from placing "and not" after "requires factions { roman, }" than the building would once again become invisible in the building browser. I will test this and report the results.
    Last edited by GigeliusMinimus; 05-08-2013 at 13:32.

  4. #4

    Default Re: Questions on EDB

    I am happy to say this requirement formula worked:

    For the workshop: requires factions { roman, } and building_present workshop or factions { roman, } and not building_present hospital and not building_present library

    Also, I tried replacing "and building_present workshop" with a hidden resource called "test", hidden resource which I haven't added to any region, and that worked as well:

    requires factions { roman, } and hidden_resource test or factions { roman, } and not building_present hospital and not building_present library

    The result is a less confusing code line and also a less confusing requirement description in the building browser. It will now tell you that the workshop requires library and hospital because it's not coded to display the "not" in front of them. It's still not seamless but at least you can see the buildings in the browser.

  5. #5
    Arrogant Ashigaru Moderator Ludens's Avatar
    Join Date
    Nov 2003
    Posts
    9,063
    Blog Entries
    1

    Lightbulb Re: Questions on EDB

    Quote Originally Posted by GigeliusMinimus View Post
    Also, I suspect the trick I came across would still work if the non-sense self-requirement in the first group would be changed with a hidden resource that isn't available in any region just so that it can't be met and only the second group of requirements, the one that actually counts will be relevant.
    That should work: the EB team uses that trick to disable recruitment of a certain unit (hidden_resource not_here).

    Quote Originally Posted by GigeliusMinimus View Post
    I see you used brackets in your examples. I never used brackets in my requirements because I thought they didn't work. Am i wrong? (I hope so, they would be useful).
    I just added them to clarify how I thought the line was parsed. I have no idea if they actually work. The R:TW scripting language is very limited; so unless brackets are used in the original data files, I would assume they don't work.

    Quote Originally Posted by GigeliusMinimus View Post
    The only way I've managed to create requirement groups is through "and" conditionals. As soon as you use "or" it becomes the start of an alternative requirement/group of requirements.
    Excellent. That is what I wanted to know.
    Looking for a good read? Visit the Library!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Single Sign On provided by vBSSO