Is it possible to Change the hotkey of the camera?

yorkgrass

Warlord
Joined
Sep 30, 2006
Messages
155
I really would like to change the "up down left right" to "ASDW"? is it possible?
Thank you guys! :confused:
 
The easy way would be to reassign different "hotkeys" to the camera. Unforunately, I don't know how to do this - maybe someone else can help with that.
Another way to do it would require using Python. If your interested in this, let me know and I'll post an example.
 
Thanks Tso! I know nothing about python, but if you can give a example, I'm willing to try it!
 
You want to edit the file CvEventManager.py. In that file look for the following code which is located in onKbdEvent:
Code:
if (eventType == self.EventKeyDown):
   theKey=int(key)

Below this code you want to place:
Code:
  if theKey == int(InputTypes.KB_A):
    if self.bCtrl:
     CyCamera().SetBaseTurn(CyCamera().GetBaseTurn() - 45.0)
     return 1
    elif self.bShift:
     CyCamera().SetBaseTurn(CyCamera().GetBaseTurn() - 10.0)
     return 1
 
   if theKey == int(InputTypes.KB_D):
    if self.bCtrl:
     CyCamera().SetBaseTurn(CyCamera().GetBaseTurn() + 45.0)
     return 1
    elif self.bShift:
     CyCamera().SetBaseTurn(CyCamera().GetBaseTurn() + 10.0)
     return 1

This will control the left right movement of the camera. To control up and down movement repeat the same section of code and replace SetBaseTurn with SetBasePitch.
Edit: And use KB_S and KB_W for theKey.

Make sure that you don't edit the original game file and follow standard safe modding practices.
 
Code:
if ( eventType == self.EventKeyDown ):
			theKey=int(key)
			
				if theKey == int(InputTypes.KB_A):
					if self.bCtrl:
						CyCamera().SetBaseTurn(CyCamera().GetBaseTurn() - 45.0)
						return 1
					elif self.bShift:
						CyCamera().SetBaseTurn(CyCamera().GetBaseTurn() - 10.0)
						return 1
	 
				if theKey == int(InputTypes.KB_D):
 					if self.bCtrl:
						CyCamera().SetBaseTurn(CyCamera().GetBaseTurn() + 45.0)
						return 1
					elif self.bShift:
						CyCamera().SetBaseTurn(CyCamera().GetBaseTurn() + 10.0)
						return 1
	
				if theKey == int(InputTypes.KB_W):
					if self.bCtrl:
						CyCamera().SetBasePitch(CyCamera().GetBaseTurn() - 45.0)
						return 1
					elif self.bShift:
						CyCamera().SetBasePitch(CyCamera().GetBaseTurn() - 10.0)
						return 1
	 
				if theKey == int(InputTypes.KB_S):
					if self.bCtrl:
						CyCamera().SetBasePitch(CyCamera().GetBaseTurn() + 45.0)
						return 1
					elif self.bShift:
						CyCamera().SetBasePitch(CyCamera().GetBaseTurn() + 10.0)
						return 1
			
			CvCameraControls.g_CameraControls.handleInput( theKey )
I wrote like this? not working haha¬ I know it have to be my fault. but thanks very much. It's to mess around with python haha¬:lol:
 
I tried again this time KB_A is working, rest of them not, that's probabely because they have assigned to other functions. however!!! it's not what I intended, the camera turns to different angles rather than move right. e.g, if centre of the camera is at (x,y), I want to move it to (x-1,y) by pressing KB_A. But thanks anyway.

Waiting for more help!!!
 
Sorry about that, I thought that you wanted to rotate the camera. Moving it could be done, but would be a little more complicated. If you are interested in seeing all of the CyCamera commands, here is a link that shows them.

http://www.sthurlow.com/cvDocs/cvDoc/CyCamera.htm
 
Back
Top Bottom