Can a spectator take over for an ai player?
Moderator: Moderators
Can a spectator take over for an ai player?
Say I am playing vs a Lua ai like Craig, can a spectator take over that ai player?
-
- Posts: 823
- Joined: 21 Oct 2008, 02:54
Re: Can a spectator take over for an ai player?
Correct me if I'm wrong, but isn't Ai, just consider to be another player in the game?
Re: Can a spectator take over for an ai player?
An AI is not just another player, but a Lua AI team should be possible to overtake. You can also "partially overtake" the AI with cheats as-is, e.g. via /team N or /godmode.
- Silentwings
- Posts: 3720
- Joined: 25 Oct 2008, 00:23
Re: Can a spectator take over for an ai player?
Spring.AssignPlayerToTeam should do it.
Re: Can a spectator take over for an ai player?
ah, so will the ai try control things once a player has taken over?
- Silentwings
- Posts: 3720
- Joined: 25 Oct 2008, 00:23
Re: Can a spectator take over for an ai player?
Yes, you'll have to remove the AI somehow as well.
Re: Can a spectator take over for an ai player?
Is there a way for this or does it have to be part of the AI to step down?
- Silentwings
- Posts: 3720
- Joined: 25 Oct 2008, 00:23
Re: Can a spectator take over for an ai player?
I'm not sure, AIs are something I never got into.
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
Re: Can a spectator take over for an ai player?
The luaAI would have to be told to stop controlling the units. I doubt any luaAIs come with this feature but it sounds easy to add in. The simplest way (which allows the AI to be restarted) would be to replace Spring.GiveOrderToUnit with a function which checks whether the AI is active and blocks the order if it is not.
Re: Can a spectator take over for an ai player?
Sounds a bit like a hack. Wouldn't it just be possible to add a shutdown button into the AI?
Re: Can a spectator take over for an ai player?
LuaAI can use the PlayerChanged call-in to check if someone joined the AI team to disable itself.
The gadget that calls AssignPlayerToTeam can also notify the LuaAIs itself through GG.
The gadget that calls AssignPlayerToTeam can also notify the LuaAIs itself through GG.