Stupid Questions (see last post)

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.
User avatar
TrashMan
Posts: 599
Joined: April 30th, 2008, 8:04 pm
Contact:

Re: Stupid Questions (see last post)

Post by TrashMan »

josteph wrote:
March 27th, 2019, 12:13 pm
So the contents of the [advancement] tags is probably wrong. There's really nothing more we can say unless you post your actual code..
Here is the AMLA code:

Code: Select all

#define EFFECT_INCREASE_REQ_EXPERIENCE _AMOUNT
    [effect]
        apply_to=max_experience
        increase={_AMOUNT}
    [/effect]
#enddef



#define AMLA_ENDURANCE
    [advancement]
        id=CON
        max_times=4
        description= _ "Constitution: hitpoints +6 (Max XP +10%)"
        image="attacks/endurance.png"
        {EFFECT_INCREASE_REQ_EXPERIENCE 10%}
        [effect]
            apply_to=hitpoints
            increase=6
            increase_total=6
            heal_full=yes
        [/effect]
    [/advancement]
#enddef

#define AMLA_STRENGTH
    [advancement]
        id=STR
        max_times=3
        description= _ "Strength: melee damage +1 (Max XP +10%)"
        image="attacks/strength.png"
        {EFFECT_INCREASE_REQ_EXPERIENCE 10%}
        [effect]
            apply_to=attack
            range=melee
            increase_damage=1		
        [/effect]
        [effect]
            apply_to=hitpoints
            heal_full=yes
        [/effect]		
    [/advancement]
#enddef


#define AMLA_PRECISION
    [advancement]
        id=PREC
        max_times=3
        description= _ "Precision: range damage +1 (Max XP +10%)"
        image="attacks/precision.png"
        {EFFECT_INCREASE_REQ_EXPERIENCE 10%}
        [effect]
            apply_to=attack
            range=ranged
            increase_damage=1		
        [/effect]
        [effect]
            apply_to=hitpoints
            heal_full=yes
        [/effect]		
    [/advancement]
#enddef

#define AMLA_SPEED
    [advancement]
        id=SPEED
        max_times=3
        description= _ "Speed: moves +1 (Max XP +10%)"
        image="attacks/speed.png"
        {EFFECT_INCREASE_REQ_EXPERIENCE 10%}
        [effect]
            apply_to=movement
            increase=1		
        [/effect]
        [effect]
            apply_to=hitpoints
            heal_full=yes
        [/effect]		
    [/advancement]
#enddef

#define AMLA_RESISTANCE
    [advancement]
        id=RES
        max_times=3
        description= _ "Arcane, Fire and Cold Ressistance +10 (Max XP +10%)"
        image="attacks/resistance.png"
        {EFFECT_INCREASE_REQ_EXPERIENCE 10%}
        [effect]
            apply_to=resistance
            replace=false
            [resistance]
              fire=-10
              cold=-10
              arcane=-10
            [/resistance]		
        [/effect]
        [effect]
            apply_to=hitpoints
            heal_full=yes
        [/effect]		
    [/advancement]
#enddef


#define AMLA_SPELLPOWER
    [advancement]
        id=SPLP
        max_times=3
        description= _ "Spellpower: spell damage +10% (Max XP +20%)"
        image="attacks/spellpower.png"
        {EFFECT_INCREASE_REQ_EXPERIENCE 20%}
        [effect]
            apply_to=attack
            special=magical
            increase_damage=10%
        [/effect]        
		[effect]
            apply_to=attack
            special=lightningstrike
            increase_damage=10%
        [/effect]
        [effect]
            apply_to=hitpoints
            heal_full=yes
        [/effect]		
    [/advancement]
#enddef


#************************
#ADVANCED
#************************

