Jump to content

xxanimusxx

Member
  • Content Count

    453
  • Joined

  • Last visited

  • Medals

  • Medals

Everything posted by xxanimusxx

  1. 1. You forgot to actually compile your string to code - preprocessFile just returns the file into a string, hence your error message. Broadcast = compile preprocessFile "Broadcast.sqf" 2. For a finite array you should use a forEach-Loop: _Massive = []; _People = [as1,as2,as3,as4,as5,as6]; { if (!(isNull _x)) then { if (alive _x) then { _Massive set [count _Massive, _x]; }; }; } forEach _People; Also you should refrain from using binary addition due to code optimisations, use set instead.
  2. Well without being able to reproduce the state when the loadout doesnt work, we just can assume that some factors while loading the mission is interfering with your desired outcome. I did not do enough tests to actually confirm my assumption, but my guess would be a sort of race condition, where sometimes the mission is not quickly loaded enough to have the desired effects using the init-lines of the objects you placed in the editor. Afaik the init-field of the objects are executed before the init.sqf of the mission is being called, this could be false information though so don't consider this as an actual fact. But you can test this assumption with a little trick :> Put this line of code into the init-field of your units and replace the code you already had (the one for changing the loadout): this setVariable ["loadoutScriptFilename", "loadout_example01", true]; Change "loadout_example01" to either string which represents the filename of the sqf-file to be executed for the specific unit. If you wish to have another loadout for any of your units, you could also use "loadout_example02" or "loadout_example03" and so on. In the init.sqf, add the following lines: if (isServer) then { _loadoutFileName = ""; { // Check if unit has been assigned to any loadout-scripts _loadoutFileName = _x getVariable ["loadoutScriptFilename", ""]; if (_loadoutFileName != "") then { // Call the loadout script _x execVM format["%1.sqf", _loadoutFileName]; }; } forEach allUnits; }; Please be advised that above code will execute just once, when the server is "logged into the game". For this to work, every unit in question in your mission has to define the "loadoutScriptFilename" - players who join later on won't be able to be effected by the loadout-scripts (but naturally you can design it for JIP players as well). Sure, there are always better ways to do this (like just one loadout-script which gets the desired weapons and magazines as parameters), but with this you dont have to rearrange your sqf-files to test it. Furthermore you could extract the code above and put it into a global function to use it whenever you need, e.g. after spawning more units dynamically. If your problem still remains, we have to look for another ideas by more experienced developers :)
  3. xxanimusxx

    AI Zone Restriction

    Place a trigger into the middle of your base and set the radius to encircle it. The following configuration of the trigger will kill every Independent player within that radius. If, however, you don't want to die whenever you are an "Independent" or want to exclude some AI's from this rule, the condition and activation field needs to be altered a bit.
  4. xxanimusxx

    SLP_Spawing script

    Hi Nomadd, thanks for your efforts, your work will come in handy for some of my missions :) I just wanted to suggest a little improvment for your script if you don't mind. Having functions/commands taking more than 4~5 parameters are hard to use, even for experienced developers, due to the higher possibility of syntax errors (some missed "[" / "]" characters and alike) and errors made by not following the required order. It would be much easier if you'd design your function ("SLP_spawn") just to take the most mandatory parameters to work, which should break down the number of parameters to few ones. The rest should be set using setters, like SLP_spawn_setSide SLP_spawn_setPosition SLP_spawn_setTask .... with the same parameters your current function takes. If, for an example, the side/faction is not set, just set it using default values ("side player", "faction player") or [0,0,0] for the position. If mandatory values aren't set, you could easily return false or anything else after SLP_spawn to signal an improper use. I know this would take some effort to split the code into different functions but in the end result it would ease the usage and further help to improve overall readability - devide and conquer :D
  5. Well I asked him that some time ago, his answer: If he wouldn't load the shk_pos_init file correctly, the script would break off the moment the shk_pos-command is used (due to not being able to find the command). As he did some experiments he got some values back, being "ANY" or "SCALAR". I thought that it might be associated with the markers not being there in a dedi enviroment but he also got legit values of those. As you said the only way to help the OP would be looking deeper into his missions, firstly getting a brief look into his init.sqf to find any logical structures interfering with the shk-script :S
  6. flyInHeight is normally used on AI's in aircrafts to command them flying in a specific height. If it's you who's in the aircraft this command won't have any effect, because you for yourself have to fly in the height you wish.
  7. I don't think your intend is not possible - there is no way for a script to know when a player is speaking in the side (or any other) channel. You could add a key event handler which fires every time someone presses CAPS Lock to activate VoIP (afaik CAPS Lock is the default) and play a sound using playSound but this would only work if and only if the player doesn't change the default button for VoIP AND the player isn't always speaking without using push-to-talk after pressing CAPS Lock two times. What you need is an event listener which is fired whenever someones speaks but afaik there is none. Well, don't give up too soon, maybe someone will enlighten you with another theory and show you a way ;)
  8. Okay I'll looked into the SHK_pos script and found out that you're using it the wrong way, somehow xD The second parameter has to be the direction followed by the distance in the third parameter - your call has switched them. After looking deeper into the code I didn't find any reference to finding a location near/on a road so I think it isn't needed or supported anymore. At least using SHK_pos v0.21 (check your version in shk_pos_init.sqf and download this version if you have an older one) you can achieve your goal with this code: _attackzones = [attackwp1,attackwp2,attackwp3,attackwp4,attackwp5,attackwp6,attackwp7,attackwp8,attackwp9,attackwp10,attackwp11,attackwp12]; _pos = []; _distex1 = []; _distex2 = []; { _pos = ["center", false, ["exclude1", "exclude2"]] call SHK_pos; _x setPos _pos; //debug markers _name = str(_x) + str(random 100); _marker = createMarker [_name, (getPos _x)]; _marker setMarkerShape "ICON"; _marker setMarkerType "DOT"; //end debug markers } forEach _attackzones; The distance to the center of the spawnpoint is randomly picked using the radius of your marker "center". E.g. the distance should be between 0 - 9950, so you have to set the radius of your marker to 9950 in the editor (you should use an elliptical shape and set both values to the same one, practically defining a circle - but square shapes should also be okay it seems). Your both exclude markers have to be modified in the same way - just set the size of both markers in the editor to prevent the position being in them, no self checking required anymore! Please test this code and report your results, I'm curious if this actually works :D If it's not - well, then you have no choice but to search for another random location script or write a small one specialized for your requirements (as most of the random location scripts are designed to handle every possibile factor, even if you don't need em in your equation).
  9. Well norrin wrote a revive script and I think it allowed to manipulate the number of revives one has. Just read the thread and look for similarities to your requirements. Using the forum search and the keywords "respawn" or "revive" should give you a bunch of similiar threads ;) http://forums.bistudio.com/showthread.php?74396-Revive-Script&highlight=Respawn
  10. Well the first thing coming into mind would be removeAction - unfortunately this command won't remove those default actions placed by the game but custom ones created with addAction. There is another - but more complex - way to do this using local commands to fill the box with objects and whenever a player approaches the box, check the permissions and eventually empty the box if the permissions didn't match. This requires you to keep track of several sets of objects for every player in that one box, which multiplies whenever you have more boxes to access.... Well, I wouldn't want to do it this way, too much managment to do. An event handler reacting to "Gear" would help, but I don't think there is one... Maybe someone can help with another idea :)
  11. I meant if one of the parameters of "distance" is invalid (like an empty array) it will return somethin like "Scalar" :D The last thing to check would be outputting the marker positions to check if the dedi does mess them up or smth. player globalChat str (getMarkerPos "center"); player globalChat str (getMarkerPos "exclude1"); player globalChat str (getMarkerPos "exclude2"); Put this code above the foreach-loop and check the output. If these output valid location arrays, we have to search for someone who has experience in dedi servers ^^
  12. Hi and first of all - please use at least the CODE-BBTag to put your code in! Some indention could also help increasing the readability ;) bomb="M_AT5_AT" createVehicle (getPos goatbomb); bomb="Ace_MineExplosion" createVehicle (getPos goatbomb); bomb="Bo_GBU12_LGB" createVehicle (getPos goatbomb); bomb="M_AT5_AT" createVehicle (getPos goatbomb); bomb="Ace_MineExplosion" createVehicle (getPos goatbomb); bomb="Bo_GBU12_LGB" createVehicle (getPos goatbomb); To be able to effectively help you with your task, we would need the code to spawn the goat airdrops (goatbomb). What do you mean with trigger? Do you use a trigger placed in your editor for the airdrop, do you dynamically create a trigger in the script or does a trigger even exist? Btw the code you posted repeats some lines and would cause a huge explosion considering the two GBU12's your spawning ^^
  13. Please note that using "CAN_COLLIDE" in the last parameter can help you positioning buildings (like walls) without any gaps because the spawning won't check for collisions. But can - in some cases - produce unwanted results so use it with caution.
  14. Well trying to get the distance of two objects while one of them is null or invalid will yield the Scalar result :D Did you try to evaluate the output in your arma2(oa).RPT-File or did you start the dedi-server with "-showScriptErrors" parameter? These steps will help you figure out if somethin went wrong along the way - I suspect something off in your random locations script you're using. If this suspicion comes true, you're going to have to choose another random locations script :S Furthermore I'm at a loss here because I never made a mission to launch it on a dedi so I don't know of any peculiarities involved with dedi servers. My assumption: Either the markers aren't returning valid values or the random location script is messing somethin up on the dedi.
  15. You can use createVehicle to almost spawn any object, buildings as well ;) Example: _crane = createVehicle ["Land_A_CraneCon", position player, [], 0, "NONE"]; would spawn a Crane on your spot. Using createVehicle_array instread of createVehicle is encouraged.
  16. Well I didnt mean that they have to join your group or anything, but because you didn't show us more of your script (like how you actually spawn the units), I assumed that you didn't join your newly created units into the GroupTank. I think we can help you better if you show us an expanded section of your code, especially the part where the units get spawned.
  17. Did you output _pos aswell as the both distances using hint/globalChat/sideChat? This may help you figuring out possible problems with the markers and/or calculations (put a sleep after every while loop to be able to read the output before the next one comes) As far as I can see there is no logical error in your while-loop but using more than one exclude area could lengthen the loop count by multiple times, depending on the mapsize and the maximum radius you set on the random location. Just a little hint: If you use a value which is not changing more than once, put it into a variable and refer to them. Both marker positions can be saved in variables to spare some milliseconds (and you could output them to doublecheck!).
  18. Well as far as I understood the "excluded area", its actually an area in the random locations area which should not be used to spawn stuff into. http://oi48.tinypic.com/15nlhqd.jpg (260 kB) This is an example using a map, is this how you imagined it to be? I just ask this despite the original topic is being solved because if we happen to misunderstand you, the examples above won't work the way they should.
  19. Hello there :) I'm a humble user of this forum and I'm really enjoying to browse through the different subforums and learn new things everyday. I got helped numerous times and after collection some knowledge about scripting in ArmA, I've been able to help others. I spend most of my time in this board in the ArmA2 OA - EDITING subforums and noticed a small detail: some of the threads related to scripting issues are problems caused by the wrong usage of command parameters or bad syntax. These problems are best solved when the official BIKI is used to determine the correct way to deliver parameters or look into multiplayer issues. So here's my suggestion: Why not creating a filter which will search an entire post for scripting commands and automatically link them with the corresponding BIKI-article? To build an array of available script commands, the BIKI category for all scripting commands can be used. This post filter can be realized using PHP and vBulletin's framework to pre/post-process posts or even using JavaScript to apply the filter after the page has loaded. I don't know if such a feature is welcomed by the moderators/administrators of this board because after beeing the tech support for some boards I managed myself for some time ago, I really know how time consuming it can be to implement such features.
  20. xxanimusxx

    Making a trigger detect a mine

    Well I'd use isKindOf or nearEntities and check if the superclass of the objects near the player is that of a mine. The Condition of your trigger could look like this: count ((position player) nearEntities ["Mine", 50]) > 0 This will trigger when there is an object which is a subclass of "Mine" within an area of 50 meters. But I'm not sure if "Mine" alone will suffice, because there seems to be several entries of "Mine" in the config, like one in cfgWeapons and one another in cfgVehicles. Maybe a more experienced user can give you a hint where to look in the config.
  21. While F2k Sel's code is correct and would give you the result you're looking for, I'd like to suggest a slight change to his code: _pos = []; _excludeArea = getMarkerPos "exclude"; { while {_pos = [random position code]; _pos distance _excludeArea < 2000} do {}; _x setPos _pos; } forEach _array; This should be a (little) bit more efficient and less code to write :D Yeah I know, I don't contribute to actually solving your problem but showing people alternative ways to code is also nice :) The random placement could reach the maximum efficiency when you'd use a circle area with its center equal to the exlude area to spawn your objects/units within. Then you could easily use trig functions and break down the complexity of the function by the factor of O(m) (while m being regulated by the mapsize), which could save some milliseconds when placing a huge list of units/objects. This is also nothin you'd concern yourself when placing a handful of units but it could make a difference when time (and efficiency) is critical to your requirements.
  22. Well do you join the created units to the GroupTank? GroupTank = CreateGroup West; GroupTank setGroupId ["Alpha Tank Platoon"]; // ... [unit1, Unit2, Unit3] join GroupTank;
  23. You'd actually use disableAI _soldier1 disableAI "ANIM" Just for the future: If you want to disable or enable somethin just search for "disable" in the BIKI, there are tons of commands begginning or containing these words :) For another example read Echo5Hotel's thread: Prisoner frustration
  24. Well I created a thread similiar to you're one and had to realize that the object you want to set the texture must have hiddenSelections in his config. So look into the config for the object you want to alter and ensure that you're using an index corresponding to hiddenselection-array. If the object doesn't have the hiddenselection array, you can't use setObjectTexture ( I didn't even find an object which meets this criteria tho...)
  25. xxanimusxx

    Prisoner frustration!

    Okay just to make sure what your triggers do: When the player group gets near the POI, the target joins your group and AI related settings are configured (AI animations and movement enabled). But after the bodyguards are killed, you actually deactivate Animations and Movement for AI's. I didn't use disableAI-commands yet but if I venture a guess, I'd say the target doesn't do any animations because of that. Also "removeAllWeapons this" will do nothing because there is no "this" in the context of the trigger (I think another variable like this_list is holding the players inside the trigger or somethin).
×