Jump to content

MasterPuffin

Member
  • Content Count

    30
  • Joined

  • Last visited

  • Medals

Everything posted by MasterPuffin

  1. Hello, since I searched way to long to find a working keyhandler for my mission, I want to share my results with you! ******************************** Put the following code in your init.sqf: execVM "keyhandler.sqf"; in your main mission folder create a file called keyhandler.sqf and put the following code in it waitUntil {!isNull(findDisplay 46)}; (findDisplay 46) displaySetEventHandler ["KeyDown","_this call keyspressed"]; keyspressed = { _keyDik = _this select 1; _shift =_this select 2; _ctrl = _this select 3; _alt = _this select 4; _handled = false; switch (_this select 1) do { case 23: {//I key if (_shift) then { execVM "YOURSCRIPT"; }; if (_ctrl) then { execVM "YOURSCRIPT"; }; }; case 22: {//U key if (_shift) then { execVM "YOURSCRIPT"; }; }; _handled; }; It's pretty self explanatory just replace YOURSCRIPT with the path to your script. The number behind case is the key as shown in this list. If you have any questions feel free to ask! Cheers Puffin
  2. When executed, this script will holster your weapon, or puts it on your back. You can draw your weapon again using 1 or 2 on your keyboard. player action ["SWITCHWEAPON",player,player,-1]; waitUntil {currentWeapon player == "" or {primaryWeapon player == "" && handgunWeapon player == ""}}; You can either use addaction or a keyhandler to execute the script. If you have any questions or need help with your mission feel free to ask! Cheers Puffin
  3. Hello, I searched a long time for a working restraining script, which works in MP. Long story short, I didn't found one, so I wrote one myself. Yes it's not perfect, so feel free to improve it, but it works. ******************************** Create a file called onPlayerRespawn.sqf (or use your existing one) and put the following code into it: restrain=false; restcaller=false; Create a folder called scripts. Inside this folder create a file called restrain.sqf and put the following code into it: restcaller = false; if (restrain=false;) then { if (player distance cursortarget < 2) then { restcaller = true; [[[],"scripts\restrainTarget.sqf"],"BIS_fnc_execVM",cursortarget,false,false] call BIS_fnc_MP; }; }; player distance cursortarget < 2 --> the number is the max. distance in meters to restrain someone. Change it to whatever you want. Inside the folder scripts create a file called restrainTarget.sqf and put the following code into it: if (restcaller isEqualto false) then { if (restrain isEqualto false) then { restrain=true; player setVariable ["restrain", true, true]; while { player getVariable ["restrain", false] } do { player playMove "AmovPercMstpSnonWnonDnon_EaseIn"; //Animation in if (((!alive player) || (player getVariable["onkill",FALSE]))) then { player setVariable ["restrain", false, true]; }; }; player playMoveNow "AmovPercMstpSnonWnonDnon_EaseOut"; //Animation out } else { restrain=false; player setVariable ["restrain", false, true]; //Set surrender to true player playMoveNow "AmovPercMstpSnonWnonDnon_EaseOut"; //Animation out }; }; restcaller = false; Using the script: You can either use addaction or a keyhandler to execute the script. When you execute the script the player pointed at by the cursor will be restrained (as long as he's in your configured range). Executing the script again will set the player free. If you have any questions or need help with your mission feel free to ask! Cheers Puffin
  4. if you wand your light permanently on instead of blinking replace the while part in the light.sqf with the following code: while{ (alive _vehicle) && (_repeat isEqualTo true)} do { if(_leftRed) then { _lightleft setLightBrightness _brightness; } else { _lightright setLightBrightness _brightness; }; sleep 1; _repeat = _vehicle getVariable "lights"; }; deleteVehicle _lightleft; deleteVehicle _lightright;
  5. This script is best used with a keyhandler, however if you have a bit of experience with coding you can get it also work with addaction. This script works in MP ******************************** Put the following code in your keyhandler: case 38: {//L key if (_shift) then { _vehicle = (vehicle player); if (isNil {_vehicle getVariable "EmergencyVeh"}) then { _vehicle setVariable ["EmergencyVeh", false, true]; }; _ComVeh = _vehicle getVariable "EmergencyVeh"; if (vehicle player != player && (driver _vehicle == player && _ComVeh isEqualTo true)) then { if (isNil {_vehicle getVariable "lights"}) then { _vehicle setVariable ["lights", false, true]; }; _LightState = _vehicle getVariable "lights"; if (_LightState isEqualTo true) then { _vehicle setVariable ["lights", false, true]; } else { [[[_vehicle],"scripts\light.sqf"],"BIS_fnc_execVM",true,false,false] call BIS_fnc_MP; _vehicle setVariable ["lights", true, true]; }; }; }; }; Create a folder called scripts. Inside this folder create a file called light.sqf and put the following code into it: Private ["_vehicle","_lightRed","_lightBlue","_lightleft","_lightright","_leftRed"]; _vehicle = _this select 0; if(isNil "_vehicle" OR isNull _vehicle) exitWith {}; _lightRed = [20, 0.1, 0.1]; _lightBlue = [0.1, 0.1, 20]; _lightleft = "#lightpoint" createVehicle getpos _vehicle; sleep 0.2; _lightleft setLightColor _lightRed; _lightleft setLightBrightness 0.2; _lightleft setLightAmbient [0.1,0.1,1]; switch (typeOf _vehicle) do { case "C_Offroad_01_F": { _lightleft lightAttachObject [_vehicle, [-0.37, 0.0, 0.56]]; }; case "B_MRAP_01_F": { _lightleft lightAttachObject [_vehicle, [-0.8, -0.90, 0.6]]; }; case "C_SUV_01_F": { _lightleft lightAttachObject [_vehicle, [1.1,0.4,-0.05]]; }; case "I_Heli_light_03_unarmed_F": { _lightleft lightAttachObject [_vehicle, [1.23, 4.7, -1.42]]; }; case "B_Heli_Light_01_F": { _lightleft lightAttachObject [_vehicle, [-0.75, 1.7, -0.95]]; }; case "C_Hatchback_01_sport_F": { _lightleft lightAttachObject [_vehicle, [0.62, 1.87, -0.52]]; }; case "C_Offroad_02_unarmed_F": { _lightleft lightAttachObject [_vehicle, [0.62, 1.87, -0.52]]; }; case "O_MRAP_02_F": { _lightleft lightAttachObject [_vehicle, [-0.8, -0.90, 0.6]]; }; case "B_APC_Wheeled_01_cannon_F": { _lightleft lightAttachObject [_vehicle, [-0.8, -0.90, 0.6]]; }; case "B_Heli_Transport_01_F": { _lightleft lightAttachObject [_vehicle, [1.23, 4.7, -1.42]]; }; }; _lightleft setLightAttenuation [0.181, 0, 1000, 130]; _lightleft setLightIntensity 10; _lightleft setLightFlareSize 0.38; _lightleft setLightFlareMaxDistance 150; _lightleft setLightUseFlare true; _lightright = "#lightpoint" createVehicle getpos _vehicle; sleep 0.2; _lightright setLightColor _lightBlue; _lightright setLightBrightness 0.2; _lightright setLightAmbient [0.1,0.1,1]; switch (typeOf _vehicle) do { case "C_Offroad_01_F": { _lightright lightAttachObject [_vehicle, [0.37, 0.0, 0.56]]; }; case "B_MRAP_01_F": { _lightright lightAttachObject [_vehicle, [0.8, -0.90, 0.6]]; }; case "C_SUV_01_F": { _lightright lightAttachObject [_vehicle, [-1.1,0.4,-0.05]]; }; case "I_Heli_light_03_unarmed_F": { _lightright lightAttachObject [_vehicle, [-1, 3.2, -2]]; }; case "B_Heli_Light_01_F": { _lightright lightAttachObject [_vehicle, [0.75, 1.7, -0.95]]; }; case "C_Hatchback_01_sport_F": { _lightright lightAttachObject [_vehicle, [-0.62, 1.87, -0.52]]; }; case "C_Offroad_02_unarmed_F": { _lightright lightAttachObject [_vehicle, [0.37, 0.0, 0.56]]; }; case "O_MRAP_02_F": { _lightright lightAttachObject [_vehicle, [0.8, -0.90, 0.6]]; }; case "B_APC_Wheeled_01_cannon_F": { _lightright lightAttachObject [_vehicle, [0.8, -0.90, 0.6]]; }; case "B_Heli_Transport_01_F": { _lightright lightAttachObject [_vehicle, [-1, 3.2, -2]]; }; }; _lightright setLightAttenuation [0.181, 0, 1000, 130]; _lightright setLightIntensity 10; _lightright setLightFlareSize 0.38; _lightright setLightFlareMaxDistance 150; _lightright setLightUseFlare true; _lightleft setLightDayLight true; _lightright setLightDayLight true; _transitionState = sunOrMoon; _brightness = 0; _repeat = true; if (_transitionState < 1) then { _brightness = 2; } else { _brightness = 50; }; _leftRed = true; while{ (alive _vehicle) && (_repeat isEqualTo true)} do { if(_leftRed) then { _leftRed = false; _lightright setLightBrightness 0.0; sleep 0.05; _lightleft setLightBrightness _brightness; } else { _leftRed = true; _lightleft setLightBrightness 0.0; sleep 0.05; _lightright setLightBrightness _brightness; }; sleep 0.05; _repeat = _vehicle getVariable "lights"; }; deleteVehicle _lightleft; deleteVehicle _lightright; You can remove any vehicles you don't need or add some. Just remember that you have to add them twice (for the left and the right light). Now you can place a vehicle in the editor and put the following in the init box: this setVariable ["EmergencyVeh", true, true]; Only vehicles with this variable can activate the lights. As always, if you have any questions feel free to ask! Cheers Puffin
  6. This script is best used with a keyhandler, however if you have a bit of experience with coding you can get it also work with addaction. This script works in MP ******************************** Download the sounds here (or use your own ones) Make a folder called sounds and put the two files inside this folder Put the following code in your description.ext class CfgSounds { class Siren { name = "Siren"; sound[] = {"sounds\Siren.ogg", 5.0, 1}; titles[] = {1, ""}; }; class Yelp { name = "Yelp"; sound[] = {"sounds\Yelp.ogg", 5.0, 1}; titles[] = {1, ""}; }; }; Put the following code in your keyhandler: case 33: {//F key if (_shift) then { _vehicle = (vehicle player); if (isNil {_vehicle getVariable "EmergencyVeh"}) then { _vehicle setVariable ["EmergencyVeh", false, true]; }; _ComVeh = _vehicle getVariable "EmergencyVeh"; if (vehicle player != player && (driver _vehicle == player && _ComVeh isEqualTo true)) then { if (isNil {_vehicle getVariable "siren"}) then { _vehicle setVariable ["siren", false, true]; }; _SirenState = _vehicle getVariable "siren"; if (_SirenState isEqualTo true) then { _vehicle setVariable ["siren", false, true]; } else { [[[_vehicle],"scripts\siren.sqf"],"BIS_fnc_execVM",true,false,false] call BIS_fnc_MP; _vehicle setVariable ["siren", true, true]; }; }; }; if (_ctrl) then { _vehicle = (vehicle player); if (isNil {_vehicle getVariable "EmergencyVeh"}) then { _vehicle setVariable ["EmergencyVeh", false, true]; }; _ComVeh = _vehicle getVariable "EmergencyVeh"; if (vehicle player != player && (driver _vehicle == player && _ComVeh isEqualTo true)) then { [[[_vehicle],"scripts\yelp.sqf"],"BIS_fnc_execVM",true,false,false] call BIS_fnc_MP; }; }; }; Create a folder called scripts. Inside this folder create a file called siren.sqf and put the following code into it: Private ["_vehicle"]; _vehicle = _this select 0; _repeat = true; while{ (alive _vehicle) && (_repeat isEqualTo true)} do { _vehicle say3D "Siren"; sleep 5.5; _repeat = _vehicle getVariable "Siren"; }; Inside the folder scripts create a file called yelp.sqf and put the following code into it: Private ["_vehicle"]; _vehicle = _this select 0; _vehicle say3D "Yelp"; Thats it! As always, if you have any questions feel free to ask! Cheers Puffin
  7. This script will spawn a vehicle on a marker and sets a custom vehicle skin. This scripts also works in MP. ******************************** First create a folder called skins and put all your skins in it. Create a folder called scripts. Inside this folder create a file called VehicleSpawner.sqf and put the following code into it: _dest = (_this select 3) select 0; _type = (_this select 3) select 1; _spawn = 0; if (_type == "Sport") then { _spawn = "C_Hatchback_01_sport_F"; }; if (_type == "SUV") then { _spawn = "C_SUV_01_F"; }; if (_type == "Jeep") then { _spawn = "C_Offroad_02_unarmed_F"; }; if (_type == "Offroad") then { _spawn = "C_Offroad_01_F"; }; if (_type == "Hellcat") then { _spawn = "I_Heli_light_03_unarmed_F"; }; if (_type == "Hummingbird") then { _spawn = "B_Heli_Light_01_F"; }; if (_type == "Ghosthawk") then { _spawn = "B_Heli_Transport_01_F"; }; if (_type == "Neophron") then { _spawn = "O_Plane_CAS_02_F"; }; if (_type == "Hunter") then { _spawn = "B_MRAP_01_F"; }; if (_type == "Ifrit") then { _spawn = "O_MRAP_02_F"; }; if (_type == "Marshall") then { _spawn = "B_APC_Wheeled_01_cannon_F"; }; if (_type == "Kuma") then { _spawn = "I_MBT_03_cannon_F"; }; _target = getMarkerPos _dest; _spwnveh = _spawn createVehicle (_target); if (_type == "Sport") then { _spwnveh setObjectTextureGlobal [0, "skins\Limo.jpg"]; }; if (_type == "SUV") then { _spwnveh setObjectTextureGlobal [0, "skins\SUV.jpg"]; }; if (_type == "Jeep") then { _spwnveh setObjectTextureGlobal [0, "skins\MB4WD.jpg"]; }; if (_type == "Offroad") then { _spwnveh setObjectTextureGlobal [0, "skins\Offroad.jpg"]; }; if (_type == "Hellcat") then { _spwnveh setObjectTextureGlobal [0, "skins\Hellcat.jpg"]; }; if (_type == "Hummingbird") then { _spwnveh setObjectTextureGlobal [0, "skins\Hummingbird.jpg"]; }; if (_type == "Ghosthawk") then { _spwnveh setObjectTextureGlobal [0,"skins\Ghosthawk_0.jpg"]; _spwnveh setObjectTextureGlobal [1,"skins\Ghosthawk_1.jpg"]; }; if (_type == "Neophron") then { _spwnveh setObjectTextureGlobal [0, "skins\Neo1.jpg"]; _spwnveh setObjectTextureGlobal [1, "skins\Neo2.jpg"]; }; if (_type == "Hunter") then { _spwnveh setObjectTextureGlobal [0, "skins\Hunter1.jpg"]; _spwnveh setObjectTextureGlobal [1, "skins\Hunter2.jpg"]; }; if (_type == "Ifrit") then { _spwnveh setObjectTextureGlobal [0, "skins\Ifrit1.jpg"]; _spwnveh setObjectTextureGlobal [1, "skins\Ifrit2.jpg"]; }; if (_type == "Marshall") then { _spwnveh setObjectTextureGlobal [0, "skins\Marshall0.jpg"]; _spwnveh setObjectTextureGlobal [1, "skins\Marshall1.jpg"]; _spwnveh setObjectTextureGlobal [2, "skins\Marshall2.jpg"]; }; if (_type == "Kuma") then { _spwnveh setObjectTextureGlobal [0, "skins\kuma_0.jpg"]; _spwnveh setObjectTextureGlobal [1, "skins\kuma_1.jpg"]; _spwnveh setObjectTextureGlobal [2, "skins\kuma_2.jpg"]; }; You can add or remove vehicles you (don't) need, it's pretty self explanatory. And don't forget to change the paths to your skins. Now create an empty marker called spawn_1. You can create multiple markers for different spawn locations. Then place an item in the editor (for example a sign) and add the following code to the init line: this addAction ["Spawn Jeep","scripts\VehicleSpawner.sqf",["spawn_1","Jeep"]]; this addAction ["Spawn Jeep","scripts\VehicleSpawner.sqf",["spawn_1","Jeep"]]; --> spawn_1 is the marker where you want to spawn your vehicle. Change if you want to spawn it eg. on spawn_2. Jeep is the vehicle you want to spawn (You have a line like _type == "Jeep" for every type of vehicle you want to spawn) Repeat this process for every vehicle you want to spawn on that sign. I have made a texture which you can use for your sign. You can download it here Hello, I searched a long time for a working restraining script, which works in MP. Long story short, I didn't found one, so I wrote one myself. Yes it's not perfect, so feel free to improve it, but it works. ******************************** Create a file called onPlayerRespawn.sqf (or use your existing one) and put the following code into it: restrain=false; restcaller=false; Create a folder called scripts. Inside this folder create a file called restrain.sqf and put the following code into it: restcaller = false; if (restrain=false;) then { if (player distance cursortarget < 2) then { restcaller = true; [[[],"scripts\restrainTarget.sqf"],"BIS_fnc_execVM",cursortarget,false,false] call BIS_fnc_MP; }; }; player distance cursortarget < 2 --> the number is the max. distance in meters to restrain someone. Change it to whatever you want. Inside the folder scripts create a file called restrainTarget.sqf and put the following code into it: if (restcaller isEqualto false) then { if (restrain isEqualto false) then { restrain=true; player setVariable ["restrain", true, true]; while { player getVariable ["restrain", false] } do { player playMove "AmovPercMstpSnonWnonDnon_EaseIn"; //Animation in if (((!alive player) || (player getVariable["onkill",FALSE]))) then { player setVariable ["restrain", false, true]; }; }; player playMoveNow "AmovPercMstpSnonWnonDnon_EaseOut"; //Animation out } else { restrain=false; player setVariable ["restrain", false, true]; //Set surrender to true player playMoveNow "AmovPercMstpSnonWnonDnon_EaseOut"; //Animation out }; }; restcaller = false; Using the script: You can either use addaction or a keyhandler to execute the script. When you execute the script the player pointed at by the cursor will be restrained (as long as he's in your configured range). Executing the script again will set the player free. If you have any questions or need help with your mission feel free to ask! Cheers Puffin
  8. Add _unit setVariable ["restcaller ", false]; _unit setVariable ["restrain ", false]; at the end of the script before the line that says } forEach (units _grp);
  9. If you use a script to spawn the unit, place this line inside your script. May I ask which script are you using?
  10. You could insert the parameters in the script you are using to call your units.
  11. MasterPuffin

    [Release] Simple MP Restraining Script

    Have you set the variables in the onPlayeRespawn.sqf correctly? Also try adding those variables in the init.sqf!
  12. MasterPuffin

    [Release] Keyhandler with modificators

    @Taylor2.0 Sorry for the late reply buddy, just use the following code: case 22: {//U key if (_shift) then { execVM "scripts/restrain.sqf"; }; In this case it would trigger the script when you press Shift + U
  13. @Bosh Sorry for the late reply! This should work: if (restcaller isEqualto false) then { if (restrain isEqualto false) then { restrain=true; _this setVariable ["restrain", true, true]; while { _this getVariable ["restrain", false] } do { _this playMove "AmovPercMstpSnonWnonDnon_EaseIn"; //Animation in if (((!alive _this) || (_this getVariable["onkill",FALSE]))) then { _this setVariable ["restrain", false, true]; }; }; _this playMoveNow "AmovPercMstpSnonWnonDnon_EaseOut"; //Animation out } else { restrain=false; _this setVariable ["restrain", false, true]; //Set surrender to true _this playMoveNow "AmovPercMstpSnonWnonDnon_EaseOut"; //Animation out }; }; restcaller = false; and in the init of the AI you put restcaller = false; restrain = false;
  14. When executed this script will give the player a parachute and teleport him into the air at a on the map chosen location. cutText ["Click somewhere on the map to jump from there", "PLAIN"]; player addBackpack "B_Parachute"; openMap true; onMapSingleClick "vehicle player setPos [_pos select 0, _pos select 1, 1000]; onMapSingleClick '';true;"; onMapSingleClick "vehicle player setPos [_pos select 0, _pos select 1, 1000]; onMapSingleClick '';true;"; the number is the height the player is jumping from, change it to whatever you like. If you have any questions or need help with your mission feel free to ask! Cheers Puffin
  15. Hello, I'm using https://community.bistudio.com/wiki/Dynamic_Groups and I want to make a script which checks if a group with a certain name already exists and if not create it and assigns the player to it. In case the group already exists it should assign the player to this group. Does anyone have an idea how to do this? Cheers Puffin
  16. No, in Arma there is no way to skin helmets and vests without a mod. You can skin backpacks however The code has to run forever because at some times Arma loads the default skin even during the mission, for example if you open the Virtual Arsenal. But you are right, it would be better to place the script in the init.sqf
  17. This script will set custom skins to an uniform. It's useful, when you are using a non modded server but still want to have custom uniform textures. ******************************** Create a file called onPlayerRespawn.sqf (or use your existing one) and put the following code into it: _handle = []execVM "scripts\UniformSkin.sqf"; Create a folder called scripts. Inside this folder create a file called UniformSkin.sqf and put the following code into it: while {true} do { waitUntil {(uniform player isEqualTo "U_O_OfficerUniform_ocamo") || (uniform player isEqualTo "U_B_CombatUniform_mcam")}; sleep 1; switch (true) do { case (uniform player isEqualTo "U_O_OfficerUniform_ocamo"): { player setObjectTextureGlobal [0,"YOURSKIN"]; }; case (uniform player isEqualTo "U_B_CombatUniform_mcam"): { player setObjectTextureGlobal [0,"YOURSKIN"]; }; }; waitUntil {(uniform player != "U_O_OfficerUniform_ocamo") || (uniform player != "U_B_CombatUniform_mcam")}; }; Just replace YOURSKIN with the path to your uniform. Also change U_O_OfficerUniform_ocamo etc. to the skins you are setting your skin on. The classnames can be found here. Sometimes the skin bugs away. You can create a second file with the following content: switch (true) do { case (uniform player isEqualTo "U_O_OfficerUniform_ocamo"): { player setObjectTextureGlobal [0,"YOURSKIN"]; }; case (uniform player isEqualTo "U_B_CombatUniform_mcam"): { player setObjectTextureGlobal [0,"YOURSKIN"]; }; }; Executing it (for example via addaction or keyhandler) will set the skin again. Just don't forget to change the variables! If you have any questions or need help with your mission feel free to ask! Cheers Puffin
  18. I have found a bug: Every time the editor crashes, it resets the selected theme.
  19. AFAIK the only way to replace game textures would be to rip out the 3D models from the game files and make a mod with a custom texture. Wich is BTW a legal grey area
  20. I have one more suggestion: Mark brackets wich belong together like notepad ++ does it. For example if (whatever) then { script; more_script; };
  21. MasterPuffin

    Female character models

    I would love to see some female units in the upcoming DLCs. Modders already made decent looking female models, so it should be possible.
  22. @engima I like your editor but I would like to have an installer which puts the files in the program directory. The settings should be stored in the roaming folder. If you need help creating an installer script, I can assist you.
  23. MasterPuffin

    [Release] Repair Script

    You are right, I changed my code to English. But for the sake of simplicity I don't want to use localizations.
  24. When using this script Toolkits can be used to repair a vehicle. Repairing the vehicle will take some time. ******************************** _truck=cursortarget; if (vehicle player == player) then { if (player distance _truck < 3) then { if ("ToolKit" in items player) then { if(animationState player != "AinvPknlMstpsnonWnonDnon_medic_1" ) then { player playMove "AinvPknlMstpsnonWnonDnon_medic_1"; sleep 3; player playActionNow "stop"; player playMove "AinvPknlMstpsnonWnonDnon_medic_1"; sleep 3; player playActionNow "stop"; player playMove "AinvPknlMstpsnonWnonDnon_medic_1"; sleep 3; }; sleep 3; player removeItem "ToolKit"; _truck setdammage 0; hintSilent "Repaired vehicle"; } else { hintSilent "You need a toolkit to repair this vehicle!"; }; }; }; You can either use addaction or a keyhandler to execute the script. If you have any questions or need help with your mission feel free to ask! Cheers Puffin
×