PDA

View Full Version : Complex conditionals for recruiting and building



tommh
11-18-2004, 10:10
Sorry in advance if this is already well known. I recently found out that you can use not only AND when concatenating conditionals but OR and NOT as well

This means you can specifiy that a unit can be built if a building is NOT present of if one of a list of buildings is present for instance.
There are many other uses.

Duke John
11-18-2004, 11:37
Thanks alot for that information! This will surely come in handy.

tommh
11-20-2004, 05:35
Here are some working examples from the Ptolemaic mode I'm working on:

recruit "egyptian peltast" 0 requires factions { egyptian, } and hidden_resource egypt and not building_present_min_level hellenic_colony basic_colony


This will allow you to build egytian peltasts as long as its a native Egyptian Area and you haven't founded a hellenic colony there.

temple_of_fun_large_temple requires factions { armenia, thrace, seleucid, julii, } or factions { egyptian, } and hidden_resource greeks or factions { egyptian, } and building_present_min_level hellenic_colony basic_colony


This allows this temple if you are egyptian and either its a ethnic Greek province or you have founded a hellenic colony there

eadingas
12-01-2004, 16:17
Can you nest the brackets?

anti_strunt
12-01-2004, 16:54
But there is no way to tie certain units to a specific date, or tie them to an event other than Marius' reforms, right? :embarassed:

eadingas
12-01-2004, 17:13
It would be good if somebody posted a list of all possible conditionals... We're wandering in the mist right now, I was trying to find out some requirements not listed in the original files, but to no avail. Is this really all there is? Can't we tie the unit for example to province's tax value or population...

tommh
12-01-2004, 19:38
The only ones I know of are:

requires factions { x, y, ... z, }
building_present_min_level x y
resource x
hidden_resource x
marian_reforms

connected using "and", "or" and "not"

Addtionally condtionals do not work on agents just recruitment and building requirements.

eadingas
12-01-2004, 20:26
hmmm... when I put 'buildingx requires factions { greek, } and not hidden_resource greeks or factions { roman, } and not hidden_resource romans', it only works for greeks. Romans can't build it at all.

anti_strunt
12-02-2004, 18:20
...but no way to link it do a date... Sad... :sad:

Turbo
12-02-2004, 19:34
Here are some working examples from the Ptolemaic mode I'm working on:

recruit "egyptian peltast" 0 requires factions { egyptian, } and hidden_resource egypt and not building_present_min_level hellenic_colony basic_colony


This will allow you to build egytian peltasts as long as its a native Egyptian Area and you haven't founded a hellenic colony there.

temple_of_fun_large_temple requires factions { armenia, thrace, seleucid, julii, } or factions { egyptian, } and hidden_resource greeks or factions { egyptian, } and building_present_min_level hellenic_colony basic_colony


This allows this temple if you are egyptian and either its a ethnic Greek province or you have founded a hellenic colony there

Where would I find a list of tags such as your "hellenic_colony basic_colony"?

Thanks

Vorbis
12-03-2004, 19:29
hmmm... when I put 'buildingx requires factions { greek, } and not hidden_resource greeks or factions { roman, } and not hidden_resource romans', it only works for greeks. Romans can't build it at all.That's probably because you need to have it say "requires factions {greek, romans, }

Is there actually a use for the "or factions" command, because "requires factions" is the exact same thing?

eadingas
12-03-2004, 19:45
But I want different conditions for different factions.

HROTHGAR
01-06-2005, 17:29
I am trying to get some conditional info also. Are time trigger conditionals available? Now, early legionary cohorts are triggered by the Marian Reform event. Can anyone tell me how to include a no earlier than date(around 105 BC) to the original requirement of any Roman faction building an imperial palace? I also want to cause my (later) legionary cohorts to become available with a foundry and a time trigger(apprx 50 BC). Any help would be greatly appreciated!

