-
Content Count
1224 -
Joined
-
Last visited
-
Medals
Everything posted by dreadedentity
-
How to remove all items of certain type / category from array?
dreadedentity replied to Undeceived's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Basically...we need to know more about what you're trying to do. -
How to remove all items of certain type / category from array?
dreadedentity replied to Undeceived's topic in ARMA 3 - MISSION EDITING & SCRIPTING
subtraction [a, a, b, a, c, a, d, a, e, a] - [a] = [b, c, d, e] -
[Request] Need a custom base
dreadedentity replied to oshydaka's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Such serious, JShock. lol Obviously I'm not going to make a base for him either, but I definitely know how I can help him have an easier time @oshydaka actionStatus = false; { _x addAction ["Pick Up", { if (!actionStatus) then { (_this select 0) attachTo [(_this select 1)]; (_this select 0) setUserActionText [(_this select 2), "Drop"]; }else { detach (_this select 0); (_this select 0) setUserActionText [(_this select 2), "Pick Up"]; }; actionStatus = !actionStatus; },[],6,true,true,"",""]; }forEach (allMissionObjects "ALL" - [player]); player addAction ["Save to clipboard", { clipboard = ""; { pos = getPos _x; pos set [2, round (pos select 2)]; clipboard = clipboard + format["_obj = createVehicle [""%1"", %2, [], 0, ""NONE""]:_obj setDir %3:", typeOf _x, pos, round direction _x]; }forEach (allMissionObjects "ALL" - [player]); copyToClipboard clipboard; }]; Just put some stuff down where you think you will want them to be, then copy this, click preview, paste it into the debug console, and click "local exec". This code will allow you to pick up objects and move them, then you can save everything. Select the "save to clipboard" option, then open notepad and paste it in there. Press "ctrl + h" and replace all : with ; then you can copy that and paste it into a script. Hope that helps EDIT: This fully works in the current version of Arma 3, at the time of this posting. To anybody in the present or future claiming this doesn't work, you did it wrong. -
Cant remove DAR missiles from Hellcat? Can someone confirm/deny using sample mission?
dreadedentity replied to Sari's topic in ARMA 3 - MISSION EDITING & SCRIPTING
It seems I was wrong, you might be interested in removeWeaponTurret and addWeaponTurret. I'm testing a few lines of code to see if there's an easy way to return the turret position, will edit if I figure it out. -
Attach AR-2 Darter to soldier = poorman's helmetcam
dreadedentity replied to mikkol's topic in ARMA 3 - MISSION EDITING & SCRIPTING
There is also a command that does this switchCamera "VIEW" -
3D sound not looping
dreadedentity replied to reaper lok's topic in ARMA 3 - MISSION EDITING & SCRIPTING
This is really funny. @REAPER "script kiddie" is a negative term so being called one is quite an insult. :p -
Spawned Plane Crashes Instantly
dreadedentity replied to IndeedPete's topic in ARMA 3 - MISSION EDITING & SCRIPTING
A lot of people seem to be having this problem lately, I've tried all I can to help (theoretically). I guess I'll just have to whip up a quick mission. Or could you post your mission and I'll test it? -
BIS_fnc_loadFunctions
dreadedentity replied to Igitur's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I'm not sure exactly what you're asking for, but you may be interested in adding a function to your description.ext But I think for addons, you'll be better off with preprocessFile or preprocessFileLineNumbers -
everything = allUnits; markers = []; player addAction ["Show Markers", { { deleteMarker _x }forEach markers; //delete all markers to prevent duplicates markers = []; { _marker = createMarker ["Unit" + (str _forEachIndex), (getPos _x)]; _marker setMarkerShape "ICON"; _marker setMarkerType "MIL_DOT"; markers pushBack _marker; }forEach everything; }]; player addAction ["Remove Markers", { { deleteMarker _x }forEach markers; markers = []; }]; Since this is just for debug we don't have to worry about local variables
-
Sure, you can do something like _allUnits = []; _effectTimer = [] spawn { sleep 60; //cloak device will last for 1 minute }; while (!scriptDone _effectTimer) do { _objects = nearestObjects [getPos _grenade, ["man"], 10]; _allUnits = _allUnits - _objects; //prevents duplicates in the array _allUnits = _allUnits + _objects; //prevents duplicates in the array { hideObjectGlobal _x; }forEach _objects; }; { _x hideObjectGlobal false; }forEach _allUnits; Be warned, any units that walk into the AOE will be cloaked until the effect wears off, even if they leave the anomaly. I could probably build a better system, but I was just banging my keyboard for a minute to get this typed up quickly. The anti-zombie script is much simpler because it doesn't have to keep track of any of the units, it just kills them. For this script, you have to keep track of the units so you can un-hide them after the effect wears off.
-
Cant remove DAR missiles from Hellcat? Can someone confirm/deny using sample mission?
dreadedentity replied to Sari's topic in ARMA 3 - MISSION EDITING & SCRIPTING
removeWeaponTurret works in the current version. I don't use the dev version. You can't removeWeapon from vehicles as far as I know, you'll need to make an addon to do that. -
Cant remove DAR missiles from Hellcat? Can someone confirm/deny using sample mission?
dreadedentity replied to Sari's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Tested this in editor and it works like a charm this removeMagazinesTurret ["24Rnd_missiles",[-1]] -
I kind of want to start my own scripting team
dreadedentity replied to dreadedentity's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I agree with this, that's part of the reason I'll sit at my computer all day responding to posts. The other part is because I love seeing what somebody can do, when you give them a hint here and a code there. As for my big superproject, I'm not really sure what I'd like to accomplish. At the moment, I'm working on a server-side dynamic loot system just to see if I can do it. -
BIS_fnc_paramWeather AND BIS_fnc_setOvercast
dreadedentity replied to bigshot's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I agree with JShock here, it seems the main/only difference is network broadcast, meaning you'll only have to call it on one client/machine. I don't agree with needing to be executed in a scheduled environment, though, I looked through BIS_fnc_paramWeather in the functions viewer and there were no sleeps. In fact (and this is what I thought was interesting), it doesn't do anything except call BIS_fnc_setOvercast. So actually they do the exact same thing. So it seems JShock and I were both wrong. No, this is called script handle. You only need to know this if you intend to terminate the script early. But that only applies if you use spawn or exec or execVM. I would recommend using call instead for setOvercast, because spawn is unnecessary. Now, when you use call, you're going to get an actual result, that's why I'll always assign a new variable when I call something. Actually, only call needs to be in a scheduled environment, spawn, exec(not used anymore), execVM, and I guess execFSM all create scheduled environments when they run. But that's a good find, JShock, that's the exact page where I learned about scheduled vs. non-scheduled. :) EDIT: I'll share one small thing with you guys, I've been looking for non-scheduled environments for days and I've only found 2, unit Initialization and the editor Debug Console. I'm unsure about Event Handlers, and I'm pretty sure GUI's are but I haven't tested it. init.sqf is scheduled (I have run many sleeps from it, even before I started looking) for reasons I'm not sure of, and all code-run scripts are scheduled because you have to use execVM to run them. If you're ever unsure if a piece of code is unscheduled or not, throw in a sleep statement. You will get error "Generic error in expression". VERY LAST EDIT: Try not to use random in multiplayer scripts, because every client will get a different result...probably not the effect you want. -
Problem with Markers...help
dreadedentity replied to BEAKSBY's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Have you seen this with your eyes? I bet the other boxes actually aren't spawning at all. Your script changes the string to an object after the first box spawns. createVehicle. The reason this isn't working is because you change the first parameter from a string to an object. Then, since the command doesn't use objects for it's first parameter, the command simply fails. _box = createVehicle [_box ,[0,0,0], _markerArray, 50, "NONE"]; // ^you're probably better off just changing this to the classname of the thing you want to spawn. -
You're welcome. Make sure you add "-showScriptErrors" to your startup parameters.
-
Works fine with the double quotes, I just tested it in VR. player addAction ["Cloak", "hint ""You have cloaked.""", [], 6, false, true, "", " (uniform player) in [""U_B_Protagonist_VR"",""U_B_Soldier_VR"",""U_C_Soldier_VR"", ""U_I_Protagonist_VR"",""U_I_Soldier_VR"",""U_O_Protagonist_VR"",""U_O_Soldier_VR""] "];
-
Creating Civilian Behaviour
dreadedentity replied to Ice_Rhino's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I see no reason why this cannot be done with some simple code this addEventHandler ["FiredNear", { (_this select 0) allowFleeing 0; //dis-allow fleeing _positions = [nearestBuilding (_this select 0)] call BIS_fnc_buildingPositions; //get positions in closest building _move = _positions select (floor random (count _positions)); //select random position _waypoint = (group (_this select 0)) addWaypoint [_move, 0]; //create waypoint at position _waypoint setWaypointType "MOVE"; //order unit to move to position _waypoints = waypoints (group (_this select 0)); //get array of waypoints [] spawn { waitUntil {(count _waypoints) != (count (waypoints (group (_this select 0))))}; //this checks to see if the unit has reached their waypoint deleteVehicle (_this select 0); //delete unit }; }]; This should work (for editor-placed units) EDIT: added a line of code that will prevent the civs from fleeing, if I remember correctly civs always flee because they have no weapons, this will prevent them from ever reaching their waypoint and de-spawning. Use caution, because of the nature of urban combat and the extremely close distance something must be for the "FiredNear" EH to flag, civs might run directly in front of your guns. While you're shooting. -
You can use _this if you want, but there's not really a point since the action will be added to the player, and _this = player.
-
3D sound not looping
dreadedentity replied to reaper lok's topic in ARMA 3 - MISSION EDITING & SCRIPTING
No sense in having the sound being played by trigger activation or distance-based, this will cause duplicate sounds if a player runs in and out of the activation area. The absolute simplest way to do this is to have the sound playing constantly. Also, if you only want the sound heard within 8 meters, you should use playSound3D. Something like this would work nicely: while {true} do { _distance = 8; _volume = 50; playSound3D ["mySound.ogg", _myUnit, false, getPos _myUnit, _volume, 1, _distance]; sleep (length of sound); }; //you need to test _volume, because the smaller the distance the higher the volume needs to be for you to hear it. -
Don't forget to put a semicolon at the end.
-
3D sound not looping
dreadedentity replied to reaper lok's topic in ARMA 3 - MISSION EDITING & SCRIPTING
while {true} do { _unitName say3D "sound"; sleep (how long your sound is); }; -
You're supposed to put the arguments before priority, my mistake. About the option not showing up, put: hint str (uniform player); before the action, and add that to the list.
-
Putting it in init.sqf will work just fine. In the error message it should say #, tell me where that is or post a picture of the error message.
-
You can use the code I posted to make it so the action only shows up if you're wearing the right uniform. There are a lot of optional arguments when you use addAction, one of them is a condition. Example: player addAction ["Action Name", { code }, priority, arguments, showText, hideOnUse, shortcut, CONDITION]; // ^1 ^2 //1: Everything past here is optional. //2: Everything past here is for Take On Helicopters ONLY // What your action should look like: player addAction ["Cloak", "cloak.sqf or whatever name", 6, [], false, true, "", {(uniform player) in ["U_B_Protagonist_VR", "U_B_Soldier_VR", "U_C_Soldier_VR", "U_I_Protagonist_VR", "U_I_Soldier_VR", "U_O_Protagonist_VR", "U_O_Soldier_VR"]}]; //Action will ONLY show up if condition is true, so you can delete the uniform checking from the script. You may have to use quotes in the condition, but try it like that. If that doesn't work then you have to replace { and } with quotes. Now, anytime you are trying to use quotes inside quotes you need to use double quotes ( " ""stuff"" " ) so the compiler understands what you mean correctly. This is why I hate the stupid "code strings".