custom AMLA and modify recruits

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.
User avatar
OmnisScio
Posts: 58
Joined: October 2nd, 2013, 1:00 pm

custom AMLA and modify recruits

Post by OmnisScio »

Greetings

Is there a tutorial around anywhere on how to make an AMLA system like the one in [Legend of the Invincibles]?
Also, how does one modify units recruited by the player (Like how all units recruited in LotI chapter 3 are always loyal)?
User avatar
Ravana
Forum Moderator
Posts: 3011
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: custom AMLA and modify recruits

Post by Ravana »

I have had loyal recruits code in my addon so i could easily find it. For custom amla why dont you look how it is done in LotI?

Code: Select all

	[event]
		name=recruit
		first_time_only=no
		[object]
			silent=yes
			[effect]
				apply_to=loyal
			[/effect]
		[/object]
	[/event]
User avatar
Astoria
Inactive Developer
Posts: 1007
Joined: March 20th, 2008, 5:54 pm
Location: Netherlands

Re: custom AMLA and modify recruits

Post by Astoria »

Ravana wrote:For custom amla why dont you look how it is done in LotI?
I wouldn't recommend that if you're a novice coder. The way amlas are done in LotI is quite complicated. If you want to get started with amlas, I recommend you take a look at the wiki and maybe some other add-ons that use amlas (I believe After the Storm has some simple amlas you could use as a template. Alternatively, UtBS features a pretty large amla system for Kaleh).

EDIT:

I completely forgot about UtBS, thank you Dugi.
Last edited by Astoria on October 5th, 2013, 1:29 pm, edited 1 time in total.
Formerly known as the creator of Era of Chaos and maintainer of The Aragwaithi and the Era of Myths.
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: custom AMLA and modify recruits

Post by Dugi »

