Custom ability doesn't do anything

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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
Anagkai
Posts: 36
Joined: February 12th, 2012, 10:05 am

Custom ability doesn't do anything

Post by Anagkai » March 16th, 2018, 5:12 pm

...except being indicated on the unit.

So, the unit has said ability. Also I have a good number of other abilities, that do work, so it seems there is a problem with that specific one.

What it should do: Everytime a unit adjacent to and on the same side as a unit with this abilitiy dies, said side should get 1 gold.

Here's the ability code:

Code: Select all

#define ABILITY_RECYCLING
    [dummy]
        id=recycling
        name= _ "recycling"
        female_name= _ "female^recycling"
        description=_ "This unit will produce one gold whenever an adjacent allied unit dies."
    [/dummy]
	[event]
		id=recycling_produce_gold
		name=die
		first_time_only=no

		[filter_adjacent]
			ability=recycling
			adjacent=n,ne,se,s,sw,nw
		[/filter_adjacent]
	
		[gold]
			side=unit.side
			amount=1
		[/gold]

		text= _ "+1 Gold"	
	[/event]
#enddef
Hope, somebody can give me a clue...
My campaigns: Princess Nilwyn (available) & Relocate (in dev)

User avatar
Ravana
Moderator
Posts: 1787
Joined: January 29th, 2012, 12:49 am
Location: Estonia

Re: Custom ability doesn't do anything

Post by Ravana » March 16th, 2018, 5:43 pm

side=unit.side - no such side exists.
text= _ "+1 Gold" [event] does not use text key.

User avatar
zookeeper
WML Wizard
Posts: 9716
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Custom ability doesn't do anything

Post by zookeeper » March 16th, 2018, 7:14 pm

Wherever it is you call that macro is not a place where [event] is recognized.

And [filter_adjacent] in an [event] has no meaning.

Anagkai
Posts: 36
Joined: February 12th, 2012, 10:05 am

Re: Custom ability doesn't do anything

Post by Anagkai » March 17th, 2018, 8:03 am

-Why would that side not exist? Does a "die" event not have the associated (i.e. dying) unit as a variable?
-Can I use the [print]-tag?
-How would I go about implementing an ability that needs an event.
-Do I need to put the filter_adjacent inside the [filter]?
My campaigns: Princess Nilwyn (available) & Relocate (in dev)

User avatar
Pentarctagon
Forum Administrator
Posts: 3453
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Custom ability doesn't do anything

Post by Pentarctagon » March 17th, 2018, 8:55 am

Anagkai wrote:
March 17th, 2018, 8:03 am
-Why would that side not exist? Does a "die" event not have the associated (i.e. dying) unit as a variable?
He means it should be $unit.side, not unit.side as it is, since there is in fact no side that is literally the value "unit.side".
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code

User avatar
skeptical_troll
Posts: 399
Joined: August 31st, 2015, 11:06 pm

Re: Custom ability doesn't do anything

Post by skeptical_troll » March 17th, 2018, 9:02 am

Anagkai wrote:
March 17th, 2018, 8:03 am
-How would I go about implementing an ability that needs an event.
-Do I need to put the filter_adjacent inside the [filter]?
-You can see some examples of unit abilities here. The [abilities] tag does not support [event], you can put it somewhere else, like inside the unit definition or in the relevant scenarios.
-yes

User avatar
Bitron
Moderator
Posts: 437
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: Custom ability doesn't do anything

Post by Bitron » March 17th, 2018, 11:02 am

If you want to have the event inside your abilities tag, you can try this:

Code: Select all

#define YOUR MACRO
	[dummy]
		# your dummy
	[/dummy]

	[/abilities] # jump out of the abilities tag

	[event]
		# your event
	[/event] 

	[+abilities] # go back in
#enddef

Post Reply