tommh
01-18-2005, 22:00
Sorry for the slow reply. Been very busy lately. No there ar no date triggers. Sorry. THe only thing that approximates a date trigger is requiring an additional advanced building and then figuring out the date at which this level of development would be possible.

As to having different conditions for different factions the best way is to use completly seperate recruitment lines. You can have multiple lines for the same unit so put each fractions requirments on its own line.

khelvan
01-19-2005, 03:17
Just a FYI, we have found that you can string quite a few of these together in the same line with no problems at all, and achieve expected results. So you can get pretty damn complex in defining areas to recruit units, for instance.

Pode
02-20-2005, 05:41
Just a FYI, we have found that you can string quite a few of these together in the same line with no problems at all, and achieve expected results. So you can get pretty damn complex in defining areas to recruit units, for instance.

Alas, I confirmed the hard way today that no nested evaluation of these complex conditionals is possible.

Capability1 requires A and (B or C)

must be expressed as

Capability1 requires A and B
Capability1 requires A and C

where the or is implicit between the two lines.

Simetrical
02-27-2005, 04:27
But other forms of complex conditionals may be possible, right? "Capability1 requires A and B or C" is probably being parsed as "Capability1 requires (A and B) or C". Or do you have evidence against this? It would be very helpful if someone felt like testing how the computer parsed complex conditionals.

By the way, might it be a good idea for someone to edit down blitz576's post? It's extremely long and completely irrelevant—those lists are only used for show_me scripts, traits, and ancillaries, not recruitment or building.

-Simetrical

Epistolary Richard
02-27-2005, 06:50
I've been playing around with ZOR hidden resources for most of the day. I haven't got very far with comprehending the parsing, but this is what I have discovered:

1. Capability1 requires A and (B or C) worked for me as intended with A as a faction, and B and C as hidden resources with the effect that the unit will appear where either the B resource or the C resource is present. I didn't use any brackets though.

2. Capability1 requires A and not B and not C also works in that the unit will not appear where either resource B or resource C is present.

3. Capability1 requires A and not B or not C however appeared not to function as expected or cancelled itself it. The unit appeared where both B and C were present.

A few other things:

4. The marian_reform tag has to go at the end if it's going to be used, you can't leave it in the middle.

5. If you leave the faction blank then the programme will take its reference from export_desc_unit thus the following


recruit "warband sword briton" 0

will still allow the unit to be available to the britons.

Other requirments can be added on as well:


recruit "warband sword briton" 0 requires hidden_resource A

will put the unit in any British province contain resource A.

6. And the double spacing around the experience number and before the and hidden_resource tags doesn't seem to matter too much. I've used single spacing and it's been fine.

quadrille
02-27-2005, 17:00
Is there any way to make a certain unit only recruitable if there are no such units recruited, ie. so that you could only train one single unit of that type?

Pode
02-27-2005, 21:27
Simetrical, I found that any attempt at grouping conditionals using () {} or [] caused a CTD on launch. I did not explore implied grouping based on order of parsing other than the example I gave in my previous post. Sorry for the confusion.

Simetrical
02-28-2005, 03:37
Capability1 requires A and not B or not C however appeared not to function as expected or cancelled itself it. The unit appeared where both B and C were present.There are three ways to interpret "A and not B or not C", as far as I can tell:

1) "A and (not B or not C)". This would cause the capability to appear if and only if either A was true but B wasn't (and C would be irrelevant), or A was true but C wasn't (and B would be irrelevant).

2) "(A and not B) or not C". This would cause the capability would appear if and only if either A was true, but B was false (and C would be irrelevant); or C was false (and A and B would be irrelevant).

3) "A and not (B or not C)". This would cause the capability to appear if and only if A and C were true, but B was false (with nothing irrelevant).

If B and C are both true, none of these should apply, and the capability shouldn't appear. Either I missed a possibility, or I misunderstood Richard, or the game is seriously screwed up. This probably merits further investigation.

-Simetrical

