Filtred AI side, units
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.
- LordAndrew
- Posts: 23
- Joined: April 1st, 2018, 3:09 am
- Location: Russia
Filtred AI side, units
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
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
Re: Filtred AI side, units
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.
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.
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
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
Creator of Armory Mod, The Rising Underworld, and Voyage of a Drake: an RPG
- LordAndrew
- Posts: 23
- Joined: April 1st, 2018, 3:09 am
- Location: Russia
Re: Filtred AI side, units
I find only this few working combinations 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]
Re: Filtred AI side, units
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:
But it definitely will not work in multiplayer.
Code: Select all
[store_unit]
variable=ai_units
[filter]
[filter_side]
controller=ai
[/filter_side]
[/filter]
[/store_unit]
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
Creator of Armory Mod, The Rising Underworld, and Voyage of a Drake: an RPG
- LordAndrew
- Posts: 23
- Joined: April 1st, 2018, 3:09 am
- Location: Russia
Re: Filtred AI side, units
looking for multiplayer game maybe this code also helps me to come up with something
Re: Filtred AI side, units
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."
- LordAndrew
- Posts: 23
- Joined: April 1st, 2018, 3:09 am
- Location: Russia
Re: Filtred AI side, units
While I do not have time. Busy hacking the Pentagon website 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.
- LordAndrew
- Posts: 23
- Joined: April 1st, 2018, 3:09 am
- Location: Russia
Re: Filtred AI side, units
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 ?
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 ?