Gloria Victis code issues

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.
User avatar
Neuromancer
Posts: 204
Joined: September 10th, 2010, 9:49 pm

Gloria Victis code issues

Post by Neuromancer »

I have some questions regarding Gloria Victis campaign. It is available on the 1.9 server.

1. In the intro scenario, there are two messages which dont show up and I have no clue why.
How to reproduce: Just start the campaign and in the first scenario in the first option dialog leave either the poacher or the bowman. In the second option dialog choose "Leave the Dark Adept". Immediately after this two messages should show, but they dont. I checked spelling. Messages which dont show start at line 819 in the Intro.cfg file.

2. Hazaels leadership doesnt work. Hazael is AMLA unit, his code is in units/Entrepreneur.cfg file. Im using variation and advancement tags:

Code: Select all

	[variation]
        variation_name=level_2_entrepreneur
        inherit=yes
        level=2
    [/variation]

Code: Select all

	[advancement]
		description= _ "a better leader"
		id=leadership2
		max_times=1
		strict_amla=no
		image=attacks/fist-human.png
		[effect]
			  apply_to=remove_ability
			  [abilities]
				id=leadership
			  [/abilities]
		[/effect]
		[effect]
			apply_to=new_ability
			[abilities]
				{ABILITY_LEADERSHIP_LEVEL_2}
			[/abilities]
		[/effect]
		[effect]
			apply_to=hitpoints
			increase_total=5%
			heal_full=yes
		[/effect]
		[effect]
			apply_to=max_experience
			increase=10%
		[/effect]
		[effect]
            apply_to=variation
            name=level_2_entrepreneur
        [/effect]
	[/advancement]
Thank you for your answers.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Gloria Victis code issues

Post by zookeeper »

Neuromancer wrote:1. In the intro scenario, there are two messages which dont show up and I have no clue why.
How to reproduce: Just start the campaign and in the first scenario in the first option dialog leave either the poacher or the bowman. In the second option dialog choose "Leave the Dark Adept". Immediately after this two messages should show, but they dont. I checked spelling. Messages which dont show start at line 819 in the Intro.cfg file.
They're outside the [command] tag.
User avatar
Neuromancer
Posts: 204
Joined: September 10th, 2010, 9:49 pm

Re: Gloria Victis code issues

Post by Neuromancer »

Both issues solved. Thank you zookeeper and Quman.
Another problem: In scenario 1 (named On We March) in the opening conversation console gives "Invalid wml: [have_unit] not supported" and the message which is supposed to show doesnt come in.
How to reproduce: Leave Aramis, Bane, Luciana and Pelduras in the intro scenario, and move to the bridge mark in the world map. Message which should show up is in line 502 in config file.
User avatar
Neuromancer
Posts: 204
Joined: September 10th, 2010, 9:49 pm

Re: Gloria Victis code issues

Post by Neuromancer »

I want to check whether side 1 owns villages in given coordinates at the end of their turn, but this event keeps firing regardless of the actual ownership of the villages. Any suggestions?

Code: Select all

[event]
	name=side 1 turn end
	first_time_only=no
	[if]
		[filter]
			[filter_location]
				x,y=47-53,9-13
				terrain=*^V*
				owner_side=1
			[/filter_location]
		[/filter]
		[variable]
			name=villagesowned
			equals=0
		[/variable]
		[then]
			[message]
				id=Hazael
				message= _ "ok, we have secured the vills for now. only one turn to go."
			[/message]
			{VARIABLE villagesowned 1}
		[/then]
	[/if]
[/event]
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Gloria Victis code issues

Post by zookeeper »

[have_location], not [filter] [filter_location].
User avatar
Neuromancer
Posts: 204
Joined: September 10th, 2010, 9:49 pm

Re: Gloria Victis code issues

Post by Neuromancer »

thanks
User avatar
Neuromancer
Posts: 204
Joined: September 10th, 2010, 9:49 pm

Re: Gloria Victis code issues

Post by Neuromancer »

In swamp scenario Im deploying several units via {GENERIC_UNIT} macro. Example:

Code: Select all

{GENERIC_UNIT 4 (Saurian Oracle) 24 14}
Some of these units then get location goals:

Code: Select all

{MODIFY_UNIT id=patroller1,patroller2,patroller3 goto_x 39}
{MODIFY_UNIT id=patroller1,patroller2,patroller3 goto_y 23}
Problem is, these deployed units dont move. If some enemy is near them, they will attack him, if not, they just stay, doing nothing. I inspected them ingame, some of them had goto_x and goto_y 0 and 0, other had 39,23 (or other goto location I issued them), but they didnt move anyways. Well, I can include source code, but the whole thing has 1840 lines, so it wont be very useful. Any general suggestion about what to beware when using goto orders?
mattsc
Inactive Developer
Posts: 1217
Joined: October 13th, 2010, 6:14 pm

Re: Gloria Victis code issues

Post by mattsc »

I don't see anything wrong with the code you posted, maybe the id's don't get assigned correctly or something. You can circumvent potential problems of that sort by using either