Epistolary Richard
02-28-2005, 16:13
Darn, so much to be done and I'm not going to be able to access RTW for another three weeks at least! :sick:

@ quadrille
I haven't discovered any way of ensuring you can only build one unit. There's no conditional (that I'm aware of) that involves the game looking at what the faction already owns so we can't simply say:

requires faction and hastati = 0

(if I'm wrong on this, please let me know!)

The main problem lies in creating some kind of exhaustable building/resource so that once you've built it the resource is destroyed and so it cannot be created twice.

I don't how far people have got in understanding the campaign scripting, but that could help you if there was some trigger after a unit was constructed that could be used to destroy a conditional building.

There is, however, an easy way of only ever having one unit of a type on the map.

Easy solution
You make the unique unit non-buildable and place a single one on the starting campaign map.
Problem here is that the faction has to have the unique unit from the start, unless again a script trigger could place the unit outside of the normal recruitment system (eg, complete Achilles' home triggers placement of Achilles unit at particular location)


@ Simetrical

I think you understood me right.

I only happened to use the "or not" parameter because I was working on a excel script to make defining the unit's hidden resource requirements easier and therefore the script was set up to insert "or" in between the different hidden resource areas.

I was going to suggest that perhaps the game uses "and" "or" & "and not" but not "or not" parameters, but that would mean that it shouldn't have appeared in B.

I don't think we should be too concerned with "or not" though as each one of the situations that it could have been (per your list) can be defined using "and" & "and not" (though you'd have to have two lines for 1) & 2)).

I'd be more interested in a couple of other areas:

A) khelvan said we can string quite a few of these together, is there an upper limit? (so if I want to be able to build the unit in half the map, can I list ten ZOR areas that already exist or would I have to create another resource for it?)

B) what happens if we put in contradictory recruitment parameters, eg, requires faction and italy and not italy ?

quadrille
02-28-2005, 19:41
Thanks for the reply Richard!

The best would of course be if the player himself could train the unit at any time, but after that not be able to train any more of the same unit (until it's killed). The purpose I was wondering is because I'm working on the warhammer mod, and we are trying to find a way of preventing people from training armies of greater daemons (which would be very "un-fluffy", and which is not possible in the table top game).

The thing with giving the player the daemon at the start of the campaign is that it would most likely get killed quite soon and then be gone forever (unless there's for example a way of modding the probability that the unit heals after a battle, but that has more to do with the way it was "taken down" than which unit it actually is, hasn't it?).

Epistolary Richard
03-01-2005, 12:14
I see what you're aiming for. Here are a few ideas pluck out of the blue, but I don't know how feasible some of them are:

1) Have a "Realm of Chaos" province which is the only one that can build daemonic units. Make the population very small and grow very slowly so that it will limit the number of daemons able to be "recruited".
Problem: the Chaos player can just demob units in the province and boost its population. Perhaps something can be done with making it a long way away or make the daemon units take up lots more of the population than regular units. (I have to say, though, I quite like the idea of the Chaos player sending a trail of peasant units from the places he's captured back north to 'sacrifice' to get his daemon units)

2) Make your starting family members greater daemons, make them all infertile and so reduce the number the Chaos player will have.
Problem: I don't know if it's possible to make different generals have different models so they may all look alike.

3) Include a 'Daemon Prince' trait that can be gained by one of your characters so if they slaughter enough of the enemy they made a daemon prince/greater daemon. It you make it hard enough to get then it will necessarily limit the number of greater daemons in the army, on the plus side it will accurately reflect the fact that for Chaos hordes success breeds success. Or perhaps replace Faction Leader or Faction Heir, so there will only ever be (and always be) one daemon at a time.
Problem: I don't know if it's possible for the acquisition of a trait to change the general model, eg, if I made a special 'Scarface' version of a general could I mod the files so that any character who got this trait used the 'Scarface' version rather than the regular version.


