-
Content Count
1224 -
Joined
-
Last visited
-
Medals
Everything posted by dreadedentity
-
If then else stament
dreadedentity replied to ravsun's topic in ARMA 3 - MISSION EDITING & SCRIPTING
What doesn't work about this? -
Flashing Hint
dreadedentity replied to driftingnitro's topic in ARMA 3 - MISSION EDITING & SCRIPTING
The sound that hint plays is tied to some sound setting in-game. I don't remember which slider it was, but through my tweaking to find the optimal sound volume for me, the sound has now completely disappeared. Also, if it's a problem, I welcome you to use the hintSilent command. -
Flashing Hint
dreadedentity replied to driftingnitro's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I've never heard of combosetext but there is composeText that has the same function you described. I just assumed you made a typo. ---------- Post added at 04:12 ---------- Previous post was at 04:01 ---------- I've simplified your script, fixed the errors, and confirmed it's working: _titlered = parseText "<t color='#cc0000' size='1.2' shadow='1' shadowColor='#ffcc00' align='center'>Mission Update:</t>"; _titleylw = parseText "<t color='#ffcc00' size='1.2' shadow='1' shadowColor='#cc0000' align='center'>Mission Update:</t>"; _text = parseText "<t align='center'>All primary targets destroyed</t>"; //opportunity to play a nice sound here for "_i" from 0 to 5 do { if (_i % 2 == 0) then { hint composeText [_titlered, linebreak, linebreak, _text]; } else { hint composeText [_titleylw, linebreak, linebreak, _text]; }; sleep 0.5; }; Structured text didn't seem to care about your \n\n so I removed them and added a double linebreak using the composeText command. I think only a single linebreak looks much better, but it's your script in the end. -
Spawn Ai in a Loop
dreadedentity replied to m1ndgames's topic in ARMA 3 - MISSION EDITING & SCRIPTING
//replace: if (count (units INDEPENDENT_Group) > _playerscount) exitWith {}; //with hintSilent format ["Units in IND_Group: %1", count units INDEPENDENT_Group]; if (count (units INDEPENDENT_Group) > _playerscount) exitWith {}; Writing tests is a good way to find and solve logical errors. Also, you have way too many useless comments. Example: _counter = _counter + 1 //increment "_counter" by 1 -
setName Problem
dreadedentity replied to doubleblind's topic in ARMA 3 - MISSION EDITING & SCRIPTING
As always, formatting your code into easily-read lines goes a long way: "B_G_Soldier_F" createUnit [ position player, group player, format [ " this setVariable ['BIS_enableRandomization',false]; u%1 = this; this call DB_fnc_RandomLoadout; this setName [str %2,str %3,str %2]; //I think it should be (this setName [(str %2) + ' ' + (str %3), str %2, str %3];) ",unitCount,_name select 1,_name select 0 //I think it should be (",unitCount, _name select 0, _name select 1) this assumes that the arrray should be ordered FirstName/LastName ] ]; -
Problem with if...then condition.
dreadedentity replied to beno_83au's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I'm not too sure about that if statement being the cause, but just to be safe, I threw in some appropriate parenthesis. I always say, "when it fucks up, wrap it up". Leaving out parenthesis is pretty hit-or-miss in arma scripting. Sometimes the code will work as intended, other times it will bone your entire script. At best it causes undefined behavior. Try this: if((side _x) != west && {(getPos _x) distance (getMarkerPos "centremkr") < 1000}) then Also this: if (!isServer) exitWith {}; is a horrible practice. Just don't. You shouldn't ever need a catch-all like this. It's really not so hard to write: if (isServer) then { //server scripts } else { //client scripts }; in init.sqf. Good structure will save you a lot of headaches...trust me. -
Timer Script Question
dreadedentity replied to treoctone's topic in ARMA 3 - MISSION EDITING & SCRIPTING
_seconds = 0; _secondsTemp = 0; _minutes = 0; _hours = 0; while {true} do { _timer = [] spawn { uiSleep 1; //uiSleep uses system time rather than in-game timekeeping (which is tied to framerate) and is therefore more accurate }; _seconds = _seconds + 1; _hours = floor (_seconds / 3600); _minutes = floor((_seconds - (_hours * 3600)) / 60); _secondsTemp = floor (_seconds - (_hours * 3600) - (_minutes * 60)); if (_hours < 10) then { _hours = "0" + (str _hours); }; if (_minutes < 10) then { _minutes = "0" + (str _minutes); }; if (_secondsTemp < 10) then { _secondsTemp = "0" + (str _secondsTemp); }; waitUntil {scriptDone _timer}; //all math should be done before before the script has finished, //this prevents the CPU from simply sitting idle and then wasting time number crunching when it should be displaying information hint format ["%1:%2:%3", _hours, _minutes, _secondsTemp]; //after script is finished then the proper amount of time has passed, display the info }; That's as efficient in every aspect as I can make this in my current state of inebriation (script size, script speed, cpu time wasted). Also, the total amount of seconds that has passed is preserved so that it can be used elsewhere as an event trigger. With 2 small changes you can modify this from counting up to counting down and make some other cool things. Actually, I think this is so cool that I will post this as a code snippet -
Problem with kicking non crew class from vehicle
dreadedentity replied to alleycat's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I'm a little confused here, do you want to eject all of the non-"crew" from a vehicle, or just kicking out everyone that isn't the "crew" class? If it's the former, this might suit your needs: DE_ejectVehicleCargo = { //accepts vehicles as input. Behavior with non-vehicle input is undefined. //Example: myCar call DE_ejectVehicleCargo //Returns: BOOLEAN //true if cargo successfully ejected //false if cargo was not ejected (this should never happen but it's nice to include things like this to your functions) _veh = _this; _count = 0; _output = false; _check = count (crew _veh); { if ((_veh getCargoIndex _x) > -1) then { if (alive _x) then { _count = _count + 1; _x action ["Eject", _veh]; //"Eject" can be replaced with "GetOut" }; }; }forEach (crew _veh); if ((count (crew _veh)) == (_check - _count)) then { _output = true; }; _output; }; EDIT: Just remembered that dead units can't do "actions" so added an condition that only counts alive units for the success check Example usage: _test = false; while {!_test} do { _test = myVehicle call DE_ejectVehicleCargo; }; //Doing it this way guarantees that the action will be completed successfully -
[HELP]What is RscSlider?
dreadedentity replied to j_murphy's topic in ARMA 3 - MISSION EDITING & SCRIPTING
This is a slider -
Creating 3D Markers for Multiplayer
dreadedentity replied to m1ndgames's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I'm pressed for time right now, and I can look a little more closely later, but 1 best practice that I noticed right-off-the-bat: execVM returns a script handle, but I assume you don't care to save the script handle because you're assigning it to the global variable NULL. NULL is not a reserved word in sqf, you are in fact assigning that script handle to a real variable. This could cause undefined behavior, script errors, or difficult-to-debug scripts in the future if you try to use NULL as a test, ie. if (myVar == NULL) then There are 2 best practices for saving a script handle you don't care about. 1. simply...not save it. You are not required to actually save any output from the commands 2. Try assigning the script handle to a number. Numbers in sqf are reserved and cannot be re-assigned a different value. Example: 0 = [] execVM "myScript.sqf"; Method #2 is rather useful when using the 2D editor and running scripts from unit init boxes, where saving the script handle into a variable is required (for some goddamn reason) Hope that helps for now. I'll look more closely later -
What am I doing wrong wtth this XP/Level script?
dreadedentity replied to Nebulazer's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Honestly, if you want to make this infinitely scale-able, you could just keep adding cases, but a much better option is to use a mathematical function to calculate levels. Say the function you're using is y = 2x^3, where x represents a level and y represents the amount of exp needed to reach that level. Your function would probably look something like this: calcLevel = { _level = _this; //function should always take "p_level" as an argument. ex. _currentLevel = (p_level) call calcLevel; while (p_exp >= 2(_level^3)) do { _level = _level + 1; //test level starting from input level and going until the correct level is found }; p_level = _level; _level; //set the global level identifier and return the value }; Using this function, you're entire levels.sqf can be reduced to: (uiNameSpace getVariable "myUI_LevelTitle") ctrlSetText format ["Level: %1", (p_level) call calcLevel]; At this point, I would question the use of a separate script to hold it, and just put it in a function instead -
What am I doing wrong wtth this XP/Level script?
dreadedentity replied to Nebulazer's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I've simplified your "Levels.sqf", it should be shorter and run faster: switch (true) do { case (p_exp >= 24000): { p_level = 6; }; case (p_exp >= 12000): { p_level = 5; }; case (p_exp >= 6000): { p_level = 4; }; case (p_exp >= 3000): { p_level = 3 }; case (p_exp >= 1500): { p_level = 2; }; case (p_exp >= 0): { p_level = 1; }; }; (uiNameSpace getVariable "myUI_LevelTitle") ctrlSetText format ["Level: %1", p_level]; The only other thing you need to know now is that every time you give a player exp, they need to run the script again and recalculate their level EDIT: Also that there is no "=>" operand -
Arma 3 "objects"?
dreadedentity replied to mr-blizzard's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Yes it does, however you cannot access object attributes directly, they've all been encapsulated and abstracted. The only way to get the information each field contains is by using the scripting commands available to us. When you say objects "like JavaScript", I assume you're talking about objects in the context of object-oriented programming. The answer is most undoubtedly yes, because Real Virtuality is also most likely written in an object-oriented programming language (probably C++ like almost every game these days). For example their solider class might look something like this: class Soldier_Base { public: model = //stuff name = //stuff faction = NULL health = 1; direction = 0; float returnDirection() { return direction; }; //other fields and functions } However, there is no way to access object attributes directly using .sqf (and probably .sqs also). We have to use commands like getDir or direction: _myDir = direction player; //equivalent C++ statement (pre-compiled code): resultToSQF = Soldier_Base.returnDirection(); Notice how we did not access the variable directly, but rather used a function? Using functions to return relevant information rather than accessing attributes directly is called encapsulation. -
2 questions (3d sound whole server can here, and changing sky effects)
dreadedentity replied to acoustic's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Those dust clouds were created using particle effects -
What am I doing wrong wtth this XP/Level script?
dreadedentity replied to Nebulazer's topic in ARMA 3 - MISSION EDITING & SCRIPTING
If this is all you're putting in the debug console: p_exp=p_exp+1500; hint "XP +1500"; (uiNameSpace getVariable "myUI_LevelTitle") ctrlSetText format ["Level: %1",level]; Then you need to actually run the script again before you will see any changes. I'll go ahead and suggest you post everything you've done, rather than pieces (which are completely useless if you don't post the right ones) -
Get the variable of a group
dreadedentity replied to whiztler's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Thanks, KK. Thread is kind of weird. I'm convinced OP has a misunderstanding of what exactly a variable is at the "fundamentals"-level -
Get the variable of a group
dreadedentity replied to whiztler's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Wait, this is weird. Are you really asking how to get the variable name from in-game? ---------- Post added at 02:48 ---------- Previous post was at 02:23 ---------- I think this is going to be as good as it gets: _vars = allVariables missionNamespace; _var = ""; { if ((call compile _x) == myGroup) then { _var = _x; }; } forEach _vars; -
Get the variable of a group
dreadedentity replied to whiztler's topic in ARMA 3 - MISSION EDITING & SCRIPTING
groupID -
General scripting performance question
dreadedentity replied to redarmy's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Do note that the damage that is returned using (_this select 2) is the total damage of the unit after calculating damage from the hit. Using this code will result in an exponential damage increase, not a base damage increase. To do this properly, you must first isolate the damage that the hit caused, then multiply that, then set the damage to the unit. I may have been thinking of the "HandleDamage" event handler instead. this addEventHandler ["HandleDamage", { _unit = _this select 0; _totalDamage = _this select 2; _curHealth = damage _unit; _shotDamage = _totalDamage - _curHealth; //Isolate the damage that the shot caused (_curHealth + (_shotDamage * DAMAGE_MULTIPLIER)); //Return the modified damage to the engine because the engine will take care of adding the damage to the unit }]; In this code, I have set a global variable called DAMAGE_MULTIPLIER which you can set in init.sqf (or wherever you want). Alternatively, you can just replace that with a number. Also, this. lol. like...how can we help you if you don't give any details about it "not working". -
Set object texture from URL?
dreadedentity replied to blckeagls's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Of course it is possible, but it would be much more work than it's worth to do. Check out callExtension. But I think hosting an ftp server is something that not many people know how to do, and writing an extension would be extremely difficult for non-programmers. -
terminate script does not work!?!?
dreadedentity replied to Ranwer135's topic in ARMA 3 - MISSION EDITING & SCRIPTING
sleep 2; Area_A say3D "C4_Beep"; sleep 1.9; Area_A say3D "C4_Beep"; sleep 1.9; Area_A say3D "C4_Beep"; sleep 1.9; Area_A say3D "C4_Beep"; sleep 1.9; Area_A say3D "C4_Beep"; sleep 1.8; Area_A say3D "C4_Beep"; sleep 1.8; Area_A say3D "C4_Beep"; sleep 1.8; Area_A say3D "C4_Beep"; sleep 1.8; Area_A say3D "C4_Beep"; sleep 1.7; Area_A say3D "C4_Beep"; sleep 1.7; Area_A say3D "C4_Beep"; sleep 1.7; Area_A say3D "C4_Beep"; sleep 1.7; Area_A say3D "C4_Beep"; sleep 1.6; Area_A say3D "C4_Beep"; sleep 1.6; Area_A say3D "C4_Beep"; sleep 1.6; Area_A say3D "C4_Beep"; sleep 1.6; Area_A say3D "C4_Beep"; sleep 1.5; Area_A say3D "C4_Beep"; sleep 1.5; Area_A say3D "C4_Beep"; sleep 1.5; Area_A say3D "C4_Beep"; sleep 1.5; Area_A say3D "C4_Beep"; sleep 1.4; Area_A say3D "C4_Beep"; sleep 1.4; Area_A say3D "C4_Beep"; sleep 1.4; Area_A say3D "C4_Beep"; sleep 1.4; Area_A say3D "C4_Beep"; sleep 1.3; Area_A say3D "C4_Beep"; sleep 1.3; Area_A say3D "C4_Beep"; sleep 1.3; Area_A say3D "C4_Beep"; sleep 1.3; Area_A say3D "C4_Beep"; sleep 1.2; Area_A say3D "C4_Beep"; sleep 1.2; Area_A say3D "C4_Beep"; sleep 1.2; Area_A say3D "C4_Beep"; sleep 1.2; Area_A say3D "C4_Beep"; sleep 1.1; Area_A say3D "C4_Beep"; sleep 1.1; Area_A say3D "C4_Beep"; sleep 1.1; Area_A say3D "C4_Beep"; sleep 1.1; Area_A say3D "C4_Beep"; sleep 1; Area_A say3D "C4_Beep"; sleep 1; Area_A say3D "C4_Beep"; sleep 1; Area_A say3D "C4_Beep"; sleep 1; Area_A say3D "C4_Beep"; sleep 0.9; Area_A say3D "C4_Beep"; sleep 0.9; Area_A say3D "C4_Beep"; sleep 0.9; Area_A say3D "C4_Beep"; sleep 0.9; Area_A say3D "C4_Beep"; sleep 0.8; Area_A say3D "C4_Beep"; sleep 0.8; Area_A say3D "C4_Beep"; sleep 0.8; Area_A say3D "C4_Beep"; sleep 0.8; Area_A say3D "C4_Beep"; sleep 0.7; Area_A say3D "C4_Beep"; sleep 0.7; Area_A say3D "C4_Beep"; sleep 0.7; Area_A say3D "C4_Beep"; sleep 0.7; Area_A say3D "C4_Beep"; sleep 0.6; Area_A say3D "C4_Beep"; sleep 0.6; Area_A say3D "C4_Beep"; sleep 0.6; Area_A say3D "C4_Beep"; sleep 0.6; Area_A say3D "C4_Beep"; sleep 0.5; Area_A say3D "C4_Beep"; sleep 0.5; Area_A say3D "C4_Beep"; sleep 0.5; Area_A say3D "C4_Beep"; sleep 0.5; Area_A say3D "C4_Beep"; sleep 0.4; Area_A say3D "C4_Beep"; sleep 0.4; Area_A say3D "C4_Beep"; sleep 0.4; Area_A say3D "C4_Beep"; sleep 0.4; Area_A say3D "C4_Beep"; sleep 0.3; Area_A say3D "C4_Beep"; sleep 0.3; Area_A say3D "C4_Beep"; sleep 0.3; Area_A say3D "C4_Beep"; sleep 0.3; Area_A say3D "C4_Beep"; sleep 0.2; Area_A say3D "C4_Beep"; sleep 0.2; Area_A say3D "C4_Beep"; sleep 0.2; Area_A say3D "C4_Beep"; sleep 0.2; Area_A say3D "C4_Beep"; sleep 0.1; Area_A say3D "C4_Beep"; sleep 0.1; Area_A say3D "C4_Beep"; sleep 0.1; Area_A say3D "C4_Beep"; sleep 0.1; Area_A say3D "C4_Beep"; sleep 0.1; Area_A say3D "C4_Beep"; sleep 0.1; Area_A say3D "C4_Beep"; sleep 0.1; Area_A say3D "C4_Beep"; sleep 0.1; Area_A say3D "C4_Beep"; sleep 0.1; Area_A say3D "C4_Beep"; sleep 0.1; sleep 2; for "_i" from 1.9 to 0 step -0.1 do { for "_o" from 0 to 3 do { Area_A say3D "C4_Beep"; sleep _i; }; }; Loops are pretty nice. Condensed your 164 lines to 9. T1 respawnVehicle ["5"]; T2 respawnVehicle ["5"]; T3 respawnVehicle ["5"]; T4 respawnVehicle ["5"]; T5 respawnVehicle ["5"]; CT1 respawnVehicle ["5"]; CT2 respawnVehicle ["5"]; CT3 respawnVehicle ["5"]; CT4 respawnVehicle ["5"]; CT5 respawnVehicle ["5"]; { _x respawnVehicle ["5"]; }forEach [T1,T2,T3,T4,T5,CT1,CT2,CT3,CT4,CT5]; 12 lines condensed here down to 3 -
Dialog react to light?
dreadedentity replied to devildog664's topic in ARMA 3 - MISSION EDITING & SCRIPTING
ctrlSetFade -
I believe Fight9 is right, "controls" is a class, not an array (besides, the way you have it is not an array anyway).
-
Breaching - IDEAS AND FEEDBACK?!
dreadedentity replied to rye1's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hey Das I think that would make an excellent code snippet, just saying ;) (I WANT THAT CODE) -
addAction for tent/sleeping bag
dreadedentity replied to ramon_dexter's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I believe Das was talking about adding the action to the unit, actions are local, and it is already on the wiki