Custom ability doesn't do anything
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.
Custom ability doesn't do anything
...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:
Hope, somebody can give me a clue...
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
My campaigns: Princess Nilwyn (available) & Home of the Undead (available)
Re: Custom ability doesn't do anything
side=unit.side - no such side exists.
text= _ "+1 Gold" [event] does not use text key.
text= _ "+1 Gold" [event] does not use text key.
Re: Custom ability doesn't do anything
Wherever it is you call that macro is not a place where [event] is recognized.
And [filter_adjacent] in an [event] has no meaning.
And [filter_adjacent] in an [event] has no meaning.
Re: Custom ability doesn't do anything
-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]?
-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) & Home of the Undead (available)
- Pentarctagon
- Project Manager
- Posts: 5564
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: Custom ability doesn't do anything
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
take one down, patch it around
-2,147,483,648 little bugs in the code
- skeptical_troll
- Posts: 500
- Joined: August 31st, 2015, 11:06 pm
Re: Custom ability doesn't do anything
-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
Re: Custom ability doesn't do anything
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
Developer of Project Haldric
Add-ons: Millennium Era, Vision of a Shaman, A New Home
Art: Bitron's Art Thread
Tools: WML Syntax Highlighter for VS Code
Add-ons: Millennium Era, Vision of a Shaman, A New Home
Art: Bitron's Art Thread
Tools: WML Syntax Highlighter for VS Code