But I have a question as well, for your greater daemon units, how are you getting around the 6 man unit limit?


Edit :idea2:

Greater Daemon mercenaries!

Mercenary elephants only appear in a few places and have a very low refresh rate. Have a look at them in descr_mercenaries and see if you could put something similar in an isolated Realm of Chaos province.
Problem: Any other faction can recruit them too! But then again, if the other factions are getting banners into the Realm of Chaos province then Chaos is pretty much onto a loser anyway...
If you really want to be sure that no one else can recruit them, put the RoC province on an island within an inland sea (a Sea of Chaos perhaps ~D ), ensure the only port for the sea is on the island and give the Chaos player the only ship in that sea.

surfasb
06-02-2005, 04:47
I see what you're aiming for. Here are a few ideas pluck out of the blue, but I don't know how feasible some of them are:

1) Have a "Realm of Chaos" province which is the only one that can build daemonic units. Make the population very small and grow very slowly so that it will limit the number of daemons able to be "recruited".
Problem: the Chaos player can just demob units in the province and boost its population. Perhaps something can be done with making it a long way away or make the daemon units take up lots more of the population than regular units. (I have to say, though, I quite like the idea of the Chaos player sending a trail of peasant units from the places he's captured back north to 'sacrifice' to get his daemon units)

2) Make your starting family members greater daemons, make them all infertile and so reduce the number the Chaos player will have.
Problem: I don't know if it's possible to make different generals have different models so they may all look alike.

3) Include a 'Daemon Prince' trait that can be gained by one of your characters so if they slaughter enough of the enemy they made a daemon prince/greater daemon. It you make it hard enough to get then it will necessarily limit the number of greater daemons in the army, on the plus side it will accurately reflect the fact that for Chaos hordes success breeds success. Or perhaps replace Faction Leader or Faction Heir, so there will only ever be (and always be) one daemon at a time.
Problem: I don't know if it's possible for the acquisition of a trait to change the general model, eg, if I made a special 'Scarface' version of a general could I mod the files so that any character who got this trait used the 'Scarface' version rather than the regular version.


But I have a question as well, for your greater daemon units, how are you getting around the 6 man unit limit?


Edit :idea2:

Greater Daemon mercenaries!

Mercenary elephants only appear in a few places and have a very low refresh rate. Have a look at them in descr_mercenaries and see if you could put something similar in an isolated Realm of Chaos province.
Problem: Any other faction can recruit them too! But then again, if the other factions are getting banners into the Realm of Chaos province then Chaos is pretty much onto a loser anyway...
If you really want to be sure that no one else can recruit them, put the RoC province on an island within an inland sea (a Sea of Chaos perhaps ~D ), ensure the only port for the sea is on the island and give the Chaos player the only ship in that sea.



The best idea for a non recuitable unit, but want it to be retainable is to make it's build time something ridiculous like 800. Then it's still retainable but not buildable since the game is hardcoded to accept only 244(something like that) turns.

Periklis
06-03-2005, 14:43
But I want different conditions for different factions.

In that case you have to make two lines one for the romans and one for the greeks with different conditions. If you look in RTR files you will understand.

eadingas
06-03-2005, 14:46
That post was 3 months old, we moved on since then a bit :)

Epistolary Richard
06-03-2005, 15:10
Actually, the board uses the american dating system of putting the month first. Your post was made at the beginning of December, that's seven months ago!

Was there even RTW modding back then? :grin:

eadingas
06-03-2005, 15:26
Hmm then I think that was even before the period when I was the building coordinator for EB... prehistory :)

Teleklos Archelaou
10-02-2005, 20:27
Does using "or" as a building conditional necessitate restating "factions (x,y,z,)"?

In other words is example 1 the same as example 2?

1. requires factions (x, y, ) and buildingalpha or buildingbeta

2. requires factions (x, y, ) and buildingalpha or (x, y, ) and buildingbeta