#define AMLA_QUICKSTRIKE
    [advancement]
        id=QS
        require_amla="STR,PREC"
		
        max_times=1
        description= _ "Quickstrike: melee strikes +1 (Max XP +20%)"
        image="attacks/quickstrike.png"
        {EFFECT_INCREASE_REQ_EXPERIENCE 20%}
        [effect]
            apply_to=attack
            range=melee
            increase_attacks=1
        [/effect]
        [effect]
            apply_to=hitpoints
            heal_full=yes
        [/effect]		
    [/advancement]
#enddef


#define AMLA_DEFENSE
    [advancement]
        id=DEF
	    require_amla="STR,SPEED"
		
        max_times=2
        description= _ "Defense: increased defense on all terrain by +5% (Max XP +10%)"
        image="attacks/heater-shield.png"		
        {EFFECT_INCREASE_REQ_EXPERIENCE 10%}
	[effect]
		apply_to=defense
		replace=false
		[defense]
			frozen=-5
			castle=-5
			sand=-5
			village=-5
			flat=-5
			hills=-5
			mountains=-5
			cave=-5
			shallow_water=-5
			coastal_reef=-5
			swamp_water=-5
			forest=-5
			fungus=-5
			deep_water=-5
			unwalkable=-5
		[/defense]
	[/effect]
        [effect]
            apply_to=hitpoints
            heal_full=yes
        [/effect]	
    [/advancement]
#enddef


#define AMLA_FORTRESS
    [advancement]
        id=FORT
        require_amla="STR,CON"
		
        max_times=1
        description= _ "Fortress: armor rating +10%, -1 movement point (Max XP +10%)"
        image="icons/steel_armor.png"
        {EFFECT_INCREASE_REQ_EXPERIENCE 10%}
	[effect]
	    apply_to=resistance
	    replace=false
	    [resistance]
	 	  blade=-10
		  impact=-10
		  pierce=-10
	    [/resistance]
	[/effect]
        [effect]
            apply_to=movement
            increase=-1		
        [/effect]	
    [effect]
        apply_to=hitpoints
        heal_full=yes
    [/effect]	
    [/advancement]
#enddef


#define AMLA_SURESTRIKE
    [advancement]
        id=SSTRIKE
        require_amla="PREC,SPEED"
		
        max_times=1
        description= _ "Sure Strike: +10% chance to hit (Max XP +20%)"
        image="attacks/fist-human.png"
        {EFFECT_INCREASE_REQ_EXPERIENCE 20%}
        [effect]
            apply_to=attack
            increase_accuracy=10%
        [/effect]			
        [effect]
            apply_to=hitpoints
            heal_full=yes
        [/effect]	
    [/advancement]
#enddef


#define AMLA_TOUGH
    [advancement]
        id=TOUGH
        require_amla="CON,SPEED"
		
        max_times=1
        description= _ "Tough: Strong metabolism increases healing and poison resistance. (Max XP +20%)"
        image="attacks/word3.png"
        {EFFECT_INCREASE_REQ_EXPERIENCE 20%}
	[effect]
		apply_to=new_ability
		[abilities]
			{ABILITY_TOUGH}
		[/abilities]
	[/effect]
        [effect]
            apply_to=hitpoints
            heal_full=yes
        [/effect]	
    [/advancement]
#enddef

Light travels much faster than sound, that's why some people seem bright until you hear them speak.

>>> MY LITTLE LAB! <<<

User avatar
josteph
Developer
Posts: 740
Joined: August 19th, 2017, 6:58 pm

Re: Stupid Questions (see last post)

Post by josteph »

You have [advancement] tags both in the macro definitions and in around the uses of the macros (the {AMLA_FOO} things). That means the WML after preprocessing contains [advancement][advancement]...[/advancement][/advancement] which is not valid.

User avatar
TrashMan
Posts: 599
Joined: April 30th, 2008, 8:04 pm
Contact:

Re: Stupid Questions (see last post)

Post by TrashMan »

Ok, got most things working.

One annyoing bug is that the holy water overlay doesn't go away. I don't remembe doing it before.

Code: Select all

