Jump to content

tryteyker

Member
  • Content Count

    1164
  • Joined

  • Last visited

  • Medals

  • Medals

Everything posted by tryteyker

  1. You could try shortening down the magazine to 3 shots once the player takes them from his backpack. Maybe there's en EH for taking stuff out of the backpack.
  2. You got me really interested there. So, if I get this right, everytime you let the function select something from the array you discard the element selected? Or am I totally wrong here?
  3. Just thought I'd throw this in here: addWaypoint Check out that link. Go through the other links below ("See also" section). It should look like this when adding a waypoint (specifically for helos): _usgrp = ["USMC_Soldier","USMC_Soldier","USMC_Soldier","USMC_Soldier"]; //variable containing all soldiers _grp = createGroup WEST; // This creates an empty group for us to use when spawning the helo pilot (ADDED THIS) _helo = createvehicle ["CH47_EP1",getmarkerpos "chspawnpos",[],0,"FLY"]; // spawns vehicle _helopilot = _grp createUnit ["USMC_Soldier_Pilot",getmarkerpos "chspawnpos",[],0,"NONE"]; // spawns pilot _helopilot moveInDriver _helo; waitUntil {!isNil "BIS_fnc_init"}; _ussoldiers = [getmarkerpos "chspawnpos", WEST, _usgrp] call BIS_fnc_spawnGroup; //Spawns a group of soldiers, look up the function on the BIKI for further reference. {_x moveincargo _helo} foreach units _ussoldiers; // Moves the group into the cargo of _helo; _helowp = _grp addWaypoint [getmarkerpos "helowp1",0]; //Adds a basic waypoint at the marker position of helowp1 (I guess you know your way around the editor) _helowp setWaypointBehaviour "CARELESS"; // As you can see we access the waypoint via the variable given to it (_helowp) so we can modify the waypoint. A basic waypoint often isn't enough _helowp setWaypointCombatMode "BLUE"; // This tells the unit to never fire (important so the helo doesn't go nuts in case of insertion / extraction). _helowp setWaypointType "TR UNLOAD"; // Sets the type of WWaypoint (this defines whether it's a "Move", "Get In" or whatever kind of waypoint. Important. The above waypoint is pretty much what you need for the helo to land and unload. If you're interested in super simple stuff and precise landings and all that check out Mando Heliroute for ArmA2. This allows for precise movements and allows the AI to land on buildings and whatnot. I definitely recommend this over making your own waypoints and so on. The above waypoint is a really simple waypoint
  4. My script only spawns the stuff you need, and as Iceman says, you'll need to add waypoints via addWaypoint and other stuff (you can look this up in the BIKI).
  5. Just something I've thrown together real quick: _usgrp = ["USMC_Soldier","USMC_Soldier","USMC_Soldier","USMC_Soldier"]; //variable containing all soldiers _helo = createvehicle ["CH47_EP1",getmarkerpos "chspawnpos",[],0,"FLY"]; // spawns vehicle _helopilot = createUnit ["USMC_Soldier_Pilot",getmarkerpos "chspawnpos",[],0,"NONE"]; // spawns pilot _helopilot moveInDriver _helo; waitUntil {!isNil "BIS_fnc_init"}; _ussoldiers = [getmarkerpos "chspawnpos", WEST, _usgrp] call BIS_fnc_spawnGroup; //Spawns a group of soldiers, look up the function on the BIKI for further reference. {_x moveincargo _helo} foreach units _ussoldiers; // Moves the group into the cargo of _helo; /* Add waypoints etc with addWaypoint setWaypointBehaviour setWaypointStatements etc Also include additional stuff if you want */ You can call it with something like this: nul = [player] execVM "helospawn.sqf"; In the trigger, ofcourse. Above script is untested, should work though. You need the Functions module on the map for it.
  6. @Dark How close are you spawning the helo to the player? If it's far away it shouldn't be an issue, but if it is close, enableSimulation might be helpful since this freezes the object into place, so it won't emit any sound or dust etc. I'm not sure whether this causes the object to behave like a stone or if it truly freezes it in place though.
  7. hideObject would be my first guess here. Creating a trigger that hides the helo until insertion should work fine. Note though that this is just local and has to be executed server-side, look through the comments for more info on that.
  8. I got a simple question about selecting a value within an array (I guess that's called subarray). So for example I execute a script like this: [player,[0.3,1]] execVM "somescript.sqf" Let's assume the subarray is a skill level. When I want to select a value within the skill-array it should look like this, right? _skill = (_this select 1) select 0; This would select 0.3 from the skill array. //Edit: Solution explained here, further down the post: http://forums.bistudio.com/showthread.php?100559-Beginners-guide-Arrays&p=1652016&viewfull=1#post1652016
  9. Remove the action at the start of the script (incase you use addAction) and add a sleep of 5 secs (sleep 5) to the end before adding the action again.
  10. tryteyker

    DoMove not working

    You're using "move" which basically requires a group and creates a waypoint. doMove should work just fine.
  11. You'll have to create a unit with a Stinger for that to work, since creating a missile mid-air and getting it to fly towards the helo isn't possible (atleast that's what I know of, I've tested it with 3 unguided and 2 guided missiles, they just fall straight to the ground even if spawned in the air). RU_Soldier_AA could be used for that, and take a look at createUnit array.
  12. If you want to have fixed positions, you could create a marker (F6 in the editor) and place it where you want the heli to spawn. Then instead of using the xyz coordinates you could use this: _group addWaypoint [(getmarkerpos "marker1"),0]; If you wanted to tell a heli to move to the position of the player (or assign the helo a WP) you'd use this: _group addWaypoint [(position player),0]; or heli doMove (position player); Or if you want to assign a waypoint with an offset: _position = [(getpos player select 0) + 3000, (getpos player select 1) + 3000, 0]; _group addWaypoint [_position,0]; Which would assign a waypoint 3000m away from the player. I hope this helps you understand the concept a bit.
  13. Why do you use exact xyz positions when adding waypoints? Wouldn't it make more sense to use markerpositions (when having fixed positions, like you seem to have) or simply a position offset from another position? Also I don't really see any if else statement which includes side anywhere, unless I'm blind right now. D:
  14. The only time I got the AI to get out of the helo was when I gave the group leader a Get out waypoint which was synced with the Tr Unload WP of the helo, but otherwise it only applied to the player (from what I've seen atleast)
  15. Hey, I'm currently working on a convoy-like mission, where I'm the lead vehicle and the AI follows me. And I've already got a (pretty simple) problem, and that is that the AI is acting incredibly stupid. I realize that's Arma2's AI and all that but I'd love if the AI stays in a column instead of always trying to form a wedge. They eventually catch up in an actual column once I move but I don't really want to wait 5 minutes until the AI drove out of the wall they crashed into and then line up perfectly. Any ideas how I could go about this? Thanks in advance.
  16. I think you kind of misunderstood my issue (and I probably haven't been clear enough :S), my issue here is basically that the AI always tries to move left and right of me regardless of whether I use "In Formation" or "None" as property of every vehicle at start. This causes the vehicles behind me to crash into walls and stuff, so it takes ages for them to catch up. Also, I'm driving a Humvee. So, the gunner is the commander, for whatever reason, so I'm only the driver. I can't give orders.
  17. Maybe try this: Create a trigger around the heli pad and as condition include a height check which should be less than or equal to 2. //Edit: Condition: (getposATL heli select 2) <= 2 This is the height check, you could also use ASL if you want to, shouldn't make a real difference unless you're landing on the LHD on Utes, which has an ASL height of 15. In the On Act put this: {_x action ["eject",helo]} foreach units group GroupName; This SHOULD work (I'll get back as how to do the height check because I have no idea right now but know for sure that I've included it in one of my missions)
  18. I made a mission some time ago which was basically a simple airstrike where an A10 would fly over the target area and drop bombs until there's none left and then leave. The problem with this is that the bombs never go past the object selected so it'll only hit the actual target and the targets infront of that. I used a fixed spawnpoint during the missiontesting but that's easily changeable. If you want to take a look, here's the script: // Creating the plane & pilot _grp = creategroup WEST; setfire = true; hintSilent "Select your firedirection"; onMapSingleClick { //We only need this event to fire once, once that happens we reset it onMapSingleClick {}; //ASL height _height = getTerrainHeightASL _pos; //Move the object ASTarget setPosASL [_pos select 0, _pos select 1, _height]; //Set variable setfire = false; }; waituntil {!setfire}; _targets = nearestObject [ASTarget, "Tank"]; hintSilent format ["%1",_targets]; if (!setfire) then { "Firedirection" setMarkerPos getpos ASTarget; // plane = createvehicle ["AV8B2", getmarkerpos "unitspawn",[],0,"FLY"]; plane = createvehicle ["A10", getmarkerpos "unitspawn",[],0,"FLY"]; plane setposATL [(getposATL plane select 0), getposATL plane select 1, 200]; plane setspeedmode "full"; plane setDir 90; plane setvelocity [100,0,0]; plane allowDamage false; pilot = _grp createunit ["USMC_Soldier_Pilot",getmarkerpos "unitspawn",[],0,"FORM"]; pilot moveindriver plane; pilot action ["LandGearUp", plane]; pilot doMove getpos _targets; pilot doTarget _targets; pilot flyinheight 300; pilot allowdamage false; }; // Dropping MK82 /* for [{_i = 0},{pilot distance _targets < 1500 && _i <= 2},{_i = _i + 1}] do { MyGameLogic action ["useWeapon",plane,pilot,5]; hintSilent format ["%1",_i]; sleep 0.2; }; */ waituntil {pilot distance _targets < 500}; //Declaring variable to limit bomb usage _i = 0; // A10 while {_i <= 3} do { MyGameLogic action ["useWeapon",plane,pilot,7]; sleep 1; _i = _i + 1; hintSilent format ["%1",_i]; }; /* AV8B2 while {_i <= 4} do { MyGameLogic action ["useWeapon",plane,pilot,5]; sleep 2; _i = _i + 1; hintSilent format ["%1",_i]; }; */ _pwp = _grp addWaypoint [getmarkerpos "planewp",0]; pilot doMove (getMarkerPos "planewp"); The script basically used nearestObject to give the pilot a valid target (since an empty target isn't valid and the pilot won't drop any bombs regardless of what you do) and then basically tells the pilot to drop bombs all over the place. It isn't 100% accurate (the actual airstrike) but IMO it shouldn't be 100% accurate. Here's the thread, scroll down to the bottom if you want an example mission (the script is both useable with an AV8B (without LGBs) and an A10) //Edit To go a bit more in-depth about the script, ASTarget is an invisible HPad, which is used to determine the nearestObject around it (for testing purposes I placed 3 Tanks in a triangle-shaped form and made it so it only checks for tanks). Firedirection is a simple marker. You can always add "Car" etc to nearestObject, it will only choose 1 object and target that one though. Using sleep is important when you're planning to use while-loops to drop bombs because without it all the bombs just go drop instantly. (Actually I just noticed this isn't totally what you want but I hope it's still helpful in some way.) //Edit So just to clarify I've also had the problem of the plane not targeting anything when simply moving to a position and telling the plane to target everything. It did nothing, came back and killed everything. The above way is how I fixed it.
  19. For the plane deleting issue I suppose you could add a WP 3000m away from the player and once the plane is about 2500-3000m away from the player delete it.
  20. clicked = 0; hint "Click on map to set the target location"; sleep 1; openmap true; onMapSingleClick { onmapsingleclick{}; target setpos [_pos select 0, _pos select 1, 0]; clicked = 1; openmap false; }; waitUntil {(clicked == 1)}; IMO using {} is a better way of writing code within onMapSingleClick if you're using multiple lines. Also: deleteVehicle AirSupport; DeleteGroup _ma2; A better way to write this might be: {deletevehicle _x} foreach crew AirSupport + [Airsupport] And maybe add a Range check to prevent it looking ugly (like, A10 is flying right above and then it's suddenly gone). About your main problem though, as Zulu1 said, Careless will cause the A10 to ignore everything. I also suggest to change the waypointtype to Search & Destroy ("SAD") above the target area instead of Move.
  21. If you don't want to run it via init.sqf I suggest you run it everytime before executing a function via script (ex. spawning a group). I've also heard that CBA checks for availability automatically but I've never relied on that (even though I always use CBA nowadays)
  22. assignAsCargo assigns the player as cargo and without an additional eject command the player won't get kicked out automatically. assignAsCargo isn't needed anyway (not as far as I know), so try without it. And you'll probably have to manually get out via action unless you're in a group and not the group leader, since the game won't force the player to do anything unless forced to via script. If you're in a group and the group leader has a Get Out WP synchronized with the Transport Unload, the group will automatically disembark, including you, so you don't have to do anything. Otherwise I recommend using the Eject action. Also you don't necessarily need to name your HPad unless you have multiple HPads and want the helicopter to land at the specific HPad, then you'll have to use heli land "land1", otherwise you can use the following: "GET IN" - low hover mode for units to get in "GET OUT" - low hover mode for units to get out "LAND" - full stop "NONE" - This cancels a landing
  23. Could be something like this: Anybody Present as condition, additionally this condition: player in vehicle Then configure your ending, whether it be with a script (execute that in the On Act field if that's the case) or something else.
  24. (Edit: Added a partially rewritten code, the old one was a pure mess. Still having issues though) Hey, since I didn't have anything to do I decided to work on a little spawn script, which basically spawns a Chinook & and a group, moving the group into the chinook and create an insertion scenario. I'd use Mando Heliroute for that but since this is just for learning I tried it myself. First of all, here's the complete script (might be a bit long, but not that long): _target = player; _dist = random 200; _dir = random 360; _pos = getpos _target; _positions = [(_pos select 0) + (sin _dir) * _dist, (_pos select 1) + (cos _dir) * _dist, 0]; _grp = createGroup WEST; _posmarker = createMarker ["Spawnpos",_positions]; "Spawnpos" setmarkershape "ICON"; "Spawnpos" setmarkertype "DESTROY"; chinook = createvehicle ["MH60S",_positions,[],0,"FLY"]; chinpilot = _grp createunit ["USMC_Soldier_Pilot",getpos chinook,[],0,"FORM"]; chinpilot moveinDriver chinook; chinook flyinheight 150; chinook setpos [getpos chinook select 0, getpos chinook select 1, 150]; hintsilent "setposd"; waitUntil {!isnil "BIS_fnc_init"}; _group = [getpos chinook, WEST,["USMC_Soldier","USMC_Soldier_AA","USMC_Soldier_HAT","USMC_Soldier_LAT","USMC_SoldierS"],[],[],[0.5,1],[],[2,0.5],0] call BIS_fnc_spawnGroup; waitUntil {alive chinook}; deleteMarker "Spawnpos"; {_x moveincargo chinook} foreach units _group; {_x assignAsCargo chinook} foreach units _group; hintSilent "moved"; _dist = random 100; _dir = random 180; _positions = [(_pos select 0) + (sin _dir) * _dist, (_pos select 1) + (cos _dir) * _dist, 0]; _lzmarker = createMarker ["Move",_positions]; "Move" setmarkershape "DESTROY"; "Move" setmarkerType "ICON"; _chinwp = _grp addWaypoint [_positions, 0]; _chinwp setWaypointType "MOVE"; _chinwp setWaypointBehaviour "CARELESS"; _chinwp setWaypointFormation "LINE"; _chinwp setWaypointCombatMode "BLUE"; waitUntil {chinook distance (getmarkerpos "Move") < 600}; hintsilent "passed wp, going to insertion"; chinook setSpeedMode "LIMITED"; _chinheight = getposASL chinook select 2; hint format ["%1",_chinheight]; _insertionwp = _grp addWaypoint [_positions,0]; _insertionwp setWaypointType "TR UNLOAD"; _insertionwp setWaypointBehaviour "CARELESS"; _insertionwp setWaypointFormation "LINE"; _insertionwp setWaypointCombatMode "BLUE"; while {chinook distance (getmarkerpos "Move") > 200} do { _chindistance = chinook distance (getpos _insertionwp); hintSilent format ["%1",_chindistance]; }; if (_chinheight > 30 && chinook distance (getmarkerpos "Move") < 200) then { chinook flyinheight 20; hintSilent "Approaching"; }; waitUntil {_chinheight < 40}; hintsilent "creating"; _hpad = "HeliH" createvehicle (position _insertionwp); chinook flyinheight 15; if (_chinheight <= 20) then { chinook land "LAND"; _group action ["eject",_chinook]; }; /* waitUntil {(_x not in _chinook) foreach units _group}; hintSilent "Hi"; _dist = random 200; _dir = random 360; _positions = [(_pos select 0) + (sin _dir) * _dist, (_pos select 1) + (cos _dir) * _dist, 0]; _movewp = _chinook addWaypoint [_positions,0]; _movewp setWaypointType "MOVE"; _movewp setWaypointBehaviour "CARELESS"; _movewp setWaypointFormation "LINE"; _movewp setWaypointCombatMode "BLUE"; _chinook moveTo _movewp; */ So, first issue: _target = player; _dist = random 200; _dir = random 360; _pos = getpos _target; _positions = [(_pos select 0) + (sin _dir) * _dist, (_pos select 1) + (cos _dir) * _dist, 0]; _grp = createGroup WEST; _posmarker = createMarker ["Spawnpos",_positions]; "Spawnpos" setmarkershape "ICON"; "Spawnpos" setmarkertype "DESTROY"; chinook = createvehicle ["MH60S",_positions,[],0,"FLY"]; chinpilot = _grp createunit ["USMC_Soldier_Pilot",getpos chinook,[],0,"FORM"]; chinpilot moveinDriver chinook; chinook flyinheight 150; chinook setpos [getpos chinook select 0, getpos chinook select 1, 150]; hintsilent "setposd"; I got the _positions from hogmason in one of my earlier threads when it was about getting a random spawning position aswell, and it worked out then. Now I had this thought that it probably wasn't a smart idea to use createUnit and I should've used createVehicle instead, since the helo never showed up (tested this like 5 times with diff. triggers, wasn't even alive), but first I added a marker. That one doesn't show up either. Which kind of leaves me thinking that I've done some sort of math error, since I got zero idea what sinus and cosinus is (still going to Highschool so we don't have that yet), even though my teacher explained the basics to me. Anyway, I've "reset" it to how I've done it before, _dir = 360, _dist = 50. Still no luck. I'm testing this on Utes, and that might not be a good idea because of the small little island. What I want to achieve here is that the script creates the Chinook & group within 360 degrees of the player. Then, the script looks in a 180 degree arc for a waypoint and creates it (the rest should be sort of obvious). I've, for test purposes, set the creation to position player, and I see the vehicle popping up but instantly disappearing. My RPT file sadly doesn't give any errors. For this reason, I haven't had a chance to try the rest of the script (although it gave me an error on the commented-out code on the bottom, not sure if it was because the chinook didn't exist or because it's generally wrong), so I'll probably update if I fix this first issue. I'd appreciate some help. //Edit: So I rewrote the code because I mixed stuff up, did some wrong things etc Now my issue is the heli landing. I'm creating a helipad directly at the position but the helo's not landing. Managed to get the issue with the helo working by sending him to the marker and correctly setting up the marker this time aroound (setmarkershape will forever be my enemy from now on :().
  25. Well honestly that doesn't sound like a challenge, but anyway, not my position to judge here. :P I guess I can write up the basic concept of spawning units since my Arma doesn't want to work anyway. First I suggest you read through createVehicle array & createUnit array (links provided above or just search on the BIKI) I'll start off with createVehicle array. Basic syntax for this: Object = createVehicle [type, position, markers, placement, special] Quick explanation of the stuff: Object = Basically the array containing the vehicle (example: _hind) type = The type of vehicle you want to spawn. Note this is an empty vehicle, so no crew within it. (Helpful links: Arma2 Library and =faction&options[sort_by]=vehicleclass&options[faction]=USMC&options[vehicleclass]=Air]SIX Config Browser (both include (nearly) all objects of Arma2 & OA) position = Baasically this can be a fixed position (ex: position player) or a markerposition (ex: getmarkerpos "infspawn"). Look up position and getmarkerpos on the BIKI for more info. markers = This is additional markers for randomized positioning. Note that this is within an array, so using [] is required. (ex: ["marker1","marker2"]) Using getmarkerpos is not necessary, only if oyu use a marker within the position. placement = This is the placement radius (sorta like offset) of the marker / position. It checks in a circle as far as I know. (ex: you use position player & placement of 10, this causes the vehicle to spawn 10 m away from the players position) special = This can be multiple things. "Special properties can be: "NONE", "FLY" and "FORM". "CAN_COLLIDE" creates the vehicle exactly where asked, not checking if others objects can cross its 3D model." - Taken from the BIKI. NONE = Nothing, no special stuff. Just like the special properties section in the regular editor when you spawn a unit and choose None. FLY = Self explaining, just like "Flying" in editor. Only useful for Helos or Airplanes. FORM = Again self explaining, just like "In Formation" in editor. Sets the vehicle to the predefined formation (if in a group) which was defined by setFormation (or just plain old Wedge if it's Arma doing the job) CAN_COLLIDE = This one's special. regularly Arma checks whether an object could collide with for ex. a barrel which is in the way. This disables said check and lets you basically place objects within objects (I've never used it tho) I hope this kind of makes sense. If it does, off to the next one: createUnit array Basic syntax: Object = group createUnit [type, position, markers, placement, special] Alot of this is just like createVehicle array, although there are some differences. Object = Same as createVeh array, the array containing the object (ex: _pilot) group = Now for this you either need a pre-defined group via editor or you need to create it via script. This defines which group the newly created unit will join (remember, this is a unit, so like a soldier for example). Ex. via editor: groupName = group this in units init line in editor. Ex. via script: _group = createGroup WEST/EAST/INS type = Same as createVehicle array, just that it's more towards single units here and not vehicles. position = Same as createVeh array. markers = Same as createVeh array. placement = Same as createVeh array. special = This is a bit different from createVeh array since this is focused on units. "Special properties can be: "NONE" and "FORM"." - Taken from BIKI The only special properties now are NONE and FORM, but are the exact same as we used in createVehicle array. I hope this made some sense and if not just ask questions.
×