A Shop Like Thing
From The Battle for Wesnoth Wiki
Just paste this code into your scenario: The code inside each [option] tag are different items, their attributes can easily be changed. In the first section of code, it defines on what coordinates on the map are the shops located. it also shows which sides can use them. You can take out any item in [options] tags and this code still works., as long as you have the beginning and the end bits.
"side=1,2,3,4 x=37,34,40,37 y=1,2,2,4"
[event] name=moveto first_time_only=no [filter] side=1,2,3,4 x=37,34,40,37 y=1,2,2,4 [/filter] [store_gold] side=$side_number variable=gold [/store_gold] [message] speaker=narrator message=_ "What items would you like to purchase?"
[option] message=_ "Sharpen Melee Weapon g:140 dmg:2" [command] [if] [variable] name=gold greater_than=140 [/variable] [then] [gold] amount=-140 side=$side_number [/gold] [object] [effect] apply_to=attack range=short increase_damage=2 [/effect] [/object] [/then] [/if] [/command] [/option]
[option] message=_ "Enchance Ranged Weapon g:150 dmg:2" [command] [if] [variable] name=gold greater_than=150 [/variable] [then] [gold] side=$side_number amount=-150 [/gold] [object] [effect] apply_to=attack range=long increase_damage=2 [/effect] [/object] [/then] [/if] [/command] [/option]
[option] message=_ "Crystal Orb g:150 dmg:+2 Magical" [command] [if] [variable] name=gold greater_than=150 [/variable] [then] [gold] amount=-150 side=$side_number [/gold] [object] [effect] apply_to=attack special=magical increase_damage=2 [/effect] [/object] [/then] [/if] [/command] [/option]
[option] message=_ "Toughness Increase Scroll g:250 hp:10" [command] [if] [variable] name=gold greater_than=250 [/variable] [then] [gold] amount=-250 side=$side_number [/gold] [object] [effect] apply_to=hitpoints increase_total=10 [/effect] [/object] [/then] [/if] [/command] [/option]
[option] message=_ "Flying Boots g:400 m:to 10" [command] [if] [variable] name=gold greater_than=400 [/variable] [then] [gold] amount=-400 side=$side_number [/gold] [object] [effect] apply_to=movement set=10 [/effect] [/object] [/then] [/if] [/command] [/option]
[option] message=_ "Boot Upgrade g:400 m:+1" [command] [if] [variable] name=gold greater_than=400 [/variable] [then] [gold] amount=-400 side=1 [/gold] [object] [effect] apply_to=movement increase=1 [/effect] [/object] [/then] [/if] [/command] [/option]
[option] message=_ "Healing Fountain g:All hp:+50" [command] [if] [variable] name=gold greater_than=0 [/variable] [then] [gold] amount=0 side=$side_number [/gold] [object] [effect] apply_to=hitpoints increase=50 violate_max=1 [/effect] [/object] [/then] [/if] [/command] [/option]
[option] message=_ "Rage Stone g:300 atks:+1 Melee" [command] [if] [variable] name=gold greater_than=300 [/variable] [then] [gold] amount=-300 side=$side_number [/gold] [object] [effect] apply_to=attack range=short increase_attacks=1 [/effect] [/object] [/then] [/if] [/command] [/option]
[option] message=_ "Sight Stone g:350 atks:+1 ranged" [command] [if] [variable] name=gold greater_than=350 [/variable] [then] [gold] amount=-350 side=$side_number [/gold] [object] [effect] apply_to=attack range=long increase_attacks=1 [/effect] [/object] [/then] [/if] [/command] [/option]
[option] message=_ "Fire Scepter g:350 atks:8-1 ranged magical fire" [command] [if] [variable] name=gold greater_than=350 [/variable] [then] [gold] amount=-350 side=$side_number [/gold] [object] [effect] apply_to=new_attack name=Fire Scepter type=fire special=magical range=long damage=8 number=1 [/effect] [/object] [/then] [/if] [/command] [/option]
[option] message=_ "Ice Scepter g:350 atks:8-1 ranged magical Ice" [command] [if] [variable] name=gold greater_than=350 [/variable] [then] [gold] amount=-350 side=$side_number [/gold] [object] [effect] apply_to=new_attack name=Ice Scepter type=cold special=magical range=long damage=8 number=1 [/effect] [/object] [/then] [/if] [/command] [/option] ##########################closing tags [/message] [/event]