[solved] Adding "loyal" via object/effect

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
User avatar
Dovolente
Posts: 140
Joined: April 17th, 2007, 9:02 pm
Location: USA, Mountain West
Contact:

[solved] Adding "loyal" via object/effect

Post by Dovolente »

With the following, my unit gains the "illuminates" ability correctly, but it doesn't gain "loyal".

Code: Select all

			[object]
				silent=yes
				name=_ "the Phial of Orocia"
				description= _ "unit gains loyalty and illuminates the surrounding area"
				[effect]					
					apply_to=new_ability
					[abilities]
						{ABILITY_ILLUMINATES}
					[/abilities]
				[/effect]
				[effect]
					apply_to=loyal
				[/effect]
			[/object]
On the effectWML page, it implies that apply_to can take 'loyal' as a value, and it says that there are no associated keys for loyal. But apparently this isn't working--any ideas?
Last edited by Dovolente on June 13th, 2012, 2:44 pm, edited 1 time in total.
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Adding "loyal" via object/effect

Post by Dugi »

The first thing I would try is to check whether the unit really isn't loyal, because only the loyal trait is explicitly visible.

But I suppose you have done that. Then, I would suggest to do this:

Code: Select all

[store_unit]
	[filter]
	        x,y=$x1,$y1   #IMPORTANT NOTE: Make sure this will filter your unit, you may use id=his_name or something similar instead
	[/filter]
	variable=new_loyal
	kill=no
[/store_unit]
{VARIABLE new_loyal.upkeep loyal}
{VARIABLE i $new_loyal.modifications.trait.length}
{VARIABLE new_loyal.modifications.trait[$i].id loyal}
{VARIABLE new_loyal.modifications.trait[$i].male_name loyal}
{VARIABLE new_loyal.modifications.trait[$i].female_name ("female^loyal")}
{VARIABLE new_loyal.modifications.trait[$i].description ("Zero upkeep")}
{VARIABLE new_loyal.modifications.trait[$i].effect.apply_to loyal}
{CLEAR_VARIABLE i}
[unstore_unit]
	variable=new_loyal
	find_vacant=no
[/unstore_unit]
It stores the unit, first makes it loyal, then adds the trait that makes sure that the loyal trait will persist when it advances and to make it show up and then unstores it.
Use the object with the ability before or after.
User avatar
Astoria
Inactive Developer
Posts: 1007
Joined: March 20th, 2008, 5:54 pm
Location: Netherlands

Re: Adding "loyal" via object/effect

Post by Astoria »

apply_to=loyal only makes the upkeep zero, it doesn't do anything else. Just use [modify_unit] to make the unit appear with an icon and edit traits.
Formerly known as the creator of Era of Chaos and maintainer of The Aragwaithi and the Era of Myths.
User avatar
Dovolente
Posts: 140
Joined: April 17th, 2007, 9:02 pm
Location: USA, Mountain West
Contact:

Re: Adding "loyal" via object/effect

Post by Dovolente »

Thanks, both answers were instructive. Problem solved. :)
Post Reply