Simetrical
10-02-2005, 23:11
Depends how it's parsed. If it's simple left-to-right parsing, what you'd want is "requires buildingalpha or buildingbeta and factions { x, y, }", because it would get parsed "requires ((buildingalpha or buildingbeta) and factions { x, y, })". It could also be right-to-left, in which case you'd want "requires factions { x, y, } and buildingalpha or buildingbeta" = "requires (factions { x, y, } and (buildingalpha or buildingbeta))". If it's using some other kind of parsing, God only knows.

You'll have to try it out for yourself, really. And post the results here.

Teleklos Archelaou
10-02-2005, 23:31
Well I just tried out:

requires factions { x, y, } and buildingalpha or { z, } and buildingbeta

and the second part seems to work right now. But it ignores the restriction on the first part when I add that.

When I said:

requires factions { x, y, } and buildingalpha or factions { z, } and buildingbeta

the first part worked but the second part was totally ignored. Gah.

Teleklos Archelaou
10-10-2005, 18:17
Aha. I found a way to get a second set of factions into a requirement line in constructing a building, but it still isn't nearly what I would like. The "or" apparently will keep two things together, so this would work:

buildingalpha requires factions { greek_cities, romans_brutii, } or factions { parthia, } and building_present_min_level hinterland_roads roads

I had been unable to get any second grouping of factions to work. So one set can have no requirements, while the second set has some. But this doesn't do a lot, as I was wanting to have different sets for multiple different factions. If anyone has any idea how to achieve this, please let me know. But the above appears to work. The first two factions have no requirements, and work immediately, but the last one, parthia, has to have roads built first before it will be buildable. But once they are constructed you could build it.

(It appears as if someone else in EB figured it out too, earlier. Probably Angadil, but not sure. But I see this same structure used in another building's requirements that I hadn't seen before.)

Simetrical
10-11-2005, 00:31
This would suggest that the requirements are parsed right-to-left, although it's not certain. If that is indeed the case, I suspect what you want would be unattainable.

Seth Krn3ll
04-30-2008, 00:13
I noticed a weird outcome.

When I put the "and not building_present" (or the "and not hidden_resource") condition for a building, the building tree is affected in ALL settlements.

Lets say I put a "not hidden_resource" condition to build a market, the markets disappears in ALL settlements building tech tree.

The condition works perfecltyperfectlyperfectperfectaperfectoperfectsperfectasperfectedperfecterperfectosperfectersperfe ctingperfectionperfectibleperfectionsperfectness - the market is buildable where the hidden resource is not present and cannot be built where the hidden resource is present, but the catalog of available buildings is impaired everywhere the same, no matter if the condition is satisfied or not.

On the contrary, if I put a "and building_present" (or "and hidden_resource"), tech tree is correctly affected - the market disappears - only where the resource is not present.

Is it just me or it happens to everyone?

Aradan
04-30-2008, 00:30
Did u try using the _min_level variation (of course using the first level as parametre)?

Never happened to me/fatw anyway, at least with "not hidden_resource". Can't remember an instance with the other atm.

Seth Krn3ll
04-30-2008, 02:02
Did u try using the _min_level variation (of course using the first level as parametre)?

Never happened to me/fatw anyway, at least with "not hidden_resource". Can't remember an instance with the other atm.
Mmm can you check it please to be sure?
I made lots of tentatives, changing the buildings involved, the resource, the faction, and I always have that same outcome.

Be sure to check the building catalog tree of the settlement, because its only there that it can be noticed: the building conditions works in the game, you see the icon of the new level to build. Its just if you check the tree that you see its not there.

Mmm let me post a few screens.

CONDITION:
red_eye1 requires factions { romans_julii, } and not hidden_resource barad_dur

OUTCOME:

>> CITY WITH RESOURCE:
Correclty, not shown and not able to be built.

http://digilander.libero.it/krnell/lotrmod/no%20hidden%20-%20hidden%202.jpg

tech tree:
Correctly, not shown.

