[Pogamut-list] Opponent's health status
michal.bida
pogamut-forum at artemis.ms.mff.cuni.cz
Tue Jun 30 18:40:30 CEST 2009
Re: Re: Opponent's health status
Author: michal.bida
Hi!
First of all - you cannot get the information about opponents health - that would be cheating if you would be aware of health level of all of your opponents. If you want to know if someone died the best thing how to find out is to register listener to player killed message. Something like this:
RcvMsgListener myPkListener = new RcvMsgListener() {
@Override
public void receiveMessage(RcvMsgEvent e) {
PlayerKilled pk;
pk = (PlayerKilled) e.getMessage();
lastPlayerKilledID = pl.killerID;
}
};
@Override
protected void postPrepareAgent() {
this.getBody().addTypedRcvMsgListener(myPkListener, MessageType.PLAYER_KILLED);
}
Then you always have in lastPlayerKilledID variable the ID of last player killed.
best,
michal
More information about the Pogamut-list
mailing list