Game Development Community

Pre-Grouping Units

by Matt Huston · in RTS Starter Kit · 06/25/2006 (7:13 pm) · 0 replies

I have a maximum of 8 units that the player can control. I would like to automatically map these to the hotkeys (1-8) on the keyboard. So I am thinking I should do this everytime I call "createPlayer". So if I have 1 unit, it is mapped to 1 and so on to 8. So the idea is, everytime a player is created, it is "selected", grouped to next hotkey and then deselected. (command to client calls this function and then its run client-side) My trouble is coming with, I have created a CommandtoServer function like this below. However, for Selection and Movement purposes, I've found the code requires me to use a ghostID for selections. I am not sure how I would go about doing this. Because just sending %player over is an unghosted ID and won't get me the results I need.

commandToClient(%this, 'addUnitList', %player);