Store_unit not working in weapon special

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
Cuervo
Posts: 11
Joined: December 4th, 2008, 2:25 am

Store_unit not working in weapon special

Post by Cuervo »

Hello, I am new to the forum and was trying to create an ability that would "burn units". The ability shows up but does nothing. I don't have a lot of WML experience but here is my code:

Code: Select all

#define WEAPON_SPECIAL_BURN ATTACK
	[dummy]
		id=burn
		name= _ "Burn"
		name_inactive= _ "Burn"
		description= _ "When an enemy is burned they will lose hp depending on their fire resistance until they stay in a water or a village for a turn. Burning can't be healed by a healer."
	[/dummy]
[/specials]
[event]
	name=attacker_hits
	first_time_only=no
	[special_filter]
		weapon={ATTACK}
	[/special_filter]
	[store_unit]
		variable=burned
		kill=yes
                [filter_second]
                        description=$second_unit
                [/filter_second]
	[/store_unit]
	[set_variable]
		name=burned.hitpoints
		value=1
	[/set_variable]
	[unstore_unit]
		variable=burned
		text= _ "3"
		red, green, blue=250,0,0
	[/unstore_unit]
[/event]
[+specials]
#enddef
I simplified it down to the level of just reducing the HP to one, I haven't gotten around to implementing any of the resistance checks and damage. I would appreciate any help.
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: Store_unit not working in weapon special

Post by Sapient »

Code: Select all

                [filter_second]
                        description=$second_unit
                [/filter_second]
this is wrong...

I think maybe you meant this:

Code: Select all

                [filter]
                        description=$second_unit.description
                [/filter]
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
Cuervo
Posts: 11
Joined: December 4th, 2008, 2:25 am

Re: Store_unit not working in weapon special

Post by Cuervo »

Thank you for your help Sapient, but it didn't work. :? I even tried taking out all of the filters, still only the description shows up.
If this is unclear I want to have a equivalent of the dehydration in UtBS in a ability. Currently I am trying to just get something that will set the enemies hp to 1. Then I will build up from there.
-Cuervo
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Store_unit not working in weapon special

Post by zookeeper »

You're making the [event] end up inside [attack].
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: Store_unit not working in weapon special

Post by Sapient »

zookeeper is right; you should define the event separately using a different macro name and then include it inside the unit type definition (not inside the attack definition).
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
Cuervo
Posts: 11
Joined: December 4th, 2008, 2:25 am

Re: Store_unit not working in weapon special

Post by Cuervo »

Thanks Zookeeper and Sapient. I did need to move the events outside of the [attack] but I also needed to use second_unit instead of secondary_unit. But now I have another question. :) Is it possible to only have the event trigger after the attack is done and after the attach hits? I couldn't find this. I do have the development version too i that function is only included there. Thanks
-Cuervo
User avatar
krotop
2009 Map Contest Winner
Posts: 433
Joined: June 8th, 2006, 3:05 pm
Location: Bordeaux, France

Re: Store_unit not working in weapon special

Post by krotop »

Probably you would want to make that in 2 steps.
1. use an attack event to categorize a unit as 'affected by burn'
2. use a turn refresh event that does damage if a unit is affected by burn and not in water, or 'uncategorize' units affected by burn but are in water.
Don't trust me, I'm just average player.
***
Game feedback for the Nightmares of Meloen
Art feedback by mystic x the unknown
User avatar
beetlenaut
Developer
Posts: 2825
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Store_unit not working in weapon special

Post by beetlenaut »

Cuervo wrote:Is it possible to only have the event trigger after the attack is done and after the attach hits?

Code: Select all

[event]
    name=attacker_hits
    ...
[event]
    name=attack_end
    ...
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
Cuervo
Posts: 11
Joined: December 4th, 2008, 2:25 am

Re: Store_unit not working in weapon special

Post by Cuervo »

Thanks for your help, I am very appreciative :). I was stuck on that for a log time and it turned out to be somewhat trivial, but I learning. Thanks very much.
-Cuervo
Post Reply