ChaosRider’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
ChaosRider
Posts: 846
Joined: April 15th, 2012, 1:15 pm

Re: I need help with the creation of codes...

Post by ChaosRider »

My Amla file is looking like that (but it isnt do higher lvls with getting next levels, and bonuses for strikes isnt working :P).

Code: Select all

#textdomain wesnoth-help
#this file contains macros for After Max Level Advancement (AMLA)



#define AMLA_DEFAULT
    # Canned definition of the default AMLA.
    [advancement]
        strict_amla=yes
        max_times=100
        id=amla_default
        description= _ "Max HP bonus +6, +3% of map hp, +1.5 dmg, +0.5 strikes, +2% to all resistances, Max XP +20%"
        image="misc/icon-amla-tough.png"
        [effect]
            apply_to=hitpoints
            increase_total=6
            heal_full=yes
        [/effect]
        [effect]
            apply_to=hitpoints
            increase_total=3%
            heal_full=yes
        [/effect]
		[effect]
            apply_to=attack
			increase_damage=1.5
        [/effect]
        [effect]
        apply_to=movement
        increase=1
        [/effect]
        [effect]
            apply_to=max_experience
            increase=20%
        [/effect]
        [effect]
            apply_to=status
            remove=poisoned
        [/effect]
        [effect]
            apply_to=status
            remove=slowed
        [/effect]
		[effect]
			apply_to=attack
			increase_attacks=0.5
		[/effect]
		[effect]
			[event]
				id=amla_default_lvlup
				name=lvl_up
				first_time_only=no
				[modify_unit]   
					[filter]
						type=xxxxx
						##  probably type=xxxxx, but could potentially be whatever you want
					[/filter]
					##  increase level by 1
					##  either look it up in the WML Reference, or wait and somebody will probably tell you how
					apply_to=level
					increase_level=1
				[/modify_unit]
			[/event]
		[/effect]
        [effect]
            apply_to=resistance
            replace=no
			[resistance]
                cold=-2
            [/resistance]
        [/effect]
        [effect]
            apply_to=resistance
            replace=no
            [resistance]
                fire=-2
            [/resistance]
        [/effect]
		[effect]
			apply_to=resistance
			replace=no
			[resistance]
				arcane=-2
			[/resistance]
		[/effect]
		[effect]
			apply_to=resistance
			replace=no
			[resistance]
				impact=-2
			[/resistance]
		[/effect]
		[effect]
			apply_to=resistance
			replace=no
			[resistance]
				pierce=-2
			[/resistance]
		[/effect]
		[effect]
			apply_to=resistance
			replace=no
			[resistance]
				blade=-2
			[/resistance]
		[/effect]
    [/advancement]
#enddef
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.
User avatar
Elvish_Hunter
Posts: 1575
Joined: September 4th, 2009, 2:39 pm
Location: Lintanir Forest...

Re: I need help with the creation of codes...

Post by Elvish_Hunter »

As zookeeper usually says, if something isn't in the wiki, then it means that it doesn't work. And in that file there are several examples of made-up WML.

Code: Select all

      [effect]
            apply_to=attack
         increase_damage=1.5
        [/effect]

Code: Select all

      [effect]
         apply_to=attack
         increase_attacks=0.5
      [/effect]
increase_damage must either be an integer or a percentage; I'm not sure, but I think that if it's a float it'll be truncated.

Code: Select all

      [effect]
         [event]
            id=amla_default_lvlup
            name=lvl_up
            first_time_only=no
            [modify_unit]   
               [filter]
                  type=xxxxx
                  ##  probably type=xxxxx, but could potentially be whatever you want
               [/filter]
               ##  increase level by 1
               ##  either look it up in the WML Reference, or wait and somebody will probably tell you how
               apply_to=level
               increase_level=1
            [/modify_unit]
         [/event]
      [/effect]
At http://wiki.wesnoth.org/EffectWML , is there [event] amongst the accepted stuff inside [effect]? No. So, it'll never work.

Code: Select all

        [effect]
            apply_to=resistance
            replace=no
         [resistance]
                cold=-2
            [/resistance]
        [/effect]
        [effect]
            apply_to=resistance
            replace=no
            [resistance]
                fire=-2
            [/resistance]
        [/effect]
      [effect]
         apply_to=resistance
         replace=no
         [resistance]
            arcane=-2
         [/resistance]
      [/effect]
      [effect]
         apply_to=resistance
         replace=no
         [resistance]
            impact=-2
         [/resistance]
      [/effect]
      [effect]
         apply_to=resistance
         replace=no
         [resistance]
            pierce=-2
         [/resistance]
      [/effect]
      [effect]
         apply_to=resistance
         replace=no
         [resistance]
            blade=-2
         [/resistance]
      [/effect]
