Jump to content

Easelm

Member
  • Content Count

    19
  • Joined

  • Last visited

  • Medals

Posts posted by Easelm


  1. Noone wants to eject the crew of a chopper without any reason... =)

    In following (ugly) code i put an 5 man INF Squad in the heli and eject them..

    SpawnHele = true;
    while {SpawnHele} do 
    {
      Unit1 = [getPos hpad, side player, (configFile >> "CfgGroups" >> "West" >> "BIS_US" >> "Air" >> "US_CH47FFlight")] call BIS_fnc_spawnGroup;
      wp1 = Unit1 addWaypoint [getPos wp, 20];
      Cargo1 = [getPos hpad, WEST, 5] call BIS_fnc_spawnGroup;
      {_x moveInCargo (assignedVehicle (leader Unit1))} foreach units Cargo1;
     if(SpawnHele) Then 
     {
       {
          unassignVehicle (_x);
          (_x) action ["EJECT", vehicle _x];
          } foreach units Cargo1;
       };
     }; 
       sleep 5;
    };

    :rolleyes:

    Ugly code? I laughed. If you could not understand my code because it isn't your way, then please, keep those comments to yourself.

    @Buliwyf

    Mate, when a guy doesnt even know about moveInCargo command, dont confuse him with all that fancy stuff :) lol

    @Easelm

    1: you need assignAsCargo, moveInCargo Commands.

    2: several different ways of doing it, using foreach command:

    examples:

    name group, place this in group leaders init.line. groupname = group this,

    then do eject foreach units groupname, as Buliwyf showed.

    {
      unassignVehicle (_x);
      (_x) action ["EJECT", vehicle _x];
    } foreach units groupname;

    or do eject for all units in heli that is not in group with driver/pilot:

    {
      if ((group _x) != (group (driver heliname))) then {
         unassignVehicle (_x);
         (_x) action ["EJECT", vehicle _x];
      };
    } foreach units groupname;

    you can also do if not driver then eject etc... many posibilitys., 1st groupname version recomended, many different ways of doing it.

    Thanks. At least someone actually gets me and what I am looking for. I am going to try it out now. <3


  2. First Question:

    Hello again. I am wondering how to get units inside of a helicopter when that helicopter spawns "in the air". I have tried my own methods, I also searched for some methods and other things that didn't help.

    Second Question:

    Once I get units spawning in the helicopters correctly, I want to eject the units in the helicopter, well, I have something that works, but I want the pilot to stay in the helicopter instead of him launching out and the Helicopter falling out of the sky.

    Here is the code I have for the helicopters to spawn, units ejecting, the helicopters go to a waypoint(This script works, but I want to add the above questions):

    SpawnHele = true;
    while {SpawnHele} do 
    {
      Unit1 = [getPos hpad, side player, (configFile >> "CfgGroups" >> "West" >> "BIS_US" >> "Air" >> "US_CH47FFlight")] call BIS_fnc_spawnGroup;
      wp1 = Unit1 addWaypoint [getPos wp, 20];
     if(SpawnHele) Then 
     {
       {
          unassignVehicle (_x);
         (_x) action ["EJECT", vehicle _x];
       } foreach units Unit1;
     }; 
       sleep 5;
    };


  3. Thanks buddy. I actually got it working, but I'm going to try your method.

    ---------- Post added at 01:02 AM ---------- Previous post was at 12:31 AM ----------

    Hey, everything works, thanks for that, but it isn't calling "Bombers.sqf" when the enemies hit the trigger.

    Bombers.sqf contains:

    _bomb =  "Bo_GBU12_LGB" createVehicle getPos leader _Grp;
    _bomb1 = "Bo_GBU12_LGB" createVehicle getPos leader _Grp1;
    _bomb2 = "Bo_GBU12_LGB" createVehicle getPos leader _Grp2;
    _bomb3 = "Bo_GBU12_LGB" createVehicle getPos leader _Grp3;
    _bomb4 = "Bo_GBU12_LGB" createVehicle getPos leader _Grp4;

    SpawnEnemies.sqf contains:

    //grp1 = [getPos hpad5, EAST, 3] call BIS_fnc_spawnGroup;
    
    SpawnEnemies = true; // start spawning
    
    while {SpawnEnemies} do {
    _Grp = [getPos hpad1, EAST, 2] call BIS_fnc_spawnGroup;
           _Grp1 = [getPos hpad2, EAST, 2] call BIS_fnc_spawnGroup;
           _Grp2 = [getPos hpad3, EAST, 2] call BIS_fnc_spawnGroup;
           _Grp3 = [getPos hpad4, EAST, 2] call BIS_fnc_spawnGroup;
           _Grp4 = [getPos hpad5, EAST, 2] call BIS_fnc_spawnGroup;
           _wp = _Grp addWaypoint [getPos hpad6, 10];
           _wp1 = _Grp1 addWaypoint [getPos hpad6, 10];
           _wp2 = _Grp2 addWaypoint [getPos hpad6, 10];
           _wp3 = _Grp3 addWaypoint [getPos hpad6, 10];
           _wp4 = _Grp4 addWaypoint [getPos hpad6, 10];
    sleep 10 + (random 10); // sleep 30 - 60 sec before next group
    };

    When I put a test "Bomber" code in the loop, it will make them explode, but it doesn't work outside of the loop for some reason.


  4. Well, I had this working before, but I was waiting on my best bud to get back from his 2 day work at an Air Force Base, but it seems I have forgotten what I did to make the units spawn continuously.

    Here is the grp1:

    grp1 = [getPos hpad1, EAST, 3] call BIS_fnc_spawnGroup;

    Here is what I had:

    // Respawns units
    for "_k" from 0 to ((count units grp1)-1) do {
       sleep 2;
    };

    Help would be greatly appreciated.


  5. Hmm, for the global name, do I actually have to add another scripts name to make it work?

    I have Bombers.sqf:

    Boom = "M_AT10_AT" createVehicle getpos vehicle NAMEHERE;

    ^ Works, just need to get the group to explode for a test.

    Or does it work globally without adding the script, like so:

    grp1 execVM "Bombers.sqf";

    ---------- Post added at 05:06 AM ---------- Previous post was at 04:59 AM ----------

    EDIT:: I got the looping to work. <3 Just need to know the above.


  6. Yes. Give them a GLOBAL name (without the underscore). Then you can refer to the group using this name in other scripts. In this case below it is westgrp1.

    //spawn a WEST group with 5 random units...
    westgrp1 = [getPos hpad1, WEST, 5] call BIS_fnc_spawnGroup;
    

    Next...

    To take away the groups (westgrp1) ammo.....

    for "_i" from 0 to ((count units westgrp1)-1) do {
       _unit = units westgrp1 select _i;
       {_unit removeMagazine _x} forEach magazines _unit;
       sleep 0.01;
    };

    For the timer it depends how you want to do things.... there's a few ways... but you most probably need to use a loop with a big sleep. You have the loop structure above.

    Start opening scripts and try to read and understand them. Try to see what they do. Familiarize yourself with the scripting commands.

    The best advice is probably to not to be too ambitious. You will simply end up frustrated.

    Do you have -showScriptErrors added to your games shortcut? This is very important in order to see where your scripts are screwing up.

    Thanks for your help. I am reviewing the command list, as well as adding some other things. I appreciate your help. Peace out. I will figure out the looping enemies spawn myself. :)


  7. Tried your sample. Really like it.

    However, when I attempt to change the WEST to EAST, it doesn't work. I've gone over the script a dozen times. I'm obviously missing something because there isn't much to it.

    The really cool part is that I put another line in the script to call specific enemy units, much like the wiki page shows. Did not work until I made the enemies WEST... when I shot them, I got the "blue on blue" message.

    any help?

    To spawn the "EAST" enemies, you will need to at least have one OPFOR or w/e enemy present.


  8. Try again.... I took out the reference to the "binocs".

    Thanks. Worked like a charm. And you understood my problem fully, I appreciate it. I have some more questions. Is there any way to assign the new groups a name so you can script them; As well as taking away their ammo and if possible, loop the script so they will spawn on a timer? If it is too much to have thoughts about, it is okay. Really, I am happy to even have the correct script.


  9. Here is an example from one of my missions.

    // Array of markers pre placed in the editor at diffrent locations.
    
    _markers = ["m1", "m2", "m3","m4","m5","m6","m7","m8","m9","m10","m11","m12","m13","m14","m15","m16","m17","m18","m19""m20""m21","m22","m23","m24","m25"];
    
    /// Pick some random positions out of our markers to spawn the bad guys
       _pos = (getMarkerPos (_markers select (floor(random(count _markers)))));
       _pos2 = (getMarkerPos (_markers select (floor(random(count _markers)))));
       _pos3 = (getMarkerPos (_markers select (floor(random(count _markers)))));
       _pos4 = (getMarkerPos (_markers select (floor(random(count _markers))))); 
    
    // Spawn the groups        
       grp1 = [_pos, east, ["TK_INS_Soldier_EP1","TK_INS_Soldier_EP1","TK_INS_Soldier_EP1"]] call BIS_fnc_spawnGroup;
       grp2 = [_pos2, east, ["TK_INS_Soldier_EP1","TK_INS_Soldier_EP1","TK_INS_Soldier_EP1"]] call BIS_fnc_spawnGroup;
       grp3 = [_pos3, east, ["TK_INS_Soldier_EP1","TK_INS_Soldier_EP1","TK_INS_Soldier_EP1"]] call BIS_fnc_spawnGroup;
       grp8 = [_pos4, east, ["TK_INS_Soldier_EP1","TK_INS_Soldier_EP1","TK_INS_Soldier_EP1"]] call BIS_fnc_spawnGroup;
    
    // Place three of the groups into building positions. 
    
    grp1 execVM "PlaceInBuilding.sqf";
    grp2 execVM "PlaceInBuilding.sqf";
    grp3 execVM "PlaceInBuilding.sqf";
    
    // Have the last group start patroling from the center of the area (Marker 24) 
    
    [grp8, getMarkerPos "m24",75 ] call bis_fnc_taskPatrol;
    

    Commands you should look at:

    http://community.bistudio.com/wiki/Category:ArmA_2:_Functions

    http://community.bistudio.com/wiki/addWaypoint

    This is exactly what I am talking about. You linked me the script, but you didn't show how to activate the script. If you say its by a trigger, please give me an example. I wrote in "On Act." the script, but nothing happened. I also spawned the markers. It would be greatly appreciated. If I am coming on too strong, well, I'm trying to get through people here.


  10. Doubtful. If I know how to script explosives, I wouldn't know how to do anything else without actually having to be into this Arma2 OA editing, especially if it is something new to me, such as spawning functions. I just started a few days ago, so I am still reviewing tons of essentials.

    And I just noticed that the thread you linked was a few topics down, but note, I was using the search function and it didn't show up.

    But anyway, I will notify everyone if I still need help by bumping this thread, thanks for your help.


  11. Yes, before you type or comment, I have looked, found a lot of things for my request, but, sadly they are crap. They do not give out specific detail in 'how' to get the enemies spawning. I would also like to set their waypoints and set an automatic different name to script them.

    If the automatic different name isn't possible, I will go with the waypoints and spawning enemies. I pretty much know how to script explosives, but I would like to have enemies spawning for fun, non-stop action.

    About "how to get them to spawn", is it triggered by a Game Logic? If so, could someone elaborate on how to do that? I have been searching for the script I want for hours, but I have had no luck.

×