Jump to content
  • 0
juandayz

[BASIC GUIDE] 4 ways to add scroll menu options

Question

This is a very simple and basic guide to make your own scroll menu options and execute your scripts.

Please fell free to put other ways or whatever do you want about it :) hope help you with it.

Execute an script through fn_selfactions.sqf  Using nearest players from objet or AI

*If u wanna execute an script using an objet or AI as a trigger then at buttom of your custom fn_selfactions  use this structure:

 

Spoiler

private["_playerPos","_nearestVariable"];//this section is for put the private variables for this script

_playerPos = getPosATL player;//obtain the player position
_nearestVariable = count nearestObjects [_playerPos, ["OBJET ID OR AI ID"], 3] > 0;//check if thers an specific objet near Xdistance(3mts in this case)  from player
 
if (_nearestVariable) then { //here proceed if _nearestVariable is present (player position from objet/AI )
        if (s_player_action < 0) then { // you can use any other name.. i use _action here
            s_player_action = player addaction[("<t color=""#F7D708"">" + ("THE NAME TO PUT IN SCROLL MENU") +"</t>"),"path\to\script.sqf"]; //here you define the text  you put in the scroll menu option, the color and the path where script is located
        };
    } else {
    /////////////this section is for remove the scroll menu option if _nearestVariable is not present
        player removeAction s_player_action;
        s_player_action = -1;
    };        


    
So to complete the structure from above  we gonna use a "TK_CIV_Woman01_EP1" AI id to get the option:

Structure: (at bottom of your fn_selfactions.sqf)

Spoiler

private["_playerPos","_neartrader"];

_playerPos = getPosATL player;
_neartrader = count nearestObjects [_playerPos, ["TK_CIV_Woman01_EP1"], 4] > 0;
 
if (_neartrader) then {
        if (s_player_tk_trader < 0) then {
            s_player_tk_trader = player addaction[("<t color=""#F7D708"">" + ("Buy") +"</t>"),"path\to\script.sqf"];
        };
    } else {
        player removeAction s_player_tk_trader;
        s_player_tk_trader = -1;
    };


//In this case u dont need add nothing more.    

Using cursor target on specific AI/Objet to launch the script. (aim the objet/AI and get a scroll menu option)

First you will need find this in your custom selfactions.sqf

