Comparing Teams (interesting behavior)
Posted: Fri May 16, 2014 10:55 am
I am was testing this code (for another thing) and when I am comparing teams, it seems to think the victim and player are on the same team.
Console Output
All these players (including myself) were on the same team. I'm assuming the iteration is moving too quickly to pause and calculate accurate results per player?
Syntax: Select all
@SayCommand('!slay')
def slay(player, teamonly, CCommand):
myPlayer = PlayerEntity(userid_from_playerinfo(player))
for players in PlayerGenerator():
victim = PlayerEntity(index_from_playerinfo(players))
teamA = victim.team
teamB = myPlayer.team
msg('Team of Victim: %s \n Team of Slayer: %s'%(teamA,teamB))
if teamA != teamB:
msg('Damaging %s'%(victim.name))
myPlayer.damage(index_from_playerinfo(players), 100, DamageTypes.BULLET, hitgroup=2)
Console Output
Code: Select all
[D&D] Team of Victim: 2 Team of Slayer: 3
[D&D] Damaging Arawra
[D&D] Team of Victim: 3 Team of Slayer: 3
[D&D] Team of Victim: 3 Team of Slayer: 3
[D&D] Team of Victim: 2 Team of Slayer: 3
[D&D] Damaging Wyatt
[D&D] Team of Victim: 3 Team of Slayer: 3
[D&D] Team of Victim: 2 Team of Slayer: 3
[D&D] Damaging Tim
[D&D] Team of Victim: 3 Team of Slayer: 3
[D&D] Team of Victim: 2 Team of Slayer: 3
[D&D] Damaging Tom
[D&D] Team of Victim: 2 Team of Slayer: 3
[D&D] Damaging Paul
[D&D] Team of Victim: 3 Team of Slayer: 3
All these players (including myself) were on the same team. I'm assuming the iteration is moving too quickly to pause and calculate accurate results per player?