Jump to content

dreadedentity

Member
  • Content Count

    1224
  • Joined

  • Last visited

  • Medals

Everything posted by dreadedentity

  1. dreadedentity

    Cloaking

    No, if this worked, it would only check if there was a uniform on the ground, not on your character. Here's how I would do it, using the "in" command. private = ["_acceptableUniforms"]; _acceptableUniforms = ["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"]; if ((uniform player) in _acceptableUniforms) then { //cloak player }else { hint "Your uniform is crap, get a better one."; };
  2. First you're going to need an actual unit called range. Then you can shorten that to just one line like this: range globalChat format ["|Rifle Range 2|\nTargets: %1\nHit: %2", _inc, _score]; \n makes a new line, so it should make things look a little nicer
  3. D'oh, I should have known about this command...thanks Das
  4. Not world position. The kind of positions I'm talking about are the kind that you can give units waypoints to stand in certain positions (usually near windows). I've looked through a bunch of house configs but I can't even find a clue for what I'm looking for. Also, is there anywhere I can look for a full list (with explanations) of all the parameters that go into a config file?
  5. dreadedentity

    EMP Grenade

    Great script, I like the effects. There's room for improvement, but your level of skill is higher than most. _AOE = _this select 0; _Lights = nearestObjects [_AOE , ["Lamps_Base_F", "PowerLines_base_F","PowerLines_Small_base_F","PowerLines_Wires_base_F","Land_PowerPoleWooden_F"], 50]; _DamageOFF = 0.95; _DamageON = 0.00; _Vehicles = nearestObjects [(getpos _AOE), ["Car"], 50]; _CountLights = count _Lights; (_Lights select 0) say3D "electricity_loop"; sleep (floor(random 3) +2); for "_i" from 0 to _CountLights do //this will run 1 extra time //replace 0 with 1 or _CountLights with (_CountLights - 1) { if (getDammage (_Lights select _i) < 0.90) then { (_Lights select _i) setDamage _DamageOFF; sleep 0.1; (_Lights select _i) setDamage _DamageON; sleep 0.1; (_Lights select _i) setDamage _DamageOFF; sleep 0.1; }; }; { if (isEngineOn _x) then {_x setHit ["motor", 1]} } foreach _Vehicles; I only saw 1 logic error in the code _position = (_this select 0); _AOE = 50; { _x say3D "electricity_loop"; _x setHit ["light_1_hitpoint", 0.97]; //all possible light hitpoints _x setHit ["light_2_hitpoint", 0.97]; //no lights escape this _x setHit ["light_3_hitpoint", 0.97]; _x setHit ["light_4_hitpoint", 0.97]; } forEach (nearestObjects [_position, [ "Lamps_base_F", //These are all the lights' base classes "PowerLines_base_F", "PowerLines_Small_base_F" ], _AOE]); This code should have the same effect, but without the light flashing before going out and it only works with lights not vehicles. I have faith that you'll be able to reproduce the effect, though.
  6. Iceman, I think you're nested one level too deep there, buddy. _position = [[getPos (_this select 0), 75]] call BIS_fnc_randomPos;
  7. dreadedentity

    Arrays and for do help

    missionNamespace setVariable and forEach //put all _posDrop's in an array _outputArray = []; { missionNamespace setVariable[format["_veh%1",_forEachIndex], createMine ["APERSMine", _x, [], 0]]; _outputArray pushBack [format["_veh%1", _forEachIndex]; }forEach _posDropArray; EDIT: I didn't see there was more to your post. So basically, any time you write a spawning script, it should return an array with the objects spawned for easy script-transferring. That way you eliminate weird stuff like this: veh0 = _veh0; veh1 = _veh1; veh2 = _veh2; and you can get the positions of all the vehicles with another simple loop that's essentially the same as the first code, using the array of variable strings that we output { missionNamespace setVariable[format["_posDrop%1",_forEachIndex], call compile format["getPosATL %1", _x]]; }forEach _outputArray; Yeah...that might just be crazy enough to work. ---------- Post added at 23:04 ---------- Previous post was at 22:28 ---------- Let's try another approach, because I really wasn't paying enough attention while I wrote my first post. Things were done in a weird way. Let's start with the way you're spawning units. You should always return an array with those units inside, unless you don't plan on ever needing to run code on them that can't be run during spawning. Something like this: //fictional function //let's say the first parameter is unit to spawn and second parameter is how many. _vehArray = ["B_SOLDIER_F", 6] call DREAD_spawnUnits; Now that you have an array with all of the units, you can easily get the positions of each with: _posArray = []; { _posArray pushBack [getPosATL _x]; }forEach _vehArray; //returns an array with all the positions You can even write a function for that, feed the first array in, and get the position array from the output. Now for the fun part, where we create the mines and give them variables. For ease of understanding, let's say I turned the above code into a function, got the array of positions and named it _posArray. Now we would be able to use something like in my first post to create dynamic variables. _outputArray = []; { missionNamespace setVariable[format["_veh%1",_forEachIndex], createMine ["APERSMine", _x, [], 0]]; _outputArray pushBack [format["_veh%1", _forEachIndex]; }forEach _posArray; So now what you've got an array of strings that each have the same name as variables, which at any time you can use something like: _obj = missionNamespace getVariable (_outputArray select 3); And now you have an actual variable, which you can use to do code with. (All of this should be considered "At least in theory", I have never gotten a setup this crazy to work. And I've been trying for 185 posts worth of time)
  8. dreadedentity

    Custom MessageBox Dialog control

    What is the error? I'm assuming that GUI's are a non-scheduled environment (Cannot use sleep, uiSleep, or waitUntil since the suspend script operation). A very informative explanation of scheduled & non-scheduled can be found on the documentation page for call (scroll down to Notes) One last thing, duration and onLoad are not required parameters, but you may want to add movingenabled = false;. If you don't need them, just take them out. Also, you didn't have to make custom functions, a simple createDialog would suffice, unless you need to pass parameters to the dialog.
  9. dreadedentity

    AI Report Direction of Fire

    So the problem with "FiredNear" is that units must be within 69 meters for it to flag. Arma's AI can engage from outside of 200 meters, and they can easily spot enemies within 100 meters. But if you've gotten that solved already you can try the reveal command. I'm not sure if this would make units use their radio to call out enemies or not. But if they do, then it would require the units to be in a group with the player or he would never see the radio message. Another, possibly better, solution would be to make the soldier that was fired at respond with a sideChat message, although, this has locality issues in multiplayer (sideChat only writes the message for computer where the code was run, it does not work like normal side chat messages in multiplayer) and if you don't code it carefully you'll end up with numerous side chat messages as each soldier responds to the threat.
  10. I downloaded his code and had a poke around. find "\JWC_CASFS\casMenu.hpp" and open it (you can use notepad). Scroll down until you see: class btnRequest: JWC_Button { idc = 100112; text = "Request CAS"; action = "casRequest = true; abortCAS = false; closeDialog 0"; y = 0.619; x = 0.006; w = 0.178; h = 0.090; color[] = {0, 0, 0, 1}; colorFocused[] = {0,0,0,1}; //add this animTextureNormal = ""; animTextureDisabled = ""; animTextureOver = ""; animTextureFocused = ""; animTexturePressed = ""; animTextureDefault = ""; class TextPos { left = 0.023; top = 0.027; right = 0.005; bottom = 0.005; }; }; That should fix that. Don't forget to save the file. EDIT: For anyone interested in how to debug a GUI here's the process I followed to fix this. First I looked at the picture DarkXess posted a few posts above mine. The error was found in desciption.ext which is where the code was run. In description.ext I found this: #include "JWC_CASFS\casMenu.hpp" Great! Let's head over to casMenu.hpp. I opened that up and look what I found: class btnRequest: JWC_Button Important? Yes! Now you can put your colorFocused definition anywhere in that class, the only exception is that you can't put it in another class, like class TextPos which is so conveniently there. I prefer to keep similar definitions close to each other, though, so I put colorFocused under color. Picture for clarity (colors correspond with thought processes):
  11. @DarkXess and Brinik I don't know how he set up his GUI code but I've become pretty familiar with GUI coding. It looks like you guys need to open description.ext, find the class definitions and add colorFocused[] = {0,0,0,0};
  12. dreadedentity

    Cloaking

    One last quick note, if you want things to be invisible in multiplayer you should use hideObjectGlobal instead. hideObject only runs on the local client, meaning that you'll be invisible on your screen, but everybody else can still see you.
  13. dreadedentity

    Rappelling off of building?

    For edge detection, you might want to start with boundingBox and boundingBoxReal. Honorable mentions to sizeOf and boundingCenter but they return so little information that I can't see usefulness in them.
  14. dreadedentity

    Cloaking

    You're new to scripting and you figured out how to use particle effects? I've been looking at the documentation for that shit for 3 days and couldn't figure it out. Well done
  15. Wiki page with everything you can put in description.ext. That link will take you straight to where respawns are, but you can look at everything else too.
  16. Hello all, I got bored again tonight and decided to mess around with Event Handlers. Turns out making a gun that shoots strider's is easy! I wish my video didn't come out at 360p for some reason and is blurry as hell. add to your init.sqf player addEventHandler ["Fired", { _bullet = _this select 6; _dir = _this select 0; _velocity = velocity _bullet; [_bullet, _velocity, _dir] spawn { sleep 0.02; _newPos = getPos (_this select 0); deleteVehicle (_this select 0); _newBullet = createVehicle ["I_MRAP_03_F", _newPos, [], 0, "NONE"]; //_newBullet setDir (_this select 2); //breaks setVelocity for some reason. do not uncomment. _newBullet setVelocity (_this select 1); }; }];
  17. Thanks, I still get commands wrong sometimes too! Anyway, the reason I had spawned a new thread was specifically for the sleep statement, you don't want to spawn a car right at the barrel. Maybe I should have tested that, though. I just thought it was best to avoid it so I don't inadvertently create an awesome suicide method. :p Also, I noticed that sometimes the cars would not be spawned where they should (sometimes they'd be off to the side), is that related to the "CAN_COLLIDE" you changed?
  18. Never seen Moricky post, havne't seen Larrow in a couple of days, and KK rarely posts :(
  19. dreadedentity

    Cloaking

    Priority sets how high it shows up in the action list, the next parameter after that makes it so the option shows up when you get close enough or you have to scroll your mouse wheel.
  20. dreadedentity

    Cloaking

    this addaction ["cloak", "cloak.sqf", [], 6, false, true]; addAction Look at "showWindow" and "hideOnUse" in the parameter explanations. As for the particle effects, I have no idea how to use them or set them up. We'll have to wait for someone else to come explain :p
  21. hurts my feelings :p Anyway the problem with using in is that you can only find if an element is in the array and the problem with using count is it only tells you how many matches there are. That code I posted will tell you, if, how many, and their position within the array to search. :coop:
  22. Sorry to steal the spotlight, but I'm just having so much fun iterating through arrays! /* USAGE: _result = [P1, P2] call DREAD_fnc_searchArrayForElements; P1: ARRAY - Array containing elements to find. P2: ARRAY - Array containing elements to search for. RETURNS: An array containing arrays consisting of the indexes the input elements were found on. EXAMPLE: _search = ["a", "b", "c", "d", "a", "b", "c", "d"]; _find = ["a", "d"]; _result = [_search, _find] call DREAD_fnc_searchArrayForElements; RETURNS: [ [0, 4] , [3, 7] ]; NOTE: Function will not stop after finding the first match. Function will find all instances of matching elements. NOTE: If an element is not found, result will be "[]". */ DREAD_fnc_searchArrayForElements = { private ["_search", "_find", "_result", "_testedElement", "_curElement"]; _search = [_this, 0, [], [[]]] call BIS_fnc_param; _find = [_this, 1, [], [[]]] call BIS_fnc_param; _result = []; { _testedElement = _x; _curElement = []; { if (_testedElement == _x) then { _curElement pushBack _forEachIndex; }; }forEach _search; _result pushBack _curElement; }forEach _find; _result }; Minimally tested, pretty much only tested with strings. Theoretically can process arrays of any size, though, again, minimally tested. Hope this helps.
  23. Clarify a little for me, so are you trying to see if any elements in _arraySrch are contained in _arraySt?
  24. Are you trying to keep them in formation while they attack?
×