xxanimusxx
Member-
Content Count
453 -
Joined
-
Last visited
-
Medals
-
Medals
Everything posted by xxanimusxx
-
Check if already got used one Time
xxanimusxx replied to gallexme's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
okay, how about we do some flashlight debugging (the fav. sentence of my prof.): Output all individual expressions of your if-clause and see if they're getting the value you hope for. hint format ["is a crate: %1\nis opened: %2\nhas crowbar: %3\nis alive: %4", str _isCrate, _cursorTarget getVariable "opened", str("ItemCrowbar" in _itemsPlayer), str _isAlive]; If isCrate is false, try using _cursorTarget isKindOf "CustomAmmoBox" this will check for children in the config as well. -
Check if already got used one Time
xxanimusxx replied to gallexme's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Please don't be offended but we can't do anything for you if all what you're doing is showing us some variables but not how they're getting their values :D Expand your script to show us how all the local variables get their values, then we can help you ^^ (PS: It wouldn't hurt to describe the underlying scenario, we know that you want to check if your ammobox got used, but then again why checking the crowbar?^^) I dont see any errors in your if-structure so I guess it has to do something with how you assign the values. -
Help needed: Player is too close to another player
xxanimusxx replied to goldenfiver's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
okay it's sloppy but it seems to work (did a quick test). I updated my first post and the code, you can just copy and paste it :) -
Help needed: Player is too close to another player
xxanimusxx replied to goldenfiver's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
ahahah, not able to see the wood for the trees... thanks F2k Sel again, didn't even see it xDD goldenfiver, there's your problem :D Please report back if its working after the change. -
Help needed: Player is too close to another player
xxanimusxx replied to goldenfiver's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Well that leaves me speachless as well :D Can you post your init.sqf (or at least the part where you initially call the script + define the eventhandler)? Maybe someone can figure out why you get an error message where none should occur :D // Edit: grrr, please put your code into PHP-Tags :D -
Help needed: Player is too close to another player
xxanimusxx replied to goldenfiver's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
If you have a respawn-system, yes, you have to call that script again everytime the player is resurrected (keyword addEventHandler/"Respawn"). The code in the init.sqf ensures that newly connected players also get to execute that script, so I guess you'd want to add the eventhandler just under the execVM you meantioned. -
Arma 2 SP TO CO-OP.
xxanimusxx replied to foxykid09's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Whats with all these requests lately that no one understands? Context, people, context! We don't own a magical crytal ball.... (Sorry for the offtopic, just had to get this off of my chest...) -
BIS_fnc_spawnGroup: Examples of use?
xxanimusxx replied to pd3's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Based on the third example of the BIKI-article you posted, providing empty arrays is the way to disregard those parameters until the one you want to set. This is the part of the script which handles the skill: //If a range was given, set a random skill. if ((count _skillRange) > 0) then { private ["_minSkill", "_maxSkill", "_diff"]; _minSkill = _skillRange select 0; _maxSkill = _skillRange select 1; _diff = _maxSkill - _minSkill; _unit setUnitAbility (_minSkill + (random _diff)); }; So there you have it, your syntax is correct :) GroupSquad8 = [getMarkerPos "Squad8", east, ["GUE_Soldier_CO","GUE_Soldier_Medic","GUE_Soldier_ 3","GUE_Soldier_CO","GUE_Soldier_AT","GUE_Soldier_ AT","GUE_Soldier_GL","GUE_Soldier_CO"], [], [], [0.3, 0.6]] call BIS_fnc_spawnGroup; -
Help needed: Player is too close to another player
xxanimusxx replied to goldenfiver's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Okay, I had to change some things but now it should work. Thanks for F2k Sel giving me the right pointers, the problem was as following: The cycle didn't prioritize the "red state" and didn't differentiate between them, causing the cycle to return whenever someone less than 10m was detected. To solve this problem, you have to check the whole array and exit the cycle prematurely just in case someone with less than 5m is detected, else cycle through the rest of the array and take a note whenever someone in the range of 5 ≤ x ≤ 10 for later use. I edited my code in my first post above, I didn't test it though but it should work considering the logics. -
Help needed: Player is too close to another player
xxanimusxx replied to goldenfiver's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Hmm thats strange, I have to admit though that I just used some randomly placed AI's to test the script and it seemed to work. Could you upload a short video showing that? I think that would be the fastest way to see the problem. If thats too much of a hassle for you, maybe you could explain the exact scenario in which this did happen so I'd be able to recreate that. If you wouldn't mind using the hint in the upper right hand side corner of the screen, it would be pretty easy :D If you want to show the names near the image, you'd have to insert some more GUI-controls into your description.ext and to be blunt - you'd have to limitate the number of names you'll be showing because you can't dynamically create GUI-controls. -
Activating skins via mybb forum
xxanimusxx replied to JackZhidkov's topic in ARMA 2 & OA : ADDONS - Configs & Scripting
Exactly, the easiest way would be inserting or editing a record in your mysql-database which your gameserver uses to load the data. You have to set up a script in your gameserver which runs periodically and checks your database for these changes - the rest is some scripting to execute the appropriate commands. If you're running your gameserver in the same physical space (Root- or VServer) like your Webserver, you could even use some small middleware and a DLL to use "callExtension" ingame - but that could proof to be hard to accomplish if you don't have proper knowledge. To sum it up: MyBB -> Request to Database -> ArmA2 reads from Database -> ArmA2 executes script to adapt to request. But you won't find any help relating to MyBB nor DayZ in these forums here so I'm afraid you have to either get the MyBB-Interface working first and ask your question for ArmA2 or get help in the respective projects' homepages (MyBB.com/dayzmod.com) -
Help needed: Player is too close to another player
xxanimusxx replied to goldenfiver's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Okay, after some meddling with configs and numerous curses I finally managed to put something together which is actually working :) Put this code into a file named "displayDistance.sqf" and put it into your missions folder: disableSerialization; cutRsc ["DistanceDisplay", "PLAIN"]; waitUntil {!isNull (uiNamespace getVariable ["distanceDisplayRsc", displayNull]);}; _distanceDisplayRsc = uiNamespace getVariable ["distanceDisplayRsc", displayNull]; _soldierRsc = _distanceDisplayRsc displayCtrl 1; _distance = 0; _middleRangeFound = false; _green = [0.196078,0.803921,0.196078,0.5]; _orange = [1, 0.547058, 0, 0.5]; _red = [1, 0, 0, 0.5]; _playerSide = side player; _unitSide = objNull; while {alive player} do { _distance = 100; _middleRangeFound = false; { _distance = player distance _x; _unitSide = side _x; if (_unitSide == _playerSide && _x != player && _distance < 5) exitWith { _soldierRsc ctrlSetTextColor _red; _middleRangeFound = false; }; if (_unitSide == _playerSide && _x != player && _distance < 10) then { _middleRangeFound = true; }; if (_unitSide != _playerSide) then { _distance = 10; }; } forEach playableUnits; if (!_middleRangeFound && (_distance >= 10 || _distance == 0)) then { _soldierRsc ctrlSetTextColor _green; } else { if (_middleRangeFound) then { _soldierRsc ctrlSetTextColor _orange; }; }; sleep 0.2; }; And the following piece of code into your init.sqf: if (!isServer) then { execVM "displayDistance.sqf"; }; Okay to show some image you need to create a .paa-file with transparency. I made myself an image of a soldier which gets colored, so you're free to use it if you want :) Now look into your missions folder and check if there is a file named "description.ext". If there isn't any file like that, create it!. In this file, put this code somewhere: class RscTitles { class DistanceDisplay { idd = -1; movingEnable = 0; duration = 86400; onLoad = "uiNamespace setVariable [""distanceDisplayRsc"", _this select 0];"; class controlsBackground { }; class controls { class playerIcon { idc = 1; type = 0; style = 48; colorBackground[] = {0,0,0,0}; colorText[] = {0.196078,0.803921,0.196078,0.5}; font = "Bitstream"; sizeEx = 0; lineSpacing = 0; fixedWidth = 0; shadow = 0; x = "0.948958 * safezoneW + safezoneX"; y = "0.9 * safezoneH + safezoneY"; w = "0.0514583 * safezoneW"; h = "0.095926 * safezoneH"; text = "img\soldier.paa"; }; }; }; }; Important: If you had a description.ext in your missions folder and the class "RscTitles" is already present, just insert the class "DistanceDisplay" into it, effectively merging the classes into RscTitles (you can't define more than one of those...). Confused? Just download the files and place them into your missions folder or merge them if you'd like. PS: If you want to check the distances to other players excluding AIs, just replace "allUnits" with "playableUnits". -
addAciton condition returning false instead of true
xxanimusxx replied to eagledude4's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
The thing is, _id is local to the scope you define it in, which is a whole another scope like the one where you set a value for _id in your if-clauses. Try changing _id into a global variable, something like currentPlayerID and it should work :) [color="#FF0000"]currentPlayerID [/color]= ""; if (isServer) then { //For Editor Testing [color="#FF0000"]currentPlayerID [/color]= name player; } else { [color="#FF0000"]currentPlayerID [/color]= getPlayerUID player; }; House1BuyAction = player addaction [format["Buy House ($%1)", House1 getVariable "Price"],"Scripts\Houses\HouseBuy.sqf",House1,1,false,true,"",'(House1 getVariable "Owner" == "None" and House1 getVariable "Owner" != [color="#FF0000"]currentPlayerID[/color]) and (player distance getMarkerPos "House1DoorF" <= 2)']; -
Created group becomes null group
xxanimusxx replied to Masheen's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Well when programming there is one thumb I'm following: if somethings just working with a sporadically, it has something to do with race conditions or deadlocks. As we don't have to deal with any threading related problems here, I'll just assume it has to do with timing. I also scripted something like this a while ago and also had scripted that the heli will automatically blow up once the driver is dead - which caused spontenous explosions every third or fourth time I spawned the heli with the crew. To eliminate this problem, I made these steps: First create the crew at ground level, then create the heli (I also disabled simulation just for the case) and get the crew into the heli. My script waited with waitUntil{!isNull (driver _heli)}; and then checked in a loop if the driver is alive. This last line really helped me out, because I didn't have to take care of any timing issues anymore. You could also spawn your heli at ground level, mount the crew and then get the heli into the air, I think that would prevent any crashes you wouldn't want. -
How to get unit numbers that match those on unit icons? (for Ammo Check addon)
xxanimusxx replied to orcinus's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
I don't know in which order this command is returning the units, but what about trying out units? If i didn't know it any better, I'd bet the HUD is using this command as well to enumerate through your allies. _count = 1; { if (alive _x && _x != player) then { hintsilent format["Unit# %1:\n\tMagClass: ....\n\n", _count]; _count = _count + 1; }; } foreach units (group _yourGroup); Wrap this up in a loop and try out if the enumeration is matching the icons in your HUD. -
Created group becomes null group
xxanimusxx replied to Masheen's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Inb4: DayZ haters :D Okay, I know this is not the thing you wanted to hear and I'm opposed to say this, but your problem is a DayZ specific one :D DayZ keeps track of every "legit" vehicle in the server with a server monitor and a global array in which all the vehicles are referenced. If your spawned vehicle is NOT in this array and does not have the appropriate attributes set (like OwnerID and such) it will automatically blow up everytime someone gets into that vehicle. What I do in vanilla Arma2 is spawning the AI soldiers at coords [0,0,0] and then get them into the heli one after another, starting with the pilot of course :D Never had any problems with this, but as I said, I highly recommand to look into DayZ-Forums to find out how to legitimately spawn vehicles. -
Question about spawning a vehicule
xxanimusxx replied to Virevert's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Okay, now I'm confused here. Is this a file which is already present somewhere or does this file needs to be scripted by the OP first? If it's the latter, why don't you show how to write that instead of showing how to execVM it :D I mean no offense buddy, but you didn't contribute to solve his problem in any way but helped to move the problem into another layer :( I'm really sorry though if "mission1a.sqf" is something like an insider info and I'm too stupid to recognize xD Btw after using setDir you should use the setPos-commands to synchronize the new direction to all clients. Maybe this will help you? -
Noob question about triggers
xxanimusxx replied to Dreepa's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Triggers force you to use the return value of any function you call/spawn. Omitting the return value would lead to an error, thus preventing to save your triggers properties. I also used to assign the return value to nil, which is a keyword to undefine existing variables - but the BIKI suggest or rather warns not to assign any value to nil, which is understandable because this would mean to make a global variable out of nil, corrupting the use of this "keyword". Just use any global variable name (global means without the _ ) to catch the return value. Outside of triggers you can just disregard the return value - if you don't need it, why bother creating a variable you'll never use? :D -
Trigger for spotting an area
xxanimusxx replied to Dreepa's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Hmm, there is (or rather was) a thread about which programming language could contribute to learn SQF-Scripting which was interesting, because one could read about how others learned SQF-Scripting. It wouldn't hurt to have some knowledge in any programming/scripting language because it helps you to understand the basic structures and the syntax. My approach was straight forward - looking into scripts and trying to decipher that shit :D BIKI was my best friend as I searched for almost every command and slowly began to understand what command did what and I'm still learning ^^ Search for "beginner" in this subforum, it shoud yield some usefull threads or sometimes tutorials. And to answer your questions in Post #4: Variable names prefixed with _ are local to the scope in which they were defined at. Trying to access this variable outside that scope would normally lead to errors. Every sub-scope can access the local variables of their parent-scopes (which doesn't work for spawned functions though :D). Select is used to get the x'th value off of an array. If you want to get the 6'th value of an array _myArray = [1,2,3,4,5,6,7,8]; , you'd use _myArray select 5 . Arrays are zero-indexed, which means indeces are starting at 0. -
Noob question about triggers
xxanimusxx replied to Dreepa's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Hmm personally I don't like too much code in the onAct/Deact-Fields of triggers, it gets confusing the more code you put in. If I have more than 3 commands, I consider putting those commands into a function and spawning that function in the onAct-Field. Something like myTriggeredFunction = { deleteMarker "obj4"; task4 setTaskState "SUCCEEDED"; sleep 10; hint "Data recovered."; }; in any SQF-File or in the init.sqf and putting this into the onAct-field: thisList spawn myTriggeredFunction; But this could cause other problems, like you have to define the spawned function for every client (so using init.sqf wouldn't be so bad after all) and other problems stemming from MP locality. Or you could play around with the timeout/countdown value of the trigger to achieve similar effects? I don't know, could be even more work to do so maybe not :D It couldn't hurt to think about the need of the trigger in the first place - some cases don't require using them and sometimes it's even better to rely on scripts other than triggers. My rule of thumb is: Does my script has to detect the presence of something or somebody? If the answer is yes, use triggers, if no, well, roll up your sleeves and get yourself scriptin' :D -
Custom Ammo Crates with Random Loadout
xxanimusxx replied to NotASemiPro's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Doesn't it appear strange to you that addWeaponCargo and addMagazineCargo magically finds the crate you want to use them on? _crate, my young Padawan, use you must! Checking Wiki, usefull it is! Hmmmmmmm. -
Noob question about triggers
xxanimusxx replied to Dreepa's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
You can't sleep nor wait in unscheduled "enviroments" like called functions, eventhandlers or - in this case - the onAct-Field of triggers. The fastest workaround would be wrapping your code into a spawn: [] spawn {deleteMarker "obj4"; task4 setTaskState "SUCCEEDED"; sleep 10; hint "Data recovered.";}; -
Trigger for spotting an area
xxanimusxx replied to Dreepa's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Well, you're basically asking us to show you how to count on the basis of the chaos theory equations (which, in this analogy, equals Silderoy's code). As there already are great ressources to learn SQF-Scripting, you should indulge yourself into those and make yourself familiar with the BIKI (Bohemia Interactive Wiki) and you'll step for step understand more of the codes you'll see in this forums. I hope my post doesn't appear too offtopic for you, but I also hope you understand that no one has the time nor the patience to explain every little bit of SQF-Scripting where it doesn't belong to :) -
Mission help.
xxanimusxx replied to Lars-the-dane's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Okay, I know this is stupid and I'm clutchting at straws here but could you post your content of the onAct-field? All of it, with all of the spaces and such, put a PHP-Tag around it and show it to us. I really can't fathom why this isn't working for you :< -
Mission help.
xxanimusxx replied to Lars-the-dane's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Well that's strange, using the vanilla ArmA2 CO and the latest beta patch I don't get these problems, is the code to start the bombardment the only text in your onAct-field? I don't know if any addons could cause these problems, or my arma is just something "special" :D Could someone recreate this? Just put something like nil = [] spawn {hint "YAY!";}; into any trigger's onAct-Field and hit OK. Does this work without any error messages? Yes? Please report back asap! :D // PS: try to use any other name than "nil" and try out if it works, if not, somethings wrong on the other end of the rope :D