A problem with storing a diing unit

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
Mathel
Posts: 39
Joined: May 26th, 2017, 1:34 pm

A problem with storing a diing unit

Post by Mathel »

So I am trying to make a unit in a campaign "immortal" by putting it on the recall list whenever it is killed. My attempt is to store it in a "last breath" event and unstore it into the recall list.

The event is as follows:

Code: Select all

	[event]
		name=last breath
		first_time_only=no
		[filter]
			id=Rich-helper
		[/filter]
		[message]
			id=Rich
			message=_ "You are too wounded. Into the turban you go!"
		[/message]
		[message]
			speaker=second_unit
			message=_ "The enemy is being pulled away from me!"
		[/message]
		[message]
			id=Rich-helper
			message=_ "The turban smells of bats! I want to go somewhere else!"
		[/message]
		[message]
			id=Rich
			message=_ "But you do not have a sense of smell."
		[/message]
		[message]
			id=Rich-helper
			message=_ "But what about the ladies?"
		[/message]
		[store_unit]
			[filter]
			id=Rich-helper
			[/filter]
			variable=rich-helper_stockpile
		[/store_unit]
		[unstore_unit]
			variable=rich-helper_stockpile
			x,y=recall,recall
		[/unstore_unit]
	[/event]
The event fires, the talking happens, but then Wesnoth writes in chat "<Invalid WML found> [unstore_unit]: variable 'rich-helper_stockpile' doesn't exist" and the unit is not stored, let alone placed onto the recall list.

Can someone please tell me, what I am doing wrong?
User avatar
Ravana
Forum Moderator
Posts: 3000
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: A problem with storing a diing unit

Post by Ravana »

"-" is invalid in variable name.
Mathel
Posts: 39
Joined: May 26th, 2017, 1:34 pm

Re: A problem with storing a diing unit

Post by Mathel »

Thank you. Replacing "-" with "_" worked.
Post Reply