Turns itself to stone at daybreak ability :|

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
Gibimbius
Posts: 14
Joined: June 3rd, 2018, 11:27 am

Turns itself to stone at daybreak ability :|

Post by Gibimbius »

Hello, I wish to implement a unit ability that makes petrifies the unit that has it during daytime and unpetrifies it during night time. I don't quite know what I'm doing but this is my incomplete attempt so far. It's not working...

Code: Select all

#define ABILITY_TURNS_TO_STONE
	[petrify]
	    id="turns to stone"
	    name= _ "turns to stone"
            female_name= _ "female^turns to stone"
            description= _ "Turns to stone during daytime."
	    [filter_location]
                time_of_day=lawful
            [/filter_location]
	    affect_self=yes
	[/petrify]
#enddef

:|

What am I doing wrong? I tried to take a look at some abilities "canned" definitions but they show very little. Where I can find examples? I'm a little lost about this because the WML guide is too brief and the references are big.

My final objective an ability that petrifies the unit during "lawful" time and set the resistance values blade=5 and pierce=5 (it will take only 5% damage of these types). Even better if the unit is petrified at defend animation :D . Them at the nightfall I wish the unit do unpetrify itself and return to its original resistances.

I wish to make trolls that petrify and get very tough at dawn (and perhaps regenerate), them return to life again during nightfall = )
User avatar
Zap-Zarap
Posts: 159
Joined: March 16th, 2015, 2:18 pm

Re: Turns itself to stone at daybreak ability :|

Post by Zap-Zarap »

The Minotaur Monster from Deep Elves has "Lithic Idol" ability, similar to your plan.
Maybe check the code of that unit?
It is in ageless era, too, if you happen to have that installed...
I like beavers.
Gibimbius
Posts: 14
Joined: June 3rd, 2018, 11:27 am

Re: Turns itself to stone at daybreak ability :|

Post by Gibimbius »

Where can I find the "uncanned" definitions of the core abilities?

how can I define a filter to affect "self"?
User avatar
Ravana
Forum Moderator
Posts: 2949
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Turns itself to stone at daybreak ability :|

Post by Ravana »

Petrified units can not be attacked, so resistance change is in most cases irrelevant.
User avatar
skeptical_troll
Posts: 498
Joined: August 31st, 2015, 11:06 pm

Re: Turns itself to stone at daybreak ability :|

Post by skeptical_troll »

You can't use the canned petrified tag as is, because it is a weapon special and it is active only when the associate weapon is used. You need to create an event inside the unit or unit type definition (remember to include an id key or won't work) which triggers every relevant turn and petrify/unpetrify the unit (see https://wiki.wesnoth.org/DirectActionsWML#.5Bpetrify.5D )
Gibimbius
Posts: 14
Joined: June 3rd, 2018, 11:27 am

Re: Turns itself to stone at daybreak ability :|

Post by Gibimbius »

Where can I find the event definitions of the abilities and special attacks used in core??
User avatar
Bitron
Developer
Posts: 453
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: Turns itself to stone at daybreak ability :|

Post by Bitron »

it is in <Game Folder>/data/core/macros. There is an "abilities.cfg" inside.
I use a "stone sleep" ability in the Millennium Era, which does pretty much the same as "Lithic Idol", just for vampires instead.
Gibimbius
Posts: 14
Joined: June 3rd, 2018, 11:27 am

Re: Turns itself to stone at daybreak ability :|

Post by Gibimbius »

Bitron wrote: June 10th, 2018, 10:51 pm it is in <Game Folder>/data/core/macros. There is an "abilities.cfg" inside.
I use a "stone sleep" ability in the Millennium Era, which does pretty much the same as "Lithic Idol", just for vampires instead.
Thank you, I adapted the "Lithic Idol" :D

I already saw the abilities.cfg, it gives me only canned abilities, I don't get to see the direct actions (https://wiki.wesnoth.org/DirectActionsWML) that run inside the abilities. For instance I can't see how petrify or poison works.

I get something like a black box with few inputs...

Code: Select all

#define WEAPON_SPECIAL_PETRIFY
    # Canned definition of the Petrify ability to be included in a
    # [specials] clause.
    [petrifies]
        id=petrifies
        name= _ "petrifies"
        description= _ "This attack petrifies the target, turning it to stone. Units that have been petrified may not move or attack."
    [/petrifies]
#enddef
or

Code: Select all

#define WEAPON_SPECIAL_POISON
    # Canned definition of the Poison ability to be included in a
    # [specials] clause.
    [poison]
        id=poison
        name= _ "poison"
        description= _ "This attack poisons living targets. Poisoned units lose 8 HP every turn until they are cured or are reduced to 1 HP. Poison cannot, of itself, kill a unit."
    [/poison]
#enddef
For instance if I want to modify poison so that its kill able to kill, or if I want to change its "color", I can't. I want to learn from the core abilities if possible.
User avatar
Bitron
Developer
Posts: 453
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: Turns itself to stone at daybreak ability :|

Post by Bitron »

Ahh. I think they are actually scripted in either Lua or directly in C++.
Shiki
Developer
Posts: 348
Joined: July 13th, 2015, 9:53 pm
Location: Germany

Re: Turns itself to stone at daybreak ability :|

Post by Shiki »

You can build your own poison, using events to do stuff.
Here's an example of poison only working on unpoisonable units (undead), with two events to let it work on defence and offence.
The ability itself looks like this, in this case it's combined with the normal poison ability.
Try out the dark board theme.
Post Reply