Dugi wrote:For custom amla why dont you look how it is done in LotI?
Better don't do that. There are some optimalisations that make it look really bizarre, and also some hard-to-find codes to expand its function to support new effects (like changing alignment). Better look at Elynia's AMLA in Invasion from the Unknown or at Kaleh from Under the Burning Suns (if you don't mind deciphering all the macros there).
In older version of LotI, it was written in a clearer way. I have separated it and made an add-on named Dugi's Resource Pack, where you may find it.
Also, how does one modify units recruited by the player (Like how all units recruited in LotI chapter 3 are always loyal)?
They are separate unit types (to have different recruit cost). If they are recruited, a recruit event is fired upon them, using simple an [object] to do the changes.
User avatar
vultraz
Developer
Posts: 960
Joined: February 7th, 2011, 12:51 pm
Location: Dodging Daleks

Re: custom AMLA and modify recruits

Post by vultraz »

Dugi wrote: Better look at Elynia's AMLA in Invasion from the Unknown
After the Storm is better and more cleanly coded and as a result, easier to understand.
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?
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: custom AMLA and modify recruits

Post by gfgtdf »

i dont reccomend looking at UtbS amla codes as novice. Form my impression it is not much easier to understand than LotI.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
User avatar
OmnisScio
Posts: 58
Joined: October 2nd, 2013, 1:00 pm

Re: custom AMLA and modify recruits

Post by OmnisScio »

Ok, currently I'm working on the modifying recruited units bit. It works to a degree, but there are some problems.
Spoiler:
It applies these traits, but they are appended to two that are randomly generated. I know I could probably do this with that object thing, but I want to be able to do other things with this as well, things that it looks like the object thing can't do. I was thinking of adding the AMLA options through this so that I wouldn't have to make new versions of all the units. (note that this is a test and I do not intent to have all elf units loyal and dextrous) (had to take all the brackets out for some reason, seemed to upset the ... forum thing)
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: custom AMLA and modify recruits

Post by Dugi »

That won't work. Traits are determined on recruiting, and relatively hard to change. In this case, I'd recommend you to make custom units with these two traits with availability=musthave .
User avatar
Astoria
Inactive Developer
Posts: 1007
Joined: March 20th, 2008, 5:54 pm
Location: Netherlands

Re: custom AMLA and modify recruits

Post by Astoria »

Dugi wrote:That won't work. Traits are determined on recruiting, and relatively hard to change. In this case, I'd recommend you to make custom units with these two traits with availability=musthave .
It does work for me.

Code: Select all

    [event]
        name=prerecruit
        first_time_only=no
        [filter]
            type=Aragwaith Spearman
        [/filter]

        [modify_unit]
            [filter]
                find_in=unit
            [/filter]
            {IS_LOYAL}

            [modifications]
                {TRAIT_LOYAL}
            [/modifications]
        [/modify_unit]
    [/event]
This made every Aragwaith Spearman recruited loyal.

About the amlas, you can't do that with unit modifications. If you want to give a unit an [advancement], you'll have to make another unit type.
Formerly known as the creator of Era of Chaos and maintainer of The Aragwaithi and the Era of Myths.
User avatar
OmnisScio
Posts: 58
Joined: October 2nd, 2013, 1:00 pm

Re: custom AMLA and modify recruits

Post by OmnisScio »

I've seen a few times in events using the dollar sign to get properties of the events target, is there a list/tutorial of all the things one can do with that.

See, what if that prerecruit event, created a new unit (with the [unit] tags) of the type that would have been created, made the modifications in there with the [modifications] tags, and then killed the unit that was orginally going to be made?
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: custom AMLA and modify recruits

Post by Dugi »

@bumbadadabum
But that won't remove the effect of the first trait you replaced with the loyal trait, until the unit advances. Also, if you add the dextrous trait that way, it won't increase its ranged damage, until it advances (maybe there is a trick to do this too in the simple [modify_unit] way, but still, the former second trait's effects will persist).
About the amlas, you can't do that with unit modifications. If you want to give a unit an [advancement], you'll have to make another unit type.
This is indeed true, but there are workarounds. You can add all possible advancements to the unit, give them all unachievable requirements (let's say, requiring an AMLA named unachievable_1), and add this required dummy AMLA (an AMLA just with id=unachievable_1) whenever you choose (this probably can't be done with [modify_unit], though, but it shouldn't be hard anyway). That way you will make it possible to add AMLA choices to a single unit.

@OmnisScio
I've seen a few times in events using the dollar sign to get properties of the events target, is there a list/tutorial of all the things one can do with that.
Pyrphorus was making something of that kind.
See, what if that prerecruit event, created a new unit (with the [unit] tags) of the type that would have been created, made the modifications in there with the [modifications] tags, and then killed the unit that was orginally going to be made?
You can kill the unit on recruit, and create a unit of the same type with [modifications] of your choice.
User avatar
Astoria
Inactive Developer
Posts: 1007
Joined: March 20th, 2008, 5:54 pm
Location: Netherlands

Re: custom AMLA and modify recruits

Post by Astoria »

Dugi wrote:@bumbadadabum
But that won't remove the effect of the first trait you replaced with the loyal trait, until the unit advances. Also, if you add the dextrous trait that way, it won't increase its ranged damage, until it advances (maybe there is a trick to do this too in the simple [modify_unit] way, but still, the former second trait's effects will persist).
Ah I see. That makes matters a little bit more complicated. The former trait's effects even persist when the effect is cleared... I think Ravana's solution for making the units loyal would work, for now.
This is indeed true, but there are workarounds. You can add all possible advancements to the unit, give them all unachievable requirements (let's say, requiring an AMLA named unachievable_1), and add this required dummy AMLA (an AMLA just with id=unachievable_1) whenever you choose (this probably can't be done with [modify_unit], though, but it shouldn't be hard anyway). That way you will make it possible to add AMLA choices to a single unit.
But the amlas still need to be defined in a unit .cfg. How I understood it, he wanted to make an amla system without custom unit .cfgs. This isn't possible.
Formerly known as the creator of Era of Chaos and maintainer of The Aragwaithi and the Era of Myths.
User avatar
OmnisScio
Posts: 58
Joined: October 2nd, 2013, 1:00 pm

Re: custom AMLA and modify recruits

Post by OmnisScio »

I havn't tried getting the amlas in yet, but almost everything else works so far.
Spoiler:
This works. the only problem is that the unit is created while the original is still there, and is placed to the side. I do not know how to get the new unit positioned correctly after the original is killed, I have no way to refer to it.
About the amla, I've seen in the LotI code, [advancement] tags in [modifications] tags outside of a unit declaration cfg file. The impression I have at the moment is that [modifications] tags are more powerful than [modify_unit] tags in that [modifications] tags is like its directly affecting the constructor of the unit, while [modify_unit] tags can only use its mutators.
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: custom AMLA and modify recruits

Post by Dugi »

This works. the only problem is that the unit is created while the original is still there, and is placed to the side. I do not know how to get the new unit positioned correctly after the original is killed, I have no way to refer to it.
Just kill it before creating the new one. Its properties in $unit will remain until the event ends.
About the amla, I've seen in the LotI code, [advancement] tags in [modifications] tags outside of a unit declaration cfg file. The impression I have at the moment is that [modifications] tags are more powerful than [modify_unit] tags in that [modifications] tags is like its directly affecting the constructor of the unit, while [modify_unit] tags can only use its mutators.
You must be mistaken. [advancement] tags have no effect inside [modifications]. Maybe you meant [advance] tags, I used these to alter the AMLA or change the unit somehow (this could be done also by [object], but I chose [advance] to make things slightly quicker).
User avatar
OmnisScio
Posts: 58
Joined: October 2nd, 2013, 1:00 pm

Re: custom AMLA and modify recruits

Post by OmnisScio »

can [advance] tags be used to allow non-custom units to have custom amla systems? can the default amla be removed from a unit?

If not, I'm all out of ideas. I like the idea of adding an additional promotion to all the units as a way of getting the amla system in without having to make copies of all the ubits, might have to do that myself. I wonder, were the additional promotion levels desired to begin with (with the added bonus of being able to easily implement the amla system) or were they the solution to that problem?
Post Reply