#define HOLY_WATER X Y
    {PICK_UP (items/holy-water.png) ({X}) ({Y})
    ( _ "Holy water! What luck, it's just what we need against undead!")
    (
        [object]
            id=holywater_{X}_{Y}
            image=items/holy-water.png
            duration=level

            name= _ "Holy Water"
            description= _ "By poring the contents of this flask over a weapon, one can temporarily bless it."
            cannot_use_message= _ "This unit cannot use this item."
            [filter]
                x={X}
                y={Y}
                [not]
                    [filter_wml]
                        [status]
                            not_living=yes
                        [/status]
                    [/filter_wml]
                [/not]
                [not]
                    race=bats
                [/not]
            [/filter]
            [then]
                [remove_item]
                    x,y={X},{Y}
                [/remove_item]
            [/then]
            [effect]
                apply_to=attack
                range=melee
                set_type=arcane
            [/effect]
			[effect]
				apply_to=overlay
				add="overlays/arcane-icon.png"
			[/effect]			
        [/object]
    )}
#enddef


#define PICK_UP _IMG _X _Y _VERBOSE_MSG _OBJECT_CODE_AND_ACTIONS
    [event]
        name=victory
        [clear_variable]
            name=pickups.generic_flag_{_X}_{_Y}
        [/clear_variable]
    [/event]
    [item]
        image={_IMG}
        x={_X}
        y={_Y}
    [/item]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            x={_X}
            y={_Y}
        [/filter]
        {REDRAW}
        [if]
            [variable]
                boolean_equals=no
                name=pickups.generic_flag_{_X}_{_Y}
            [/variable]
            [then]
                [message]
                    speaker=unit
                    message={_VERBOSE_MSG}
                [/message]
                [message]
                    speaker=narrator
                    image=wesnoth-icon.png
                    message= _ "Do you want this unit to pick up this item?"
                    [option]
                        message= _ "Yes"
                        [command]
                            {_OBJECT_CODE_AND_ACTIONS}
                            [+object]
                                [+then]
                                    # Mark object as picked-up; won't happen if the object's filter
                                    # doesn't match primary_unit
                                    [set_variable]
                                        name=pickups.generic_flag_{_X}_{_Y}
                                        value="yes"
                                    [/set_variable]
                                [/then]
                            [/object]
                        [/command]
                    [/option]
                    [option]
                        message= _ "No"
                        [command]
                            [allow_undo]
                            [/allow_undo]
                        [/command]
                    [/option]
                [/message]
            [/then]
        [/if]
    [/event]
#enddef

Light travels much faster than sound, that's why some people seem bright until you hear them speak.

>>> MY LITTLE LAB! <<<

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

Re: Stupid Questions (see last post)

Post by Ravana »

It actually is. [object] is used both to describe object, and action that adds object.

User avatar
josteph
Developer
Posts: 740
Joined: August 19th, 2017, 6:58 pm

Re: Stupid Questions (see last post)

Post by josteph »

josteph wrote:
March 25th, 2019, 3:22 pm
I think there's an addon that doubles all units hitpoints (and weapon damage and so on) but I can't find it.
It's "Scaling Mod".

User avatar
TrashMan
Posts: 599
Joined: April 30th, 2008, 8:04 pm
Contact:

Re: Stupid Questions (see last post)

Post by TrashMan »

Ravana wrote:
March 27th, 2019, 10:12 pm
It actually is. [object] is used both to describe object, and action that adds object.
???
It actually is.. what?
It's "Scaling Mod".
My HP mod works now. The Scaling mod doesn't solve the issue. Doubling HP is kinda pointless if damage is also doubled, since TTK remains the same.
But I can see some use, because % based traits/attributes are REALYL wonky with small numbers.
+10% damage on an attack that normally does 5 does nothing
Light travels much faster than sound, that's why some people seem bright until you hear them speak.

>>> MY LITTLE LAB! <<<

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

Re: Stupid Questions (see last post)

