ForestDragon's WML questions

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
ForestDragon
Posts: 1770
Joined: March 6th, 2014, 1:32 pm
Location: Ukraine

Re: ForestDragon's WML questions

Post by ForestDragon »

Ravana wrote:I would use something like

Code: Select all

formula="(($this_unit.max_hitpoints -1+1) / ($this_unit.hitpoints -1+1)) > 2"
ok, so, i should put it inside [filter_wml] tag, right?
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
User avatar
Ravana
Forum Moderator
Posts: 3000
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: ForestDragon's WML questions

Post by Ravana »

No. [unit] doesnt have formula key.
User avatar
ForestDragon
Posts: 1770
Joined: March 6th, 2014, 1:32 pm
Location: Ukraine

Re: ForestDragon's WML questions

Post by ForestDragon »

Ravana wrote:No. [unit] doesnt have formula key.
then where do i put it? i want the AI to NOT avoid ALL units matching this criteria
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
User avatar
Ravana
Forum Moderator
Posts: 3000
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: ForestDragon's WML questions

Post by Ravana »

formula= is part of standard unit filter.
User avatar
ForestDragon
Posts: 1770
Joined: March 6th, 2014, 1:32 pm
Location: Ukraine

Re: ForestDragon's WML questions

Post by ForestDragon »

Ravana wrote:formula= is part of standard unit filter.
ok, thanks
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
User avatar
ForestDragon
Posts: 1770
Joined: March 6th, 2014, 1:32 pm
Location: Ukraine

Re: ForestDragon's WML questions

Post by ForestDragon »

hi, i am back, so, quick question, can i make a MP mod which adds more colors to the side color selection menu (like the yellow/pink from Iftu)?
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
User avatar
Ravana
Forum Moderator
Posts: 3000
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: ForestDragon's WML questions

Post by Ravana »

No. But you can change them later, like https://github.com/ProditorMagnus/Color ... or_mod.cfg

In order to change menu, you might need "core" addon type.
User avatar
ForestDragon
Posts: 1770
Joined: March 6th, 2014, 1:32 pm
Location: Ukraine

Re: ForestDragon's WML questions

Post by ForestDragon »

thanks! i might use this addon as a base for mine (i am planning to add it to my era)
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
User avatar
ForestDragon
Posts: 1770
Joined: March 6th, 2014, 1:32 pm
Location: Ukraine

Re: ForestDragon's WML questions

Post by ForestDragon »

hi, so, i am working on an ability called paralyze, but it's effects wear off on the paralyzed unit's turn, i know that it's caused by the 'duration=turn' in the [object], can anyone tell me a way around that?:

Code: Select all

#textdomain wesnoth

# Weapon specials

# Paralyze special macros #

#define WEAPON_SPECIAL_PARALYZE
    [dummy]
        id=paralyze
        name= _ "paralyze"
        description= _ "This attack paralyzes a unit for a turn. Paralyzed units"
    [/dummy]
#enddef

#define EVENTS_PARALYZE
    [event]
        name=attacker_hits
        first_time_only=no
        [filter_attack]
            special=paralyze
        [/filter_attack]
        [filter_second]
          [not]
            [filter_wml]
                [status]
                    not_living="yes"
                [/status]
            [/filter_wml]
          [/not]
        [/filter_second]
        {VARIABLE second_unit.status.paralyzed yes}
        {VARIABLE second_unit.variables.incinerator $unit.id}
        [unstore_unit]
            variable=second_unit
            find_vacant=no
        [/unstore_unit]
        [object]
            silent=yes
            duration=turn
            sort=potion-like
            [filter]
                find_in=second_unit
            [/filter]
            [effect]
                apply_to=image_mod
                replace="CS(50,50,20)"
            [/effect]
        [/object]
        [object]
            silent=yes
            duration=turn
            [filter]
                find_in=second_unit
            [/filter]
            [effect]
                apply_to=attack
                attack_weight=0.0
                defense_weight=0.0
            [/effect]
            [effect]
                apply_to=movement
                set=0
            [/effect]
        [/object]
    [/event]
    [event]
        name=defender_hits
        first_time_only=no
        [filter_second_attack]
            special=paralyze
        [/filter_second_attack]
        {VARIABLE unit.status.paralyzed yes}
        {VARIABLE unit.variables.paralyzer $second_unit.id}
        [unstore_unit]
            variable=unit
            find_vacant=no
        [/unstore_unit]

        [object]
            silent=yes
            sort=potion-like
            duration=turn
            [filter]
                find_in=unit
            [/filter]
            [effect]
                apply_to=image_mod
                replace="CS(50,50,20)"
            [/effect]
        [/object]
        [object]
            silent=yes
            duration=turn
            [filter]
                find_in=second_unit
            [/filter]
            [effect]
                apply_to=attack
                attack_weight=0.0
                defense_weight=0.0
            [/effect]
            [effect]
                apply_to=movement
                set=0
            [/effect]
        [/object]
    [/event]
    [event]
        name=turn refresh
        first_time_only=no

        [store_unit]
            [filter]
                [filter_wml]
                    [status]
                        paralyzed=yes
                    [/status]
                [/filter_wml]
                [and]
                    [filter_side]
                        side=$side_number
                    [/filter_side]
                [/and]
            [/filter]
            variable=unparalyze_store
            kill=no
        [/store_unit]
        {FOREACH unparalyze_store i}
            {CLEAR_VARIABLE unparalyze_store[$i].status.paralyzed}
            {CLEAR_VARIABLE unparalyze_store[$i].variables.paralyzer}
            [unstore_unit]
                variable=unparalyze_store[$i]
                find_vacant=no
            [/unstore_unit]
            [object]
                silent=yes
                sort=potion-like
                [filter]
                    find_in=unparalyze_store[$i]
                [/filter]
                [effect]
                    apply_to=image_mod
                    replace="CS(0,0,0)"
                [/effect]
            [/object]
        {NEXT i}
        {CLEAR_VARIABLE unparalyze_store}

    [/event]
