Jump to content

dreadedentity

Member
  • Content Count

    1224
  • Joined

  • Last visited

  • Medals

Everything posted by dreadedentity

  1. dreadedentity

    Cloaking

    For invisibility you may be interested in hideObject and hideObjectGlobal. But for the wavy particle effects I have no idea.
  2. Google: What is a scalar? I guess you could consider that it's the engine's way of saying "Something is here but that's all I can tell."
  3. dreadedentity

    Player locker system

    2 questions about this in 2 days, wow! I was trying to smash out some code yesterday to answer another thread about pretty much this exact topic, but apparently the event handler that I wanted to use is currently not working in stable releases and I should go to the dev branch (still haven't). But if you want to go to the dev branch here's the code I came up with (re-written to work with OBJECTS rather than sides). /* USAGE: _name = [P1, P2] execVM "script.sqf"; P1: OBJECT - The container you want to lock. P2: OBJECT - The only player that can access the container. */ _obj = [_this, 0, objNull, [objNull]] call BIS_fnc_param; _player = [_this, 1, objNull, [objNull]] call BIS_fnc_param; _obj addEventHandler ["ContainerOpened", { _openedContainer = _this select 0; _unit = _this select 1; if (_player != _unit) then { _unit action ["CancelAction", _unit]; hint "You are not allowed to access this container"; }; }]; This code relies on the "_player" variable being passed to the event handler through the script, I'm not sure if it actually works that way. So this code might not work at all.
  4. Ah okay, I'm sure you already know about this, but if you tried to "select -1" it would throw a "Generic Error in Expression" error because -1 is not a valid index. Also, in case it wasn't clear what I changed, I changed _number to _i in the second line. It would likely throw "Undefined variable in expression: _number" as there was no code to pre-define it.
  5. dreadedentity

    Some help with suice vest

    add -showScriptErrors to your arma 3 startup parameters
  6. _superArray = [["apples", "oranges", "bananas", "kiwis"], [3, 17, 9, 5]]; _i = (_superArray select 0) find "oranges"; _number = (_superArray select 0) select _number; something looks wrong here, maybe try: _superArray = [["apples", "oranges", "bananas", "kiwis"], [3, 17, 9, 5]]; _i = (_superArray select 0) find "oranges"; if (_i != -1) then //returned value will be -1 if searched element was not found { _number = (_superArray select 1) select _i; }else { hint "Element was not found."; };
  7. dreadedentity

    Some help with suice vest

    You dropped these: [ ] _veh3 = createVehicle [vehname3, getPos player, [], 0, "NONE"]; createVehicle (array)
  8. I don't think there's a predefined BIS function that can search nested arrays. I know you're smart enough to write your own function though, waltenberg. Screw it, I freaking love nested loops and nested arrays. /* USAGE: _result = [P1, P2] call DREAD_fnc_findInNestedArray; RETURNS: An array containing the element of the array the desired result was found on, and the element of the result within that array. If the element is not found, result will be an array with a single element consisting of "Not Found". P1: ARRAY - Array you want to test. P2: ANY - Element you want to find. EXAMPLE: _superArray = [[12, "apple"], [5, "orange"], [17, "banana"]]; _result = [_superArray, "banana"] call DREAD_fnc_findInNestedArray; RETURNS: [3, 2] NOTE: Function will stop and return position at first found element. NOTE: Arrays of all sizes can be input, as long as they are only nested one deep. */ DREAD_fnc_findInNestedArray = { private ["_result", "_result2", "_stopLoop", "_found"]; { _stopLoop = false; { _found = false; _result2 = _forEachIndex; if (str _x == str(_this select 1)) then { _stopLoop = true; _found = true; }; if (str _x == str(_this select 1)) exitWith {_result2}; }forEach _x; _result = [_forEachIndex + 1, _result2 + 1]; if (_stopLoop) exitWith {_result}; }forEach (_this select 0); if (!_found) then { _result = ["Not Found"]; }; _result; }; Tested and confirmed working for Numbers and Strings. Not sure about other variable types though. ---------- Post added at 03:08 ---------- Previous post was at 02:58 ---------- Iceman gave me an idea, you could probably do something with this: DREAD2 = { { _x find (_this select 1); }forEach (_this select 0); }; Usage is currently set up to be the same, but you'll have to add your own result-returning and breakouts. Also, untested.
  9. dreadedentity

    locked ammo box for other side?

    I was messing around with the container EH when I found it doesn't work on stable and made my thread about it, to answer this question. lol
  10. Wondering if it's broken or if I'm just using it wrong. This is the code I tried: _obj = _this select 0; _obj addEventHandler ["ContainerOpened", { _openedContainer = _this select 0; _unit = _this select 1; hint "Fuck this shit."; if (side _unit != west) then { _unit action ["CancelAction", _unit]; hint "You are not allowed to access this container"; }; }]; Run the script in an ammobox's init line, passing "this" to get the object. Tested by using an Op4 rifleman to run up and used both "Inventory" option, and "Rearm" option. Neither comment shows up. Also tested replacing ContainerOpened with InventoryOpened and transposing _this select 0 & _this select 1 (I understood from the wiki that they're opposite from ContainerOpened for some reason). What's wrong here?
  11. dreadedentity

    ContainerOpened EH broken?

    Completely innocent question, what are the benefits to using the dev branch? Would code written with it work in stable releases, or would clients have to run dev branch also? I downloaded it once before to play around with rotorlib but it was extremely difficult for me to fly with it.
  12. Press ctrl + shift + s, come up with a name and click save. Then paste it to your .hpp. That's how I've been doing it.
  13. I see, I never made that distinction before.
  14. All of that should go in the condition field. But thisList is terrible to use inside trigger conditions because it only returns an array of units that are currently satisfying the trigger's condition. Using it in the condition will make the trigger un-triggerable for the simple reason that they will never satisfy the condition and be put into thisList. thisList is much better off in the On Activation field. I looked at the picture and I can't tell what you're trying to do at all. ---------- Post added at 04:23 ---------- Previous post was at 04:18 ---------- I looked at the picture again and I think I figured out what you want the trigger to do. Condition: this; On Act.: { _x setPos (getPos xflag2); }forEach thisList;
  15. dreadedentity

    Weird Purchase Message

    I got one of those 2 days ago. I came back to my computer and the message was there. Freaked me out because I have removed my CC information from Steam and my account wallet is $0.00. Not sure if this is the right board for this topic though.
  16. Not sure what your problem is at first-glance, but I did change a bit of code and add a lot of comments with suggestions/changes. _opCenter = createCenter west; //move to init.sqf west setFriend [east, 0]; //move to init.sqf _bluCenter = createCenter east; //move to init.sqf east setFriend [west, 0]; //move to init.sqf //Not sure if the above code is actually necessary at all, I have spawned opfor units with scripts in empty missions before without having problems. Either way, you only want this code to run once, because each side only needs one Center. _planePilots = []; //for testing purposes switch(side player)do { case WEST:{ _planeType = "B_Heli_Light_01_armed_F"; }; case EAST:{ _planeType = "O_Heli_Light_02_F" ; }; }; _grp = createGroup (side player); for "_i" from 0 to 2 do { sleep .05; _spos = [(getPosATL player select 0) - (sin _planeDirection) * _planeDistance, (getPosATL player select 1) - (cos _planeDirection) * _planeDistance , 50]; if (_i == 1) then { _plane1Pos = [_spos, _planeSpread,_planeDirection -90] call bis_fnc_relpos; _plane1Pos set [2,_flyHeight]; _spos = _plane1Pos; }; if (_i == 2) then { _plane1Pos = [_spos, _planeSpread,_planeDirection +90] call bis_fnc_relpos; _plane1Pos set [2,_flyHeight]; _spos = _plane1Pos; }; _plane = createVehicle [_planeType, _spos, [], 0, "FLY"]; if (_i == 0) then { _plane setRank "LIEUTENANT"; }else { _plane setRank "SERGEANT"; }; /* if (_i == 1) then { _plane setRank "SERGEANT"; }; if (_i == 2) then { _plane setRank "SERGEANT"; }; */ //can be done with one "if" statement //_grp setSpeedMode "FULL"; _plane setDir _planeDirection; _plane flyInHeight _flyHeight; // PRESET VELOCITY /* _vel = velocity _plane; _plane setVelocity [ (_vel select 0) + (sin _planeDirection * _speed), (_vel select 1) + (cos _planeDirection * _speed), (_vel select 2) ]; */ if (side player == WEST) then //forgot to put "if" at the beginning. { _plane setAmmo ["missiles_DAR", 0] } else { _plane setAmmo ["missiles_DAGR", 0] }; _plane allowDamage _allowDamage; //_allowDamage not defined in posted code _plane setSkill 1; //maximum skill? // MAY HAVE TO REMOVE CREW FIRST {deletevehicle _x} foreach (crew _plane); //no need to assign a new variable _crew = [_plane,_grp] call bis_fnc_spawncrew; _grp setFormation "VEE"; _planeArray = _planeArray + [_plane]; //_planeArray will only be available in the current script. Also, not necessary to do this when you can use (units _grp) to get an array with all units in the group. _plane sideChat "Air Cav on it's way!"; //message will be sent 3 times _planePilots pushBack (driver _plane); //puts each pilot into an array }; [] spawn //will display all helicopter pilots. Used for testing. { while {true} do { hintSilent format["%1", _planePilots]; }; }; Also, I'm not sure what you mean by it spawns and then crashes into the ground. Does it tilt downward and to the right? This is a sign that there's no pilot (I added code already to easily check that).
  17. dreadedentity

    trigger condition help

    thisList is a very nice magic variable, but it wouldn't achieve the result I think you're looking for in this case. A lot of details on what you're trying to do are left out, but what I would do is this: //Put all units that should be checked into a group (!alive target1) && {{alive _x} count _enemyGroup <= 7} This condition uses Lazy Evaluation, meaning the first condition that returns false, the game engine stops checking the rest of the conditions (saves CPU performance that way). So what exactly it does it it checks if target1 is dead. If it's not, it doesn't check the next condition. If it is, then it moves on to check "if the number of alive units in _enemyGroup is less than or equal to 7". That should give you the effect you want. EDIT: If you're doing this in the condition field of a trigger in the editor, you can't use a local variable (any variable with an underscore in front of it _myVar). It will return an error "local variable in global space". Hope that helps
  18. BangaBob wrote a pretty cool script that I think does exactly what you're looking for. Enemy Occupation System
  19. Hello all, As some of you may know, I'm terrible with addActions. So I need some help. I need a toggle-able action that, when used, will remove any other toggle-able actions in the player's action menu. I'm using this to pick up objects, so that's why it needs to be toggle-able and why other options need to be removed when used. Thanks
  20. It depends on what my function or script does. 9 times out of 10 my function is going to return a value, so I wouldn't ever assign a null variable, I'd assign normal variable. Actually, in my scripts, if my function doesn't return a value I don't usually try to assign it one, I'll just use [] call myFunction; However, for a script, it's a different story. All of the scripts that I've released to-date are meant to run continuously until the end of the mission. I assign script handles to null because I don't really know of effect of it. I'm not sure if it just destroys the handle, but what I can absolutely be sure of is that running another script and using null again will overwrite the first handle and make the first script impossible to terminate.
  21. dreadedentity

    Help with an action

    I try not to focus on anything I consider trolling, it's always a pleasure to look over your always-informative code and try to learn something from it/you. I consider myself to be the bottom 2 kinds of people. Keep coming in my threads!!!
  22. Hello all, I got bored and decided that it would be fun to see if I can make a person jump. You can! my init.sqf player addAction ["Jump (for loop)", { for "_i" from 0 to 12 do { player setPos [getPos player select 0, getPos player select 1, (_i / 12)]; sleep 0.02; }; }]; player addAction ["Jump (setVelocity)", { _vel = velocity player; _dir = direction player; _speed = 1; player setVelocity [ (_vel select 0) + (sin _dir * _speed), (_vel select 1) + (cos _dir * _speed), (_vel select 2) + 5 ]; }]; [] spawn { while {true} do { _position = getPos player; if (_position select 2 < getPos player select 2) then { hintSilent format["%1", getPos player select 2]; }; }; }; I don't know how to bind code to keypresses so this is where I leave you. Have fun!
  23. dreadedentity

    Simple Icons

    Dread's Simple Icons Hello all, Have you ever wanted to put icons above the heads of certain units? You're in luck! Now that's possible. This has now become a 2-part release, the original script and a (supposedly) JIP compatible version. Let me state for the record right now that I'm no good at multiplayer scripting, but that shouldn't be a problem because of the way I set up the JIP script anyway. Have fun! 9/24/2014 1:35pm US eastern: I have just updated both scripts, you can now choose the icon you use for each unit. If you don't want to, the script will revert to the old way of auto-choosing based on side. Example Mission (Dropbox) (contains old scripts, copy/paste from below) Photo from example Mission: http://i.imgur.com/Itl0llM.jpg (177 kB) Notes: You can leave P2 as "" to have no text underneath the icons. You can make and use your own icons with the latest release! (untested)DO NOT TERMINATE YOUR SCRIPT. It will not stop drawing the icons, actually, all it will do is make it not possible to ever stop drawing the icons because that code is contained within the script itself. The correct way to stop drawing the icons is with BIS_fnc_removeStackedEventHandler. You can then terminate the script if you wish. Version: Consider-to-be Final Release (I might add stuff if the suggestions are really awesome) Stable in: Current release of Arma 3 (at the date of this posting). Known Bugs: None that I know of. DE_simpleIcons.sqf ///////////////////////////////////// // Function file for Armed Assault // // Created by: DreadedEntity // ///////////////////////////////////// /* USAGE: _handle = ["P1", "P2", ["P3_a", "P3_b", "P3_c", etc.], P4, "P5"] execVM "DE_simpleIcons.sqf"; _handle = Can be anything. Multiple instances can use the exact same handle without issue. P1: STRING - UNIQUE(!!!) name for the onEachFrame event. Name must be unique or instances will be overwritten. P2: STRING - Text you want to appear under each icon. P3: ARRAY - Array of classnames("STRINGS") of units you want to make icons for. P4: NUMBER - Distance from player to create unit icons. P5: STRING (OPTIONAL) - Name of icon you want to use. (include filetype) EXAMPLE: null = ["eachFrame", "Kill", ["O_SOLDIER_F", "O_OFFICER_F"], 1000, "targetCiv.jpg"] execVM "DE_simpleIcons.sqf"; Any Opfor riflemen and officers within 1000 meters of the player will have a purple marker above their heads when run. */ _name = _this select 0; _text = _this select 1; _classNames = _this select 2; _distance = _this select 3; _icon = [_this, 4, "None", [""]] call BIS_fnc_param; waitUntil {time > 0}; MISSION_ROOT = call { private "_arr"; _arr = toArray __FILE__; _arr resize (count _arr - 19); toString _arr }; //Kudos to Killzone_Kid for this _units = nearestObjects [player, _classNames, _distance]; [_name, "onEachFrame", { { if ((alive _x) && {!isPlayer _x}) then { _iSize = (0.5) - (0.01 / (player distance _x)); _unitPos = [(getPos _x) select 0, (getPos _x) select 1, ((getPos _x) select 2) + 2]; if (_this select 2 != "None") then { drawIcon3D[MISSION_ROOT + "\icons\" + (_this select 2), [1,1,1,0.5], _unitPos, _iSize, _iSize, 0, _this select 1]; } else { switch (side _x) do { case west: {drawIcon3D[MISSION_ROOT + "\icons\targetWest.jpg", [1,1,1,0.5], _unitPos, _iSize, _iSize, 0, _this select 1];}; case east: {drawIcon3D[MISSION_ROOT + "\icons\targetEast.jpg", [1,1,1,0.5], _unitPos, _iSize, _iSize, 0, _this select 1];}; case independent: {drawIcon3D[MISSION_ROOT + "\icons\targetGuer.jpg", [1,1,1,0.5], _unitPos, _iSize, _iSize, 0, _this select 1];}; case civilian: {drawIcon3D[MISSION_ROOT + "\icons\targetCiv.jpg", [1,1,1,0.5], _unitPos, _iSize, _iSize, 0, _this select 1];}; }; }; }; }forEach (_this select 0); }, [_units, _text, _icon]] call BIS_fnc_addStackedEventHandler; waitUntil {{alive _x} count _units == 0}; [_name, "onEachFrame"] call BIS_fnc_removeStackedEventHandler; @PersianMO brought it to my attention that this might not work with JIP's so I modified the script and it should work with JIP's perfectly DE_simpleIconsJIP.sqf ///////////////////////////////////// // Function file for Armed Assault // // Created by: DreadedEntity // ///////////////////////////////////// /* USAGE: _handle = ["P1", "P2", [P3_a, P3_b, P3_c, etc.], "P4"] execVM "DE_simpleIconsJIP.sqf"; _handle = Can be anything. Multiple instances can use the exact same handle without issue. P1: STRING - UNIQUE(!!!) name for the onEachFrame event. Name must be unique or instances will be overwritten. P2: STRING - Text you want to appear under each icon. P3: ARRAY - Array of OBJECTS you want to make icons for. P4: STRING (OPTIONAL) - Name of icon you want to use. (include filetype) EXAMPLE: null = ["eachFrame", "Kill", enemyUnits] execVM "DE_simpleIconsJIP.sqf"; */ _name = _this select 0; _text = _this select 1; _units = _this select 2; _icon = [_this, 3, "None", [""]] call BIS_fnc_param; waitUntil {time > 0}; MISSION_ROOT = call { private "_arr"; _arr = toArray __FILE__; _arr resize (count _arr - 22); toString _arr }; //Kudos to Killzone_Kid for this [_name, "onEachFrame", { { if ((alive _x) && {!isPlayer _x}) then { _iSize = (0.5) - (0.01 / (player distance _x)); _unitPos = [(getPos _x) select 0, (getPos _x) select 1, ((getPos _x) select 2) + 2]; if (_this select 2 != "None") then { drawIcon3D[MISSION_ROOT + "\icons\" + (_this select 2), [1,1,1,0.5], _unitPos, _iSize, _iSize, 0, _this select 1]; } else { switch (side _x) do { case west: {drawIcon3D[MISSION_ROOT + "\icons\targetWest.jpg", [1,1,1,0.5], _unitPos, _iSize, _iSize, 0, _this select 1];}; case east: {drawIcon3D[MISSION_ROOT + "\icons\targetEast.jpg", [1,1,1,0.5], _unitPos, _iSize, _iSize, 0, _this select 1];}; case independent: {drawIcon3D[MISSION_ROOT + "\icons\targetGuer.jpg", [1,1,1,0.5], _unitPos, _iSize, _iSize, 0, _this select 1];}; case civilian: {drawIcon3D[MISSION_ROOT + "\icons\targetCiv.jpg", [1,1,1,0.5], _unitPos, _iSize, _iSize, 0, _this select 1];}; }; }; }; }forEach (_this select 0); }, [_units, _text, _icon]] call BIS_fnc_addStackedEventHandler; waitUntil {{alive _x} count _units == 0}; [_name, "onEachFrame"] call BIS_fnc_removeStackedEventHandler; All persons are free to use and modify these scripts to fit their needs, provided the original credit remains intact or I am credited somewhere in the modified script.
  24. dreadedentity

    Simple Icons

    No, you can call DE_simpleIcons.sqf also if you want, rather than be specifically for JIP's DE_simpleIconsJIP.sqf was just meant to synchronize what teammates see and what a joined player sees. Ideally, you would add all enemies to an array after creating them, then publicVariable the array, which could be received by a JIP, and then that JIP could run DE_simpleIconsJIP.sqf with the array as a parameter, ensuring that he sees what the other players are seeing. But you could use DE_simpleIconsJIP.sqf exclusively if you want.
  25. dreadedentity

    Hunger/Thirst System (Done but with issues)

    Don't worry about trying to display chat. Players can press / to look at past messages (I think this only works in multiplayer though)
×