Mebeover 0 Posted January 5, 2023 Hey I'm new to scripting, trying to set up a respawn system for a mission where players have a 2 minute wait on respawn, and while they wait they can spectate other players in either first or third person mode only (no freecam spectate), and then once timer ends they respawn on a custom position. ["Initialize", [player]] call BIS_fnc_EGSpectator; - is in onPlayerKilled.sqf ["Terminate"] call BIS_fnc_EGSpectator; - is in onPlayerRespawn.sqf respawn = 3; respawnDelay = 120; - is in description.ext Now this works as intended, but my attempts to disable free cam specate mode have fallen short. I'm not quite sure where or how to use the parameter allowFreeCamera. Running the script with: ["Initialize", [player, allowFreeCamera = false]] call BIS_fnc_EGSpectator; gives the error undefined variable - so presumably I have to define allowFreeCamera somewhere, but where? Any assistance is greatly appreciated. Share this post Link to post Share on other sites
Harzach 2507 Posted January 5, 2023 https://community.bistudio.com/wiki/BIS_fnc_EGSpectator Quote Syntax: [mode, [spectator, whitelistedSides, allowAi, allowFreeCamera, allow3PPCamera, showFocusInfo, showCameraButtons, showControlsHelper, showHeader, showLists]] call BIS_fnc_EGSpectator Parameters: mode: String - Function mode, can be: "Initialize" "Terminate" See the in-game Functions Viewer to see all the possible values. The following parameters are for "Initialize". spectator: Object - Player whitelistedSides: Array - (Optional, default: []) sides that can be spectated allowAi: Boolean - (Optional, default: false) whether AI can be viewed by the spectator allowFreeCamera: Boolean - (Optional, default: true) whether free camera mode is available allow3PPCamera: Boolean - (Optional, default: true) whether 3rd Person camera mode is available showFocusInfo: Boolean - (Optional, default: true) whether to show Focus Info stats widget showCameraButtons: Boolean - (Optional, default: true) whether or not to show camera buttons widget showControlsHelper: Boolean - (Optional, default: true) whether to show controls helper widget showHeader: Boolean - (Optional, default: true) whether to show header widget showLists: Boolean - (Optional, default: true) whether to show entities / locations lists So, the function takes many parameters. You have successfully passed the first two params with: ["Initialize", [player]] call BIS_fnc_EGSpectator; As you can see, you only pass a param's value, not its title. With that in mind, your attempt at setting allowFreeCamera to false: ["Initialize", [player, allowFreeCamera = false]] call BIS_fnc_EGSpectator; should have looked like this: ["Initialize", [player, false]] call BIS_fnc_EGSpectator; HOWEVER! When specifying a parameter like this, all previous params must be declared. In my "fixed" code above, I set the third param to "false" - but the third param taken is whitelistedSides, which should be an array of side names. Since we are changing the fifth param, we need to specify all previous params, even if we are not changing them from their default values. So: ["Initialize", [player, [], false, false]] call BIS_fnc_EGSpectator; 1 Share this post Link to post Share on other sites
Mebeover 0 Posted January 6, 2023 Thanks! Cheers for the detailed explanation Share this post Link to post Share on other sites