You could make it disappear with the "cursorTarget" and "deleteVehicle" command.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
This might be of use to some. I wrote a script to deploy a laptop. It will always be a scroll option for all players, until they deploy it. I set it so that it won't deploy within a certain distance of another laptop. You can tweak that 400 variable to get a distance of your own choosing. I did this to keep people from deploying a hundred laptops on top of each other. Ideally, there should be some way to have an option to "shutdown" the laptop which would delete it. But I haven't figured that part out yet.
Put this in the fn_selfactions.sqf:
Code:// LAPTOP ON START private ["_laptop"]; _laptop = count nearestObjects [_playerPos, ["Notebook"], 400] > 0; if((speed player <= 1) && _canDo and !_laptop) then { hasLaptop = true; } else { hasLaptop = false; }; if (hasLaptop) then { if (LaptopON< 0) then { LaptopON = player addAction [("<t color=""#0096ff"">" + ("Laptop On") +"</t>"),"scripts\LaptopON.sqf","",5,false,true,"",""]; }; } else { player removeAction LaptopON; LaptopON = -1; }; // LAPTOP ON END
and then this goes in your scripts folder as LaptopON.sqf:
Code:player playActionNow "Medic"; sleep 1; titleText ["Your laptop is powering up.","PLAIN DOWN"]; titleFadeOut 5; _mypos = getposATL player; _dir = getdir player; _mypos = [(_mypos select 0)+2*sin(_dir),(_mypos select 1)+2*cos(_dir), (_mypos select 2)]; _laptopON = createVehicle ["Notebook", _mypos, [], 0, "CAN_COLLIDE"]; _laptopON setDir _dir; _laptopON setposATL _mypos; sleep 2; titleText ["System online.","PLAIN DOWN"]; titleFadeOut 5;
One problem is that the laptop spawns backwards. I would like for it to spawn in with the screen facing the player. Not sure how to do that. I'll update it when I get that far.
This might be of use to some. I wrote a script to deploy a laptop. It will always be a scroll option for all players, until they deploy it. I set it so that it won't deploy within a certain distance of another laptop. You can tweak that 400 variable to get a distance of your own choosing. I did this to keep people from deploying a hundred laptops on top of each other. Ideally, there should be some way to have an option to "shutdown" the laptop which would delete it. But I haven't figured that part out yet.
Put this in the fn_selfactions.sqf:
Code:// LAPTOP ON START private ["_laptop"]; _laptop = count nearestObjects [_playerPos, ["Notebook"], 400] > 0; if((speed player <= 1) && _canDo and !_laptop) then { hasLaptop = true; } else { hasLaptop = false; }; if (hasLaptop) then { if (LaptopON< 0) then { LaptopON = player addAction [("<t color=""#0096ff"">" + ("Laptop On") +"</t>"),"scripts\LaptopON.sqf","",5,false,true,"",""]; }; } else { player removeAction LaptopON; LaptopON = -1; }; // LAPTOP ON END
and then this goes in your scripts folder as LaptopON.sqf:
Code:player playActionNow "Medic"; sleep 1; titleText ["Your laptop is powering up.","PLAIN DOWN"]; titleFadeOut 5; _mypos = getposATL player; _dir = getdir player; _mypos = [(_mypos select 0)+2*sin(_dir),(_mypos select 1)+2*cos(_dir), (_mypos select 2)]; _laptopON = createVehicle ["Notebook", _mypos, [], 0, "CAN_COLLIDE"]; _laptopON setDir _dir; _laptopON setposATL _mypos; sleep 2; titleText ["System online.","PLAIN DOWN"]; titleFadeOut 5;
One problem is that the laptop spawns backwards. I would like for it to spawn in with the screen facing the player. Not sure how to do that. I'll update it when I get that far.
That's a good idea. It's too bad there aren't more electronic items in Day Z to cannibalize. My idea was to require a flashlight be sacrificed for its batteries. So maybe I'll add scrap and tools to the requirements, and a flashlight. Then the device would work for a limited time before self destructing when it runs out of juice. And in the process you lose your flashlight, so people wouldn't be able to dupe dozens of them on the spot. I'll get to work on that then.you should require the player to have a toolbox and scrap metal to use it
Yes, I have gotten the power down option to pop up, but so far I'm having trouble with the deletevehicle.You could make it disappear with the "cursorTarget" and "deleteVehicle" command.
Try this....after _dir = getdir player;
_dir = _dir + 180;
if (_dir > 360.0) then {
_dir = _dir - 360.0;
};
That's a good idea. It's too bad there aren't more electronic items in Day Z to cannibalize. My idea was to require a flashlight be sacrificed for its batteries. So maybe I'll add scrap and tools to the requirements, and a flashlight. Then the device would work for a limited time before self destructing when it runs out of juice. And in the process you lose your flashlight, so people wouldn't be able to dupe dozens of them on the spot. I'll get to work on that then.
Thanks. The idea, I think, is to require scrap and a flashlight to create a laptop, and on activation the scrap and flashlight are removed. It runs for a time, and then shuts off. The scrap is deposited back in the inventory. Flashlight is lost, because its battery got drained. I have a working script to do this, it's based off the zombie emitter script, so credit where credit is due. I wanted to borrow its timer for the battery life.I'd be glad to lend any assisstance I can, now that I am home and have a decent computer to work with.
// LAPTOP ON START
private ["_laptop"];
_laptop = count nearestObjects [_playerPos, ["Notebook"], 4] > 0;
if((speed player <= 1) && _canDo and !_laptop && ("PartGlass" in magazines player) && ("PartGeneric" in magazines player) && ("ItemToolbox" in items player) && ("ItemFlashlight" in items player)) then {
hasLaptop = true;
} else {
hasLaptop = false;
};
if (hasLaptop) then {
if (LaptopON< 0) then {
LaptopON = player addAction [("<t color=""#0096ff"">" + ("Laptop On") +"</t>"),"scripts\LaptopON.sqf","",5,false,true,"",""];
};
} else {
player removeAction LaptopON;
LaptopON = -1;
};
// LAPTOP ON END
private ["_mypos", "_dir", "_createLaptop", "_sounddist", "_battery", "_Laptop", "_LaptopON", "_timer", "_soundList"];
player playActionNow "Medic";
sleep 1;
titleText ["Your laptop is powering up.","PLAIN DOWN"]; titleFadeOut 5;
_mypos = getposATL player;
_dir = getdir player;
_mypos = [(_mypos select 0)+2*sin(_dir),(_mypos select 1)+2*cos(_dir), (_mypos select 2)];
_createLaptop = createVehicle ["Notebook", _mypos, [], 0, "CAN_COLLIDE"];
_createLaptop setDir _dir;
_createLaptop setposATL _mypos;
sleep 1;
player removeMagazine "PartGeneric";
player removeWeapon "ItemFlashlight";
player removeMagazine "PartGlass";
sleep 1;
titleText ["System online.","PLAIN DOWN"]; titleFadeOut 5;
_sounddist = 50;
_battery = 18;
while {_battery > 1} do {
_Laptop = nearestObject [player, "Notebook"];
[nil,_Laptop,rSAY,["", _sounddist]] call RE;
_LaptopON = (alive _Laptop);
_timer = time;
while {_LaptopON} do {
if ((time - _timer) > 5) exitwith {};
};
_soundList = [""] call BIS_fnc_selectRandom;
[nil,_Laptop,rSAY,[_soundList, _sounddist]] call RE;
_battery = _battery - 1;
};
sleep 1;
deleteVehicle _createLaptop;
player addMagazine "PartGeneric";
player addMagazine "PartGlass";
titleText ["The laptop's battery is critically low.","PLAIN DOWN"]; titleFadeOut 5;
//LAPTOP OFF START
if(cursorTarget isKindOf "Notebook") then {
if (LaptopOFF < 0) then {
LaptopOFF = player addAction ["Power Down Laptop","scripts\laptopOFF.sqf",cursorTarget, 0, false, true, "",""];
};
} else {
player removeAction LaptopOFF;
LaptopOFF = -1;
};
//LAPTOP OFF END
Agreed. I've updated my last post to require the windscreen.I think you should have a screen required to, so use a windshield as the item "PartGlass" I think. Also you can have them craft a generator and it works within a 400 meter radius of the cameras, and the laptop and powers them.
Hehe nice =)
Its such a buzz people using my stuff. I have only been arma coding for like 2 months. Done some tricky stuff for Epoch recently!
// NOTEBOOK ON START
private ["_laptop"];
_laptop = count nearestObjects [_playerPos, ["Notebook"], 4] > 0;
if((speed player <= 1) && _canDo and !_laptop && ("Kostey_notebook" in items player) && ("ItemFlashlight" in items player)) then {
hasNotebook = true;
} else {
hasNotebook = false;
};
if (hasNotebook) then {
if (NotebookON < 0) then {
NotebookON = player addAction [("<t color=""#0096ff"">" + ("Notebook On") +"</t>"),"scripts\notebookON.sqf","",5,false,true,"",""];
};
} else {
player removeAction NotebookON;
NotebookON = -1;
};
// NOTEBOOK ON END
private ["_mypos", "_dir", "_createLaptop", "_sounddist", "_battery", "_Laptop", "_LaptopON", "_timer", "_soundList"];
player playActionNow "Medic";
sleep 1;
titleText ["You use the flashlight's batteries to power your notebook.","PLAIN DOWN"]; titleFadeOut 5;
_mypos = getposATL player;
_dir = getdir player;
_mypos = [(_mypos select 0)+2*sin(_dir),(_mypos select 1)+2*cos(_dir), (_mypos select 2)];
_createLaptop = createVehicle ["Notebook", _mypos, [], 0, "CAN_COLLIDE"];
_createLaptop setDir _dir;
_createLaptop setposATL _mypos;
sleep 1;
player removeWeapon "Kostey_notebook";
player removeWeapon "ItemFlashlight";
sleep 1;
titleText ["System online.","PLAIN DOWN"]; titleFadeOut 5;
_sounddist = 50;
_battery = 18;
while {_battery > 1} do {
_Laptop = nearestObject [player, "Notebook"];
[nil,_Laptop,rSAY,["", _sounddist]] call RE;
_LaptopON = (alive _Laptop);
_timer = time;
while {_LaptopON} do {
if ((time - _timer) > 5) exitwith {};
};
_soundList = [""] call BIS_fnc_selectRandom;
[nil,_Laptop,rSAY,[_soundList, _sounddist]] call RE;
_battery = _battery - 1;
};
sleep 1;
deleteVehicle _createLaptop;
player addWeapon "Kostey_notebook";
titleText ["The laptop's battery is critically low.","PLAIN DOWN"]; titleFadeOut 5;
Sorry for the delay. I got frustrated so I went and worked on another thing. So far I have successfully made the notebook spawn in a store by subbing it out with a script I've been using to swap items from rmod into the game.nice, let us know if the solutions work.
spawn_loot = compile preprocessFileLineNumbers "scripts\spawn_loot.sqf";
private["_itemType","_iPos","_indexLootSpawn","_iArray","_iItem","_iClass","_item","_qty","_max","_tQty","_arrayLootSpawn","_canType","_holderItem"];
// [_itemType,_weights]
_iItem = _this select 0;
_iClass = _this select 1;
_iPos = _this select 2;
_radius = _this select 3;
_holderItem = _iItem;
switch (_iItem) do {
case "Binocular": { _holderItem = "Kostey_notebook"};
default {};
};
_iItem = _holderItem;
switch (_iClass) do {
default {
//Item is food, add random quantity of cans along with an item (if exists)
_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
_arrayLootSpawn = [] + getArray (configFile >> "cfgLoot" >> _iClass);
_itemType = _arrayLootSpawn select 0;
_weights = _arrayLootSpawn call fnc_buildWeightedArray;
_qty = 0;
_max = ceil(random 4) + 1;
//diag_log ("LOOTSPAWN: QTY: " + str(_max) + " ARRAY: " + str(_arrayLootSpawn));
while {_qty < _max} do {
private["_tQty","_indexLootSpawn","_canType"];
_tQty = floor(random 1) + 1;
//diag_log ("LOOTSPAWN: ITEM QTY: " + str(_tQty));
_indexLootSpawn = _weights call BIS_fnc_selectRandom;
_canType = _itemType select _indexLootSpawn;
_holderItem = _canType;
switch (_canType) do {
// case "Kostey_notebook": { _holderItem = "Notebook"};
default {};
};
_canType = _holderItem;
//diag_log ("LOOTSPAWN: ITEM: " + str(_canType));
_item addMagazineCargoGlobal [_canType,_tQty];
_qty = _qty + _tQty;
};
if (_iItem != "") then {
_item addWeaponCargoGlobal [_iItem,1];
};
};
case "weapon": {
//Item is a weapon, add it and a random quantity of magazines
_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
_item addWeaponCargoGlobal [_iItem,1];
_mags = [] + getArray (configFile >> "cfgWeapons" >> _iItem >> "magazines");
if (count _mags > 0) then {
_item addMagazineCargoGlobal [(_mags select 0),(round(random 3)+2)];
};
};
case "magazine": {
//Item is one magazine
_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
_item addMagazineCargoGlobal [_iItem,1];
};
case "object": {
//Item is one magazine
_item = createVehicle [_iItem, _iPos, [], _radius, "CAN_COLLIDE"];
};
};
if (count _iPos > 2) then {
_item setPosATL _ipos;
};
Add the following in your fn_selfactions.....
Code://CCTV if(cursorTarget isKindOf "Notebook" and _canDo) then { if (s_player_Laptop < 0) then { s_player_Laptop = player addAction ["Activate Laptop Surveillance","cctv\init.sqf",cursorTarget, 0, false, true, "",""]; }; } else { player removeAction s_player_Laptop; s_player_Laptop = -1; }; //End
Once your done with that make a folder called cctv and add the 2 included files (found here: www.zombiebattalion.net/CCTV.rar )into that folder.
Once all this is done you need to go into your editor and place cameras wherever you want them.You also need to add a Laptop somewhere on map to interact with. Classnames are (Notebook) and (Loudspeaker) .
In the editor they are found at Object (small) -> Notebook , Loudspeaker
Depending on how many cameras you place and how for apart they are you may need to adjust the following line to a larger radius.
Found in cctv/init.sqf "CCTV_radius = 500; // Radius which notebooks detect cameras"
Hope this helps...and again this is not my script/code. Credit goes to https://github.com/maca134/dayz-cctv