- Joined
- Aug 7, 2004
- Messages
- 875
Hey guys.
I've been trying to make a Hero Pick system similar to that of DotA. Basically the Hero Pick system in dota works like this; when a player picks a hero, it removes all the heroes in all tavern for that specific player only. I've been wondering how to do this since there are no natives to do this specific function. So I created my own function using GetLocalPlayer()
It works neatly when I tested it singleplayer. However there is a problem I've discovered when I'm testing the map with my friend online. Basically when I pick a Hero everything is fine, but then when he picks a Hero he got disconnected. This keeps happening everytime, the same thing happens vise versa, which makes me come to a conclusion that the error happens on the second player that picks a hero.
I don't know whats wrong with this, but I'm pretty sure its using that GetLocalPlayer() - Can't imagine another way of achieving this.
However the same effect works fine on multiplayer on these functions
This is an effect that I've discovered when browsing through a list of natives. The same effect works for my function
They both use GetLocalPlayer() to match with whichPlayer.
I've spent 3 hours solving this problem, reversing the logic and stuff. So now I think I need your help. If you know anything relating to this please help me and I will give rep if possible.
Thanks
I've been trying to make a Hero Pick system similar to that of DotA. Basically the Hero Pick system in dota works like this; when a player picks a hero, it removes all the heroes in all tavern for that specific player only. I've been wondering how to do this since there are no natives to do this specific function. So I created my own function using GetLocalPlayer()
JASS:
function RemoveUnitFromAllStockForPlayer takes integer unitId, player whichPlayer returns nothing
if (GetLocalPlayer() == whichPlayer) then
call RemoveUnitFromAllStock(unitId)
endif
endfunction
function AddUnitToAllStockForPlayer takes integer unitId, player whichPlayer returns nothing
if (GetLocalPlayer() == whichPlayer) then
call AddUnitToAllStock(unitId,1,1)
endif
endfunction
function AddUnitToStockForPlayer takes unit whichUnit, integer unitId, player whichPlayer returns nothing
if (GetLocalPlayer() == whichPlayer) then
call AddUnitToStock(whichUnit,unitId,1,1)
endif
endfunction
It works neatly when I tested it singleplayer. However there is a problem I've discovered when I'm testing the map with my friend online. Basically when I pick a Hero everything is fine, but then when he picks a Hero he got disconnected. This keeps happening everytime, the same thing happens vise versa, which makes me come to a conclusion that the error happens on the second player that picks a hero.
I don't know whats wrong with this, but I'm pretty sure its using that GetLocalPlayer() - Can't imagine another way of achieving this.
However the same effect works fine on multiplayer on these functions
This is an effect that I've discovered when browsing through a list of natives. The same effect works for my function
JASS:
function MultiboardSetDisplayForPlayer takes player whichPlayer, multiboard mb returns nothing
JASS:
function MultiboardSetTitleTextForPlayer takes player whichPlayer, multiboard mb, string text returns nothing
They both use GetLocalPlayer() to match with whichPlayer.
I've spent 3 hours solving this problem, reversing the logic and stuff. So now I think I need your help. If you know anything relating to this please help me and I will give rep if possible.
Thanks