Jump to content


  • Content Count

  • Joined

  • Last visited

  • Medals

Posts posted by sizraide

  1. Hello,

    I've been looking around lately, but I can't seem to find any forum that explains how to place the camera to third person view.


    I'm trying to create a cutscene which a camera starts at initial position and moves into the position of third person view.

    For now I have a script that moves the camera into eye position of player.


    _camera camPreparePos getPosATL object;
    _camera camCommitPrepared 0;
    _camera camSetFocus [-1, -1];
    _camera camPrepareFOV getObjectFOV player;
    _camera camPrepareTarget ASLToAGL ((eyePos player) vectorAdd ((eyeDirection player) vectorMultiply 25));
    _camera camPreparePos ASLToAGL eyePos player; //Positions camera into player eye level.
    _camera camCommitPrepared 15;


  2. 2 hours ago, _foley said:

    Basically, you can take eye position of the player and add eyeDirection to it, multiplied by the distance (100m in your case). It goes like this:

    _positionInSky = (eyePos player) vectorAdd ((eyeDirection player) vectorMultiply 100);

    This position will be in PositionASL format, so you might need to also add ASLToAGL like in your script.

    It works! I appreciate your help.

  3. Hello, I'm using screenToWorld [0.5, 0.5].


    But it only returns the position on landscape.


    I'm wondering how do I retrieve the position of what the player is looking at if it's in the sky?

    But only for 100 meters in distance. So for example, if player is looking at sky. Get the position of 100 meters distance relative to the players eye view.

    Because I'm trying to create a cutscene but the player is unfortunately looking at the sky in this scene. And I want to camera to eventually move into the players perspective for a smooth camera to player transition


    EDIT: The player is not looking at any object in the sky, just to clarify.

    _camera camPrepareFov 0.24;
    _camera camPreparePos [9212.05, 19240.1, 1.26343];
    _camera camPrepareFocus [22.29, 1];
    _camera camPrepareTarget getPosATL camera_tents;
    _camera camCommitPrepared 0;
    _camera camSetFocus [-1, -1];
    _camera camPrepareFOV getObjectFOV player;
    _camera camPrepareTarget screenToWorld [0.5, 0.5] // Trying to change this position
    _camera camPreparePos ASLToAGL eyePos player; // Move camera position into players eye position
    _camera camCommitPrepared 13;


  4. Hello,

    I'm trying to edit the properties of a "BIS_fnc_moduleEditTerrainObject" or Edit Terrain Object Module that's been placed and attached to a building in Eden Editor.

    I've looked into the config of this module and I want to change the Object State to destroyed of the object attached to this module.


    // building_ModuleOne is the variable name of the Edit Terrain Object module placed in Eden Editor.
    building_ModuleOne setVariable ["#state",  4];
    // So far this is how I'm doing it, but it won't work - no error messages as well.

    Any help would be appreciated.

  5. Hello, I'm creating an animated opening simlar to Tac-Ops intro.

    I have it all setup and stuff, but the resolution that was said in the wiki which is 2048x2048 is not really perfect for animated openings, unless I'm doing something wrong.

    Basically, the whole picture is not displayed, it's always zoomed in and the quality decreases drastically because of it.

    Here is what I typed in the _timeline for the picture to display:

    [MODE_LAYER_CREATE, 4,"img\introImg\test.jpg"] call bis_fnc_animatedScreen;
    [MODE_LAYER_ANIMATE, 4, 8, nil, 1, nil, 1] call bis_fnc_animatedScreen;

    Is there another way to do this?

  6. 9 hours ago, Maff said:

    The setUnitPos command is working for me.

    Make sure you are using the command correctly.

    Also, Are you using any AI mods?


    Nope, just 3den Enhanced.

    My script is just:

    _unit setUnitPos "MIDDLE";
    _unit setUnitPos "UP";

    My unit has no animation, or anything to prevent it from crouching and standing up.

    EDIT: I've created other units and tested it on them, still the same results.

  7. 1 hour ago, Harzach said:


    Nothing is being redefined. 

    //groupName addWaypoint [center, radius, index, name]
    _wp1 = group nicholas addWaypoint [getPos nicholas_wp_1, 0];


    Two thoughts:


    Is the position "nicholas_wp_2" correctly named?


    Is the unit actually able to get within 5 meters of the first waypoint?


    *edit* - and what @Larrow said. Good to see you!

    Yep, tested it. He does.

  8. 1 hour ago, Larrow said:

    This ...

    and this...

    Should be the waypoint, much like you have done for setWaypointType, ie. _wp1 and _wp2 respectively.



    the 0 here is random placement around the given point, not the waypoints index.


    Index 0 is a special waypoint that relates to where the unit spawns and is pointless to change it.

    I did this, and it still occurs?

    	nicholas enableAI "PATH";
    	_grp = group nicholas;
    	// first waypoint
    	_wp1 = _grp addWaypoint [getPos nicholas_wp_1, 0];
    	_wp1 setWaypointType "MOVE";
    	_wp1 setWaypointVisible false;
    	_wp1 showWaypoint "NEVER";
    	// second waypoint
    	_wp2 = _grp addWaypoint [getPos nicholas_wp_2, 0];
    	_wp2 setWaypointType "MOVE";
    	_wp2 setWaypointVisible false;
    	_wp2 showWaypoint "NEVER";


  9. Hello, I made a tiny script to add two waypoints. But as soon as the unit goes to the first one he doesn't move to the second one, help?


    	nicholas enableAI "PATH";
    	// First waypoint
    	_wp1 = group nicholas addWaypoint [getPos nicholas_wp_1, 0];
    	_wp1 setWaypointType "MOVE";
    	[group nicholas, 0] setWaypointVisible false;
    	[group nicholas, 0] showWaypoint "NEVER";
    	[group nicholas, 0] setWaypointCompletionRadius 5;
    	// Second waypoint
    	_wp2 = group nicholas addWaypoint [getPos nicholas_wp_2, 1];
    	_wp2 setWaypointType "MOVE";
    	[group nicholas, 1] setWaypointVisible false;
    	[group nicholas, 1] showWaypoint "NEVER";
    	[group nicholas, 1] setWaypointCompletionRadius 1;


  10. 18 hours ago, 7erra said:

    yes, with https://community.bistudio.com/wiki/User_Interface_Event_Handlers#onKeyDown

    what main menu? the one you see at the start of the game?

    KeyDown doesn't seem to work here? No errors pop up when I press ENTER button.


    with uiNamespace do {
    	[] spawn 
    		textDisplay = findDisplay 46 ctrlCreate ["RscStructuredText", 1100];
    		textDisplay ctrlSetPosition [0.380469 * safezoneW + safezoneX, 0.534 * safezoneH + safezoneY, 0.227109 * safezoneW, 0.102 * safezoneH];
    		textDisplay ctrlSetBackgroundColor [0,0,0,1];
    		textDisplay ctrlSetText "All choices you pick will shape your character in the story for the whole mission, pick wisely.";
    		textDisplay ctrlSetFontHeight 0.035;
    		textDisplay ctrlCommit 0;
    		buttonDisplay = findDisplay 46 ctrlCreate ["RscButton", 1600];
    		buttonDisplay ctrlSetPosition [0.380469 * safezoneW + safezoneX, 0.636 * safezoneH + safezoneY, 0.227109 * safezoneW, 0.051 * safezoneH];
    		buttonDisplay ctrlSetBackgroundColor [0,0,0,0.5];
    		buttonDisplay ctrlSetText "Press 'ENTER' to confirm";
    		buttonDisplay ctrlSetFontHeight 0.035;
    		buttonDisplay ctrlCommit 0;
    (findDisplay 46) displayAddEventHandler ["keyDown",
    	switch (_this select 1) do 
    		case 28:  
    			{ ctrlDelete (uiNamespace getVariable _x) } forEach [buttonDisplay, textDisplay]; 
    			findDisplay 46 displayRemoveAllEventHandlers "KeyDown";
    		case 156:  
    			{ ctrlDelete (uiNamespace getVariable _x) } forEach [buttonDisplay, textDisplay]; 
    			findDisplay 46 displayRemoveAllEventHandlers "KeyDown";


  11. On 12/6/2021 at 12:43 AM, 7erra said:
    uiNamespace getVariable "ctrl"

    though I would suggest you choose another variable name, since this name is easily overwritten

    I appreciate the help, sorry for the long replies I get caught up in work.

    But is there any possible way to keep a dialog/display open after the person presses ESC? So the person can still access the main menu but the dialog will remain opened.

  12. On 12/3/2021 at 9:06 PM, 7erra said:

    You can use the LBSelChanged UIEH for that


    You can only use a button UIEH on a button. Listboxes are not buttons.


    lbAdd does not return a control. it returns the index of the added entry. also: using the first syntax instead of the second one is unreliable.

    Okay, I managed to fix everything so far and reach my end goal. I just have on issue


    with uiNamespace do 
    	ctrl = findDisplay 46 ctrlCreate ["RscStructuredText", 2000];
    	ctrl ctrlSetPosition [0.398398 * safezoneW + safezoneX , 0.211 * safezoneH + safezoneY, 0.322734 * safezoneW, 0.663 * safezoneH];
    	ctrl ctrlSetFont "EtelkaMonospacePro";
    	ctrl ctrlCommit 0;
    	ctrl ctrlSetBackgroundColor [0,0,0,0.7];


    When I try to access "ctrl" variable it does not get recognized in other scripts, how can I access it?

  13. Hello, I'm creating a singleplayer mission.

    I wan't to add a notebook system where a player can press a key "N" and it would open a notebook GUI interface where the player can read their notes they've acquired throughout the mission.

    I'm in the process of trying to add notes into the ListBox here:


    // Notes
    createDialog "notes";
    	private _noteName = _x;
    	_ctrl = lbAdd [1500, _noteName];
    } forEach ["Unfortunate Syrta", "FIA's purpose"];

    But I am so confused. How do I make it so when a player clicks on an item in the list box it opens up a new display interface? Because I created multiple RscStructuredText classes for each note to display when a "note" is clicked inside the list box.

    I've read the GUI configuration page for List boxes multiple times but I am still confused on the lbAdd, lbSetPicture, etc... commands.

    My first attempt was to create a ButtonClick ctrlHandler that would activate when an item is clicked inside the list box, I still haven't been able to write the script for that yet. No idea if it would work.

    Any help is appreciated, thanks.


  14. 17 hours ago, 7erra said:

    For some reason exitWith will not overwrite the event. try if else instead:

    _displayHandler = (findDisplay 46) displayAddEventhandler["KeyDown",{
    	params ["_display","_key"];
    	if (_key == 1) then {
    	} else {
    // or even more simple:
    _displayHandler = (findDisplay 46) displayAddEventhandler["KeyDown",{
    	params ["_display","_key"];
    	_key == 1


    Appreciate the help!

    I managed to fix it here:

    // Open GUI
    _display = findDisplay 46 createDisplay "chooseDifficulty";
    // Add UI EventHandler
    _display displayAddEventhandler["KeyDown",{
    	params ["", "_key"];
    	_key == 1
    // Wait for confirmation
    // Enable borders
    [0, 0, false, true ] spawn BIS_fnc_cinemaBorder;
    // Remove displayHandler
    findDisplay 46 displayRemoveAllEventHandlers "KeyDown";
    // Close display finally
    _display closeDisplay 1;


  15. 9 hours ago, killzone_kid said:

    displayAddEventHandler ["keydown" .....] override escape key https://community.bistudio.com/wiki/User_Interface_Event_Handlers#onKeyDown


    // Open GUI
    _display = findDisplay 46 createDisplay "chooseDifficulty";
    // Add UI EventHandler
    _displayHandler = (findDisplay 46) displayAddEventhandler["KeyDown",{
    	params ["_display","_key"];
    	if (_key == 1) exitWith {true};
    // Remove displayHandler
    (findDisplay 46) displayRemoveEventHandler ["KeyDown", _displayHandler];

    I made an displayEventHandler, this doesn't seem to be working? Any clues?

    When I press ESC, it still closes the display. But no error pops up.

  16. Hello, I'm creating a singleplayer scenario.

    I created a GUI to choose difficulty for a singleplayer mission at the beginning of the mission.

    But the GUI can be closed by pressing ESC, I wonder if there's any countermeasures to avoid that? So the player can't close it until he chooses a difficulty.



    class chooseDifficulty
        idd = 1234;
        class controls

            class baseFrame: RscFrame
                idc = 1800;
                x = 0.386445 * safezoneW + safezoneX;
                y = 0.279 * safezoneH + safezoneY;
                w = 0.215156 * safezoneW;
                h = 0.476 * safezoneH;
            class textDifficulty: RscText
                idc = 1000;
                text = "Choose difficulty"; //--- ToDo: Localize;
                x = 0.452187 * safezoneW + safezoneX;
                y = 0.313 * safezoneH + safezoneY;
                w = 0.0836719 * safezoneW;
                h = 0.034 * safezoneH;
            class easyDiff: RscButton
                idc = 1600;
                text = "Easy peasy, lemon squeezy."; //--- ToDo: Localize;
                x = 0.416328 * safezoneW + safezoneX;
                y = 0.381 * safezoneH + safezoneY;
                w = 0.155391 * safezoneW;
                h = 0.068 * safezoneH;
                colorBackground[] = {0.5,0.7,0.5,0.8};
                action = "diff = 1";
            class mediumDiff: RscButton
                idc = 1601;
                text = "Adventure Mode"; //--- ToDo: Localize;
                x = 0.416328 * safezoneW + safezoneX;
                y = 0.466 * safezoneH + safezoneY;
                w = 0.155391 * safezoneW;
                h = 0.068 * safezoneH;
                colorBackground[] = {0.5,0.7,0.5,0.8};
                action = "diff = 2";
            class hardDiff: RscButton
                idc = 1602;
                text = "Hard as hell."; //--- ToDo: Localize;
                x = 0.416328 * safezoneW + safezoneX;
                y = 0.551 * safezoneH + safezoneY;
                w = 0.155391 * safezoneW;
                h = 0.068 * safezoneH;
                colorBackground[] = {0.5,0.7,0.5,0.8};
                action = "diff = 3";
            class confirmDiff: RscButton
                idc = 1603;
                text = "Confirm"; //--- ToDo: Localize;
                x = 0.452187 * safezoneW + safezoneX;
                y = 0.67 * safezoneH + safezoneY;
                w = 0.0836719 * safezoneW;
                h = 0.051 * safezoneH;
                colorActive[] = {0.5,0.7,0.5,0.8};
                action = "ok = true";



    _menuLayer = ["difficultyFade"] call BIS_fnc_rscLayer;
    _menuLayer cutText ["", "BLACK FADED", 999];

        // Enable borders
        [0, 0, false, true ] spawn BIS_fnc_cinemaBorder;
        // Create menu background
        private _camera = "camera" camCreate getPosATL screen;
        _camera cameraEffect ["internal", "back"];
        _camera camPrepareTarget getPosATL screen;
        _camera camPrepareFOV 0.5;
        _camera camCommitPrepared 0;
        camCommitted _camera;

        sleep 3;
    _menuLayer cutText ["", "BLACK IN", 3];

    sleep 3;

    // Open menu difficulty
    diff = 0; // Declare difficulty
    ok = false;

    // Open GUI
    _display = findDisplay 46 createDisplay "chooseDifficulty";

    _display closeDisplay 1;
    execVM "sections\1.sqf";

    _camera cameraEffect ["terminate", "back"];
    camDestroy _camera;


  17. 5 minutes ago, pierremgi said:

    Spawn that:


    [] spawn {
      // testGroup = createGroup [independent, true]; // totally useless (due to next line)
      testGroup = [getPos trg1, independent, (configfile >> "CfgGroups" >> "Indep" >> "IND_F" >> "Infantry" >> "HAF_InfSquad")] call BIS_fnc_spawnGroup; // call it
      sleep 0.5;  // if needed: spawned units can be civilian just after spawn, before joining their group
        _x execVM "unit_loadouts\checkgear.sqf"
      } forEach units testGroup;




    It works now, appreciate it. Sleep 0.5 did the trick.

  18. 1 minute ago, Ibragim A said:

    The BIS_fnc_spawnGroup function creates the group itself, so there is no need to first create it with the createGroup command.

    You can read about how the apply command works here. With its help, you cannot change the equipment of units.

    Your first code should work correctly. Anyway, it will run your script with every unit in the group as an argument. If it does't work, look for the error in the script itself.

    { [_x] execVM "unit_loadouts\checkgear.sqf" } forEach units testGroup;


    Thats what I am confused about, why is it not working?

    in my unit_loadouts folder I have one of the loadout scripts here:


    private _unit = (_this select 0);
    removeAllWeapons _unit;
    //Add rifle of unit
    _unit addMagazines ["30Rnd_556x45_Stanag", 10];
    _unit addWeapon (selectRandom["CUP_arifle_M4A3_black", "CUP_arifle_M4A1"]);
    //Adding equipment on rifle
    _unit addPrimaryWeaponItem (selectRandom["CUP_optic_CompM2_low", "CUP_optic_ACOG2"]);
    _unit addPrimaryWeaponItem "CUP_acc_Flashlight";
    //Add pistol of unit
    _unit addMagazines ["9Rnd_45ACP_Mag", 4];
    _unit addWeapon "hgun_ACPC2_F";
    //Add backpack
    _unit addBackpack "B_AssaultPack_dgtl";
    (unitBackpack _unit) addItemCargo ["FirstAidKit", 8];
    (unitBackpack _unit) addmagazineCargo ["handgrenade", 3];
    (unitBackpack _unit) addmagazineCargo ["SmokeShell", 2];
    (unitBackpack _unit) addmagazineCargo ["SmokeShellRed", 2];
    (unitBackpack _unit) addmagazineCargo ["SmokeShellGreen", 2];



  19. I have this script that changes the loadout of a unit



    private _unit = _this select 0;

        _unit setVariable ["BIS_enableRandomization", false]; 
        _unit addGoggles "CUP_G_ESS_BLK";
        /****** RIFLE MAN ******/
        _classname = typeOf _unit;
        if(_classname == "i_soldier_F") then {
            [_unit] execVM "unit_loadouts\rifleman.sqf";
        /****** GRENADIER MAN ******/
        if(_classname == "i_Soldier_GL_F") then {
            [_unit] execVM "unit_loadouts\grenadier.sqf";
        /****** MEDIC MAN ******/
        if(_classname == "i_medic_F") then {        
            [_unit] execVM "unit_loadouts\medic.sqf";
        /****** AUTORIFLE MAN ******/
        if(_classname == "i_soldier_ar_f") then {        
            [_unit] execVM "unit_loadouts\autorifleman.sqf";
        /****** TEAMLEADER MAN ******/
        if(_classname == "i_soldier_tl_f") then {        
            [_unit] execVM "unit_loadouts\teamleader.sqf";
        /****** MARKSMAN MAN ******/
        if(_classname == "i_soldier_m_f") then {        
            [_unit] execVM "unit_loadouts\marksman.sqf";
        /****** RIFLEMAN AT MAN ******/
        if(_classname == "i_soldier_lat_f") then {        
            [_unit] execVM "unit_loadouts\rifleman_at.sqf";



    testGroup = createGroup [independent, true];
    testGroup = [getPos trg1, independent, (configfile >> "CfgGroups" >> "Indep" >> "IND_F" >> "Infantry" >> "HAF_InfSquad")] spawn BIS_fnc_spawnGroup;
    { [_x] execVM "unit_loadouts\checkgear.sqf" } forEach units testGroup;
    (units testGroup) apply {[_x] execVM "unit_loadouts\checkgear.sqf"};

    I'm trying to create a group, and apply the script to each member of the group using apply.

    Don't know if there is another way, couldn't find any other way.