I want to test if an admiral has at least a "cog" ship into his fleet. Is there any condition that could help me? found nothing in docudemos, but who know, maybe some of you can help me...
I want to test if an admiral has at least a "cog" ship into his fleet. Is there any condition that could help me? found nothing in docudemos, but who know, maybe some of you can help me...
Can't see a straightforward way to do it.
Percentage unit attribute, then give each ship a unique attribute, maybe.
There is a solution, but it will generate false error messages:
The description
Identifier: PercentageUnitAttribute
Trigger requirements: character_record
Parameters: unit attribute
Sample use: PercentageUnitAttribute navy_coq > 25.5 (test for all units with the attribute 'navy_coq')
Description: Test to see what percentage of the army have a particular attribute
The error message
: PercentageUnitAttribute needs a living character with an army.
The use
You require a custom attribute in the EDU entry if you wish to test for a particular unit. The entry should come at the end of the 'attributes' line of the unit - example:
The DrawbackCode:attributes sea_faring, can_withdraw, navy_coq
This works with named characters as it requires a character record. Not if it will work with admirals (it should, they can get traits which is part of a character record).
Men, thanks you got my day![]()
Give them the 'cog' attribute and this would work:
PercentageUnitAttribute cog > 1
The error message should be returned when the character does not have an army, but there's no way to test if he has one or not before using the condition.
It's only really a problem to have error messages in your log when some noob notices a different problem and assumes the error message has something to do with it. So as long as you find that kind of thing amusing you'll be fine![]()
ok. the idea is to give him a different strat_model depending on his fleet, presuming the strongest ship would be the "admiral" one. so if he has, let's say, only cogs, he will use a low tier model, while if he has more powerful vessels he will use a bigger baddasser looking model(hardcoded limit is 10). thanks anyway
The PercentageUnitAttribute condition should work in EDCT, right?
Yeah, great idea Kiliç.
I have a tool for filtering out those error messages. The page has a link to post that has some findings on when it does and doesn't happen but it didn't test admirals.
Hmm, having a quick read through that post the error only happens when there are two named characters in the same army. You might be safe there because a fleet can only have one admiral (?).
The error message happens every time the trigger fires, at least in my mod.
The tool fails to rectify this entry:
16:03:37.939 [game.script] [error] Trigger processing error in <devastation_cav_living_on_land>
: PercentageUnitCategory needs a living character with an army.
when testing <PercentageUnitCategory> condition
Those tests I ran did not include named characters in settlements. From memory the error always happens for those guys because they don't have an army.
There were certainly cases when the errors didn't appear for me. I used it in a submod to give the commander a trait if his army had a particular unit. If the error happened (e.g. he is now the 2nd named character in that army) then the trait would not be removed like it should, due to the the trigger failing with that error. Which suggests that if the error always happened then the trait would never work at all.![]()
In my mod a few characters are placed outside settlements with a unit that has the required attribute. The number of errors I am getting in the first round is pretty much equivalent to them. To avoid excessive amounts of messages I added 'not EndedInSettlement' to the conditions of the trigger. It also made more sense for what I wanted to achieve with the trigger.