#enddef
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
User avatar
Ravana
Forum Moderator
Posts: 3000
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: ForestDragon's WML questions

Post by Ravana »

I would suggest either not using objects, or removing objects in code at right time.
User avatar
ForestDragon
Posts: 1770
Joined: March 6th, 2014, 1:32 pm
Location: Ukraine

Re: ForestDragon's WML questions

Post by ForestDragon »

hi, so, back to the paralyze special, i am trying to make it so that it wears off, but it doesn't work (i copied the timer from 'sculpts' ability from Era of Magic, in which (and in my era) it works) here is the paralyze special again:

Code: Select all

#textdomain wesnoth-help

#define WEAPON_SPECIAL_TGA_PETRIFY
# wmlxgettext: [attack]
# wmlxgettext: [specials]
    [petrifies]
        id=TGA_petfity
        name= _ "petrify"
        description="This attack petrifies the target, turning it to stone for two turns. Units that have been petrified may not move or attack.."# doesn't work on ghosts/other incorporeal beings."
    [/petrifies]
[/specials]
[/attack]
[event]
    name=attack_end
    first_time_only=no
    [filter_attack]
        special=TGA_petfity
    [/filter_attack]
#    [filter_second]
#      [not]
#        movement_type=undeadspirit
#      [/not]
#    [/filter_second]

#    [filter]
#        type={TYPE}
#    [/filter]

    # Record information about the stoning
    [set_variables]
        name=sculpt_unit_information
        mode=append
        [value]
            id=$second_unit.id
            side=$second_unit.side
            turn_of_unstoning=$"($turn_number| + 2)"
        [/value]
    [/set_variables]
[/event]

[event]
    name=defender_hits
    first_time_only=no
    [filter_second_attack]
        special=TGA_petfity
    [/filter_second_attack]

#    [filter_second]
#        type={TYPE}
#    [/filter_second]

    # Record information about the stoning
    [set_variables]
        name=sculpt_unit_information
        mode=append
        [value]
            id=$unit.id
            side=$unit.side
            turn_of_unstoning=$"($turn_number| + 2)"
        [/value]
    [/set_variables]
[/event]

[event]
    name=side turn
    first_time_only=no

    {FOREACH sculpt_unit_information i}
        [if]
            [variable]
                name=sculpt_unit_information[$i].turn_of_unstoning
                less_than_equal_to=$turn_number
            [/variable]
            [and]
                [variable]
                    name=sculpt_unit_information[$i].side
                    equals=$side_number
                [/variable]
            [/and]

            [then]
                [unpetrify]
                    id=$sculpt_unit_information[$i].id
                [/unpetrify]

                [clear_variable]
                    name=sculpt_unit_information[$i]
                [/clear_variable]
            [/then]
        [/if]
    {NEXT i}
[/event]
[+attack]
[+specials]
# wmlxgettext: [/specials]
# wmlxgettext: [/attack]
#enddef
the evenr in question is most likely the ''side turn" event
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
User avatar
Ravana
Forum Moderator
Posts: 3000
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: ForestDragon's WML questions

Post by Ravana »

but it doesn't work
So, what does happen?

Also, which version you use? I believe 1.13 mapped FOREACH to iter instead of fori.
User avatar
ForestDragon
Posts: 1770
Joined: March 6th, 2014, 1:32 pm
Location: Ukraine

Re: ForestDragon's WML questions

Post by ForestDragon »

Ravana wrote:
but it doesn't work
So, what does happen?

Also, which version you use? I believe 1.13 mapped FOREACH to iter instead of fori.
i use 1.12 version. about 'what does happen?' i didn't quite get what you mean. If you mean about what's wrong, it's the fact that the effect isn't removed at the 'side turn' event
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
User avatar
Eagle_11
Posts: 759
Joined: November 20th, 2013, 12:20 pm

Re: ForestDragon's WML questions

Post by Eagle_11 »

Paralyze is supposed to do what ? 'freeze' target unit for the next turn ?
User avatar
Ravana
Forum Moderator
Posts: 3000
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: ForestDragon's WML questions

Post by Ravana »

What does happen as in does sculpt_unit_information have the data that it should at that point.
Post Reply