Game Development Community

Passing vars to PathManager

by Novack · in RTS Starter Kit · 08/05/2007 (5:10 pm) · 6 replies

I want to know all the selected units from PathManager. So, I want to pass %client (or some variable) to the PathManager::getNextWaypoint function through Player::onReachDestination (that last one doesnt have %client by default, I would pass it as well).

BUT, onReachDestination is looped (by Torque design), and the second time is called it looses the param values. As a result, my chain is broken and I cannot pass %client (or any other var than Player) to PathManager.

The only solution is the creation of a global variable? I already try GetControllingObject() and GetControllingClient() but both returns 0. Any ideas?

#1
08/06/2007 (7:15 am)
In the default RTSKit, all units are created by the RTSConnection with create player, and in that function, all units are assigned a .client variable. If you haven't changed how units are created, you might be able to use that to get the client.
#2
08/06/2007 (7:53 am)
Wow... thats just... a miracle! :D
Ill check it tonight, thanks, Ill post later about the results.
#3
08/06/2007 (4:02 pm)
Well man, that works, thank you!
#4
08/07/2007 (10:42 am)
Cool! Glad to hear it.
#5
08/08/2007 (11:12 am)
It think its %rtsunit.getControllingConnection(); in the rts starter kit. If not its %rtsunit.getControllingClient();I would rely on the code variable instead of the one assigned in the script.

%rtsunit.client = %client

doesnt really change its client, i think, unlike
%rtsunit.setControllingConnection(%client);
which does.
#6
08/10/2007 (7:45 am)
Mhh good info.

There is some similar way to know in wich simsets and/or simgroups the unit is (from the unit)?