changing parameters to units the script

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.
dragon_99
Posts: 21
Joined: February 19th, 2015, 2:49 pm

changing parameters to units the script

Post by dragon_99 »

Hello! I'm sorry placet mine English.

How can change the unit in the process script.
Need to change : experience=59 ,hitpoints=1 ,max_moves=0
Add ability : {ABILITY_CURES}
attempt to 1

Code: Select all

 [modify_unit]
            type="Elvish Fighter"
            [filter]
                type="Elvish Fighter"
            [/filter]
            [store_unit]
                [filter]
                    type="Elvish Fighter"
                [/filter]
                type="Elvish Fighter"
            [/store_unit]
            [set_variables]
                name = stored_unit.modifications.object
                [value]
                    [effect]
                        experience=59
                        increase_total=-99%
                        max_moves=0
                    [/effect]
                [/value]
            [/set_variables]
            [unstore_unit]
                type="Elvish Fighter"
            [/unstore_unit]
        [/modify_unit]
attempt to 2

Code: Select all

        [object]
            silent=yes
            [filter]
                id=lp-2
                x=1-46
                y=1-21
            [/filter]
            [effect]
                apply_to=last breath
                max_moves=0
                [abilities]
                    {ABILITY_CURES}
                [/abilities]
            [/effect]
        [/object]
User avatar
Ravana
Forum Moderator
Posts: 3008
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: changing parameters to units the script

Post by Ravana »

Something like

Code: Select all

	[modify_unit]
		[filter]
			type="Elvish Fighter"
		[/filter]
		experience=59
		hitpoints=1
		max_hitpoints=1
		moves=0
		max_moves=0
		{ABILITY_CURES}
	[/modify_unit]
I guessed you wanted both current and max for hp and moves.
dragon_99
Posts: 21
Joined: February 19th, 2015, 2:49 pm

Re: changing parameters to units the script

Post by dragon_99 »

Can somehow through id
User avatar
Ravana
Forum Moderator
Posts: 3008
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: changing parameters to units the script

Post by Ravana »

You can put id for [filter] then.
dragon_99
Posts: 21
Joined: February 19th, 2015, 2:49 pm

Re: changing parameters to units the script

Post by dragon_99 »

Will an unknown type
User avatar
Ravana
Forum Moderator
Posts: 3008
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: changing parameters to units the script

Post by Ravana »

If you dont know certain type then dont use that key.
dragon_99
Posts: 21
Joined: February 19th, 2015, 2:49 pm

Re: changing parameters to units the script

Post by dragon_99 »

Solution type above id.
And of life has not changed

Code: Select all

        [modify_unit]
            [filter]
                type="Elvish Fighter"
                id=Elvish Fighter-3
            [/filter]
            experience=59
            hitpoints=1
            moves=0
            max_moves=0
        [/modify_unit]
User avatar
Ravana
Forum Moderator
Posts: 3008
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: changing parameters to units the script

Post by Ravana »

If you use id in filter then everything else in that filter is needless.
dragon_99
Posts: 21
Joined: February 19th, 2015, 2:49 pm

Re: changing parameters to units the script

Post by dragon_99 »

No. Bug.
User avatar
beetlenaut
Developer
Posts: 2825
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: changing parameters to units the script

Post by beetlenaut »

It's not a bug. Remove type="Elvish Fighter". This is probably a mistake. If it doesn't work, you have another mistake.

Posting in English is a good idea, but you should repeat the post in your native language. You might get help that is easier to understand. Many people on these forums speak other languages.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
User avatar
Elvish_Hunter
Posts: 1576
Joined: September 4th, 2009, 2:39 pm
Location: Lintanir Forest...

Re: changing parameters to units the script

Post by Elvish_Hunter »

beetlenaut wrote:Posting in English is a good idea, but you should repeat the post in your native language. You might get help that is easier to understand. Many people on these forums speak other languages.
I must admit that I'm having a hard time understanding what are you trying to accomplish :augh: Do you want to modify a single unit? A bunch of units? Or a unit type, meaning that all Fighters will be modified? As beetlenaut said, please post both in English and you native language.
I'm assuming that you're trying to modify a single unit, so here there is a tip:

Code: Select all

id=Elvish Fighter-3
Don't rely on IDs assigned automatically by the game, because they'll be different for every player. Instead, when creating a unit by using the [unit] tag or a macro, assign yourself an ID to it; be careful, as multiple units with the same ID aren't allowed.
Current maintainer of these add-ons, all on 1.16:
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
dragon_99
Posts: 21
Joined: February 19th, 2015, 2:49 pm

Re: changing parameters to units the script

Post by dragon_99 »

I all decided through macros.

Code: Select all

        {MODIFY_UNIT (id=Elvish Fighter-3) experience 59}
        {MODIFY_UNIT (id=Elvish Fighter-3) moves 0}
        {MODIFY_UNIT (id=Elvish Fighter-3) max_moves 0}
        {MODIFY_UNIT (id=Elvish Fighter-3) hitpoints 1}

Code: Select all

[modify_unit]
            [filter]
                type="Princess"
                id=lp-2
            [/filter]
            [abilities]
                {ABILITY_CURES}
            [/abilities]
        [/modify_unit]

        {MODIFY_UNIT (id=lp-2) moves 0}
        {MODIFY_UNIT (id=lp-2) max_moves 0}
beetlenaut wrote:It's not a bug. Remove type="Elvish Fighter". This is probably a mistake. If it doesn't work, you have another mistake.

Posting in English is a good idea, but you should repeat the post in your native language. You might get help that is easier to understand. Many people on these forums speak other languages.
I wrote on the Russian forums there silence.
Last edited by Elvish_Hunter on February 24th, 2015, 9:32 am, edited 1 time in total.
Reason: Merged double posts
User avatar
beetlenaut
Developer
Posts: 2825
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: changing parameters to units the script

Post by beetlenaut »

If you have a problem again, you should write on this forum in Russian (and English). The forums for other languages are often silent.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
User avatar
Elvish_Hunter
Posts: 1576
Joined: September 4th, 2009, 2:39 pm
Location: Lintanir Forest...

Re: changing parameters to units the script

Post by Elvish_Hunter »

dragon_99: please avoid posting two consecutive messages in the same thread in just four minutes. This is what we call double posting, and is against point 1f of our Posting Guidelines. If nobody replied, please just edit your last message instead.
For this reason, I merged your messages.
dragon_99 wrote:I all decided through macros.
I'm still noticing the suspicious Elvish Fighter-3 ID, that looks like an automatically generated one. How did you create the unit, exactly? Was it recruited? Because this may change our answer.
Current maintainer of these add-ons, all on 1.16:
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
User avatar
ChaosRider
Posts: 846
Joined: April 15th, 2012, 1:15 pm

Re: changing parameters to units the script

Post by ChaosRider »

Maybe this way?
Spoiler:
Creator of WOTG (+2880 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.12 Wesnoth server.
Post Reply