Post by Ravana »

Response to post that has been deleted.

User avatar
TrashMan
Posts: 599
Joined: April 30th, 2008, 8:04 pm
Contact:

Re: Stupid Questions (see last post)

Post by TrashMan »

Ah, OK.

Looks like the only issue is the Holy Water overlay that won't go away.
Light travels much faster than sound, that's why some people seem bright until you hear them speak.

>>> MY LITTLE LAB! <<<

User avatar
TrashMan
Posts: 599
Joined: April 30th, 2008, 8:04 pm
Contact:

Re: Stupid Questions (see last post)

Post by TrashMan »

I can't get my WORD OF POWER weapon special to work

Can't figure out why it won't work. Only 1 enemy gets damaged

Code: Select all

#define WORD

    [event]
        name=attacker_hits
        first_time_only=no
       
        [filter_attack]
            special=word
        [/filter_attack]

	  [harm_unit]
	    [filter]
                [filter_adjacent]
                    x,y=$x1,$y1
                [/filter_adjacent]
                # The defender was already damaged.
                [not]
                    x,y=$x2,$y2
                [/not]
	    [/filter]
	    [filter_second]
	      x,y=$x1,$y1
	    [/filter_second]
	    amount=$($damage/1.5)
	    damage_type=$weapon.type
	    fire_event=yes
	    experience=yes
	  [/harm_unit] 
	  [harm_unit]
	    [filter]
                [filter_adjacent]
                    x,y=$x1,$y1
                [/filter_adjacent]
                # The defender was already damaged.
                [not]
                    x,y=$x2,$y2
                [/not]
	    [/filter]
	    [filter_second]
	      x,y=$x1,$y1
	    [/filter_second]
	    amount=8
	    damage_type=impact
	    fire_event=yes
	    experience=no
	  [/harm_unit] 
        # Harm units two hexes away from the attacker (half damage).
        [harm_unit]
            [filter]
                [filter_location]
                    # Exclude the units that just received full damage.
                    [not]
                        x,y=$x1,$y1
                        radius=1
                    [/not]
                    # Include the remaining units within two hexes.
                    [and]
                        x,y=$x1,$y1
                        radius=2
                    [/and]
                    side=$enemy_sides
                [/filter_location]
            [/filter]
            [filter_second]
                x,y=$x1,$y1
            [/filter_second]
	    amount=4
	    damage_type=impact
	    fire_event=yes
	    experience=yes
        [/harm_unit]
        [harm_unit]
            [filter]
                [filter_location]
                    # Exclude the units that just received full damage.
                    [not]
                        x,y=$x1,$y1
                        radius=1
                    [/not]
                    # Include the remaining units within two hexes.
                    [and]
                        x,y=$x1,$y1
                        radius=2
                    [/and]
                    side=$enemy_sides
                [/filter_location]
            [/filter]
            [filter_second]
                x,y=$x1,$y1
            [/filter_second]
	    amount=$($damage/2)
	    damage_type=$weapon.type
	    fire_event=yes
	    experience=no
        [/harm_unit]
    [/event]
#enddef


#define WEAPON_SPECIAL_WORD
   [dummy]
      id=word
      name= _ "Word of Power"
       description= _ "A massive shockwave that will damage everything around the caster."
    [/dummy]
#enddef
Light travels much faster than sound, that's why some people seem bright until you hear them speak.

>>> MY LITTLE LAB! <<<

User avatar
beetlenaut
Developer
Posts: 2397
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Stupid Questions (see last post)

Post by beetlenaut »

You should try these [harm_unit] sections one at a time, testing after each one, so if something doesn't work, you know where to look. Inside each [harm_unit] tag, you should also add your [filter] and [filter_location] conditions one at a time (testing after each one) for the same reason, and add your formulas last when you know everything else works properly. You would have found that at least some of these break at the formula step. Unless you defined $damage somewhere else, you probably wanted $damage_inflicted.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide

Post Reply