ForestDragon's WML questions
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.
Re: ForestDragon's WML questions
:inspect is actually really cool. Didn't use it for a year or so either.ForestDragon wrote:thanks! i actually never used it before, will try it outbeetlenaut wrote:Go into a game, and type :inspect. Look at a unit, and you can see the name of every variable it has.
EDIT: couldn't find the max hp
In 1.13 it's even better.
Edit: have a look https://wiki.wesnoth.org/CommandMode
Try out the dark board theme.
- ForestDragon
- Posts: 1771
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: ForestDragon's WML questions
hi, so, i am having trouble with 1 ability, and 1 weapon special, here:
firstly, i want to make a regeneration-like abilty? but which only works when the unit doesn't stand next to enemies, i am struggling to make a working filter
ignore the 'hop out of the tank part' of the description, it works fine, what i care about is the filter
and secondly: this weapon special called bleeding (i am struggling with giving the attacked unit a variable that increases by 2 for each hit, and due to that i get the nil damage problem):
firstly, i want to make a regeneration-like abilty? but which only works when the unit doesn't stand next to enemies, i am struggling to make a working filter
Code: Select all
[regenerate]
value=5
id=technicians
name= _ "technicians +5"
female_name= _ "female^regenerates +5"
description= _ "Goblin Technicians sitting inside the tank will repair it 5 HP per turn (this only works if there are no enemies nearby). they also hop out of the tank if it is destroyed, although they retain only 15 of their hp."
affect_self=yes
poison=slowed
[filter_adjacent]
is_enemy=yes
count=0
adjacent=n,ne,se,s,sw,nw
[/filter_adjacent]
[/regenerate]
and secondly: this weapon special called bleeding (i am struggling with giving the attacked unit a variable that increases by 2 for each hit, and due to that i get the nil damage problem):
Code: Select all
[event]
name=attacker_hits
first_time_only=no
[filter_attack]
special=bleeding
[/filter_attack]
[filter_second]
[not]
[filter_wml]
[status]
undrainable="yes"
[/status]
[/filter_wml]
[/not]
[/filter_second]
[set_variables]
name=bleed_unit
mode=append
[value]
id=$second_unit.id
side=$second_unit.side
bleed=$"(bleed| + 2)"
[/value]
[/set_variables]
[/event]
[event]
name=defender_hits
first_time_only=no
[filter_second_attack]
special=bleeding
[/filter_second_attack]
[filter]
[not]
[filter_wml]
[status]
undrainable="yes"
[/status]
[/filter_wml]
[/not]
[/filter]
[set_variables]
name=bleed_unit
mode=append
[value]
id=$unit.id
side=$unit.side
bleed=$"(bleed| + 2)"
[/value]
[/set_variables]
[/event]
[event]
name=attack_end
first_time_only=no
[filter_attack]
special=bleeding
[/filter_attack]
# [filter_second]
# [not]
# movement_type=undeadspirit
# [/not]
# [/filter_second]
# [filter]
# type={TYPE}
# [/filter]
[harm_unit]
[filter]
id=$bleed_unit[$i].id
[/filter]
amount=$bleed_unit[$i].bleed
experience=no
fire_event=yes
animate=yes
[/harm_unit]
[clear_variable]
name=bleed_unit[$i]
[/clear_variable]
{NEXT i}
[/event]
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
Re: ForestDragon's WML questions
filter_adjacent might need to be in filter_self.
- ForestDragon
- Posts: 1771
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: ForestDragon's WML questions
thanks! i'll try it outRavana wrote:filter_adjacent might need to be in filter_self.
EDIT: it's working perfectly, now i only have the bleeding special to worry about
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
- ForestDragon
- Posts: 1771
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: ForestDragon's WML questions
hi, so, i am trying to make an ability like summon. the menu shows up perfectly, but clicking it does nothing:
Code: Select all
[event]
name=moveto,side turn
id=turret
first_time_only=no
[set_menu_item]
id=turret
description="build a turret for 14 gold"
image=units/orcs/turret.png~SCALE(24,24)
[show_if]
[/show_if]
[filter_location]
[filter_adjacent_location]
[filter]
ability=build_turret
side=$side_number
# [filter_wml]
# moves=$this_unit.max_moves
# [/filter_wml]
[/filter]
[/filter_adjacent_location]
[not]
[filter]
[/filter]
[or]
terrain=_off^_usr,Q*,W*,*^X*,X*
[/or]
[/not]
[/filter_location]
[command]
[store_gold]
side=$side_number
variable=gold
[/store_gold]
[message]
speaker=narrator
message= _ "Build a turret here?"
side_for=$side_number
[option]
message= {MENU_IMG_TXT "attacks/blank-attack.png" _"No"}
[command]
[/command]
[/option]
#potions
[option]
message= {MENU_IMG_TXT "unit/orcs/turret.png" _"Yes"}
[show_if]
[variable]
name=gold
greater_than_equal_to=14
[/variable]
[/show_if]
[command]
[gold]
side=$side_number
amount=-14
[/gold]
[sound]
name=gold.ogg
[/sound]
[scroll_to]
x,y=$x1,$y1
[/scroll_to]
[unit]
type=Orcish Turret
side=$side_number
x,y=$x1,$y1
animate=yes
[/unit]
[/command]
[/option]
[/message]
[/command]
[/set_menu_item]
[/event]
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: ForestDragon's WML questions
You probably have something outside of a command that you think is inside or something like that, but with random indenting like this, the code is too hard to read. If you indent it sensibly, you might see the error yourself, and people would be more willing to help, too. (If it is actually indented nicely in your editor, then figure out how to paste it in the forums that way.)
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
- ForestDragon
- Posts: 1771
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: ForestDragon's WML questions
oh! this is inside a unit's file (events can easily be placed in there) anyways, here is the full filebeetlenaut wrote:You probably have something outside of a command that you think is inside or something like that, but with random indenting like this, the code is too hard to read. If you indent it sensibly, you might see the error yourself, and people would be more willing to help, too. (If it is actually indented nicely in your editor, then figure out how to paste it in the forums that way.)
Code: Select all
#textdomain wesnoth-units
[unit_type]
id=Goblin Mechanic
name= _ "Goblin Mechanic"
race=goblin
image="units/orcs/saper.png"
{MAGENTA_IS_THE_TEAM_COLOR}
hitpoints=44
movement_type=orcishfoot
movement=5
experience=50
level=1
alignment=chaotic
advances_to=null
{AMLA_DEFAULT}
cost=20
usage=fighter
description= _ ""
die_sound={SOUND_LIST:GOBLIN_DIE}
{DEFENSE_ANIM "units/orcs/saper.png" "units/orcs/saper.png" {SOUND_LIST:GOBLIN_HIT} }
[resistance]
blade=85
pierce=85
impact=85
fire=90
cold=90
arcane=90
[/resistance]
[abilities]
[damage]
id=self-destuct
name= _ "self-destruct (15)"
description="On death, the unit explodes, dealing 15 fire damage to adjacent enemy units."
[/damage]
[heals]
value=8
id=repair
affect_allies=yes
name= _ "repair +8"
female_name= _ "female^repair +8"
description= _ "Allows the unit to heal adjacent allied mechanical units at the beginning of our turn.
A unit cared for by this healer may heal up to 8 HP per turn"
affect_self=no
poison=slowed
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[/affect_adjacent]
[filter_adjacent]
race=mechanical
[/filter_adjacent]
[/heals]
[damage]
id=build_turret
name= _ "build turret"
description="This unit can build an Orcish Turret for the price of 15 gold. works only if the unit has all of his moves left. (Note, this menu will only appear any unit moves, or when a side turn starts with the unit present)"
[/damage]
[/abilities]
[attack]
name=wrench
description=_"wrench"
icon=attacks/adkey.png
type=impact
range=melee
damage=7
number=3
[specials]
{WEAPON_SPECIAL_STUN}
[/specials]
[/attack]
[attack]
name=arm
description=_"mechanical arm"
icon=attacks/fist.png
type=impact
range=melee
damage=12
number=2
[specials]
[damage]
id=anti-tank
name= _ "anti-tank"
description= _ "When used offensively, this attack deals double damage to mechanical units."
multiply=2
active_on=offense
[filter_opponent]
race=mechanical
[/filter_opponent]
[/damage]
[/specials]
[/attack]
[attack_anim]
[filter_attack]
name=wrench
[/filter_attack]
offset=0.0~0.15:100,0.15~0.35:100,0.35~0.45:75,0.45~0.5:100,0.5:20,0.5~0.4:30,0.4~0.2:75,0.2~0.0:75
start_time=-300
[frame]
image="units/orcs/saper.png:50"
[/frame]
[frame]
image="units/orcs/saper.png:50"
[/frame]
[frame]
image="units/orcs/saper.png:[100,75,100,50,75]"
[/frame]
{SOUND:HIT_AND_MISS mace.wav {SOUND_LIST:MISS} -100}
[frame]
image="units/orcs/saper.png:75"
[/frame]
[/attack_anim]
[attack_anim]
[filter_attack]
name=arm
[/filter_attack]
offset=0.0~0.15:100,0.15~0.35:100,0.35~0.45:75,0.45~0.5:100,0.5:20,0.5~0.4:30,0.4~0.2:75,0.2~0.0:75
start_time=-300
shock_start_time=-240
[frame]
image="units/orcs/saper.png:50"
[/frame]
[frame]
image="units/orcs/saper.png:50"
[/frame]
[frame]
image="units/orcs/saper.png:[100,75,100,50,75]"
[/frame]
{SOUND:HIT_AND_MISS fist.ogg {SOUND_LIST:MISS} -100}
[if]
hits=yes
[frame]
image="units/orcs/saper.png:75"
sound=hiss.wav
[/frame]
[/if]
[else]
hits=no
[frame]
image="units/orcs/saper.png:75"
[/frame]
[/else]
[if]
hits=yes
[shock_frame]
halo=halo/empowered-[1~15].png~SCALE(100,100)~BLEND(0,60,196,0.6):50
offset=1.0
auto_vflip=false
[/shock_frame]
[/if]
[/attack_anim]
[death]
start_time=0
[frame]
image=units/orcs/saper.png~O(0%)
halo=projectiles/fireball-impact-[1~15].png~SCALE(400,400):120
[/frame]
sound2_start_time=0
[sound2_frame]
sound=explosion.ogg
[/sound2_frame]
sound3_start_time=60
[sound3_frame]
sound=explosion.ogg
[/sound3_frame]
sound_start_time=120
[sound_frame]
sound=flame-big.ogg
[/sound_frame]
[/death]
[event]
name=last_breath
first_time_only=no
[filter]
type=Goblin Mechanic
[/filter]
[harm_unit]
[filter]
[filter_adjacent]
x,y=$x1,$y1
[/filter_adjacent]
[filter_side]
[enemy_of]
side=$unit.side
[/enemy_of]
[/filter_side]
[/filter]
amount=15
# alignment=$unit.alignment
damage_type=fire
experience=no
fire_event=yes
poisoned=no
slowed=no
# animate=yes
[/harm_unit]
[/event]
[event]
name=moveto,side turn
id=turret
first_time_only=no
[set_menu_item]
id=turret
description="build a turret for 14 gold"
image=units/orcs/turret.png~SCALE(24,24)
[show_if]
[/show_if]
[filter_location]
[filter_adjacent_location]
[filter]
ability=build_turret
side=$side_number
# [filter_wml]
# moves=$this_unit.max_moves
# [/filter_wml]
[/filter]
[/filter_adjacent_location]
[not]
[filter]
[/filter]
[or]
terrain=_off^_usr,Q*,W*,*^X*,X*
[/or]
[/not]
[/filter_location]
[command]
[store_gold]
side=$side_number
variable=gold
[/store_gold]
[message]
speaker=narrator
message= _ "Build a turret here?"
side_for=$side_number
[option]
message= {MENU_IMG_TXT "attacks/blank-attack.png" _"No"}
[command]
[/command]
[/option]
#potions
[option]
message= {MENU_IMG_TXT "unit/orcs/turret.png" _"Yes"}
[show_if]
[variable]
name=gold
greater_than_equal_to=14
[/variable]
[/show_if]
[command]
[gold]
side=$side_number
amount=-14
[/gold]
[sound]
name=gold.ogg
[/sound]
[scroll_to]
x,y=$x1,$y1
[/scroll_to]
[unit]
type=Orcish Turret
side=$side_number
x,y=$x1,$y1
animate=yes
[/unit]
[/command]
[/option]
[/message]
[/command]
[/set_menu_item]
[/event]
[/unit_type]
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: ForestDragon's WML questions
That's not what I meant. I was talking about the text formatting. Instead of this:
It should look like this:
It's much easier to read and figure out this way. It's essential for other people trying to help, but it can help you too.
Code: Select all
[option]
message= {MENU_IMG_TXT "unit/orcs/turret.png" _"Yes"}
[show_if]
[variable]
name=gold
greater_than_equal_to=14
[/variable]
[/show_if]
[command]
[gold]
side=$side_number
amount=-14
[/gold]
...
[/command]
[/option]
Code: Select all
[option]
message= {MENU_IMG_TXT "unit/orcs/turret.png" _"Yes"}
[show_if]
[variable]
name=gold
greater_than_equal_to=14
[/variable]
[/show_if]
[command]
[gold]
side=$side_number
amount=-14
[/gold]
...
[/command]
[/option]
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
- ForestDragon
- Posts: 1771
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: ForestDragon's WML questions
oh, ok, i get what you mean nowbeetlenaut wrote:That's not what I meant. I was talking about the text formatting. Instead of this:It should look like this:Code: Select all
[option] message= {MENU_IMG_TXT "unit/orcs/turret.png" _"Yes"} [show_if] [variable] name=gold greater_than_equal_to=14 [/variable] [/show_if] [command] [gold] side=$side_number amount=-14 [/gold] ... [/command] [/option]
It's much easier to read and figure out this way. It's essential for other people trying to help, but it can help you too.Code: Select all
[option] message= {MENU_IMG_TXT "unit/orcs/turret.png" _"Yes"} [show_if] [variable] name=gold greater_than_equal_to=14 [/variable] [/show_if] [command] [gold] side=$side_number amount=-14 [/gold] ... [/command] [/option]
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
- ForestDragon
- Posts: 1771
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: ForestDragon's WML questions
hi, so, i made an event here, it's working fine, but i want it to trigger after the unit gained experience from killing another unit, not before that
oh, and the event is here btw:
oh, and the event is here btw:
Code: Select all
[event]
name=die
first_time_only=no
[filter]
[/filter]
[if]
[variable]
name=exp_vacuum_[$second_unit.side]
equals=yes
[/variable]
[then]
[sound]
name=magic-faeriefire-miss.ogg
[/sound]
[store_unit]
[filter]
id=$second_unit.id
[/filter]
variable=exp_drained_unit
[/store_unit]
[set_variable]
name=exp_stored_[$side_number]
add="$exp_drained_unit.experience"
[/set_variable]
{VARIABLE exp_drained_unit.experience 0}
[unstore_unit]
variable=exp_drained_unit
find_vacant=no
[/unstore_unit]
{CLEAR_VARIABLE exp_drained_unit}
[/then]
[else]
[/else]
[/if]
[/event]
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
Re: ForestDragon's WML questions
So what's the problem? If die events trigger before XP is given, then does any of the other combat-related events trigger after? If yes, then use them. If not, then you can't do it.
- ForestDragon
- Posts: 1771
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: ForestDragon's WML questions
hi, so, i scrapped that idea. so, here is a new one, and a new problem:
i can't make it so that the selected ally leader's side is stored (or at least properly used by the events)
Code: Select all
[set_menu_item]
description=_ "Send some xp to this side"
id="send_xp"
# image="misc/cross-white.png"
[show_if]
[have_unit]
[filter_side]
[allied_with]
side=$side_number
[/allied_with]
[/filter_side]
canrecruit="yes"
x="$x1"
y="$y1"
[/have_unit]
[and]
[not]
[have_unit]
x="$x1"
y="$y1"
side=$side_number
[/have_unit]
[/not]
[/and]
[/show_if]
[store_unit]
[filter]
x=$x1
y=$y1
[/filter]
variable=thisleader
kill=no
[/store_unit]
[command]
[message]
caption=_ "XP Bank"
image=portraits/tomb-guardian.png
speaker="narrator"
message="Type in the amount of exp to send to side $this_leader.side|, type 0 if you dont want to send any exp to this side. there is currently $exp_stored_[$side_number]| exp in your the bank, and there is currently $exp_stored_[$thisleader.side]| exp in your ally's bank. (note: if you type in more xp than there is in your bank, nothing will happen)"
[text_input]
variable=exp_send
[/text_input]
[/message]
[if]
[variable]
name=exp_send
greater_than=0
[/variable]
[and]
[variable]
name=exp_send
less_than_equal_to=$exp_stored_[$side_number]
[/variable]
[/and]
[then]
[sound]
name=magic-faeriefire-miss.ogg
[/sound]
[set_variable]
name=exp_stored_[$side_number]
sub=$exp_send
[/set_variable]
[set_variable]
name=exp_stored_[$thisleader.side]
add=$exp_send
[/set_variable]
[message]
speaker=narrator
message=_" Player $side_number| has sent player $exp_stored[$thisleader.side]| $exp_send| xp."
[/message]
[/then]
[else]
[/else]
[/if]
[/command]
[/set_menu_item]
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
Re: ForestDragon's WML questions
Observe your variable names.
- ForestDragon
- Posts: 1771
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: ForestDragon's WML questions
could you be a bit more specific? did you notice an error?Ravana wrote:Observe your variable names.
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
Re: ForestDragon's WML questions
I noticed you call for variable name you do not assign.