Droid side while playing
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.
- ChaosRider
- Posts: 846
- Joined: April 15th, 2012, 1:15 pm
Droid side while playing
While playing some player decide to droid own side, who control side then? Or how to findout that there is no longer a human as a controller but ai? Im curious because in wml I can check it if ai is set from the start.
Creator of WOTG (+2880 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.12 Wesnoth server.
Re: Droid side while playing
You mean something like this?
Checking the controller (not very good but probably working):
Code: Select all
[modify_side]
side=1
controller=ai
[/modify_side]
Code: Select all
[store_side]
side=1 #it's possible that it needs a filter_side tag
variable=sidetocheck
[/store_side]
[switch]
variable=sidetocheck.controller
[case]
value=ai
#action
[/case]
#other cases if you need
[else]
#action
[/else]
[/switch]
- ChaosRider
- Posts: 846
- Joined: April 15th, 2012, 1:15 pm
Re: Droid side while playing
Not much since I have code in which Im using already storing side and checking who is controller (human/ai), what's funny if I give there to works only when side is controlled by human (or ai) then I get oos, but I don't get oos when I set it for the opposite condition (not_equals=ai (for human sides), not_equals=human (for ai sides)), but this doesnt work when side started as a human player is droided later.
Problem is when human player droid own side because my code is still asking him about picking unit class, but it shouldn't because I thought after droid side is changed controller from human to ai...
Spoiler:
Creator of WOTG (+2880 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.12 Wesnoth server.
- Implementor37
- Posts: 121
- Joined: February 22nd, 2015, 12:41 am
- Location: The Internet
Re: Droid side while playing
I'm assuming that by "droiding his own side" you are referring to a player entering the :droid command into Wesnoth itself, and not a WML script, right?
Anyway, that shouldn't really matter. Here's what i think is wrong:
I believe should be:
Try that and see if it fixes the problem--i think you just forgot the variable operator ('$') and the pipeline character ('|')--which updates and imports the value of the variable.
Anyway, that shouldn't really matter. Here's what i think is wrong:
Code: Select all
[variable]
name=this_side.controller
not_equals=ai
[/variable]
Code: Select all
[variable]
name=$this_side.controller #or should this be $this_side.controller| ? I forget...
not_equals=ai
[/variable]
Author of End of the Legion, available now on the 1.12 and 1.13 servers!
Supporter of the addition of the Aragwaithi into mainline.
Supporter of the addition of the Aragwaithi into mainline.
Re: Droid side while playing
Normally yes, but [variable] indeed wants name instead of value so original is correct. I have tried to get which sides are ai, but I never got anything reliable.Implementor37 wrote:I'm assuming that by "droiding his own side" you are referring to a player entering the :droid command into Wesnoth itself, and not a WML script, right?
Anyway, that shouldn't really matter. Here's what i think is wrong:I believe should be:Code: Select all
[variable] name=this_side.controller not_equals=ai [/variable]
Try that and see if it fixes the problem--i think you just forgot the variable operator ('$') and the pipeline character ('|')--which updates and imports the value of the variable.Code: Select all
[variable] name=$this_side.controller #or should this be $this_side.controller| ? I forget... not_equals=ai [/variable]
I have noted http://forums.wesnoth.org/viewtopic.php?f=21&t=41347 to try for this, but never had any further need for it. So try with wesnoth.synchronize_choice.
Re: Droid side while playing
In 1.13 we changed how it works.
In future versions, when you droid a side, it will ask ai to make moves but it will not change the "controller" field and from the point of view of WML nothing will have changed.
We did this so that, if you droid a side and then win the game, it counts as a victory, since you are still *really* a human and not an ai.
Also if you save and reload the game, the droided sides will be human slots and not ai slots.
The controller field is used for a lot of things, it can change what events are fired, what the outcome of the scenario is, so you don't usually want to change it unless WML specifically asks for it.
When you :droid a side, that is supposed to mean "I am asking an AI to make moves for me, but it is still my side, I'm not trying to reconfigure the entire scenario". We might add a different command that means "There was a bug, this side is supposed to be AI / supposed to be human, I want to reconfigure the entire scenario", which will work like it did in 1.10 and 1.12.
In future versions, when you droid a side, it will ask ai to make moves but it will not change the "controller" field and from the point of view of WML nothing will have changed.
We did this so that, if you droid a side and then win the game, it counts as a victory, since you are still *really* a human and not an ai.
Also if you save and reload the game, the droided sides will be human slots and not ai slots.
The controller field is used for a lot of things, it can change what events are fired, what the outcome of the scenario is, so you don't usually want to change it unless WML specifically asks for it.
When you :droid a side, that is supposed to mean "I am asking an AI to make moves for me, but it is still my side, I'm not trying to reconfigure the entire scenario". We might add a different command that means "There was a bug, this side is supposed to be AI / supposed to be human, I want to reconfigure the entire scenario", which will work like it did in 1.10 and 1.12.
- ChaosRider
- Posts: 846
- Joined: April 15th, 2012, 1:15 pm
Re: Droid side while playing
So in Wesnoth 1.10 (before 1.11 and higher) is there any way to catch the moment when human player droid own side (and undroid) to inform my code to threat this one side as ai side not human?
Creator of WOTG (+2880 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.12 Wesnoth server.
Re: Droid side while playing
I don't think so... maybe with lua or something.
- ChaosRider
- Posts: 846
- Joined: April 15th, 2012, 1:15 pm
Re: Droid side while playing
Only way will be to add option (by right click) for each of players to change from manual picking for automatically picking units (only when first human player choose to allow them to pick unit classes by own (first human player can: a) unallow units classes, b) allow but only automatically picked, c) allows human players to choose it by own (but for ai sides its still b option))).
Creator of WOTG (+2880 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.12 Wesnoth server.
- Implementor37
- Posts: 121
- Joined: February 22nd, 2015, 12:41 am
- Location: The Internet
Re: Droid side while playing
Maybe you could just put a warning message in the beginning of every scenario using your add-on saying something like
instead of trying to figure out what to have the ai do with a :droid side.WARNING! Do not :droid your side. Doing so breaks the WML for this add-on.
Author of End of the Legion, available now on the 1.12 and 1.13 servers!
Supporter of the addition of the Aragwaithi into mainline.
Supporter of the addition of the Aragwaithi into mainline.
Re: Droid side while playing
I guess the alternatives are...
- Use the "ai_turn" event?
- Register a special AI stage with all sides that runs before the other stages, whose only purpose is that when their turn starts it fires a custom event you control? (This is pretty hacky.)
- Use the "ai_turn" event?
- Register a special AI stage with all sides that runs before the other stages, whose only purpose is that when their turn starts it fires a custom event you control? (This is pretty hacky.)
- ChaosRider
- Posts: 846
- Joined: April 15th, 2012, 1:15 pm
Re: Droid side while playing
Or other good option to have no problems with droiding will be to give human players time to pick unit class (by right click at unit) to the turn end, if they wont do this then at turn end it will get automatically.
Creator of WOTG (+2880 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.12 Wesnoth server.