Unit canrecruit=false

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
enclave
Posts: 936
Joined: December 15th, 2007, 8:52 am

Unit canrecruit=false

Post by enclave »

Sorry I have a very strange question...... (1.14.1)
Does [unit] NOT automatically set canrecruit=false if unspecified?
Looks like all my units created with [unit] tag completely don't have any canrecruit value...
It might be me being silly.. or not?
I was sure in 1.12 all units were having canrecruit value.. do I need a brain scan...? I feel like im stupid...

To say more, I tried to make unit with [unit] canrecruit=false and to the best of my knowledge the result was a unit without canrecruit variable.. only king has canrecruit and it is true obviously... but other units don't have canrecruit=false, they just don't have canrecruit at all...!?
Did I mess something up with my add-on codes or it's really happening and it's a new "feature"?
User avatar
Celtic_Minstrel
Developer
Posts: 2166
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Compatibility-breaking changes between 1.12 and 1.13/1.14

Post by Celtic_Minstrel »

Well, false and absent are essentially the same, aren't they? Though I'm not certain whether boolean_equals counts a missing key as false.

It sounds like this might be a result of the optimization for save files? I seem to recall someone did an optimization to leave redundant keys (keys that are set to their default value) out of the save files, and it affects [store_unit] too since they both use the same method to convert a unit to WML. I'm not sure though.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
vultraz
Developer
Posts: 960
Joined: February 7th, 2011, 12:51 pm
Location: Dodging Daleks

Re: Compatibility-breaking changes between 1.12 and 1.13/1.14

Post by vultraz »

As celmin said, canrecruit=false and a missing canrecruit= key count as the same. It doesn't matter if the key is missing.
Creator of Shadows of Deception (for 1.12) and co-creator of the Era of Chaos (for 1.12/1.13).
SurvivalXtreme rocks!!!
What happens when you get scared half to death...twice?
enclave
Posts: 936
Joined: December 15th, 2007, 8:52 am

Re: Compatibility-breaking changes between 1.12 and 1.13/1.14

Post by enclave »

vultraz wrote: May 29th, 2018, 5:09 am As celmin said, canrecruit=false and a missing canrecruit= key count as the same. It doesn't matter if the key is missing.
so if i do [store_unit] canrecruit=false then I obviously get all units without canrecruit tag?
User avatar
vultraz
Developer
Posts: 960
Joined: February 7th, 2011, 12:51 pm
Location: Dodging Daleks

Re: Compatibility-breaking changes between 1.12 and 1.13/1.14

Post by vultraz »

Almost certainly. You can confirm pretty easily.
Creator of Shadows of Deception (for 1.12) and co-creator of the Era of Chaos (for 1.12/1.13).
SurvivalXtreme rocks!!!
What happens when you get scared half to death...twice?
User avatar
Ravana
Forum Moderator
Posts: 2952
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Unit canrecruit=false

Post by Ravana »

Confirmed, so this is not compatibility-breaking, so split.
Post Reply