Skip to content

Instantly share code, notes, and snippets.

View headswe's full-sized avatar
🏀
Building cool things

Sebastian Nygren headswe

🏀
Building cool things
View GitHub Profile
@headswe
headswe / init.sqf
Last active August 29, 2015 14:04
Example of addaction and bis_fnc_mp
fnc_OnLaptopInteract = {
// send [], to function "fnc_mission_OnUseLaptop", false = to server, isPersistent = false
[[], "fnc_mission_OnUseLaptop", false, false] spawn BIS_fnc_MP; // launch a RPC to the server telling it to execute the function called "fnc_mission_OnUseLaptop"
};
fnc_mission_OnUseLaptop =
{
_countdown = 300;
MyNonPrivateValue = 5;
while{_countdown > 0 || !triggerActivated _trg} do // while count is under 300 and the trigger has not been activated keep counting
_rightHandPos = (player modelToWorld (player selectionPosition "righthand")) ;
_weaponDir = player weaponDirection currentWeapon player;
_weaponDir = (_weaponDir select 0) atan2 (_weaponDir select 1);
_x = (_rightHandPos select 0) + sin(_weaponDir) * 0.5;
_y = (_rightHandPos select 1) + cos(_weaponDir) * 0.5;
@headswe
headswe / csvdump.sqf
Last active August 29, 2015 14:06 — forked from harakka/csvdump.sqf
///////// XML EXPORT
///////// Usage: [name,CfgPatches name]
///////// Usage : [name] to export bis stuff
_CfgPatches = false;
_configPath = "";
_collectionName = "BIS";
if(count [] > 1) then
{
hlc_rifle_RU556 - AR15 Sanitied Carbine (Magpul AFG, MOE,P-Mag,BAD-lever. Novekse KX3)
hlc_rifle_RU5562 - AR15 Magpul Carbine (Magpul AFG, UBR,P-Mag,BAD-lever. Novekse KX3)
hlc_rifle_Colt727 - Colt Carbine (Colt Model 727 "Commando" - "M4" Barrel, M16A2 Upper, Full-Auto Lower)
hlc_rifle_Colt727_GL - Same as above, add M203
hlc_rifle_bcmjack - Bravo Company MFG/Haley Strategic 'Jack" Carbine ( Milspec M4 reciever, Geissele SMR Mk1, BCMGunfighter Muzzle brake/comp, there's more, but this isn't an advert)
hlc_rifle_Bushmaster300 - Busmaster .300 Carbine (M4A1-profile carbine chambered for .300 Blackout, instead of 5.56mm NATO)
hlc_rifle_vendimus - AR15 .300 Dissipator Carbine (Carbine-length heavy barrel covered by full-length rifle furniture)
hlc_rifle_SAMR - Rock River Arms LAR-15 AMR (Full-Auto-Capable full-length rifle, kitted out to be able to double as a marksman rifle, with accuracy to match)
hlc_rifle_honeybase - AAC 'Honey-Badger',Sans Suppressor
hlc_rifle_honeybadger - AAC 'Honey-Badger' (S
@headswe
headswe / gist:d658aa3714a0392cebf5
Last active August 29, 2015 14:19
Demand : Map
//Dictionary. Fast lookups are critical.
//Dictionaries provide fast lookups,based on keys,to get values. With them, we use keys and values of any type
// returns a new Dictionary handle
_map = createDictionary;
// dicthandle set [key,value];
_map set ["mypos",getpos player];
_map set [32,"threetwo"];
_map set ["friend",_otherPlayer];
_getCluster = {
private ["_clusters","_checkedMen","_distanceMaX","_cluster","_unit"];
_clusters = [];
_checkedMen = [];
_distanceMaX = 35;
{
if(!(_x in _checkedMen)) then
{
_cluster = [_x];
_unit = _x;
params ["_pos","_radius","_side];
{_pos distance2d _x < _radius && {side _x == _side}} count allunits
#include "debug_console.hpp"
conClear();
_items = [];
#define TAB 9
#define BACKWARDSLASH 92
#define QUOTE 34
KK_fnc_insert = {
private ["_arr", "_i", "_res"];
_arr = _this select 0;
_i = _this select 2;
_prevFat = getFatigue player;
while{alive player} do {
_fat = getFatigue player;
_dfat = _fat - _prevfat;
if(_dfat < 0) then {
_unit setFatigue (_fat + _dfat/2);
};
_prevFat = getFatigue player;
uisleep 1;
};
@headswe
headswe / gist:44393ba6ccf4d3fd7aa2
Created November 19, 2015 13:53
Spawn building
params["_path","_pos","_dir"];
_createdObjects = [];
_objects = "isArray (_x >> 'position')" configClasses _path;
_multiplyMatrixFunc =
{
private ["_array1", "_array2", "_result"];
_array1 = _this select 0;
_array2 = _this select 1;
_result =