Connecting a script to a hotkey

+
Connecting a script to a hotkey

So I don't know whether it is possible to introduce a new hotkey but you can use an existing one.

As far as I can see the 'V' key is "free".

To make use of it copy this line
IK_V=(GameKey="GI_Vip",Value=1.000000)
into the three Input_xxxxx.ini files (before the IK_W line)

Then in scriptStudio open witchergame.ws and add the following lines:
Code:
event OnGameInputEvent( key : name, value : float )
	{

		if ( key == 'GI_H' && IsKeyPressed( value ) )
		{
			theHud.SetGuiVisibility( ! theHud.IsGuiVisible() );
		}

[B]		if ( key == 'GI_Vip' && IsKeyPressed( value ) )
		{
			theHud.SetGuiVisibility( ! theHud.IsGuiVisible() );
		}
[/B]		
		return false;
	}

Press F7 to Reload scripts.

Now displaying the hud can be toggled by pressing 'v'.

Other scripts to be tested.

(Meanwhile my player teleport code doesn't work any more for a unknown reason...)

edit: well, it's working again:
Code:
	event OnGameInputEvent( key : name, value : float )
	{
		var pos : Vector;

		if ( key == 'GI_H' && IsKeyPressed( value ) )
		{
			theHud.SetGuiVisibility( ! theHud.IsGuiVisible() );
		}

		if ( key == 'GI_Vip' && IsKeyPressed( value ) )
		{
			theHud.SetGuiVisibility( ! theHud.IsGuiVisible() );
			pos.X = 25.9f; pos.Y = 306.f; pos.Z = 2.9f;	// troll bridge
			thePlayer.EnablePhysicalMovement( false );
			thePlayer.EnablePathEngineAgent( false );		
			thePlayer.Teleport(pos);
			//thePlayer.EnablePhysicalMovement( true );
			//thePlayer.EnablePathEngineAgent( true );		// no teleport when uncommenting this!?
		}
		
		return false;
	}
The teleporting code needs further testing.
So be aware NOT to create save games after having teleported Geralt.
 
Last edited:
Top Bottom