ForestDragon's WML questions

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
User avatar
ForestDragon
Forum Regular
Posts: 1496
Joined: March 6th, 2014, 1:32 pm

Re: ForestDragon's WML questions

Post by ForestDragon » August 25th, 2016, 1:52 pm

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?
Co-creator of Era of Magic
Creator of Tale of Alan (1.12 abandoned),The Golden Age (1.12/1.13, abandoned),XP Bank (1.14),Alliances Mod(1.14), with a large add-on in development
"Real life is like a hyper-realistic VR game, but with permadeath and boring gameplay"

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

Re: ForestDragon's WML questions

Post by Ravana » August 25th, 2016, 1:58 pm

No. [unit] doesnt have formula key.

User avatar
ForestDragon
Forum Regular
Posts: 1496
Joined: March 6th, 2014, 1:32 pm

Re: ForestDragon's WML questions

Post by ForestDragon » August 25th, 2016, 2:37 pm

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
Co-creator of Era of Magic
Creator of Tale of Alan (1.12 abandoned),The Golden Age (1.12/1.13, abandoned),XP Bank (1.14),Alliances Mod(1.14), with a large add-on in development
"Real life is like a hyper-realistic VR game, but with permadeath and boring gameplay"

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

Re: ForestDragon's WML questions

Post by Ravana » August 25th, 2016, 2:42 pm

formula= is part of standard unit filter.

User avatar
ForestDragon
Forum Regular
Posts: 1496
Joined: March 6th, 2014, 1:32 pm

Re: ForestDragon's WML questions

Post by ForestDragon » August 25th, 2016, 3:02 pm

Ravana wrote:formula= is part of standard unit filter.
ok, thanks
Co-creator of Era of Magic
Creator of Tale of Alan (1.12 abandoned),The Golden Age (1.12/1.13, abandoned),XP Bank (1.14),Alliances Mod(1.14), with a large add-on in development
"Real life is like a hyper-realistic VR game, but with permadeath and boring gameplay"

User avatar
ForestDragon
Forum Regular
Posts: 1496
Joined: March 6th, 2014, 1:32 pm

Re: ForestDragon's WML questions

Post by ForestDragon » September 15th, 2016, 3:10 pm

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)?
Co-creator of Era of Magic
Creator of Tale of Alan (1.12 abandoned),The Golden Age (1.12/1.13, abandoned),XP Bank (1.14),Alliances Mod(1.14), with a large add-on in development
"Real life is like a hyper-realistic VR game, but with permadeath and boring gameplay"

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

Re: ForestDragon's WML questions

Post by Ravana » September 15th, 2016, 3:28 pm

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
Forum Regular
Posts: 1496
Joined: March 6th, 2014, 1:32 pm

Re: ForestDragon's WML questions

Post by ForestDragon » September 15th, 2016, 3:31 pm

thanks! i might use this addon as a base for mine (i am planning to add it to my era)
Co-creator of Era of Magic
Creator of Tale of Alan (1.12 abandoned),The Golden Age (1.12/1.13, abandoned),XP Bank (1.14),Alliances Mod(1.14), with a large add-on in development
"Real life is like a hyper-realistic VR game, but with permadeath and boring gameplay"

User avatar
ForestDragon
Forum Regular
Posts: 1496
Joined: March 6th, 2014, 1:32 pm

Re: ForestDragon's WML questions

Post by ForestDragon » December 12th, 2016, 9:37 am

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
Co-creator of Era of Magic
Creator of Tale of Alan (1.12 abandoned),The Golden Age (1.12/1.13, abandoned),XP Bank (1.14),Alliances Mod(1.14), with a large add-on in development
"Real life is like a hyper-realistic VR game, but with permadeath and boring gameplay"

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

Re: ForestDragon's WML questions

Post by Ravana » December 12th, 2016, 9:42 am

I would suggest either not using objects, or removing objects in code at right time.

User avatar
ForestDragon
Forum Regular
Posts: 1496
Joined: March 6th, 2014, 1:32 pm

Re: ForestDragon's WML questions

Post by ForestDragon » December 12th, 2016, 11:39 am

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
Co-creator of Era of Magic
Creator of Tale of Alan (1.12 abandoned),The Golden Age (1.12/1.13, abandoned),XP Bank (1.14),Alliances Mod(1.14), with a large add-on in development
"Real life is like a hyper-realistic VR game, but with permadeath and boring gameplay"

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

Re: ForestDragon's WML questions

Post by Ravana » December 12th, 2016, 12:18 pm

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
Forum Regular
Posts: 1496
Joined: March 6th, 2014, 1:32 pm

Re: ForestDragon's WML questions

Post by ForestDragon » December 12th, 2016, 12:23 pm

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
Co-creator of Era of Magic
Creator of Tale of Alan (1.12 abandoned),The Golden Age (1.12/1.13, abandoned),XP Bank (1.14),Alliances Mod(1.14), with a large add-on in development
"Real life is like a hyper-realistic VR game, but with permadeath and boring gameplay"

User avatar
Eagle_11
Posts: 757
Joined: November 20th, 2013, 12:20 pm

Re: ForestDragon's WML questions

Post by Eagle_11 » December 12th, 2016, 3:11 pm

Paralyze is supposed to do what ? 'freeze' target unit for the next turn ?

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

Re: ForestDragon's WML questions

Post by Ravana » December 12th, 2016, 3:34 pm

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

Post Reply