Droid side while playing

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.
Post Reply
User avatar
ChaosRider
Posts: 846
Joined: April 15th, 2012, 1:15 pm

Droid side while playing

Post by ChaosRider »

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.
User avatar
pe_em
Posts: 115
Joined: January 10th, 2015, 5:51 pm
Location: Poland

Re: Droid side while playing

Post by pe_em »

You mean something like this?

Code: Select all

[modify_side]
    side=1
    controller=ai
[/modify_side]
Checking the controller (not very good but probably working):

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]
User avatar
ChaosRider
Posts: 846
Joined: April 15th, 2012, 1:15 pm

Re: Droid side while playing

Post by ChaosRider »

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.
Spoiler:
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...
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.
User avatar
Implementor37
Posts: 121
Joined: February 22nd, 2015, 12:41 am
Location: The Internet

Re: Droid side while playing

Post by Implementor37 »

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:

Code: Select all

[variable]
 name=this_side.controller
 not_equals=ai
[/variable]
I believe should be:

Code: Select all

[variable]
 name=$this_side.controller #or should this be $this_side.controller| ?  I forget...
 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.
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.
User avatar
Ravana
Forum Moderator
Posts: 3009
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Droid side while playing

Post by Ravana »

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:

Code: Select all

[variable]
 name=this_side.controller
 not_equals=ai
[/variable]
I believe should be:

Code: Select all

[variable]
 name=$this_side.controller #or should this be $this_side.controller| ?  I forget...
 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.
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.

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.
User avatar
iceiceice
Posts: 1056
Joined: August 23rd, 2013, 2:10 am

Re: Droid side while playing

Post by iceiceice »

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.
User avatar
ChaosRider
Posts: 846
Joined: April 15th, 2012, 1:15 pm

Re: Droid side while playing

Post by ChaosRider »

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.
User avatar
iceiceice
Posts: 1056
Joined: August 23rd, 2013, 2:10 am

Re: Droid side while playing

Post by iceiceice »

I don't think so... maybe with lua or something.
User avatar
ChaosRider
Posts: 846
Joined: April 15th, 2012, 1:15 pm

Re: Droid side while playing

Post by ChaosRider »

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.
User avatar
Implementor37
Posts: 121
Joined: February 22nd, 2015, 12:41 am
Location: The Internet

Re: Droid side while playing

Post by Implementor37 »

Maybe you could just put a warning message in the beginning of every scenario using your add-on saying something like
WARNING! Do not :droid your side. Doing so breaks the WML for this add-on.
instead of trying to figure out what to have the ai do with a :droid side.
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.
User avatar
iceiceice
Posts: 1056
Joined: August 23rd, 2013, 2:10 am

Re: Droid side while playing

Post by iceiceice »

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.)
User avatar
ChaosRider
Posts: 846
Joined: April 15th, 2012, 1:15 pm

Re: Droid side while playing

Post by ChaosRider »

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.
Post Reply