Add new effects on a max level troop

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
tido61037
Posts: 5
Joined: May 19th, 2021, 5:52 pm

Add new effects on a max level troop

Post by tido61037 »

Recently, i want to make changes to the script to add new effects to the (advances_to=null) troops. It's changed successfully with simpler effects like hp, mp, abilities... you name it. But it's not working with the effect types like: weapond specials, increase the number in resistances. Though, i tried many keyword to the (apply_to=...) to add those new effects but it won't work. Can someone show me a way to do that ? Please! :? :augh: :doh:
Currently, im using TBFW 1.15.18 version
Here is a script that i modified for an example

Code: Select all

#textdomain wesnoth-utbs
[unit_type]
    id=Crab
    name= _ "Crab"
    race=New
    image="units/monsters/crab.png"
    {DEFENSE_ANIM "units/monsters/crab-defend2.png" "units/monsters/crab-defend1.png" {SOUND_LIST:SKELETON_HIT} }
    hitpoints=29
    movement_type=naga
	[movement_costs]
            deep_water=1
            shallow_water=1
            reef=2
            swamp_water=1
            flat=1
            sand=1
            forest=2
            hills=1
            mountains=2
            village=1
            castle=1
            cave=1
            frozen=2
            fungus=2
    [/movement_costs]
	[defense]
            deep_water=50
            shallow_water=50
            reef=30
            swamp_water=45
            flat=60
            sand=55
            forest=50
            hills=50
            mountains=50
            village=50
            castle=50
            cave=60
            frozen=80
            fungus=50
    [/defense]
    movement=5
	[resistance]
        blade=75
        pierce=80
        impact=80
        fire=85
        cold=80
        arcane=80
    [/resistance]
    experience=16
    advances_to=Hypper Crab
    {AMLA_DEFAULT}
    level=1
    alignment=neutral
    cost=22
    usage=fighter
    description= _ "The Monster Crab is a semi-sentient crab the size of a horse. It is one of many twisted monsters recorded by the sages of Wesnoth and probably the creation of some twisted mage. These monstrosities have spread into the wild and prefer to live around coastal waters, preying on both humans and animals."
    die_sound={SOUND_LIST:SKELETON_DIE}
	[abilities]
	    {ABILITY_QUICK_REGENERATES}
		{ABILITY_BURROW}
		{ABILITY_SUBMERGE}
	[/abilities]
    [attack]
        name=claws
        #textdomain wesnoth-units
        description= _"claws"
        #textdomain wesnoth-utbs
        icon=attacks/claws-crab.png
        type=blade
        range=melee
        damage=9
        number=2
    [/attack]
	[advancement]
        id=Crab
        max_times=10
        description= _ "a strongger Crab"
        [effect]
            apply_to=attack
            increase_damage=1
        [/effect]
		[effect]
            apply_to=hitpoints
            increase_total=1 
        [/effect]
    [/advancement]
	[advancement]
        id=Crab
        max_times=10
        description= _ "a heavier Crab"
        [effect]
            apply_to=hitpoints
            increase_total=6
            increase=4
        [/effect]
    [/advancement]
	[advancement]
        id=Crab
        max_times=10
        description= _ "a faster Crab"
        [effect]
            apply_to=movement  
            increase=1
        [/effect]
    [/advancement]
	[advancement]
	    id=Crab
        max_times=1
        description= _ "STEADFAST Crab"
	        [effect]
                apply_to=new_ability
                [abilities]
                    {ABILITY_STEADFAST}
                [/abilities]
            [/effect]
			[effect]
                apply_to=experience
                increase_total=50%
            [/effect]
	[/advancement]
	[advancement]
	    id=Crab
        max_times=1
        description= _ "Shooting Crab"
	        [effect]
                apply_to=new_attack
                name="H2O Jet"
                description= _ "H2O Jet"
                icon=attacks/waterspray.png
                type=impact
                range=ranged
                damage=5
                number=2
            [/effect]
			[effect]
                apply_to=experience
                increase_total=20%
            [/effect]
	[/advancement]
	
    [attack_anim]
        [filter_attack]
            name=claws
        [/filter_attack]
        start_time=-250
        offset="0:100,0~0.6:150,0.6~0:200"
        [frame]
            image=units/monsters/crab-attack[1,2,3].png:[150,70,130],units/monsters/crab.png:100
        [/frame]
        {SOUND:HIT_AND_MISS pincers.ogg {SOUND_LIST:MISS} -150}
    [/attack_anim]
[/unit_type]
Last edited by WhiteWolf on November 3rd, 2021, 10:34 am, edited 4 times in total.
Reason: [c] -> [code]
User avatar
Pentarctagon
Project Manager
Posts: 5564
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Add new effects on a max level troop

Post by Pentarctagon »

Moved to the WML Workshop.

Also I'd suggest posting your current code.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
vghetto
Posts: 755
Joined: November 2nd, 2019, 5:12 pm

Re: Add new effects on a max level troop

Post by vghetto »

This should do the job.

Code: Select all

                [object]
                    [effect]
                        apply_to=new_advancement
                        [advancement]
I think you can find examples of a customized amlas in UtBS. There are plenty of other examples in the addons. The mod Colosseum comes to mind.
User avatar
tido61037
Posts: 5
Joined: May 19th, 2021, 5:52 pm

Re: Add new effects on a max level troop

Post by tido61037 »

Pentarctagon wrote: November 2nd, 2021, 4:47 pm Moved to the WML Workshop.

Also I'd suggest posting your current code.
Thank for your reply, so where can i find that WML Workshop and what is it ?
User avatar
tido61037
Posts: 5
Joined: May 19th, 2021, 5:52 pm

Re: Add new effects on a max level troop

Post by tido61037 »

vghetto wrote: November 3rd, 2021, 6:03 am This should do the job.

Code: Select all

                [object]
                    [effect]
                        apply_to=new_advancement
                        [advancement]
I think you can find examples of a customized amlas in UtBS. There are plenty of other examples in the addons. The mod Colosseum comes to mind.
Why there is a [object] in the script while this code involving in a unit advancement ? Anyway, i'll try that thanks.
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: Add new effects on a max level troop

Post by WhiteWolf »

The WML Workshop is the sub-forum where WML-related questions go. You originally posed this to the User's forum, Pentarctagon just noted that they moved your topic to where it's supposed to be.

You need an [object] tag if you want to apply the new advancement option to an already existing unit, during a game.
I think you want to directly edit the [unit_type] of a unit, so you don't have to use an [object] tag there.
About what is accepted in the apply_to key, refer to the EffectWML wiki: https://wiki.wesnoth.org/EffectWML
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
User avatar
tido61037
Posts: 5
Joined: May 19th, 2021, 5:52 pm

Re: Add new effects on a max level troop

Post by tido61037 »

WhiteWolf wrote: November 3rd, 2021, 10:40 am The WML Workshop is the sub-forum where WML-related questions go. You originally posed this to the User's forum, Pentarctagon just noted that they moved your topic to where it's supposed to be.

You need an [object] tag if you want to apply the new advancement option to an already existing unit, during a game.
I think you want to directly edit the [unit_type] of a unit, so you don't have to use an [object] tag there.
About what is accepted in the apply_to key, refer to the EffectWML wiki: https://wiki.wesnoth.org/EffectWML
Thank a lots for your information.
Post Reply