Antar, Son of Rheor [Development Thread]

Discussion and development of scenarios and campaigns for the game.

Moderators: Forum Moderators, Developers

Post Reply
gooby
Posts: 154
Joined: August 8th, 2012, 6:47 am

Re: Antar, Son of Rheor [Singleplayer Campaign Feedback Thr

Post by gooby »

Does anyone find it strange that Grimbold—a Guardsman—says "These wretched skeletons will feel the wrath of my axe!"?
User avatar
Adamant14
Posts: 906
Joined: April 24th, 2010, 1:14 pm

Re: Antar, Son of Rheor [Singleplayer Campaign Feedback Thr

Post by Adamant14 »

@gooby:

Strange that I never noticed this.
Will be fixed with the next update.
Thank you. :)
Author of Antar, Son of Rheor ( SP Campaign) | Development Thread + Feedback Thread + Replays of ASoR
gfgtdf
General Code Maintainer
Posts: 1343
Joined: February 10th, 2013, 2:25 pm

Re: Antar, Son of Rheor [Singleplayer Campaign Feedback Thr

Post by gfgtdf »

hey i just played the first scenario (on 11.2) and i liked it.
But some parts bother me:
1) in the wmlcode there is some code about new units abilites:

Code: Select all


				[unit]
					x,y=1,25
					type=Lowitz_0
					id=Lowitz
					name= _ "Lowitz"
					side=1
					profile="data/campaigns/Liberty/images/portraits/harper.png"
					facing=se
					[modifications]
						{TRAIT_LOYAL}
						{TRAIT_RESILIENT}
					[/modifications]
					[modifications]
						[object]
							silent=yes
							[effect]
								apply_to=attack
								name=club
								[specials]
									{WEAPON_SPECIAL_BACKSTAB}
								[specials]
							[/effect]
						[/object]
					[/modifications]
					{IS_LOYAL}
				[/unit]
				[unit]
					x,y=2,25
					type=Segurd_0
					id=Segurd
					name= _ "Segurd"
					side=1
					profile="portraits/Segurd.png"
					facing=se
					[modifications]
						{TRAIT_LOYAL}
						{TRAIT_STRONG}
					[/modifications]
					[modifications]
						[object]
							silent=yes
							[effect]
								apply_to=new_ability
								[abilities]
									{ABILITY_STEADFAST}
								[/abilities]
							[/effect]
						[/object]
					[/modifications]
					{IS_LOYAL}
				[/unit]
but it doesnt work like that,becue the second [modification] tag will be ignored, and you have to use [set_specials] if you want to add a weapn special. better use:

Code: Select all


				[unit]
					x,y=1,25
					type=Lowitz_0
					id=Lowitz
					name= _ "Lowitz"
					side=1
					profile="data/campaigns/Liberty/images/portraits/harper.png"
					facing=se
					[modifications]
						{TRAIT_LOYAL}
						{TRAIT_RESILIENT}
					[/modifications]
					[+modifications]
						[object]
							silent=yes
							[effect]
								apply_to=attack
								name=club
								[set_specials]
									mode=append
									{WEAPON_SPECIAL_BACKSTAB}
								[/set_specials]
							[/effect]
						[/object]
					[/modifications]
					{IS_LOYAL}
				[/unit]
				[unit]
					x,y=2,25
					type=Segurd_0
					id=Segurd
					name= _ "Segurd"
					side=1
					profile="portraits/Segurd.png"
					facing=se
					[modifications]
						{TRAIT_LOYAL}
						{TRAIT_STRONG}
					[/modifications]
					[+modifications]
						[object]
							silent=yes
							[effect]
								apply_to=new_ability
								[abilities]
									{ABILITY_STEADFAST}
								[/abilities]
							[/effect]
						[/object]
					[/modifications]
					{IS_LOYAL}
				[/unit]
2) Antars "hit and run" ability dissalows undo his moves, becuase of an event wich handles his movetos, i would be happy if you could so somthing against that.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
User avatar
Adamant14
Posts: 906
Joined: April 24th, 2010, 1:14 pm

