Creating a(nother) Dot_, and in need of help.

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
Flametrooper
Posts: 984
Joined: February 21st, 2006, 11:02 pm
Location: 0x466C616D65

Creating a(nother) Dot_, and in need of help.

Post by Flametrooper »

Well, as the title says, I am making a Dot_, and I tried coding the shops myself instead of stealing them from another one. I thought it would be an excercise in coding, help me learn WML better. Probably a bad idea. They don't even show up when the character moves to the shop location! Here's the code(I started out simple enough):

Code: Select all

#######SHOPS#######

#define SHOP X Y
[event]
name=moveto
	[filter]
	canrecruit=1
	x={X}
	y={Y}
	[/filter]

[message]
description=Shopkeeper
message= _ "What would you like to do?"
	[option]
	message= _ "Strength Training: 120g +2 melee damage"
		[command]
			[gold]
			amount=-120
			side=$side_number
			[/gold]
			[object]
			silent=yes
				[effect]
				apply_to=attack
				range=melee
				increase_damage=2
				[/effect]
			[/object]
		[/command]
		[/option]

		[option]
		message= _ "Ranged Training: 140g +2 ranged damage"
			[command]
				[gold]
				amount=-140
				side=$side_number
				[/gold]
				[object]
				silent=yes
					[effect]
					apply_to=attack
					range=ranged
					increase_damage=2
					[/effect]
				[/object]				
			[/command]
		[/option]
[/message]

[/event]
#enddef

{SHOP 9 10} {SHOP 11 9} {SHOP 13 8}
{SHOP 19 25} {SHOP 21 24} {SHOP 23 23}
#######END SHOPS#######
Basically, when the character moves to the specified location, say 9,10, nothing happens. So what am I doing wrong?
[/code]
Flametrooper
Posts: 984
Joined: February 21st, 2006, 11:02 pm
Location: 0x466C616D65

Post by Flametrooper »

Okay, never mind this thread. I screwed around and managed to make it work. (Changing the speaker from "Shopkeeper" to "Narrator" seemed to do it...strange.) Someone can delete this thread now, if they want.

*feels like a true Wesnothian idiot* :oops:
User avatar
Noyga
Inactive Developer
Posts: 1790
Joined: September 26th, 2005, 5:56 pm
Location: France

Post by Noyga »

Use first_time_only=no in your event, so you can use your shop more than once :)

description=Shopkeeper means only a unit with description=Shopkeeper would speak, so if you have no such unit, it won't work.
"Ooh, man, my mage had a 30% chance to miss, but he still managed to hit! Awesome!" ;) -- xtifr
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

Yep. Just put caption= _ "Shopkeeper" to the [message] and add an image or something to make it look like "a shopkeeper unit" is speaking.
Flametrooper
Posts: 984
Joined: February 21st, 2006, 11:02 pm
Location: 0x466C616D65

Post by Flametrooper »

Ok, thanks for the replies. I got the shop to work and a fully working hero upgrade system thingy, but now creep upgrades do not work! I suppose I could just steal them from another MP scenario, but I wanted to try it myself. Again, bad idea. Fate must never have intended me to write WML. Here's the creep creation code:

Code: Select all

###Creep Creation
[event]
name=side turn
side_number=7
first_time_only=no
	[unit]
	x=12,15
	y=13,12
	type=Peasant
	side=7
	[modifications]
		[object]
		silent=yes
			[effect]
			apply_to=attack
			range=melee
			increase_damage=$creep_melee_dmg_7
			[/effect]
			[effect]
			apply_to=attack
			range=melee
			increase_damage=$creep_melee_strikes_7
			[/effect]
			[effect]
			apply_to=attack
			range=ranged
			increase_damage=$creep_ranged_dmg_7
			[/effect]
			[effect]
			apply_to=attack
			range=ranged
			increase_damage=$creep_ranged_strikes_7
			[/effect]
			[effect]
			apply_to=hitpoints
			increase_total=$creep_hp_7
			heal_full=yes
			[/effect]
		[/object]
	[/modifications]
	[/unit]
[/event]
[event]
name=side turn
side_number=8
first_time_only=no
	[unit]
	x=17,20
	y=21,19
	type=Peasant
	side=8
	[modifications]
		[object]
		silent=yes
			[effect]
			apply_to=attack
			range=melee
			increase_damage=$creep_melee_dmg_8
			[/effect]
			[effect]
			apply_to=attack
			range=melee
			increase_damage=$creep_melee_strikes_8
			[/effect]
			[effect]
			apply_to=attack
			range=ranged
			increase_damage=$creep_ranged_dmg_8
			[/effect]
			[effect]
			apply_to=attack
			range=ranged
			increase_damage=$creep_ranged_strikes_8
			[/effect]
			[effect]
			apply_to=hitpoints
			increase_total=$creep_hp_8
			heal_full=yes
			[/effect]
		[/object]
	[/modifications]
	[/unit]
[/event]

Creeps are created all around a single trapdoor, one is created each time a turn starts, any and every side's turn, so that by Turn 2 there's 6 of them clustered around each trapdoor. Creep upgrades buyable in the shop do not show up on the creeps.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

Flametrooper wrote:

Code: Select all

[event]
name=side turn
side_number=7
first_time_only=no
	[unit]
	x=12,15
	y=13,12
Coordinates are messed up. You can't trigger a side turn event only on some side's turn. You have to use an [if] to find out the value of $side_number and branch the logic from there.

The same of course applies to the other event, too.
Post Reply