Wiki 1558 Posted December 22, 2014 (edited) Hi guys. I'm creating missions now, and I wonder: -how can I prevent the player to use the time acceleration? I know this can be blocked, but dunno how. -how can I prevent the player to use the 3rd person view, in a vehicle for example? I know it can be done, but still, dunno how. Thanks Edited December 23, 2014 by Wiki Share this post Link to post Share on other sites
Jona33 51 Posted December 22, 2014 In answer to your second question this example comes from the wiki entry for cameraView, if you run that in a loop that should do the job. if (cameraOn == _vehicle && cameraView == "External") then { _vehicle switchCamera "Internal"; }; Share this post Link to post Share on other sites
Wiki 1558 Posted December 22, 2014 thanks, will try ASAP Share this post Link to post Share on other sites
jandrews 116 Posted December 22, 2014 there are some 3rd party scripts people have made to limit 3rd person view and to limit it to all except vehicles. I have not heard of the time acceleration machine. Is that back to the future? no really, I know the editor has the time acceleration but do SP/MP games? Share this post Link to post Share on other sites
jshock 513 Posted December 22, 2014 Yea I was wondering the same thing about time accel, I thought that was editor only... Share this post Link to post Share on other sites
Greenfist 1863 Posted December 22, 2014 (edited) Yea I was wondering the same thing about time accel, I thought that was editor only... It's been in all SP missions since OFP, if I remember correctly. You could either loop a setacctime 1 command or create an user interface event handler to detect an acceleration key press and force it back to 1. Or maybe there's a mission setting/command to disable it, although I haven't ever heard of such. edit. Nothing too clever in the BI's own functions; I found something like this for cutscenes: []spawn { while {true} do { if(accTime != 1.0) then {setAccTime 1.0;}; Sleep 0.001; }; }; Edited December 22, 2014 by Greenfist Share this post Link to post Share on other sites
jshock 513 Posted December 22, 2014 (edited) I was think a displayEH KeyDown, and just have it overwrite with a hint saying time accel disabled. EDIT: i.e. (findDisplay 46) displayAddEventHandler ["KeyDown", { if (_this select 1) in (actionKeys "TimeDec") || (_this select 1) in (actionKeys "TimeInc") then { hintSilent "Time acceleration has been disabled."; }; true; }]; I think those are the correct input actions, but someone correct me if I'm wrong :). Edited December 23, 2014 by JShock Share this post Link to post Share on other sites
killzone_kid 1330 Posted December 23, 2014 There is difficulty option to prevent 3rd person view, you should force that rather than load cpu with wasteful check loops. Share this post Link to post Share on other sites
Greenfist 1863 Posted December 23, 2014 There is difficulty option to prevent 3rd person view, you should force that rather than load cpu with wasteful check loops. How do you force that in a SP mission? I can't seem to find anything about it. :confused: Share this post Link to post Share on other sites
killzone_kid 1330 Posted December 23, 2014 Sorry, I have 0 experience with SP missions. You can check difficulty selected and deny access. No idea if you can configure difficulty and embed it in SP. Share this post Link to post Share on other sites
Kydoimos 916 Posted December 23, 2014 Hi, Wiki - I've found that this is the most effective way of regulating the first-person camera: ["IP_OnEachFrameEH", "onEachFrame", {(vehicle player) switchCamera "Internal"}] call BIS_fnc_addStackedEventHandler; ---------- Post added at 13:03 ---------- Previous post was at 13:02 ---------- Regarding the time acceleration however, I'm not entirely sure. Don't think there's a single command that will do the trick - but I might be mistaken. Share this post Link to post Share on other sites
buliwyf 4 Posted December 23, 2014 I made an addon some time ago, which is running on server only. It forces infantry units to 1st person view. If you use a vehicle, you are able to switch in 3rd person view for better vehicle handling. The main part: if (isServer) then { _init = ' if (!isDedicated) then { GDT_1stPersonView = this; [] spawn { waitUntil {!(isNull player)}; diag_log ''launching no 3rd PoV loop''; _code = {if (((cameraView isEqualTo ''EXTERNAL'' && vehicle player isEqualTo player) || cameraView isEqualTo ''GROUP'') && alive player) then {(vehicle player) switchCamera ''Internal'';};}; [''GDT_onEachFrame'', ''onEachFrame'', _code] call BIS_fnc_addStackedEventHandler; }; }'; _center = createCenter sideLogic; _group = createGroup _center; _size = getNumber (configFile >> "CfgWorlds" >> worldName >> "MapSize"); "LOGIC" createUnit [[_size/2,_size/2,0], _group, _init, 0.2, "PRIVATE"]; }; Share this post Link to post Share on other sites
killzone_kid 1330 Posted December 23, 2014 Hi, Wiki - I've found that this is the most effective way of regulating the first-person camera: ["IP_OnEachFrameEH", "onEachFrame", {(vehicle player) switchCamera "Internal"}] call BIS_fnc_addStackedEventHandler; You cannot aim down sights Share this post Link to post Share on other sites
Polygon 11 Posted December 23, 2014 Wiki, make your thread titles more descriptive, ie. "How to do X and Y" instead of "How to do 2 things". Share this post Link to post Share on other sites
Wiki 1558 Posted December 23, 2014 Ok thanks for your answers, I'll try it ASAP Share this post Link to post Share on other sites
fn_Quiksilver 1636 Posted December 23, 2014 (edited) There is difficulty option to prevent 3rd person view, you should force that rather than load cpu with wasteful check loops. I disagree ... The cost of a few client side check loops won't make an noticeable affect on client FPS in a MP scenario. If the check loop servers a purpose in his scenario then IMO its a valid use of an insignificant amount of CPU. I have toyed with allowing infantry players to use 3rd person but restricting air vehicles (helis, planes) to 1st person only, and those sorts of configurations are not possible with the difficulty option setting, yet can have interesting game play effects. Beside the weight of a single AI units FSM, I find most reasonable scripted performance considerations (especially client side in MP) aren't worth much, with end goal being high+smooth FPS for the client and server. Can run a lot of very performance unfriendly loops and still get great client FPS. Take a look at Tonic's Spyglass anti-hack in most Altis Life servers. Like 20 spawned waitUntil loops running simultaneously evaluating whether a particular display is open. Nasty in terms of code efficiency and CPU loading, but the players still running around collecting peaches and running each other over with 40-60 FPS. Unfortunately I see it often in this community where scenario designer/coder cuts too deep into gameplay in order to achieve a slight code optimization/perf gain, and ends up with a 0/50 or 0/100 server. Then again, I suppose their maximum performance gains are realized once there are no players left :). Edited December 23, 2014 by MDCCLXXVI Share this post Link to post Share on other sites
killzone_kid 1330 Posted December 23, 2014 I disagree ... You can disagree all you want. If there is a difficulty option to restrict 3rd person view, and there is in fact such option on MP server, it is better than running a loop each frame, no matter which way you put it. Share this post Link to post Share on other sites
Jona33 51 Posted December 23, 2014 You can disagree all you want. If there is a difficulty option to restrict 3rd person view, and there is in fact such option on MP server, it is better than running a loop each frame, no matter which way you put it. From a performance perspective obviously, from a gameplay perspective it may not be a better option. If it has a negligible effect on FPS then it's probably better to use a more flexible option. Share this post Link to post Share on other sites
killzone_kid 1330 Posted December 23, 2014 From a performance perspective obviously, from a gameplay perspective it may not be a better option. If it has a negligible effect on FPS then it's probably better to use a more flexible option. The original question was about disabling 3rd view in general, not in particular situation. The more flexible option should come from another option in CfgDifficulty added to the game and not script crouches. Share this post Link to post Share on other sites
Wiki 1558 Posted December 24, 2014 The original question was about disabling 3rd view in general, not in particular situation. The more flexible option should come from another option in CfgDifficulty added to the game and not script crouches. Hum, no. My original question was "How to disable the 3rd person view when the player is in a vehicle?" Share this post Link to post Share on other sites
killzone_kid 1330 Posted December 24, 2014 Hum, no.My original question was "How to disable the 3rd person view when the player is in a vehicle?" Actually, no, it was about 3rd view in general before you edited it. Thank you for reminding me to quote your posts, not that I will need to now. Share this post Link to post Share on other sites
Greenfist 1863 Posted December 24, 2014 Actually, no, it was about 3rd view in general before you edited it. Thank you for reminding me to quote your posts, not that I will need to now. No. http://webcache.googleusercontent.com/search?q=cache:http://forums.bistudio.com/showthread.php?186850-how-to-prevent-2-things :) Share this post Link to post Share on other sites
killzone_kid 1330 Posted December 24, 2014 (edited) No. http://webcache.googleusercontent.com/search?q=cache:http://forums.bistudio.com/showthread.php?186850-how-to-prevent-2-things :) My bad, was pretty sure it had no vehicle mentioned :( PS just did text comparison, suspicious 100% match between undedited and edited versions. PS2 nevermind, the title change :) Edited December 24, 2014 by Killzone_Kid Share this post Link to post Share on other sites
Lala14 135 Posted December 25, 2014 (edited) I'm just gonna post 2 things for question 1 use setTimeMultiplier and then for question 2 I use this in my init.sqf [] spawn { while {true} do { if ((vehicle player != player) && (cameraView == "EXTERNAL")) then { vehicle player switchCamera "INTERNAL"; hint "No Third Person while in a vehicle!"; }; }; }; edit I dunno how you can not allow someone to accelerate the mission time .... maybe if you want have a while in place that simulates time in a script? probably would cause massive lag though. edit #2 for question 2 why not use an displayEventHandler e.g. (findDisplay 46) displayAddEventHandler ["KeyDown",{if ((_this select 1 in (actionKeys 'PersonView')) && (vehicle player isKindOf 'LandVehicle') && (vehicle player != player) then {vehicle player switchCamera "INTERNAL"; hint "No Third Person while in a vehicle!";};}]; edit #3 fixed code above with this although there is a major flaw, if the person enters in third person he will stay in third person until they switch, the eventHandler only launches when the player hits the key so yea. (findDisplay 46) displayAddEventHandler ["KeyDown", { if ((_this select 1 in (actionKeys 'PersonView')) && (vehicle player != player)) then { null = [] spawn { sleep 0.1; vehicle player switchCamera "INTERNAL"; hint "No Third Person while in a vehicle!"; }; ;} ;} ]; Edited December 25, 2014 by Lala14 Share this post Link to post Share on other sites
Greenfist 1863 Posted December 25, 2014 setTimeMultiplier changes the speed of the time, not speed of the game. You can set it to anything and the player can still accelerate it. Share this post Link to post Share on other sites