How-To Add Right-Click Actions

If you haven’t read “How-To Begin Customizing a DayZ Mod Server“, now is a good time.

One way to add script actions is to make them a right-click on objects (via the inventory screen). This method is used to wear clothes, fill water bottles, take antibiotics and the like.

You’ll need to create a custom file named “extra_rc.hpp” and include it in description.ext of the mission.

Creating a custom compiles.sqf

    1. Create a new directory, named “custom” in the mission folder
    2. Create a new filed named “extra_rc.hpp” in that folder with the following contents:
      class ExtraRc {
      // Add all your custom classes here.
      };
    3. Edit description.ext in the mission folder and and the bottom add:
      #include "custom\extra_rc.hpp"
    4. Add custom right-click options like this:
      class Skin_Soldier1_DZ {
        class clothing1 {
          text = "Wear GUE";
          script = "['Skin_Soldier1_DZ','GUE_Soldier_CO'] execVM 'custom\skins\changeSkin.sqf'";
        };
        class clothing2 {
          text = "Wear GUE CO";
          script = "['Skin_Soldier1_DZ','GUE_Commander'] execVM 'custom\skins\changeSkin.sqf'";
        };
      };

      where

      "Skin_Soldier1_DZ" - the classname of the object to add right-click
      "clothing1" and "clothing2" - should be unique if you add multiple items. There is a limit to the number of right-click options you can add(4 or 5?)
      text - The menu label that shows up as the right-click.
      script - script to run. Be very careful with the quotes. In this example, the values in the [] are the paramters passed to the script being executed via execVM.
      

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s