Hello Seth and the Novashell community!
I was working on a little exercise project involving two characters.
First Character is a human , the Entity is named "Player" (Set in the lua script itself)
Human is controlled by WASD keys. A and D to move, S to open doors and W to jump.
Second Character is a monkey, the Entity is named "Monkey" (SetName thing in the lua script itself)
I added key bindings to switch the Camera, R for the Human, T for the Monkey.
When I press R, the Camera switches to the Human, and a log message shows up.
When L is pressed, the Camera switches to the Monkey, and a similar log message shows up.
There are no bugs or glitches in the system, the only thing that is bothering me is the log message.
The log:
Code:
Original screensize detected as 1280.00 X 768.00
Found "Logitech Attack 3", 11 buttons.
Initializing GameLogic...
Clanlib Sound System Initialized
Mounting world path worlds/Boku_to_Sarukun.
Novashell V0.84 and Lua 5.13 RT Edition Initted.
Initting world
Initting intro menu
Loaded map Intro at tick 4074. 6 non-empty chunks, size is 2 by 2.
Resetting!
Clearing all maps
User profile path now D:\Game Files\Novashell/profiles/Player/Boku_to_Sarukun
Loaded map Main at tick 0. 46 non-empty chunks, size is 22 by 1.
Inserting interface..
Initting interface
Setting up overlays..
Loaded map System Palette at tick 0. 5 non-empty chunks, size is 2 by 1.
Found player in Main at X:368.00 Y: -128.00
Switching world focus to ourself?
Initializing the player entity.
Initializing the monkey.
Editor opened up
Setting retail to false
Editor closed
Brain: Unknown LUA error (Invalid return type maybe?) in Entity 330 (Monkey) : OnCameraSwitch
Brain: Unknown LUA error (Invalid return type maybe?) in Entity 330 (Monkey) : OnCameraSwitch
Brain: Unknown LUA error (Invalid return type maybe?) in Entity 329 (Player) : OnCameraSwitch
Brain: Unknown LUA error (Invalid return type maybe?) in Entity 329 (Player) : OnCameraSwitch
Editor opened up
Setting retail to false
Editor closed
player.lua , SetDefaults function.
Code:
function SetDefaults()
//--entity stuff
this:SetCategory(C_CATEGORY_ENTITY, false);
this:SetCategory(C_CATEGORY_PLAYER, true);
this:SetName("Player");
this:SetCollisionListenCategory(C_CATEGORY_TILEPIC, true);
this:SetCollisionListenCategory(C_CATEGORY_ENTITY, true);
this:GetBrainManager():Add("StandardBase","");
this:GetBrainManager():SendToBrainBase("control_filtery=0");
GetGameLogic:SetPlayer(this); // <<<<<THIS WAS ADDED
AssignPlayerToCameraIfNeeded(); //<<<Tried removing this and using it in the switch function
//--[[
//other stuff
//]]--
ResetKeys()
end
player.lua , SetupInputKeys function,
This line was added
Code:
GetInputManager:AddBinding("r,always", "OnCameraSwitch", this:GetID());
monkey.lua does not have the extra added part in SetDefaults
This line was added to the SetupInputKeys for the monkey script
Code:
GetInputManager:AddBinding("t,always", "OnCameraSwitch", this:GetID());
This is how the OnCameraSwitch looks for both player.lua AND monkey.lua -
Code:
--
function OnCameraSwitch()
GetCamera:SetEntityTrackingByID(this:GetID());
end
--
EDIT: I fixed it. Mods may close this thread now, sorry for inconvenience.
The function now looks like this-
Code:
function OnCameraSwitch()
GetCamera:SetEntityTrackingByID(this:GetID());
return true;
end
Adding a "return true;" seemed to resolve the problem.
Bookmarks