Re: Antar, Son of Rheor [Singleplayer Campaign Feedback Thr

Post by Adamant14 »

gfgtdf wrote:hey i just played the first scenario (on 11.2) and i liked it.
Thank you. Glad you like it. :)
gfgtdf wrote: But some parts bother me:
1) in the wmlcode there is some code units abilites:
but it doesnt work like that,becue the second [modification] tag will be ignored, and you have to use [set_specials] if you want to add an ability.
Oh, thank you for pointing me this issue.
And thank you for giving me a solution. :)
gfgtdf wrote:2) Antars "hit and run" ability dissalows undo his moves, becuase of an event wich handles his movetos, i would be happy if you could so somthing against that.
I know about that problem, but I have no solution.
Maybe someone here can tell me how to fix it.
Here is the code:

Code: Select all


		### Code original written by TheBladeRoden

#define WEAPON_SPECIAL_HIT_AND_RUN
	[dummy]
		id=hit and run
		name= _ "hit and run"
		description= _ "Hit and Run: Antar is light on his feet, this allows him to step back after attacking."
	[/dummy]
#enddef


#define HIT_AND_RUN_EVENTS
	[event]
		name=side turn
		first_time_only=no
		[store_unit]
			[filter]
				side=$side_number
				[filter_wml]
					[attack]
						[specials]
							[dummy]
								id=hit and run
							[/dummy]
						[/specials]
					[/attack]
				[/filter_wml]
			[/filter]
			variable=stored_hitandrun_unit
		[/store_unit]
		{FOREACH stored_hitandrun_unit i}
		[set_variable]
			name=stored_hitandrun_unit[$i].variables.saved_moves
			value=$stored_hitandrun_unit[$i].max_moves
		[/set_variable]
		[unstore_unit]
			variable=stored_hitandrun_unit
			find_vacant=no
		[/unstore_unit]
		{CLEAR_VARIABLE stored_hitandrun_unit}
		{NEXT i}
	[/event]

	[event]
		name=moveto
		first_time_only=no
		[filter]
			[filter_wml]
				[attack]
					[specials]
						[dummy]
							id=hit and run
						[/dummy]
					[/specials]
				[/attack]
			[/filter_wml]
		[/filter]
		[store_unit]
			[filter]
				x,y=$x1,$y1
			[/filter]
			kill=no
			variable=stored_hitandrun_unit
		[/store_unit]
		[set_variable]
			name=stored_hitandrun_unit.variables.saved_moves
			value=$unit.moves
		[/set_variable]
		[unstore_unit]
			variable=stored_hitandrun_unit
		[/unstore_unit]
		{CLEAR_VARIABLE stored_hitandrun_unit}
	[/event]

	[event]
		name=attack end
		first_time_only=no
		[filter_attack]
			special=hit and run
		[/filter_attack]
		[clear_variable]
			name=adding_moves_back
		[/clear_variable]
		[store_unit]
			variable=adding_moves_back
			[filter]
				x,y=$x1,$y1
			[/filter]
		[/store_unit]
		[set_variable]
			name=adding_moves_back.moves
			value=$unit.variables.saved_moves
		[/set_variable]
		[set_variable]
			name=adding_moves_back_minus_one
			value=$unit.variables.saved_moves
		[/set_variable]
		{ASoR_REDRAW}
		[if]                                                 ### the unit should have in any case three (or more) movepoints left after an offensive attack
			[variable]
				name=adding_moves_back_minus_one
				greater_than=3
			[/variable]
			[then]
				{VARIABLE_OP adding_moves_back_minus_one sub 1}
			[/then]
			[else]
				[if]
					[variable]
						name=adding_moves_back_minus_one
						equals=3
					[/variable]
					[then]
						### do nothing
					[/then]
					[else]
						[if]
							[variable]
								name=adding_moves_back_minus_one
								equals=2
							[/variable]
							[then]
								{VARIABLE_OP adding_moves_back_minus_one add 1}
							[/then]
							[else]
								[if]
									[variable]
										name=adding_moves_back_minus_one
										equals=1
									[/variable]
									[then]
										{VARIABLE_OP adding_moves_back_minus_one add 2}
									[/then]
									[else]
										[if]
											[variable]
												name=adding_moves_back_minus_one
												equals=0
											[/variable]
											[then]
												{VARIABLE_OP adding_moves_back_minus_one add 3}
											[/then]
										[/if]
									[/else]
								[/if]
							[/else]
						[/if]
					[/else]
				[/if]
			[/else]
		[/if]
		{ASoR_REDRAW}
		[unstore_unit]
			variable=adding_moves_back
		[/unstore_unit]
		{MODIFY_UNIT x,y=$x1,$y1 moves $adding_moves_back_minus_one}
		{CLEAR_VARIABLE adding_moves_back_minus_one}
		{CLEAR_VARIABLE adding_moves_back}
	[/event]
