| 03-24-2006, 08:31 PM | #1 |
I'm working on something and need to know about player numbers. In this code, where Player(p) or Player(a) is used, would that be 0 = player 1? JASS:function Combat takes integer p, integer a, unit attacking, unit attacked returns nothing if GetPlayerController(Player(p)) == MAP_CONTROL_USER then set udg_InCombat[p] = true call ForGroupBJ( GetUnitsOfPlayerAndTypeId(Player(p), 'o001'), function Remove ) endif if GetPlayerController(Player(a)) == MAP_CONTROL_USER then set udg_InCombat[a] = true call ForGroupBJ( GetUnitsOfPlayerAndTypeId(Player(a), 'o001'), function Remove ) endif endfunction |
| 03-24-2006, 08:42 PM | #2 |
they start at 0, if that is what you want to know |
| 03-24-2006, 08:51 PM | #3 |
Now this would return 1 if it was player 1 right? JASS:GetConvertedPlayerId(GetTriggerPlayer()) |
| 03-24-2006, 09:03 PM | #4 |
no it would return 0 |
| 03-24-2006, 09:12 PM | #5 |
No. If you use GetConvertedPlayerId it returns GetPlayerId()+1, so yes it would return 1. But better use GetPlayerId, and it will return 0. |
| 03-24-2006, 09:16 PM | #6 |
Oh ok ;P |
| 03-24-2006, 09:42 PM | #7 |
Thanks |
| 03-24-2006, 09:47 PM | #8 |
Will this work right? When I call the combat function I'll be calling the player number like for example player 1 = 1 JASS:function Remove takes nothing returns nothing call RemoveUnit( GetEnumUnit() ) endfunction function Combat takes integer p, integer a, unit attacking, unit attacked returns nothing if GetPlayerController(Player(p)) == MAP_CONTROL_USER then set udg_InCombat[p] = true call StartTimerBJ( udg_CombatCheckTimer[p], false, 10.00 ) call ForGroupBJ( GetUnitsOfPlayerAndTypeId(Player(p-1), 'o001'), function Remove ) endif if GetPlayerController(Player(a)) == MAP_CONTROL_USER then set udg_InCombat[a] = true call StartTimerBJ( udg_CombatCheckTimer[a], false, 10.00 ) call ForGroupBJ( GetUnitsOfPlayerAndTypeId(Player(a-1), 'o001'), function Remove ) endif //Begin Combat endfunction |
| 03-24-2006, 10:09 PM | #9 |
No, if you use the Player() function, then 0 = Player 1. We already went over this. |
| 03-24-2006, 10:10 PM | #10 |
This is what will call the function Combat: JASS:call Combat(GetConvertedPlayerId(GetOwningPlayer(GetSpellAbilityUnit())), GetConvertedPlayerId(GetOwningPlayer(GetSpellTargetUnit())), GetSpellAbilityUnit(), GetSpellTargetUnit()) |
| 03-24-2006, 10:49 PM | #11 |
Whatever, you use the function Player() inside the function Combat(). You have the functions Player(), GetPlayerId() and ConvertedPlayer(), GetConvertedPlayerId(). Use one pair or the other, don't mix them up. And why use integers anyway, just change the Combat function to take the player as an argument, rather than his ID. Better yet, since you pass the units to the function as well, why pass the players at all, you define them as the owners of the two units, might as well define them this way in the Combat() function. |
