[GS] [Help] Combining UI Script and Gameplay script in lua

__jack__

Warlord
Joined
Dec 29, 2009
Messages
141
Hi,

I am working on something relatively simple: allowing a player to change his view to another player by pressing a specifc key.

Using a gameplay script I can easily shift a specific player's view using:
PlayerManager.SetLocalPlayerAndObserver(i)

Using a UI script I can easily trigger a command using a specific key using:
function OnInputHandler( pInputStruct:table )
local uiMsg:number = pInputStruct:GetMessageType();
if uiMsg == KeyEvents.KeyUp then
if pInputStruct:GetKey() == Keys.U then
print("test");
end
end
end

Now why in there devious minds the Dev of CIV6 won't allow me to combine both by replacing the print by a PlayerManager.SetLocalPlayerAndObserver(0) ?

Is there a way to use a UI script to call a function from a Gameplay script ?
 
Top Bottom