First of all, with this syntax you're simply adding 2 or subtracting 2 (maybe you intended 20?) to the unit's current resistance. Multiplication and division are not possible, as the [resistance] tag must match the structure described at http://wiki.wesnoth.org/UnitsWML . Not only this, but all the six [effect]s above can be joined into one:

Code: Select all

        [effect]
            apply_to=resistance
            replace=no
            [resistance]
                 cold=-2
                 fire=-2
                 arcane=-2
                 impact=-2
                 pierce=-2
                 blade=-2
            [/resistance]
      [/effect]
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: I need help with the creation of codes...

Post by ChaosRider »

Resistances they are work well :P. Try this era on SX RPG, there you can check your resistances in shop :P. Just check them when you will get another lvl with using amla codes.
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.
User avatar
ChaosRider
Posts: 846
Joined: April 15th, 2012, 1:15 pm

Got a question.

Post by ChaosRider »

Is it possible to order the units in my era (taken from the core wesnoth) to use the file Amla is also being amended and in my era, without making copies of them?
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.
User avatar
A Guy
Posts: 793
Joined: May 24th, 2008, 1:55 am

Re: Got a question.

Post by A Guy »

I don't quite get what you're asking. May you please clarify your question?
I'm just... a guy...
I'm back for now, I might get started on some work again.
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: Got a question.

Post by Sapient »

yes, it is possible to change amla of official units using WML and does not require base_unit copies of the unit_type. You can modify the advancement tags using manipulation of stored unit variables, or possibly with modify_unit. I would do this in all the events where units may enter the map: recruit,recall etc. Also when they advance, using post_advance event. Then set a unit.variables.custom_amla=yes so that you can filter and won't need to apply the changes more than once. Also you would need to filter on advances_to=null to prevent applying the fix on a unit that wasn't yet max level.


I imagine it would look something like this (untested):

Code: Select all


[event]
    name=prestart
    [set_variables]
        name=custom_amla
        [value]
            {CUSTOM_AMLA1}
            {CUSTOM_AMLA2}
            {CUSTOM_AMLA3}
        [/value]
    [/set_variables]
[/event]

[event]
    name=recruit,recall,post_advance
    first_time_only=no
    [filter]
        advances_to=null
        [not]
            [filter_wml]
                [variables]
                    custom_amla=yes
                [/variables]
            [/filter_wml]
        [/not]
    [/filter]
    [set_variables]
        name=unit.advancement
        mode=replace
        to_variable=custom_amla.advancement
    [/set_variables]
    {VARIABLE unit.variables.custom_amla yes}
    [unstore_unit]
        variable=unit
    [/unstore_unit]
[/event]
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
User avatar
ChaosRider
Posts: 846
Joined: April 15th, 2012, 1:15 pm

Re: I need help with the creation of codes...

Post by ChaosRider »

Someone who can program the code for Wesnoth could do such as increased by 1 level units along with code Amla.
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.
Kernigh
Posts: 107
Joined: February 13th, 2007, 10:21 pm
Location: United States
Contact:

Re: I need help with the creation of codes...

Post by Kernigh »

ChaosRider wrote:Try this era on SX RPG, there you can check your resistances in shop :P.
You can check resistances on any map, in any game of Wesnoth, by selecting the unit, then hovering your mouse over the HP.
screenshot
screenshot
resistances.png (61.68 KiB) Viewed 3131 times
User avatar
ChaosRider
Posts: 846
Joined: April 15th, 2012, 1:15 pm

Re: I need help with the creation of codes...

Post by ChaosRider »

Time for more questions. I tried to do that would increase the ability the units life (as in the regeneration, but here depend on the maximum number of points of life) and ability to be increased or reduced the hit points of units adjacent to them, as a percentage of maximum points of the life of units. Obviously did not work ... Someone could help me with this? Here are the codes of my the ability that do not work ...

Heals - 5%

Code: Select all

#define ABILITY_HEALS_5%
    # Canned definition of the heal 5% ability to be included in an [abilities] clause.
    [heals]
        value=0.5
        id=healing 5%
        affect_allies=yes
        name= _ "heals +5% of hp max"
        female_name= _ "female^heals +5% of hp max"
        description=  _ "heals +5% of hp max:
Allows the unit to heal adjacent allied units at the beginning of our turn.

