Bitrons WML Questions

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.
User avatar
Ravana
Moderator
Posts: 1792
Joined: January 29th, 2012, 12:49 am
Location: Estonia

Re: [Ability] - Inspiration

Post by Ravana » January 31st, 2016, 7:27 pm

With first_time_only=no you might also want to add some limitation how it is allowed to trigger.

User avatar
Bitron
Moderator
Posts: 437
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: [Ability] - Inspiration

Post by Bitron » January 31st, 2016, 7:41 pm

It is the leaders goal in the scenario. I just wanted that one needs more than one character in the specific area to win the game. One also have to free another character, before one can left the game winning, thats why the event needs to be able to trigger more than once, in case the character isn't free by then.

however, thants a lot to both of you (:

User avatar
Bitron
Moderator
Posts: 437
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: Bitrons WML Questions

Post by Bitron » December 30th, 2016, 11:09 pm

Hey there!

Is there a possibility to get new sides into the game, but later? like in turn 7-8?

Samonella
Posts: 327
Joined: January 8th, 2016, 5:41 pm
Location: USA

Re: Bitrons WML Questions

Post by Samonella » December 31st, 2016, 6:14 am

Bitron wrote:Is there a possibility to get new sides into the game, but later? like in turn 7-8?
I don't think so, but you could always have a side with no units and hidden=yes. Then you could use [modify_side] to change "hidden," making the side seem to appear.
The last few months have been nothing but one big, painful reminder that TIMTLTW.

Creator of Armory Mod, The Rising Underworld, and Vengeance of a Drake: an RPG

User avatar
Bitron
Moderator
Posts: 437
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: Bitrons WML Questions

Post by Bitron » December 31st, 2016, 12:53 pm

I don't think so, but you could always have a side with no units and hidden=yes. Then you could use [modify_side] to change "hidden," making the side seem to appear.
I just set the victory_when_enemies_defeated to no and stored them and unstore in turn 5 again. It's a "moveto" scenario so that worked fine. (:

Thanks anyways, Samonella!

But acutally i have another question.. how exactly works the ca_score?

EDIT:
And one more about vision.

Code: Select all

[event]
    name=moveto
    first_time_only=yes
    [filter]
        side=2
        [filter_vision]
            side=1 
        [/filter_vision]
    [/filter]
    [message]
        speaker=unit
        message="I am your enemy. I know that you can see me here."
    [/message]
[/event]
This just work fine, but when i try to switch the sides, so that it triggers when side 1 moves into the vision of side 2, it does not work at all
Code is like this:

Code: Select all

[event]
	 		name=moveto
	 		first_time_only=yes
	 		[filter]
	 			side=1
	 			[filter_vision]
	 				side=2
	 			[/filter_vision]
	 		[/filter]
	 		[message]
	 			speaker=second_unit
	 			message= _ "There they are!"
	 		[/message]
	 		[endlevel]
	 			result=defeat
	 		[/endlevel]
	 	[/event]
why?
It triggers everytime I move a side 1 unit, wether its in vision of side 2 or not.

Samonella
Posts: 327
Joined: January 8th, 2016, 5:41 pm
Location: USA

Re: Bitrons WML Questions

Post by Samonella » December 31st, 2016, 5:38 pm

Bitron wrote:But acutally i have another question.. how exactly works the ca_score?
You mean the ca_score from micro_ais? I don't know the details, but basically it determines how important the action described by the micro_ai is. The AI is made up of a bunch of "candid actions" or "ca"s, which are things like moving the leader towards a keep, moving units towards uncaptured villages, or attacking enemy units. Each action has a ca_score, and the ai will execute actions with a higher ca_score first. This way, the ai will always do certain things before others, such as recruiting before moving the leader away to attack. Now when you make a micro_ai, you are adding a candid action to the ai's list, so the ca_score determines when that action is executed relative to the other candid actions. For example:
The micro_ai wiki wrote:By setting it, for example, to 170,000, we can have it be executed after the default recruitment CA, but before most of the other default CAs.
(Of course, I'm far from an ai expert. If somebody else says something else, trust them not me.)

Bitron wrote:And one more about vision.
This just work fine, but when i try to switch the sides, so that it triggers when side 1 moves into the vision of side 2, it does not work at all
why?
It triggers everytime I move a side 1 unit, wether its in vision of side 2 or not.
My guess is that side 2 doesn't have fog or shroud turned on?
The last few months have been nothing but one big, painful reminder that TIMTLTW.

Creator of Armory Mod, The Rising Underworld, and Vengeance of a Drake: an RPG

mattsc
Posts: 1049
Joined: October 13th, 2010, 6:14 pm
Location: Wandering, mostly aimlessly

Re: Bitrons WML Questions

Post by mattsc » December 31st, 2016, 6:56 pm

Samonella wrote:(Of course, I'm far from an ai expert. If somebody else says something else, trust them not me.)
You got it right.
Except for one little detail: I like "candid actions", but unfortunately they are simply named "candidate actions" ;)

The only thing I would add is the link to the wiki page explaining what the default AI CAs and their scores are: RCA AI candidate actions

User avatar
Bitron
Moderator
Posts: 437
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: Bitrons WML Questions

Post by Bitron » May 29th, 2017, 11:37 am

Hey there. It is me again, with a question. I was looking for ways to tweak the AI in favour of balancing different difficulties and I've found this piece of code

Code: Select all

        [ai]
            [aspect]
                id=recruitment_instructions
                [facet]
                    [value]
                        [recruit]
                            type=2
#ifdef EASY
                            number=0
#endif
#ifdef NORMAL
                            number=1
#endif
#ifdef HARD
                            number=2
#endif
                            total=yes
                            importance=1
                        [/recruit]
                        [recruit]
                            type=1
                            importance=0
                        [/recruit]
                    [/value]
                [/facet]
            [/aspect]
        [/ai]
I recken this does mean that the ai recruits just a specific number of higher leveled units, but I don't really see how exactly it is done here. I haven't found it in the WML docs yet so I am asking right here now.

EDIT: Nevermind, if found it here.

User avatar
Bitron
Moderator
Posts: 437
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: Bitrons WML Questions

Post by Bitron » April 21st, 2018, 6:01 pm

Hello guys! I'm here with a new problem. I have piece of wml code here which causes game crashes, and I don't know why. Here is the code:

Code: Select all

#define MOVEMENT_STONE_SLEEP
	[event]
		name=prerecruit
		first_time_only=no
		
		[filter]
			type_adv_tree=Vampire Deformity
		[/filter]
		
		[store_time_of_day]
		[/store_time_of_day]
		
		[if]
			[variable]
				name=time_of_day.lawful_bonus
				less_than_equal_to=0
			[/variable]
			[then]
				[unpetrify]
					type_adv_tree=Vampire Deformity
					side=$side_number
				[/unpetrify]
			[/then]
			[else]
				[petrify]
					type_adv_tree=Vampire Deformity
					side=$side_number
					[not]
						[filter_location]
							area=underground
						[/filter_location]
					[/not]
				[/petrify]
			[/else]
		[/if]
	[/event]
	
	[event]
		name=turn refresh
		first_time_only=no
		
		[store_time_of_day]
		[/store_time_of_day]
		
		[if]
			[variable]
				name=time_of_day.lawful_bonus
				less_than_equal_to=0
			[/variable]
			[then]
				[unpetrify]
					type_adv_tree=Vampire Deformity
					side=$side_number
				[/unpetrify]
			[/then]
			[else]
				[heal_unit]
					[filter]
						type_adv_tree=Vampire Deformity
						side=$side_number
						[not]
							[filter_location]
								area=underground
							[/filter_location]
						[/not]
					[/filter]
					amount=10
					animate=yes
					restore_statuses=yes
				[/heal_unit]
				[petrify]
					type_adv_tree=Vampire Deformity
					side=$side_number
					[not]
						[filter_location]
							area=underground
						[/filter_location]
					[/not]
				[/petrify]
			[/else]
		[/if]
	[/event]
#enddef
It has something to do with the filter_location, because when I delete the three area=underground filters, then it works fine. Otherwise, in Mutliplayer game, when playing with the Vampires (the code is for an ability of a vampire unit) the game just crashes right before the vampire's second turn. Maybe one of you knows why?

gfgtdf
Developer
Posts: 1005
Joined: February 10th, 2013, 2:25 pm

Re: Bitrons WML Questions

Post by gfgtdf » April 21st, 2018, 6:15 pm

how exactly does it crash? most of the times it gives you a message about the error, did you check your stderr.txt file ?
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
Bitron
Moderator
Posts: 437
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: Bitrons WML Questions

Post by Bitron » April 21st, 2018, 6:19 pm

Just that.
error.png
error.png (13.87 KiB) Viewed 331 times
(Wesnoth Game Client does not work anymore)

gfgtdf
Developer
Posts: 1005
Joined: February 10th, 2013, 2:25 pm

Re: Bitrons WML Questions

Post by gfgtdf » April 21st, 2018, 6:24 pm

hmm ok, so in your map, you you have a time area with the id "underground " defined?

please test the follwing things:
1) add a [time_area] to your scenairo wih id ="time_area"
2) add a [time_area] to your scenairo wih id ="underground "
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
Bitron
Moderator
Posts: 437
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: Bitrons WML Questions

Post by Bitron » April 21st, 2018, 6:33 pm

Oh. I guess that means when I filter for a time_area, then I need to provide it in the szenario?
I played on normal Mutliplayer Maps, that's why there is no such area.

gfgtdf
Developer
Posts: 1005
Joined: February 10th, 2013, 2:25 pm

Re: Bitrons WML Questions

Post by gfgtdf » April 21st, 2018, 6:37 pm

Bitron wrote:
April 21st, 2018, 6:33 pm
Oh. I guess that means when I filter for a time_area, then I need to provide it in the szenario?
I played on normal Mutliplayer Maps, that's why there is no such area.
Well clearly it shouldn't crash in that case, we likely be able to fix this before 1.14
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.

gfgtdf
Developer
Posts: 1005
Joined: February 10th, 2013, 2:25 pm

Re: Bitrons WML Questions

Post by gfgtdf » April 21st, 2018, 7:00 pm

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.

Post Reply