Home   Help Search Login Register  

Author Topic: On-the-fly GFX Changer (ACCEPTED)  (Read 4194 times)

0 Members and 1 Guest are viewing this topic.

Offline Deadfast

  • Members
  • *
On-the-fly GFX Changer (ACCEPTED)
« on: 26 Jul 2009, 04:13:51 »
On-the-fly GFX Changer
Version 1.00
@2009 Deadfast


Allows you to let the players change their view distance and terrain detail in your multiplayer mission using a simple dialog.





How to use?
------------

1) Extract the "otfgfx" directory into your mission root directory.

2) Add the following somewhere (on its own line) to your mission's description.ext:
   #include "otfgfx\otfgfx_dlg.hpp"

3) ExecVM "otfgfx\otfgfx_scripts.sqf", the parameters are following:
   [
      default view distance (0 - ?),
      min view distance (0 - ?),
      max view distance (0 - ?),
      default terrain detail (1 - 5),
      min terrain detail (1 - 5),
      max terrain detail (1 - 5)
   ] (all real numbers)

   All parameters are optional, if not specified otherwise default parameters will be used.

   IMPORTANT! You must send at least an empty array ( [] ):
      _null = execVM "otfgfx\otfgfx_dlg.hpp"      - will not work!!!


   Default values are:
      Default VD: 1,200m
      Min VD: 500m
      Max VD: 10,000m
      Default TD: 2
      Min TD: 1
      Max TD: 5

   Examples:
      [1500, 1000, 3000, 3, 2, 5] execVM ""otfgfx\otfgfx_scripts.sqf"";
   
      [1500, 1000, 3000] execVM ""otfgfx\otfgfx_scripts.sqf"";
   
      [] execVM ""otfgfx\otfgfx_scripts.sqf"";



4) Use the following to code to open the settings dialog for the player:
   [] call DFS_otfgfx_openSettings;


   TIP: Use an action (addAction) to open the dialog:

      a) Create a new script called "gfx_settings.sqf" in your missions' root directory
      b) Put this code into the file:
         [] call DFS_otfgfx_openSettings;
      c) Add the action to open the settings dialog to an object of your choice:
         myObject addAction ["Change graphics", "gfx_settings.sqf"];

2 example missions (one using addAction and using key assignment method) can be found in the 'examples' directory.

OFPEC Download
« Last Edit: 01 Dec 2009, 15:49:54 by hoz »

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: On-the-fly GFX Changer
« Reply #1 on: 28 Jul 2009, 01:02:39 »
Sweet! :)

The positions of the two buttons are strange however. How about using the good ol' "Ok" and "Cancel" style (like the one in the editor when you want to load a mission)?
try { return true; } finally { return false; }

Offline Deadfast

  • Members
  • *
Re: On-the-fly GFX Changer
« Reply #2 on: 28 Jul 2009, 22:34:46 »
Thanks for your input, World.

I don't think using the Yes/No dialog style here would work as the commit button simply commits the changes, it doesn't close the dialog on its own.

Offline Kremator

  • Members
  • *
Re: On-the-fly GFX Changer
« Reply #3 on: 29 Jul 2009, 11:21:16 »
What about releasing this as an addon?

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: On-the-fly GFX Changer
« Reply #4 on: 31 Jul 2009, 05:12:13 »
Uhm, why? It adds less than 10kb to a mission... :)
try { return true; } finally { return false; }

Offline kju

  • Members
  • *
    • PvPScene - The ArmA II multiplayer community
Re: On-the-fly GFX Changer
« Reply #5 on: 02 Aug 2009, 10:23:14 »
Simply :)

To have it available in any mission without modification of such.  ;)

Offline trooper.ryan

  • Members
  • *
Re: On-the-fly GFX Changer (ACCEPTED)
« Reply #6 on: 30 Nov 2009, 08:35:36 »
The file download is broken, anyone got a working link?

Offline Deadfast

  • Members
  • *
Re: On-the-fly GFX Changer (ACCEPTED)
« Reply #7 on: 01 Dec 2009, 14:12:56 »
File re-included to the first post :).

Offline hoz

  • OFPEC Site
  • Administrator
  • *****