http://digilander.libero.it/krnell/lotrmod/no%20hidden%20-%20hidden.jpg

>> CITY WITHOUT RESOURCE:
Correclty, shown and able to be built.

http://digilander.libero.it/krnell/lotrmod/no%20hidden%20-%20no%20hidden%202.jpg

tech tree:
NOT CORRECTLY, NOT SHOWN

http://digilander.libero.it/krnell/lotrmod/no%20hidden%20-%20no%20hidden.jpg



CONDITION:
red_eye1 requires factions { romans_julii, } and hidden_resource barad_dur

OUTCOME:

>> CITY WITH RESOURCE:
Correclty, shown and able to be built.

http://digilander.libero.it/krnell/lotrmod/hidden%20-%20hidden.jpg

tech tree:
Correclty, shown.

http://digilander.libero.it/krnell/lotrmod/hidden%20-%20hidden%202.jpg

>> CITY WITHOUT RESOURCE:

Correclty, not shown and not able to be built.

http://digilander.libero.it/krnell/lotrmod/hidden%20-%20no%20hidden.jpg

tech tree:
Correclty, not shown.

http://digilander.libero.it/krnell/lotrmod/hidden%20-%20no%20hidden2.jpg

Makanyane
04-30-2008, 07:39
I'm fairly sure I had same issue (actually thought it was a known factor) - I know I wrote some of the building conditionals for Eod2 the very long way round by listing 'and or' all the positive ones when I was just trying to exclude one area.

The 'and not' condition for buildings is anyway known to mess up which culture the building turns up as, in EDB guide. (https://forums.totalwar.org/vb/showthread.php?t=50439)

Note 1: Not conditionals (even if true) and positive conditionals that result false seem to break the culture/faction for the slave faction if those buildings are placed at game start - see this thread: https://forums.totalwar.org/vb/showthread.php?t=81322

Aradan
04-30-2008, 11:22
My noob-ness strikes again - and a loss of memory apparently.

Yeah, checked it and you're right. We simply don't have such buildings viewable on the BB anyway, because they are either available on village level or they are branches of multiple-choice trees. Sorry for the above post - though Dol's perfect coding is to blame actually, not a single oversight in his EDB. :)

Dol Guldur
04-30-2008, 13:25
You need to reverse the thinking to make it a postive; this is why mods have such hidden resources as not_road etc.

This is a known issue.

Seth Krn3ll
04-30-2008, 15:57
You need to reverse the thinking to make it a postive; this is why mods have such hidden resources as not_road etc.

This is a known issue.
Glad to see Its not my mistake then :)

Yes making it positive was my first idea, but seems not appliable to my nedds.

That is: the goal is to make such building availabe in all settlements BUT one. That will mean to add that hidden resource to all regions fo the game but one.

Moreover, there are such unique temple buildings for EACH culture, so I'd need one hidden resource for ALL cultures added to ALL buildings but the one they don't have to build that temple - and for each culture the "free" region is different.

In facts, making it positive would mean to add 14 new resources to more then 80 regions... sounds a bit too complex to limit a building :(

O well, I'll think some workaround for that... maybe I'll put a undestructable placeholder in the building slot so to prevent it. That will leave the tech tree there but sounds better then removing it from all the settlements.

CaesarVincens
08-18-2009, 16:20
I know it's a bit late, but I thought it would worth telling about another way around the "not" conditional.

As stated above coding a building like so:


building requires factions {whatever, } and not hidden_resource x

will cause that building to never appear in the tech tree.

However, this coding, where "never" is a HR that does not appear in any region:


building requires factions {whatever, } and hidden_resource never or not hidden_resource x

will correctly show the building in regions without hidden resource x, but not in regions with it.

Dol Guldur
08-18-2009, 17:40
Did you miss out an "or"?

CaesarVincens
08-18-2009, 18:52
Did you miss out an "or"?

No :gring:


Thanks for catching that.