Jump to content

igneous01

Member
  • Content Count

    924
  • Joined

  • Last visited

  • Medals

Everything posted by igneous01

  1. igneous01

    Conditional Attack?

    a warning i want to give out about setFriend, i have tried using it on civilians before (I had a scene where at a certain point a weapons script would run for a bunch of civilians in an array and turn them hostile against blufor) however this was very bugged as they would not shoot, and neither would blufor. Maybe this was fixed?
  2. want to point out that the command getTerrainHeightASL is not in the command dictionary in Squint, and I cant figure out how to add it in. I have to comment out the line in order to see if any real errors exist. just a friendly reminder ^^
  3. igneous01

    condition help

    this can be shortened to read alot more simply: unitsarray = [s1, s2, s3, s4, s5, s6, s7, s8] // check to see if some variables dont exist for "_i" from 0 to (count unitsarray - 1) do { _indexcheck = unitsarray select _i; if (isnull _indexcheck) then { unitsarray = unitsarray - [_indexcheck]; }; }; this would need to be run at some point when the mission starts (as players have chosen slots) or before checking in helicopter (might be easier for JIP, but hell if I know) { waitUntil {(!alive _x) || (_x in BHP)}; } foreach unitsarray; this would be run in a script, then after the loop is done you could simply make a variable called ALLIN and set it to true, then have the trigger check to see if ALLIN is true
  4. nice one Khalashnikovf ^^ it looks really useful, but I have just figured out a workaround for finding the roof of a building, using a shooting rabbit to detect a solid surface. Works fairly reliably, and can be modified to output the final z coordinate (the final height where the object touches a solid surface) here it is in case you might need it: // Probe function // A workaround for hasSurface // Creates probe object at a given position, and checks to see if this position has solid ground (diff in height less than 1m) after simulation RUFS_ProbeSurface = { private ["_pos", "_bball", "_probe", "_zi", "_zf", "_zdiff", "_vel", "_hasSurface"]; _pos = _this select 0; _zi = _pos select 2; _bball = "Rabbit"; // our furry little friend _probe = _bball createVehicle _pos; _probe setpos _pos; _vel = -60; _probe setVelocity [0, 0 , -60]; // force the object to crash downward while {_vel > 0.1 && _vel < -0.1} do { _vel = velocity _probe select 2; }; _zf = getposATL _probe select 2; _zdiff = _zi - _zf; // find difference in height if (_zdiff > 0.5 || _zdiff < -1) then { _hasSurface = false; hint "surface unsuitable"; } else { _hasSurface = true; hint "surface suitable"; }; deletevehicle _probe; // output result _hasSurface };
  5. I have been searching for this for half a day now, and no results. So the question is: Is there a method for finding a position (or checking a position) that has solid ground? I have this little function i wrote that will find a building, find its dimensions using bounding box, and return a position on top of the building (on the roof) in a random radius of the buildings rectangular dimension (so it doesnt always become the center of the building) however, this script fails at an important aspect: Not all buildings have their highest point or roof at the center of the model. Most OA buildings for example have multiple roof ledges, or a half roof half balcony scenario, and if I try to setpos an object with this position, sometimes the object will simply be off in mid air somewhere, fall down, and possibly die. The goal for me is to be able to spawn static weapons on top of buildings, but make sure that these weapons spawn on the roof of the building, and that its solid ground. here is the function: Does anyone have any ideas or methods to find a solid surface?
  6. This is one method that I want to use for placing statics by themselves, but since i have small compositions of statics with sandbags around them, I need some space to put these (rather than in buildingPos thats usually near the edge of the building or door) My alternative solution which is in the works is to use a probe like a baseball to test the position. Letting the simulation of the ball tell me if there is solid ground there. and check whether the difference in hieght of the balls original position and new position is less than 1m (usually enough to describe it as being flat ground). however current problem is I want this function to return me a value, but I cannot suspend the function using waitUntil {ball has stopped falling}, hence I may need to use spawn (but then I cant determine whether the position has ground dammit!) here is the function: // Probe function // Creates probe object at a given position, and checks to see if this position has solid ground (diff in height less than 1m) after simulation RUFS_ProbeSurface = { private ["_pos", "_bball", "_probe", "_zi", "_zf", "_zdiff", "_vel", "_hasSurface"]; _pos = _this select 0; _zi = _pos select 2; _bball = "Baseball"; _probe = _bball createVehicle _pos; _probe setpos _pos; waitUntil {_vel = velocity _probe select 2; _vel = 0}; // waitUntil the object has stopped falling _zf = getpos _probe select 2; _zdiff = _zi - _zf; // find difference in height if (_zdiff > 1) then { _hasSurface = false; hint "surface unsuitable"; } else { _hasSurface = true; hint "surface suitable"; }; deletevehicle _probe; // output result _hasSurface }; ---------- Post added at 08:40 AM ---------- Previous post was at 07:22 AM ---------- ********* My workaround solution is finished and working! Problem with baseball is that you cannot setVelocity it, nor does it have any simulation (it will float in midair) so the function is reworked to spawn a rabbit (which is considered a vehicle?) and this rabbit has a velocity vector down of -60m/s. Once it crashes into the ground, the loop will exit, and the difference between positions (original height and new height) will be checked. If the difference is greater than 0.5m down, or 1m up, then the position has no solid surface, and is unsuitable. here is the function in case someone might need it: // Probe function // A workaround for hasSurface // Creates probe object at a given position, and checks to see if this position has solid ground (diff in height less than 1m) after simulation RUFS_ProbeSurface = { private ["_pos", "_bball", "_probe", "_zi", "_zf", "_zdiff", "_vel", "_hasSurface"]; _pos = _this select 0; _zi = _pos select 2; _bball = "Rabbit"; // our furry little friend _probe = _bball createVehicle _pos; _probe setpos _pos; _vel = -60; _probe setVelocity [0, 0 , -60]; // force the object to crash downward while {_vel > 0.1 && _vel < -0.1} do { _vel = velocity _probe select 2; }; _zf = getposATL _probe select 2; _zdiff = _zi - _zf; // find difference in height if (_zdiff > 0.5 || _zdiff < -1) then { _hasSurface = false; hint "surface unsuitable"; } else { _hasSurface = true; hint "surface suitable"; }; deletevehicle _probe; // output result _hasSurface };
  7. unfortunately bounding box only returns 4 sides, and these may/may not be exactly on the roof, but somewhere in the objects box that encapsulates the entire thing. ex. --------------- i * * * I * * * i i P P P P P P P i i P * * * * *P i i P * * * * *P i where the I, is some object like a radio tower, or shape that isnt a roof.
  8. no problem, and yes, problem with this is that if the building is a backsplit, or an irregular shaped house, or has a radio tower thats on top of the roof, the bounding box will return the highest point of the model, not essentially the roof. And as Ive tried searching for a workaround for this, the only way to truly and accurately check would be to build a library of all buildings and their roof tops and interiors, and im still not too sure what I would be compiling in this library either (big array of positions? a grid of the top of the building?) the only other method I could think of, would be to have a library of houses with a height of the lowest roof, and checking afterwards the model of the house, and if the units z axis is less than the height of lowest roof.
  9. ok im working with similar stuff so here is how you can find units inside a building of any dimension would be to find buildings, it might be best to use this as a function of its own. To determine it as being an actual building, count the building positions inside the house, and check if 2 or more positions exist, then you know its a building. After you have acquired your array of houses, you need to check for: any units near any of these buildings most likely in the form of: for "_i" from 0 to ((count _listNearObjects) - 1) do { { _dist = _x distance (_listNearObjects select _i); if (_dist < 50) then { // check here } foreach allunits }; after wards you will check if the unit is inside the house: _dimensions = boundingBox _i; _WorldDimensionsMax = _i modelToWorld (_dimensions select 1); _WorldDimensionsMin = _i modelToWorld (_dimensions select 0); _xmin = _WorldDimensionsMin select 0; _ymin = _WorldDimensionsMin select 1; _zmin = _WorldDimensionsMin select 2; _zmax = _WorldDimensionsMax select 2; _ymax = _WorldDimensionsMax select 1; _xmax = _WorldDimensionsMax select 0; _unitposx = getpos _x select 0; _unitposy = getpos _x select 1; _unitposz = getpos _x select 2; if (((_unitposx > _xmin) && (_unitposx < _xmax)) && ((_unitposy > _ymin) && (_unitposy < _ymax)) && ((_unitposz > _zmin) && (_unitposz < _zmax))) then { // unit is in building }; This isnt tested, and slight tweaks will need to be made to incorporate it into your script, but it should check for the actual distances of the buildings min x, y, and z, max x, y, and z, and compare to see if the unit is also within this range. max z is the roof of the building, so anything over z will equal them standing on a roof. However bare in mind this does not work correctly if the building has balconies or multiple roof parts that differ in height. It will only return the max z of the model, not all individual z levels of different roofs. (So a dude on a balcony will survive the Nuke, or something dumb like that)
  10. thank you Ruebe, i will have a look at that as Im running short of ideas on getting road segments evenly spaced. My idea now was to draw an imaginary line between two final road segments (the two roads that are furthest from the center, and are furthest away from each other) and divide this by a spacing, then check the nearest segments that are closest to these points, and attach them to the road. I will do some more experiment, thanks for the responses
  11. So this is my fantastic problem: I want to acquire an array of positions along a road where I can spawn some units/buildings. Right now im using markers to more visually see where these positions will be, and Im stuck. Im out of ideas on any formula or methods for doing this - I can make it work on the first marker (check to see if the distance is between 200~250 of original marker) however all other markers still follow this distance constraint (which needs to check for distance ~400 and ~200, right?) So here is a picture of what I have managed to do with my script: where it is now: and what I want it to do so far I have managed to calculate the most outer bound road segment from the point of origin (the area where spawning takes place), and the segment most closest to the point of origin. But How do I check for all possible road ways (as there are multiple intersections) and create markers that are equidistant between each other (distA == B && distA == C). Ive tried For loop nested inside a foreach (for loop using road selection, and this being checked against a foreach loop making sure its within distance of all other points in array) but this doesnt work because its checking against all points. So, any math guru's around here that can provide some theory or formula to getting this to work?
  12. all is possible, this is pretty much the same principles as the c-47 spawning I suggest (really I recommend) you to look at this: http://community.bistudio.com/wiki/Category:Scripting_Commands_ArmA2 I know this isnt the most userfriendly link, but every single command, function, module, and extra documentation is here. Some special commands have limited documentation, but definitly have no use to you right now as your starting out with the basics. I strongly urge you and others to have this open at all times when scripting, because it is your bible.
  13. So, ive looked at Shukos moveobjects script, which is wonderful for moving collections of objects around. However, I want to write a script that has simple compositions of maybe 7 - 10 objects and their positions stored in a variable, so that the script can select a random composition, place it down, and fill it with some random enemy units to fortify it. Is there a method for getting this kind of like using copytoclipboard? or would it be better to have all compositions created using the 3d editor dyno grabber? and stored in a separate script?
  14. igneous01

    Team Shadow - Sniper Campaign

    that errors notes that CBA is not running in your mods list, and so ace cannot be run properly (as its dependant on CBA) also the order of mods is important here to: example of the right mod line: @CBA;@ACE;@ACEX;@ACEX_RU;@ACEX_SM;@ACEX_USNavy cba is run first, followed by ace, then ace extras, with all other extras coming last
  15. sure, it certainly is possible, however I have no way of making this MP compatible because I have no server to test with other people with atm. But for example, changing the DefuseAction.sqf to not generate a random array (CODE) and instead declaring this inside the init.sqf or description.ext (using constants) you could use the codecompare script to check if your code is right, and then unlock the vehicle as needed.
  16. interesting, ive never had the numbers reappear when i exit the keypad, it always turns blank again and i can re input the numbers. perhaps its not working in MP as intended. But as far as im aware, closing a dialog completely resets the text of that dialog (???) as it is being initialized again with its original settings (i dont know if this is true, my guess as to how dialogs operate) I will have a look at those issues you experienced. @foxhound thanks for posting, appreciated ^^
  17. is that the magazine classname or the ammo classname? createVehicle only works for cfgAmmo types, it doesnt work for magazines.
  18. thanks Muzzleflash that works great
  19. I havnt gotten that far into displaying the numbers you put in on a pad, maybe someone else knows how to get it working properly? I will spend some more time on it to see if i can get a simple number display working ---------- Post added at 04:54 PM ---------- Previous post was at 03:46 PM ---------- edit* ok so after a bit more reading I managed to get numbers to display on the keypad (though they have brackets surrounding them separated by commas) it now looks like this when you put in numbers: here is the description.ext, just copy and replace as new description.ext and it should work:
  20. first thing - your if statement looks wrong: shouldnt it be #if ndef __OA__ : i dont remember the exact way of doing it in sqs, but i remember you need to have a : at the end of the condition. also, if the song is in a folder called music, you need to add the address to it as well. "music\army.ogg" except this should be done inside the description.ext, where you define the music using cfgMusic
  21. problem is your not using double quotes inside the init string: it should be like this: _name setVehicleInit "radaradd = this addaction [""Pickup"", ""missionradar.sqf""]"; you can also use ' instead of double quotes. also _name is a variable local to the script, and it wont be interpreted by the init as having a value, using this fixes that
  22. igneous01

    Spawn enemy intervel

    maybe you should have a look at this script: http://forums.bistudio.com/showthread.php?t=117220 does what you want it to do and more.
  23. i want to also throw this out there - guard waypoint behaves very much the same way. A squad with a guard waypoint will wait at the waypoint position - when a friendly unit comes under attack, the unit will assess its battle chances of defeating the enemy, if they cannot handle it on their own, the guard squad will be called upon to assist the defending squad. This waypoint becomes even stronger with another unit acting as "sentry" using the sentry waypoint. As the sentry will be considered an observer, and will spot and assess threats, calling in the guard squad to engage if neccessary. However bear in mind, you have no control over which squads in guard, or how many are actually called upon to assist. It may come as no surprise that 4 squads in guard will all move to engage the enemy.
  24. easiest way to do boat insertion is make your boat, name it something (ex ins_boat) then in groupleader init type in: {_x assignascargo ins_boat; _x moveincargo ins_boat} foreach units (group this) this assigns and moves all units in group into the insertion boat then make a transport unload waypoint for the boat if that is not working (if the player is squad leader) then at the transport unload waypoint type in: {_x leavevehicle ins_boat} foreach units (group player) this unassigns them from the vehicle, and forces the units to get out. if this still doesnt work, you need to use: {_x action ["getOut", ins_boat]} foreach units (group player) this code forces all units (including the player) to get out as the action is being used (player has no choice but to get out) ---------- Post added at 11:40 PM ---------- Previous post was at 11:38 PM ---------- doMove can be checked using unitReady so for condition use: if (unitReady Thisguy) then { doMove
  25. So i have this really basic script that checks distance between two cars, if carA gets too close, the passenger will say something to warn you using kbtell. if carA gets too far from B, then the passenger will again say something to warn you your going to lose him. However the problem im having is that the line the passenger says is getting spammed everytime through the while loop. this is my script and the condition im using: private ["_follower", "_target", "_dist", "_targetknows", "_distmin", "_distmax"]; _follower = _this select 0; _target = _this select 1; _distmin = _this select 2; _distmax = _this select 3; _dist = _follower distance _target; pavel kbAddTopic ["Tail", "kb\conversations.bikb", ""]; while {(_dist < _distmax) && (_dist > _distmin)} do { _dist = _follower distance _target; _targetknows = _target knowsabout _follower; if (_dist < 80 && !(pavel kbWasSaid [_follower, "Tail", "Pavel_TooClose", 25])) then { pavel kbTell [_follower, "Tail", "Pavel_TooClose"]; }; if (_dist > 250 && !(pavel kbWasSaid [_follower, "Tail", "Pavel_TooFar", 25])) then { pavel kbTell [_follower, "Tail", "Pavel_TooFar"]; }; //hintsilent format ["Distance: %1m, Knowsabout: %2", _dist, _targetknows]; sleep 0.5; }; obj1 settaskstate "FAILED"; nul = [objNull, ObjNull, obj1, "FAILED"] execVM "CA\Modules\MP\data\scriptCommands\taskHint.sqf"; Following = false; _target doMove (getmarkerpos "getaway"); _target setspeedmode "FULL"; sleep 5; endmission "LOSER"; I have set the max age in kbwassaid to 25 seconds, yet every second Pavel keeps saying your going to fast?? Is it because there is no audio file with my conversation, or something else im missing?
×