Issues with [object] duration=turn_end

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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
User avatar
LordAwsomeness
Posts: 96
Joined: August 12th, 2013, 2:20 pm
Location: U.S.A.

Issues with [object] duration=turn_end

Post by LordAwsomeness » October 13th, 2019, 5:09 pm

having a little issue with my coding here. Im sure the coding is working as intended but I need a solution. so essentially I have created a macro that allows a player to cast a spell on themselves or an ally. for the player who casts it on themself, the effect continues until the beginning of their next turn. When you cast it on an ally it would not make very much sense for the effect to only last until the beginning of their next turn in certain scenarios.
Example: player 1 casts the resistance spell on ally 2. the spell ends before ally 2 even gets any of the spell's benefits. I am using the turn_end duration in the sytax [object] to determine how long the spell lasts as it is quite straightforward. But in my case, player 1 is casting on player 2 so instead of the duration lasting until the end of the turn for the unit who received the spell, it only lasts until the end of the turn of the unit that casted the spell.
is there a work around that would potentially fix this?

Here is the code below that I am currently using:

Code: Select all

#define LA_CASTING_MACROS_RUNIC_AURA_END BONUS VAR
	{LA_OPTION_CASTABLE "Runic Aura" "icons/aura_armor.png" "Gives the unit this is cast on bonus {BONUS}% resistances until the start of their next turn." runic.aura{VAR} (
	[object]
		silent=yes
		duration=turn_end
		[filter]
			x=$x1
			y=$y1
		[/filter]
		[effect]
			apply_to=resistance
			[resistance]
				arcane=-{BONUS}
				blade=-{BONUS}
				cold=-{BONUS}
				fire=-{BONUS}
				impact=-{BONUS}
				pierce=-{BONUS}
			[/resistance]
		[/effect]
	[/object]

[unstore_unit]
variable=recipient
text="Runic Aura"
red,green,blue=255,255,255
[/unstore_unit])}
#enddef
- Been playing Wesnoth since 2004 and the 1.0.x versions.
- Creator of Undead Invasion MP Scenario Pack.
- Creator of Valeria MP Adventure

User avatar
LordAwsomeness
Posts: 96
Joined: August 12th, 2013, 2:20 pm
Location: U.S.A.

Re: Issues with [object] duration=turn_end

Post by LordAwsomeness » October 13th, 2019, 5:18 pm

Actually I figured out the issue was that I was unstoring the unit after I applied the object... sorry!
- Been playing Wesnoth since 2004 and the 1.0.x versions.
- Creator of Undead Invasion MP Scenario Pack.
- Creator of Valeria MP Adventure

Post Reply