Filtred AI side, units

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
LordAndrew
Posts: 23
Joined: April 1st, 2018, 3:09 am
Location: Russia

Filtred AI side, units

Post by LordAndrew » April 3rd, 2018, 5:06 pm

Hi ! How can i filter AI side and his units ? And apply modifications for only AI ?
For example, add damage only AI or add experience only AI. Or modify units only side which control AI ?
Not found on the forum, similar topics

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

Re: Filtred AI side, units

Post by Samonella » April 3rd, 2018, 8:51 pm

Does this need to work in multiplayer? If not, it's pretty easy; just [store_side] and check the side.controller variable.

For multiplayer safety... this is something I worked out for my mod. As far as I can tell it is multiplayer safe, or at least it was in 1.13.10 when I did most of my testing.

Code: Select all

#define IF_IS_HUMAN SIDE WML
	[store_side]
		side={SIDE}
		variable=temp_side
	[/store_side]
	{VARIABLE side_controller $temp_side.controller|}
	{CLEAR_VARIABLE temp_side}
	[sync_variable]
		name=side_controller
	[/sync_variable]
	{IF_VAR side_controller equals human (
		{WML}
	)}
	{CLEAR_VARIABLE side_controller}
#enddef
I'm a little foggy on the details... Iirc, this is only reliable if it is currently {SIDE}'s turn. If you have trouble with out of sync errors I'll gladly tell you what details I remember.
The last few months have been nothing but one big, painful reminder that TIMTLTW.

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

User avatar
LordAndrew
Posts: 23
Joined: April 1st, 2018, 3:09 am
Location: Russia

Re: Filtred AI side, units

Post by LordAndrew » April 10th, 2018, 7:12 am

I find only this few working combinations :lol: but this is not a reliable structure I would be glad if you shared your options

Code: Select all

[store_unit]
	side=$side_number
	[filter]
	[filter_side] 
		side=$side_number
		controller=ai
	[/filter_side] 
	[/filter]
		variable=example
		kill=no
    [/store_unit]

#----second---#

[store_side]
	side=$side_number
	variable=ai_control
	[/store_side]
	[if]
	[variable]
	name=ai_control.controller
	equals=ai
	[/variable]
	[then]
        [/then]
	[else]
	[/else]
	[/if]

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

Re: Filtred AI side, units

Post by Samonella » April 10th, 2018, 3:35 pm

I'm not sure what your goal is. If you want to store all ai controlled units, then this should work in a single player game:

Code: Select all

[store_unit]
    variable=ai_units
    [filter]
        [filter_side]
            controller=ai
        [/filter_side]
    [/filter]
[/store_unit]
But it definitely will not work in multiplayer.
The last few months have been nothing but one big, painful reminder that TIMTLTW.

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

User avatar
LordAndrew
Posts: 23
Joined: April 1st, 2018, 3:09 am
Location: Russia

Re: Filtred AI side, units

Post by LordAndrew » April 11th, 2018, 11:52 am

looking for multiplayer game :) maybe this code also helps me to come up with something

User avatar
Sapient
Inactive Developer
Posts: 4452
Joined: November 26th, 2005, 7:41 am
Contact:

Re: Filtred AI side, units

Post by Sapient » April 11th, 2018, 2:30 pm

In MP it's possible to droid your side. Then it would temporarily be controlled by the AI. So the general case of giving extra HP, etc. just because a side is being controlled by the AI doesn't make a ton of sense. Maybe you can explain in more detail what you are trying to do, and why.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."

User avatar
LordAndrew
Posts: 23
Joined: April 1st, 2018, 3:09 am
Location: Russia

Re: Filtred AI side, units

Post by LordAndrew » April 12th, 2018, 12:17 pm

While I do not have time. Busy hacking the Pentagon website :lol: its a joke. When will be the day off , maybe i write more info. But you gave me great idea for AI side. And in scenarios and maps by default users cant droid AI side of cause if this is a multiplayer mode (:debug - off). And in the source code written condition no swap controll for humans. I think maybe need two checks ? For mod can identify who droid this side. Need to see more source code campaign, maps, scenarios, mods, AI. Your message gave me a lot of ideas for reflection and creativity on this theme.

User avatar
LordAndrew
Posts: 23
Joined: April 1st, 2018, 3:09 am
Location: Russia

Re: Filtred AI side, units

Post by LordAndrew » April 24th, 2018, 3:32 pm

Im back.
Create a verification event when loading a map with the help of filters which side is controlled by ai then apply or add numbers to the exchange buffer variable before the completion of the map or script and pull these values out every time from there. Of course you can make another event which can check at the end of the turn who controls the side. And finish the previous event or start/restart. Really no one did such interesting things ?

Post Reply