Code: Select all

{GENERIC_UNIT 4 (Saurian Oracle) 24 14}
[+unit]
    id=patroller1
    goto_x,goto_y=39,23
[/unit]
or

Code: Select all

{UNIT 4 (Saurian Oracle) 24 14 id,goto_x,goto_y=patroller1,39,23}
Does that work? I've used goto orders quite a bit and not run into problems. Did you check that the units have moves left? Also, did you try going on to the next turn and see if they move then? Maybe you issue the goto order at some point after the AI takes them into account.
User avatar
Neuromancer
Posts: 204
Joined: September 10th, 2010, 9:49 pm

Re: Gloria Victis code issues

Post by Neuromancer »

Phew, Im desperate. IDs are ok, units have full moves, they dont move even on next turn.
There is campaign file as attachment. If anyone would bother to look at it, Id be very thankful. Just unpack it into userdata, start it on normal difficulty, pick whatever recruits you like, and on the world map step on the hex labeled "the swamp - test". Then just move some unit on 18,22 to fire spawning event and watch those critters not move :/
Edit: Yeah, said event starts at line 450.
Attachments
Gloria_Victis.rar
(612.1 KiB) Downloaded 198 times
Max
Posts: 1449
Joined: April 13th, 2008, 12:41 am

Re: Gloria Victis code issues

Post by Max »

just a guess - try to remove the [ai] tag from side 3, maybe this causes a conflict somehow?
mattsc
Inactive Developer
Posts: 1217
Joined: October 13th, 2010, 6:14 pm

Re: Gloria Victis code issues

Post by mattsc »

Yep, that's the problem, although you don't need to remove the AI tag. The syntax is wrong. [avoid] takes a SLF, but without [filter_location]. The way you have coded it, it avoids all locations, meaning no unit will ever move. Delete the [filter_location] tags from [avoid] and it works (I tried it - using hard and joining the saurians).
User avatar
Neuromancer
Posts: 204
Joined: September 10th, 2010, 9:49 pm

Re: Gloria Victis code issues

Post by Neuromancer »

Thank you guys :)
User avatar
Neuromancer
Posts: 204
Joined: September 10th, 2010, 9:49 pm

Re: Gloria Victis code issues

Post by Neuromancer »

Well, dont know whether to post this issue there, or there, but I assume it is caused by some stupidly-coded event rather then by engine bug.
The thing is, AI is slow in Swamp scenario. It takes approximately 15 seconds to perform its moves at the start of the scenario and the count is increasing with every turn I make. This isnt happening in other Gloria Victis scenarios. During the AI turn CPU usage jumps up, but during human turn all is smooth (so it isnt RAM issue I guess).
I run Wesnoth 1.9.6 (although the same happens in 1.9.9 too) on Windows XP, 2GHz CPU, 2GB RAM. Please unpack the .rar into userdata, start the campaign, pick whatever recruits you like, and on the world map step on the hex labeled "the swamp - test". You can move some unit on 18,22 to fire spawning event and slow the AI even more.

Possible causes?
There are approximately 15 custom variables active in that scenario.
There are 6 sides, several avoid_locations, some AI goals issued, some units have custom goto orders.

Thanks in advance, you are really helping me in this project.
Attachments
Gloria_Victis.zip
zip for linux and mac users
(625.98 KiB) Downloaded 219 times
Gloria_Victis.rar
(611.57 KiB) Downloaded 199 times
User avatar
Neuromancer
Posts: 204
Joined: September 10th, 2010, 9:49 pm

Re: Gloria Victis code issues

Post by Neuromancer »

The issue with slowness dissapeared after I deleted all [avoid]s from the scenario file.

Now there is another issue, regarding roster code. Recalled units which died in previous scenario are unable to attack on turn 1 in next scenario. I used restore_attacks in [heal_unit].

Code which stores killed mercenaries:

Code: Select all

[event]
	name=die
	first_time_only=no
	
	[filter]
		side=4
	[/filter]
	
	[store_unit]
		[filter]
			id=$unit.id
		[/filter]
		variable=roster
		mode=append
	[/store_unit]
[/event]
Code which heals the mercenaries and unstores them into recall list

Code: Select all

{FOREACH roster i}
	[heal_unit]
		[filter]
			id=$unit.id
		[/filter]
		restore_attacks=yes
	[/heal_unit]
	[unstore_unit]
		variable=roster[$i]
		x,y=recall,recall
	[/unstore_unit]
	{NEXT i}
	[clear_variable]
		name=roster
	[/clear_variable]
Ceres
Forum Regular
Posts: 620
Joined: September 18th, 2010, 7:56 pm
Location: Germany

Re: Gloria Victis code issues

Post by Ceres »

Code: Select all

{FOREACH roster i}
   [heal_unit]
      [filter]
         id=$unit.id
      [/filter]
      restore_attacks=yes
   [/heal_unit]
What about replacing $unit.id with $roster[$i].id?
Post Reply