diff --git a/Templates/BaseGame/game/core/utility/scripts/gameObjectManagement.tscript b/Templates/BaseGame/game/core/utility/scripts/gameObjectManagement.tscript index 275c088f9..fff2a8ace 100644 --- a/Templates/BaseGame/game/core/utility/scripts/gameObjectManagement.tscript +++ b/Templates/BaseGame/game/core/utility/scripts/gameObjectManagement.tscript @@ -80,8 +80,10 @@ function spawnGameObject(%name, %addToScene) function GameBaseData::onNewDataBlock(%this, %obj) { - %this.onRemove(%obj); - %this.onAdd(%obj); + if(%this.isMethod("onRemove")) + %this.onRemove(%obj); + if(%this.isMethod("onAdd")) + %this.onAdd(%obj); } function saveGameObject(%name, %tamlPath, %scriptPath) diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/cameraCommands.ed.tscript b/Templates/BaseGame/game/tools/worldEditor/scripts/cameraCommands.ed.tscript index c842b77c1..18c0a1a5e 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/cameraCommands.ed.tscript +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/cameraCommands.ed.tscript @@ -47,6 +47,15 @@ function serverCmdToggleCamera(%client) { if (%client.getControlObject() == %client.player) { + if (!isObject(%client.camera)) + { + %client.camera = spawnObject("Camera", Observer); + MissionCleanup.add( %client.camera ); + %client.camera.scopeToClient(%client); + + %client.camera.setPosition(%client.player.getPosition()); + } + %client.camera.setVelocity("0 0 0"); %control = %client.camera; }