A unit cared for by this healer may heal up to 5% of max HP per turn, or stop poison from taking effect for that turn.
A poisoned unit cannot be cured of its poison by a healer, and must seek the care of a village or a unit that can cure."
        affect_self=no
        poison=slowed
        [affect_adjacent]
            adjacent=n,ne,se,s,sw,nw
        [/affect_adjacent]
    [/heals]
#enddef
Regenerates - 5%

Code: Select all

#define ABILITY_REGENERATES_5%
    # Canned definition of the Regenerate ability to be included in an [abilities]
    # clause.
    [regenerate]
        value=0.05
        id=regenerates 5%
        name= _ "regenerates 5% of max hp"
        female_name= _ "female^regenerates 5% of max hp"
        description= _ "Regenerates 5% of max hp:
The unit will heal itself 5% of max hp per turn. If it is poisoned, it will remove the poison instead of healing."
        affect_self=yes
        poison=cured
    [/regenerate]
#enddef
Killing - 5%

Code: Select all

#define ABILITY_KILLING_5%
    # Canned definition of the killing -5% of hp max ability to be included in an [abilities] clause.
    [heals]
        value=-0.05
        id=killing 5%
		affect_enemies=yes
		affect_allies=no
		affect_self=no
        name= _ "Killing -5% of hp max"
        female_name= _ "female^Killing -5% of hp max"
        description=  _ "Killing -5% of hp max:
Allows the unit to kill adjacent enemie units at the beginning of our turn.

Kills 5% of the life of the enemy units at the beginning of each round, standing by having the ability of the unit."
        [affect_adjacent]
            adjacent=n,ne,se,s,sw,nw
        [/affect_adjacent]
    [/heals]
#enddef
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.
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: I need help with the creation of codes...

Post by Dugi »

You cannot do it like that. You have to make an event-based ability.

Code: Select all

#define ABILITY_HEALS_5_PERCENT
    # Canned definition of the heal 5% ability to be included in an [abilities] clause.   Man, why do you even write this useless thing?
    [dummy]
        id=healing 5 percent      #The % symbol may cause problems
        name= _ "heals +5% of hp max"
        female_name= _ "female^heals +5% of hp max"
        description=  _ "heals +5% of hp max:
Allows the unit to heal adjacent allied units at the beginning of our turn.

A unit cared for by this healer may heal up to 5% of max HP per turn, or stop poison from taking effect for that turn.
A poisoned unit cannot be cured of its poison by a healer, and must seek the care of a village or a unit that can cure."
    [/dummy]
[/abilities]   #This is NOT a mistake!
[event]
  id=heals_5_percent
  first_time_only=no
  name=side turn
  [store_unit]
    [filter]
      [filter_adjacent]
         ability=healing 5 percent
         is_enemy=no
      [/filter_adjacent]
      side=$side_number
    [/filter]
    variable=unit_healed
    kill=no
  [/store_unit]
  {FOREACH unit_healed i}
    [if]
      [variable]
        name=unit_healed[$i].status.poisoned
        equals=yes
      [/variable]
      [then]
        [heal_unit]
          [filter]
            id=$unit_healed[$i].id
          [/filter]
          [filter_second]
            ability=healing 5 percent
            [filter_adjacent]
              id=$unit_healed[$i].id
              is_enemy=no
            [/filter_adjacent]
          [/filter_second]
          animate=yes
          amount=0
          restore_statuses=yes
        [/heal_unit]
      [/then]
      [else]
        [heal_unit]
          [filter]
            id=$unit_healed[$i].id
          [/filter]
          [filter_second]
            ability=healing 5 percent
            [filter_adjacent]
              id=$unit_healed[$i].id
              is_enemy=no
            [/filter_adjacent]
          [/filter_second]
          animate=yes
          amount=$($unit_healed[$i].max_hitpoints/20)
         [/heal_unit]
      [/else]
    [/if]
  {NEXT i}
  {CLEAR_VARIABLE unit_healed}
[/event]
[+abilities]
#enddef

Code: Select all

#define ABILITY_REGENERATES_5_PERCENT
    [dummy]
        id=regenerates 5 percent
        name= _ "regenerates 5% of max hp"
        female_name= _ "female^regenerates 5% of max hp"
        description= _ "Regenerates 5% of max hp:
The unit will heal itself 5% of max hp per turn. If it is poisoned, it will remove the poison instead of healing."
    [/dummy]