Re: On-the-fly GFX Changer (ACCEPTED)
« Reply #8 on: 01 Dec 2009, 14:15:14 »
Thanks Deadfast!
Xbox Rocks

Offline sci

  • Members
  • *
Re: On-the-fly GFX Changer (ACCEPTED)
« Reply #9 on: 23 Jan 2010, 11:00:28 »
Hello, first thanks for such a great script! But, when i try to use this script in my mission I get an 2 in the taskhint box and it works but the norrin revive doesn't work. I put this in the init file [] execVM "otfgfx\otfgfx_scripts.sqf";

my init:
[] execVM "otfgfx_scripts.sqf";

setTerrainGrid 50; // no grass!
setViewDistance 2500; //View Distance

// hide UPS markers.
{_x setMarkerAlphaLocal 0;} forEach

["pa1","pa2","pa3","pa4","pa5","pa6","pa7","pa8","pa9","pa10","pa11","pa12","pa13","pa14","pa15","pa16","pa17","pa18",

"pa19","pa20","pa21","pa22","pa23","pa24","pa25","pa26","pa27","pa28","pa29","pa30"];

mk_fTaskHint = compile (preprocessFileLineNumbers "fTaskHint.sqf");
execVM "briefing.sqf";

//Initialise revive script (this next line is needed for revive script)
server execVM "revive_init.sqf";

//Mission parameters
skiptime Param1;

// Compile JBOY general utility scripts
JBOY_soundLoop = compile (preprocessFileLineNumbers "JBOY_soundLoop.sqf");

//Mission parameters
//skiptime Param1;

//min max spawn distance
[BIS_ACM, 300, 900] call BIS_ACM_setSpawnDistanceFunc;

//factions to be spawned
[["USMC"], BIS_ACM] call BIS_ACM_setFactionsFunc;

//Skill range for spawned units
[0, 0.4, BIS_ACM] call BIS_ACM_setSkillFunc;

//Amount of ammo spawned units possess
[0.3, 0.6, BIS_ACM] call BIS_ACM_setAmmoFunc;

//Type of patrol. With 0 meaning no chance of appearing, and 1 meaning 100% chance. -1 removes patrol type completely.
["ground_patrol", 1, BIS_ACM] call BIS_ACM_setTypeChanceFunc;
["air_patrol", 0.2, BIS_ACM] call BIS_ACM_setTypeChanceFunc;

// in game after this point.
sleep 1;

BIS_EVO_pallammo =

["30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","15rnd_9x19_m9","15rnd_9x19_m

9","15rnd_9x19_m9","15rnd_9x19_m9"];// The players default load out
BIS_EVO_pweapons = ["M16A2","M9","binocular","NVGoggles","ItemGPS"]; // The players default load out

// Reset everyone's weapons since we're using generic classes.
removeAllWeapons player;
{player addMagazine _x;} forEach BIS_EVO_pallammo;
{player addWeapon _x;} forEach BIS_EVO_pweapons;
_primary = primaryWeapon player;
if (_primary != "") then {
   player selectWeapon _primary;
   // Grenade launcher Fix
   _muzzles = getArray(configFile>>"cfgWeapons" >> _primary >> "muzzles");
   player selectWeapon (_muzzles select 0);
};

// Prevent constant "Hi!" nonsense.
player setVariable ["BIS_noCoreConversations", true];

// Respawn with weapons stuff.
while {true} do {

   waitUntil {!(alive player)};

   // Save the weapon config of the player when he die.

   //PlayerWeapons = weapons player;
   //PlayerMagazines = magazines player;

   waitUntil {alive player};

   // Give back the weapons the player had when he died.
   
   removeAllWeapons player;
   
   {player addMagazine _x;} forEach BIS_EVO_pallammo;

   {player addWeapon _x;} forEach BIS_EVO_pweapons;

   _primary = primaryWeapon player;
   if (_primary != "") then {
      player selectWeapon _primary;
      // Grenade launcher Fix
      _muzzles = getArray(configFile>>"cfgWeapons" >> _primary >> "muzzles");
      player selectWeapon (_muzzles select 0);
   };
};

if(true) exitWith {};