Hi stupid question,
How to know player id ?
My AI inherit from OOAI so I have his skirmishAIId.
I can to get is allyteam with Game object callback.getGame().getMyTeam()
But I do not see how to get the playerId!
thanks
[Java] How to know player id
Moderators: hoijui, Moderators
Re: [Java] How to know player id
For check all team I using:
See also: clb.getGame().getPlayerTeam(player); clb.getGame().getTeamAllyTeam(owner.clb.getGame().getPlayerTeam(player));
Java AI documentation link: http://spring.abma.de/doc-Interface-JavaOO/
Code: Select all
for(int teamI clb.getTeams().getSize();teamI++) {
//some work here
if (game.getTeamColor(teamI).equals(msgColor))...
}
Java AI documentation link: http://spring.abma.de/doc-Interface-JavaOO/
Re: [Java] How to know player id
AI is no player, it's a design flaw.
- PauloMorfeo
- Posts: 2004
- Joined: 15 Dec 2004, 20:53
Re: [Java] How to know player id
Is your class declaration like this?:
https://github.com/spring/spring/blob/d ... I.java#L38
That is, do you inherit ("extend") from OOAI?
Are you trying to find the ID of *your* AI? If so, that is sent in the init():
https://github.com/spring/spring/blob/d ... .java#L105
I'm not in my "development" computer right now to confirm but from memory you should also have:
https://github.com/spring/spring/blob/d ... I.java#L38
Code: Select all
public class NullOOJavaAI extends OOAI
Are you trying to find the ID of *your* AI? If so, that is sent in the init():
https://github.com/spring/spring/blob/d ... .java#L105
Code: Select all
@Override
public int init(int skirmishAIId, OOAICallback callback)
Code: Select all
callback.getTeamId();
-
- Posts: 13
- Joined: 11 Oct 2014, 13:13
Re: [Java] How to know player id
ok thanks,
I will use callback.getTeamId(); as a player ID
I will use callback.getTeamId(); as a player ID
Re: [Java] How to know player id
player ID and team ID are not the same. only humans have player IDs. AIs are not players (that is totally wrong, but it is how it works in spring at the moment). each AI is "owned" or "controlled" by a player, so that players ID is closest to its player ID. though, if i remember right, you need just the team ID in most places.