View Full Version : Forcing the camera to focus on a unit


Kael
Jan 12, 2006, 08:30 PM
Anyone know how (through python) to force the selection, or the camera, on a unit? I have a bunch of units in a stack and I want it to display a different one than it is showing.

Ramalhão
Jan 13, 2006, 07:22 AM
I don't remember if tutorial does these things, maybe you need to look that code.

Are you planning to do cinematics? :D

snarko
Jan 13, 2006, 11:18 AM
CyCamera().LookAtUnit(pUnit) perhaps?

Kael
Jan 13, 2006, 03:54 PM
CyCamera().LookAtUnit(pUnit) perhaps?

Thats gets the camera in the right place but doesn't pop the unit to the top. Any idea how to change the selection to a different unit through python?

The Great Apple
Jan 13, 2006, 04:02 PM
CyInterface.selectUnit(CyUnit* pUnit, bool bClear, bool bToggle, bool bSound)

EDIT: There seems to be 2 APIs - I only just realised the other existed. I believe it's GBM's website. This one seems to have slightly more information than the other one, and is slightly more accurate as well, however I find the interface far worse. http://sthurlow.com/cvDocs/cvDoc/CyInterface.htm

jjsheets
Jan 13, 2006, 05:47 PM
CyInterface.selectUnit(CyUnit* pUnit, bool bClear, bool bToggle, bool bSound)

EDIT: There seems to be 2 APIs - I only just realised the other existed. I believe it's GBM's website. This one seems to have slightly more information than the other one, and is slightly more accurate as well, however I find the interface far worse. http://sthurlow.com/cvDocs/cvDoc/CyInterface.htm

Note that I am presently using CyInterface.selectGroup(unit,false,false,false)

I'm going to find out for sure if it selects an entire group.

However, Kael, if you're looking to select a specific unit in a stack, regardless of it's group membership, use selectUnit.

I do not believe that these functions allow you to select a unit from a stack of enemies so you can target a specific one, however.

Kael
Jan 13, 2006, 10:31 PM
CyInterface.selectUnit(CyUnit* pUnit, bool bClear, bool bToggle, bool bSound)

EDIT: There seems to be 2 APIs - I only just realised the other existed. I believe it's GBM's website. This one seems to have slightly more information than the other one, and is slightly more accurate as well, however I find the interface far worse. http://sthurlow.com/cvDocs/cvDoc/CyInterface.htm

I needed to use it as CyInterface().selectUnit(CyUnit* pUnit, bool bClear, bool bToggle, bool bSound) but it worked perfectly! Thanks!