#enddef
EDIT: In scenario 07 (Revenge) I have a similar problem. I guess it has something to do with the fire spread code.


Thanks for playing. :)
Author of Antar, Son of Rheor ( SP Campaign) | Development Thread + Feedback Thread + Replays of ASoR
gfgtdf
General Code Maintainer
Posts: 1343
Joined: February 10th, 2013, 2:25 pm

Re: Antar, Son of Rheor [Singleplayer Campaign Feedback Thr

Post by gfgtdf »

well here http://wiki.wesnoth.org/UnitTypeWML#Attacks they say something about an "movement_used" key on attacks, i have never used it but it may work.

to have teh same effect as the former ability, you have to set the moves to 3 if they are lower than 3. in the attack_end event
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
User avatar
Adamant14
Posts: 906
Joined: April 24th, 2010, 1:14 pm

Re: Antar, Son of Rheor [Singleplayer Campaign Feedback Thr

Post by Adamant14 »

gfgtdf wrote:well here http://wiki.wesnoth.org/UnitTypeWML#Attacks they say something about an "movement_used" key on attacks, i have never used it but it may work.

to have teh same effect as the former ability, you have to set the moves to 3 if they are lower than 3. in the attack_end event
You mean I should use only the attack_end [event] instead of the Hit&Run ability?
Author of Antar, Son of Rheor ( SP Campaign) | Development Thread + Feedback Thread + Replays of ASoR
gfgtdf
General Code Maintainer
Posts: 1343
Joined: February 10th, 2013, 2:25 pm

Re: Antar, Son of Rheor [Singleplayer Campaign Feedback Thr

Post by gfgtdf »

well currently you store the moved a unit has left (in the moveto event) to restore it later (in the attack_end event), becuase after a unit attacks the movement is set to 0.

but according to that page you can just add "movement_used=0" to the attack, to avoid movement points being taken by attacking.

but your code also checks weather the unit has less than 3 moves left and sets the moves to 3 in that case.
so if you want that behavior, you still have to do that manualy in the attck_end event.

so my plan was to add movement_used=0 to antar melee attack, the hit and run abiltiy and this event:
(note that i havent tested this events yet)

Code: Select all

[event]
	name=attack end
	first_time_only=no
	[filter_attack]
		special=hit and run
	[/filter_attack]
	[lua]
	code = <<
		-- i think this is easier than wml.
		local context = wesnoth.current.event_context
		local unit = wesnoth.get_unit(context.x1, context.y1)
		local max = function(a, b) return (a > b) and a or b end
		unit.moves = max(unit.moves, 3)
	>>
	[lua]
[/event]
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
User avatar
Adamant14
Posts: 906
Joined: April 24th, 2010, 1:14 pm

Re: Antar, Son of Rheor [Singleplayer Campaign Feedback Thr

Post by Adamant14 »

Great, I will give it a try.
Only thing:
I'm not sure if I understand you right.
Your code sets the remaining moves to three in any case, right? :hmm:
But my intention was to set them at least to three (three ore more than three).
Sorry, but I don't understand what this lua code exactly does.
Author of Antar, Son of Rheor ( SP Campaign) | Development Thread + Feedback Thread + Replays of ASoR
gfgtdf
General Code Maintainer
Posts: 1343
Joined: February 10th, 2013, 2:25 pm

Re: Antar, Son of Rheor [Singleplayer Campaign Feedback Thr

Post by gfgtdf »

"max(unit.moves,3)" means "maximum of {unit.moves,3}" so unit.moves or 3 depending on what is higher.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
User avatar
Adamant14
Posts: 906
Joined: April 24th, 2010, 1:14 pm

Re: Antar, Son of Rheor [Singleplayer Campaign Feedback Thr

Post by Adamant14 »

i tested your code, and it works perfectly.
Thank you. :)
Only thing is that this part seems not to work.
gfgtdf wrote:"max(unit.moves,3)" means "maximum of {unit.moves,3}" so unit.moves or 3 depending on what is higher.
The result is always three,in any case.

EDIT: May it be that unit.moves is zero in this case, because it has already attacked?
Author of Antar, Son of Rheor ( SP Campaign) | Development Thread + Feedback Thread + Replays of ASoR
gfgtdf
General Code Maintainer
Posts: 1343
Joined: February 10th, 2013, 2:25 pm

Re: Antar, Son of Rheor [Singleplayer Campaign Feedback Thr

Post by gfgtdf »

maybe you forgot adding "movement_used=0" on the antar file?

Code: Select all


	[attack]
		name=saber
		movement_used=0

		[specials]
			{WEAPON_SPECIAL_HIT_AND_RUN}
		[/specials]
	[/attack]


EDIT: in the sceond scenario when you meet GELPHRAD there is the same issue as in the first chapter with the double [modifications] tag
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
User avatar
Adamant14
Posts: 906
Joined: April 24th, 2010, 1:14 pm

Re: Antar, Son of Rheor [Singleplayer Campaign Feedback Thr

Post by Adamant14 »

Sorry, my fault. :oops:

Thank you very much for the code.
It works perfect now.
And it is so much shorter than the code I used before. :)

If you reach scenario 07 Revenge, there is also some code that prevents to undo a move.
I know this issue since a long time, but I have no idea what causes it, or how to fix it. :oops:
Maybe you like to help me again to fix it. :P
Author of Antar, Son of Rheor ( SP Campaign) | Development Thread + Feedback Thread + Replays of ASoR
User avatar
Adamant14
Posts: 906
Joined: April 24th, 2010, 1:14 pm

Re: Antar, Son of Rheor [Singleplayer Campaign Feedback Thr

Post by Adamant14 »

gfgtdf wrote:EDIT: in the sceond scenario when you meet GELPHRAD there is the same issue as in the first chapter with the double [modifications] tag
Fixed.

Thank you. :)
Author of Antar, Son of Rheor ( SP Campaign) | Development Thread + Feedback Thread + Replays of ASoR
gfgtdf
General Code Maintainer
Posts: 1343
Joined: February 10th, 2013, 2:25 pm

Re: Antar, Son of Rheor [Singleplayer Campaign Feedback Thr

Post by gfgtdf »

i took a look at chpter 7 and i found this:

Code: Select all

[event]
		name=moveto 
		first_time_only=no

		[if]
			[not]
				[have_unit]
					side=1,3
					{UNSAVE_SIDE_OF_THE_RIVER}
				[/have_unit]
			[/not]
			[and]
				[variable]
					name=message_already_spoken
					numerical_equals=0
				[/variable]
			[/and]
			[then]
				[message]
					speaker="ElorialDin"
					message= _ "All of us are on the other side of the river!"
				[/message]
				[message]
					speaker="ElorialDin"
					message= _ "Now to you, Orc."
				[/message]
				{VARIABLE_OP message_already_spoken add 1}
			[/then]
		[/if]
	[/event]
in this event you use [if] instead of a filter so it is aways triggered, (the if is alwasy ckecked inside the events while filters are always checkted before event in called.)

using [filter_condition] instead of "if" seems like a good idea to me.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
User avatar
Adamant14
Posts: 906
Joined: April 24th, 2010, 1:14 pm

Re: Antar, Son of Rheor [Singleplayer Campaign Feedback Thr

Post by Adamant14 »

gfgtdf wrote:i took a look at chpter 7 and i found this:
...
in this event you use [if] instead of a filter so it is aways triggered, (the if is alwasy ckecked inside the events while filters are always checkted before event in called.)

using [filter_condition] instead of "if" seems like a good idea to me.
Indeed, this did fix the issue.
You found the problem in a bunch of code, in a very short time. :o
Wow, I am very very impressed.
Thank you very much. :D
Author of Antar, Son of Rheor ( SP Campaign) | Development Thread + Feedback Thread + Replays of ASoR
Post Reply