if (_canDo && (speed player <= 1) && (_cursorTarget isKindOf "Plastic_Pole_EP1_DZ")) then {

//the line above says if _canDo variable is present and if the speed player is less or equal to 1 and if cursor target is on the plot pole then { then blabla
you can use the same syntax to make your own scroll menu option... for example if u wanna execute an script each time you put your cursor on a medical tent..("GUE_WarfareBFieldhHospital")


above of

if (_canDo && (speed player <= 1) && (_cursorTarget isKindOf "Plastic_Pole_EP1_DZ")) then {

put:

 

Spoiler

if (_canDo && (speed player <= 1) && (_cursorTarget isKindOf "GUE_WarfareBFieldhHospital")) then {
if (s_player_actiontent < 0) then {
    s_player_actiontent = player addAction ["<t color='#ff5200'>HEAL ME</t>", "path\to\script.sqf", [], 5, false];
    };
    } else {
    player removeAction s_player_actiontent;
    s_player_actiontent = -1;
    };


    
so each time you aim to GUE_WarfareBFieldhHospital you will got a "HEAL ME" option in your scroll menu.

//In this case you will need add yours
player removeAction s_player_actiontent;
s_player_actiontent = -1;

near the end of fn_selfactions.sqf  so find this lines:

Spoiler

{dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];
    s_player_repair_crtl = -1;
    {player removeAction _x} count s_player_combi;s_player_combi = [];
    dayz_myCursorTarget = objNull;
    s_player_lastTarget = [objNull,objNull,objNull,objNull,objNull];
    {player removeAction _x} count s_player_parts;s_player_parts = [];
    s_player_parts_crtl = -1;
    {player removeAction _x} count s_player_lockunlock;s_player_lockunlock = [];
    s_player_lockUnlock_crtl = -1;
    player removeAction s_player_checkGear;


  And add above put:

Spoiler

player removeAction s_player_actiontent;
s_player_actiontent = -1;

this two ways are easy and you can create a new stuff using it.


GET A NEW SCROLL MENU OPTION IF URE INTO A VEHICLE

Well first you will need find it in your custom fn_selfActions.sqf
 

Spoiler

} else {
    player removeAction s_player_grabflare;
    player removeAction s_player_removeflare;
    s_player_grabflare = -1;
    s_player_removeflare = -1;
};

bellow it add this structure:
 

Spoiler

 if (_inVehicle && (driver _vehicle == player)) then { //_inVehicle and _vehicle are variables of fn_selfactions you can find what they mean at top of the selfactions.sqf

    if (s_player_action < 0) then { //"_action" use any other name
        dayz_action = _vehicle; //dayz_action i give the name you can use other one
        s_player_action = dayz_action addaction[("<t color=""#F7D708"">" + ("Vehicle New Option") +"</t>"),"path\to\script.sqf"]; //defiine the color, the name of the option and the path to execute your script
        };
    } else {
    //remove the option if player is not inside
        dayz_action removeAction s_player_action;
        s_player_action = -1;
    };

 


Other way to get a scroll menu option, for example if u wanna get the option all time to use for show rules or something:

create a new sqf.  (name it as you want.. for example  no_use_for_a_name.sqf) and paste inside:

Spoiler

waituntil {!isnull (finddisplay 46)};
sleep 15;
setview = player addaction [("<t color=""#6599FF"">" + ("RULE") +"</t>"),"Path\to\rule.sqf","",5,false,true,"",""];

now go to your init.sqf and in very bottom paste:

[] execVM "path\to\no_use_for_a_name.sqf";

Now all players get the "RULE" option all time.

 

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Any idea how to remove the scroll option?
 

Trying to remove get in as pilot if the vehicle is MH6J_DZ. I added this into server_monitor.sqf and it creates another "Get in as pilot" dialog.

 

My code...
    

			while {(alive player) and (typeOf(vehicle player) == "MH6J_DZ")} do {
_vehicle removeAction [localize "str_actions_helipilotseat", "\z\addons\dayz_code\actions\veh_seatActions.sqf",["MoveToPilot",_driver], 0, false, true];
	}; 

 

Share this post


Link to post
Share on other sites
  • 0

In your custom self actions file  around line 250, put this:

if (_typeOfCursorTarget == "MH6J_DZ") then {_cursorTarget lockDriver true;}; // Remove the "get in pilot" option.

This will probably not work if the server spawned the vehicle because it says. "This command must be executed where vehicle is local " in the wiki. Then use this:

if (_typeOfCursorTarget == "MH6J_DZ") then {
		if (local _cursorTarget) then {
			PVDZE_veh_Lock spawn local_lockUnlock
		} else {
			publicVariable "PVDZE_veh_Lock";
		};
	};

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Similar Content

    • By Bloodthirsty
      Hey I just need some files for this server, any and all you guys can come up with and think it deserve post that shit in chat rn. I want to see some crazy ideas and additions if you got em :) Lets see what you guys can come up with

    • By juandayz
      I JUST LEAVE THIS ONE CUZ I KNOW YOU GUYS GONNA NEED IT..
       
      The very old safezone script by infistar... i was using it in 1.0.5.1  and made some changes to use in 1.6.
      Instructions:
          1. Copy paste the code of below into a file called 16_safezone.sqf - save the file.
          2. Paste this 16_safezone.sqf into mpmissioms\instance_11.chernarus\custom\
          3. Open your init.sqf
          4. At the very bottom of the file add this line:  [] execVM "custom\16_safezone.sqf";
          5. Save the init.sqf and restart your server.
          6-WARNING!!! if ure using some kind of mod that allow vehicles with GodMode out of safezones..  then you will need in 16_safezone.sqf change the path for veh_handleDam.sqf by the path that youre using your custom veh_handleDam.sqf
      this line:  fnc_veh_handleDam = compile preprocessFileLineNumbers '\z\addons\dayz_code\compile\veh_handleDam.sqf';
          16_safezone.sqf
       
      OPTIONAL:
      @BetterDeadThanZed here you got.
      REMOVE LOOT FROM TRADER CITIES AND PLOT POLES. (should removes zeds from trader places and poles too)
       
       
  • Advertisement
  • Supporters
  • Discord

×
×
  • Create New...