Extra feature giveaway.

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
BajMic
Posts: 157
Joined: January 24th, 2023, 1:22 am

Extra feature giveaway.

Post by BajMic »

I made this for my campaign, but I don't think there is enough room for this feature. I will probably remove it.

This macro places a very susfishious object on the map. You may ignore it at your own peril, but if a weak enough unit closes in...

You can also step on it, with satisfying result. Have fun!

Code: Select all

#define FISH_CARCASS SIDE X Y FACING SCALE

	#I call this species a Susfish
	{VARIABLE temp {FACING}}
	[switch]
		variable=temp
		[case]
			value=ne,e,se
			[item]
				image="units/undead/zombie-fish.png~SCALE({SCALE})~O(90%)"
				x,y={X},{Y}
				submerge=1
				visible_in_fog=no
				name=fish{X}{Y}{Y}{X}
			[/item]
		[/case]
		[case]
			value=nw,w,sw
			[item]
				image="units/undead/zombie-fish.png~SCALE({SCALE})~FL()~O(90%)"
				x,y={X},{Y}
				submerge=1
				visible_in_fog=no
				name=fish{X}{Y}{Y}{X}
			[/item]
		[/case]
	[/switch]
	[event]
		name=side {SIDE} turn
		first_time_only=no
		id=fish{X}{Y}{Y}{X}
		[if]
			[have_unit]
				level=0
				[not]
					side={SIDE}
				[/not]
				[filter_location]
					x,y={X},{Y}
					radius=3
				[/filter_location]
			[/have_unit]
			[then]
				[remove_item]
					x,y={X},{Y}
					image=fish{X}{Y}{Y}{X}	
				[/remove_item]
				[unit]
					side={SIDE}
					x,y={X},{Y}
					type=Walking Corpse
					variation=fish
					facing={FACING}
				[/unit]
				[remove_event]
					id=fish{X}{Y}{Y}{X}
				[/remove_event]
				[remove_event]
					id=stomp_fish{X}{Y}{Y}{X}
				[/remove_event]
			[/then]
		[/if]
	[/event]
	[event]
		name=moveto
		id=stomp_fish{X}{Y}{Y}{X}
		[filter]
			x,y={X},{Y}
		[/filter]
		{RANDOM (splat, splorch)}
		[switch]
			variable=random
			[case]
				value=splat
				[floating_text]
					x,y={X},{Y}
					text="<span color='white'>" + _ "splat" + "</span>"
					#splorch thump
				[/floating_text]
				[sound]
					#name=ink-miss.ogg
					name=mud-glob-miss.ogg
				[/sound]
			[/case]
			[case]
				value=splorch
				[floating_text]
					x,y={X},{Y}
					text="<span color='white'>" + _ "splorch" + "</span>"
					#splorch thump
				[/floating_text]
				[sound]
					name=ink-miss.ogg
					#name=mud-glob-miss.ogg
				[/sound]
			[/case]
		[/switch]
		[remove_item]
			x,y={X},{Y}
			image=fish{X}{Y}{Y}{X}	
		[/remove_item]
		[item]
			x,y={X},{Y}
			image=soulless-die-9.png
			name=splat
		[/item]
		[delay]
			time=100
		[/delay]
		[remove_item]
			x,y={X},{Y}
			image=splat
		[/remove_item]
		[remove_event]
			id=fish{X}{Y}{Y}{X}
		[/remove_event]
		[remove_event]
			id=stomp_fish{X}{Y}{Y}{X}
		[/remove_event]
	[/event]

#enddef
Example use:

Code: Select all

{FISH_CARCASS 2 18 33 sw (60,60)}
shevegen
Posts: 607
Joined: June 3rd, 2004, 4:35 pm

Re: Extra feature giveaway.

Post by shevegen »

What is susfishious? A dead fish?

WML is quite hard to read for me. I wonder whether we could also describe
these data structures via a .yml file. I use simple .yml files, e. g. mostly
a simple Hash. This could work at the least for simple objects (I don't suggest
to use .yml for everything, just for simple objects, and following a simple
format, e. g. only one layer of a Hash or one layer of an Array, to limit
complexity.)
User avatar
beetlenaut
Developer
Posts: 2887
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Extra feature giveaway.

Post by beetlenaut »

shevegen wrote: April 3rd, 2026, 7:42 pm What is susfishious? A dead fish?
It's a pun on the word "suspicious," in case you are asking about the language. The WML creates an object that turns into a zombie swimmer if a level-0 unit gets close to it, but disappears with an animation if a higher-level unit lands on it. The object will look something like a floating dead fish.
shevegen wrote: April 3rd, 2026, 7:42 pm I wonder whether we could also describe these data structures via a .yml file.
BfW only supports WML and Lua. A translator could probably be made, but that would take someone a lot more time than it would take for you to learn WML. You can probably learn WML in a weekend. There are lots of resources here for that. The WML Tutorial is the most detailed, and WML Guide is the most fun. The second one is a short campaign (on the 1.18 server) with almost every line of code explained.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
BajMic
Posts: 157
Joined: January 24th, 2023, 1:22 am

Re: Extra feature giveaway.

Post by BajMic »

Haha, thanks for the replies.

I am always trying to come up with extra decisions that the player could make. Lining the shore up with washed-out fish carcass that can come back to life (or be stomped to death) could entice more strategic movement from the player, without necessarily introducing more enemies.

It could also be a nice kiting lesson for the new player, i.e., end the turn out of the fish range but close enough to step on it the next turn.
Post Reply