[/abilities]
[event]
  id=regenerates_5_percent
  first_time_only=no
  name=side turn
  [store_unit]
    [filter]
      ability=regenerates 5 percent
      side=$side_number
    [/filter]
    variable=unit_healed
    kill=no
  [/store_unit]
  {FOREACH unit_healed i}
    [if]
      [variable]
        name=unit_healed[$i].status.poisoned
        equals=yes
      [/variable]
      [then]
        [heal_unit]
          [filter]
            id=$unit_healed[$i].id
          [/filter]
          animate=yes
          amount=0
          restore_statuses=yes
        [/heal_unit]
      [/then]
      [else]
        [heal_unit]
          [filter]
            id=$unit_healed[$i].id
          [/filter]
          animate=yes
          amount=$($unit_healed[$i].max_hitpoints/20)
         [/heal_unit]
      [/else]
    [/if]
  {NEXT i}
  {CLEAR_VARIABLE unit_healed}
[/event]
[+abilities]
#enddef

Code: Select all

#define ABILITY_KILLING_5_PERCENT
    [dummy]
        id=killing 5 percent
        name= _ "Killing -5% of hp max"
        female_name= _ "female^Killing -5% of hp max"
        description=  _ "Killing -5% of hp max:
Allows the unit to kill adjacent enemy units at the beginning of their turn.

Takes 5% of the life of all the enemy units that stand next to a unit with this ability at the beginning of each round."
    [/dummy]
[/abilities]
[event]
  id=kills_5_percent
  first_time_only=no
  name=side turn
  [store_unit]
    [filter]
      [filter_adjacent]
         ability=killing 5 percent
         is_enemy=yes
      [/filter_adjacent]
      side=$side_number
    [/filter]
    variable=unit_harmed
    kill=no
  [/store_unit]
  {FOREACH unit_harmed i}
    [harm_unit]
      [filter]
        id=$unit_harmed[$i].id
      [/filter]
      animate=no
      experience=no
      kill=yes
      amount=$($unit_harmed[$i].max_hitpoints/20)
    [/harm_unit]
  {NEXT i}
  {CLEAR_VARIABLE unit_harmed}
[/event]
[+abilities]
#enddef
Not tested, there might be some minor errors, but you should be able to figure them out. I also fixed the description of the killing 5%. Please, post it here once you test it.
You will send me cookies for this.
User avatar
ChaosRider
Posts: 846
Joined: April 15th, 2012, 1:15 pm

Re: I need help with the creation of codes...

Post by ChaosRider »

Ok, these codes are working properly. Thanks so much, the cake will surely somewhere ^ ^. So now I had another question. The one addition I use the unit with another additive. What should I write and where to in the first addition there is information that you need to download again the second add-on?
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.
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: I need help with the creation of codes...

Post by Dugi »

I am failing to comprehend your question. Maybe you should try to reformulate it, make an example or something.
User avatar
terrorbot276
Posts: 67
Joined: January 21st, 2010, 10:45 pm

Re: The problem with the path to the cfg file with the skill

Post by terrorbot276 »

What is the ability you're trying to use? Is it a custom ability, or is this a bug with the one of the original abilities? If you could give this info, somebody might be able to pinpoint the problem.
User avatar
ChaosRider
Posts: 846
Joined: April 15th, 2012, 1:15 pm

Re: I need help with the creation of codes...

Post by ChaosRider »

Already found the answer to another question (thanks to another player). Thanks to that I was able to use units of Creep War Edit in the Colosseum changed (and the game tells about the need to download another addon before you try play colosseum changed).
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.
User avatar
ChaosRider
Posts: 846
Joined: April 15th, 2012, 1:15 pm

Its me again :D.

Post by ChaosRider »

Here you have some code which is let your unit to get 1 more dmg with each killed enemie unit. Like for me its a bit too powerfull ability so i want to make it a bit slower, 1 dmg per "n" kills, for example this n can be 5 :D.

Code: Select all

#define ABILITY_SOULTAKER
    [dummy]
        id=soultaker
        name= _ "soultaker"
        description= _ "Soultaker:
This unit gains an additional point added to its maximum damage whenever it kills a living unit."
    [/dummy]
[/abilities]
[event]
    name=die
    first_time_only=no
    [filter]
        [not]
            [filter_wml]
                [status]
                    not_living="yes"
                [/status]
            [/filter_wml]
        [/not]
    [/filter]

    [filter_second]
        ability=soultaker
    [/filter_second]

    [unstore_unit]
        variable=second_unit
        {COLOR_HEAL}
        text= _ "+1 damage"
        find_vacant=no
    [/unstore_unit]

    [object]
        silent=yes
        duration=forever
        [filter]
            x,y=$x2,$y2
        [/filter]
        [effect]
            apply_to=attack
            range=melee
            increase_damage=1
            increase=1
        [/effect]
    [/object]
[/event]

[+abilities]
#enddef
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