Jump to content

splatsh

Member
  • Content Count

    123
  • Joined

  • Last visited

  • Medals

Posts posted by splatsh


  1. _spawntype = "HMMWV_M2";
    
    _bpos = C1 ModelToWorld [0,-12,-5.5];
    
    _bomb = _spawntype createVehicle _bpos;
    _bomb setpos _bpos;
    _bomb setDir direction C1;
    _chute = "ParachuteMediumWest" createVehicle getpos _bomb;
    _chute setpos (_bomb ModelToWorld [0,0,3]);
    _bomb attachTo [_chute,[0,0,0]];
    sleep 0.05;
    

    If u mean this?

    That did not work. =(


  2. I am using some of this code:

    http://forums.bistudio.com/showthread.php?t=77397&highlight=BIS_fnc_supplyDrop

    By Tajin

    This is how my code look like now.

    _spawntype = "HMMWV_M2";
    
    _bpos = C1 ModelToWorld [0,-12,-5.5];
    
    _bomb = _spawntype createVehicle _bpos;
    _bomb setpos _bpos;
    _bomb setDir direction _bpos;
    _chute = "ParachuteMediumWest" createVehicle getpos _bomb;
    _chute setpos (_bomb ModelToWorld [0,0,3]);
    _bomb attachTo [_chute,[0,0,0]];
    sleep 0.05;
    

    Ok, I have a C-130J named C1 on my map who is flying.

    When my code is in action, there is a spawn of a HMMWV_M2 and its moving towards the ground. But now Chute is there, I cant get this chute to spawn and attachTo the car.

    Whats wrong?


  3. My mistake.

    This will not work because of variable scope. The variable _type is local only to the script, and thus cannot be used in the trigger statement. You could try this:

    this setTriggerStatements ["C1 distance player<= 400;", format ["[C1,%1] call BIS_fnc_supplyDrop;",_type], ""];

    Thanks, I will try that later.

    One more question

    This works

    _wpt1 setWaypointStatements ["true",  "[medic] join player"];

    with this

    _unit = _group_2 createUnit [_spawntype, _spawnPoint, [], 3, "FORM"];
    _unit setVehicleVarName "medic";
    medic = _unit;
    

    Why is this not working and how to get it to work

    _wpt1 setWaypointStatements ["true",  "[_unit] join player"];

    If I can get this to work, I dont need to name my units that I am spawning, it really should help me out if I could get them to join me without names.

    and I cant get deleteVehicle to work

    _wpt2 = _group_1 addWaypoint[_spawnPoint,50];
    _wpt2 setwaypointtype "MOVE";
    _wpt2 setWaypointStatements ["true", "deleteVehicle _vehicle_1"];
    

    My chopper is moving to that _spawnPoint, but they dont delete it.

    How can I delete stuff when they have arrived to a move point?


  4. You have to pass the classname as a string:

    nul=["HMMWV_Armored"] execVM "test.sqf"

    ---------- Post added at 11:19 AM ---------- Previous post was at 11:18 AM ----------

    Should be:

    [C1,_type]

    Sorry, still not working

    _this = createTrigger ["EmptyDetector", [0,0,0]];
    _this setTriggerArea [0, 0, 0, true];
    _this setTriggerActivation ["NONE", "PRESENT", false];
    _this setTriggerStatements ["C1 distance player<= 400;", "[C1,_type] call BIS_fnc_supplyDrop;", ""];
    _trigger_0 = _this;
    
    hint format ["%1",triggerStatements _trigger_0];
    

    My hint is saying [C1, _type] when I use that.

    when I use

    _this setTriggerStatements ["C1 distance player<= 400;", "[C1, ""HMMWV_Armored""] call BIS_fnc_supplyDrop;", ""];

    My hint is telling me the right stuff:

    [C1, HMMWV_Armored]

    So, I still got something wrong.


  5. This works

    In trigger activation:

    nul=[] execVM "test.sqf"

    // test.sqf
    
    _this setTriggerStatements ["C1 distance player<= 400;", "[C1,""HMMWV_Armored""] call BIS_fnc_supplyDrop;", ""];
    

    But this wont work. Why?

    How can I make this to work right?

    nul=[HMMWV_Armored] execVM "test.sqf"

    // test.sqf
    
    _type = _this select 0;
    
    
    _this setTriggerStatements ["C1 distance player<= 400;", "[C1,""_type""] call BIS_fnc_supplyDrop;", ""];
    

    I have try this to

    [C1,"_type"]

    and

    [C1,_type]

    But I cant get it to work.


  6. Hi!

    I have this code that I run when my task is completed

    [C1,"HMMWV_M2"] call BIS_fnc_supplyDrop

    Then I get a new mission and so on...

    Now... if my HMMWV_M2 is destroyed by enemy

    Can I have something like the reinforcement code that is when you play SOM mission and your squad member got killed. Then you got a new squad member, right.

    How to make that happend with this HMMWV_M2?

    Any idea where I can look, and where to start?


  7. I have one chopper named "heli" and in the heli is a soldier named "gunner"

    chopper is going to a waypoint and when heli is there the soldier is leaving the chopper

    _wpt0 = _group_0 addWaypoint[position base_heli_land,10];
    _wpt0 setwaypointtype "MOVE";
    _wpt0 setWaypointStatements ["heli distance heli_land<= 100", "unassignVehicle gunner;"];
    

    and that is fine and working, now the chopper is standing still with engine running, and that is also good.

    Part 2:

    I have a vehivle and a driver.

    They have a waypoint to the same spot as the chopper are standing now.

    And here is what I want:

    I want that the chopper is waiting and waiting for the driver in the vehicle to come in the cargo at the chopper.

    I have a waypoint for the driver, and when done the driver is leave vehicle.

    _wpt3 = _group_2 addWaypoint[position base_heli_land,30];
    _wpt3 setwaypointtype "MOVE";
    _wpt3 setWaypointStatements ["true", "unassignVehicle driver;"];
    

    Now, I want that driver is creating a waypoint to get in the chopper.

    and when driver is in the chopper, the chopper can leave the area.

    How can I do it?


  8. I can get out a squad from a chopper with this

    _waypoint1 = _group_0 addwaypoint[position eject1,250];
    _waypoint1 setwaypointtype "MOVE";
    _waypoint1 setWaypointStatements ["true", "{unassignvehicle _x;} foreach units ai; 
    {_x action [""EJECT"", heli];} foreach units ai;"];
    

    But the same code dont work with a Vodnik.

    _waypoint4 setWaypointStatements ["true", "{unassignvehicle _x;} foreach units a2; 
    {_x action [""EJECT"", vodnik];} foreach units a2;"];
    

    ai are the same as a2 and name of vehicle is vodnik instead of heli, same code, but my squad will not get out... how come?

    ---------- Post added at 09:28 PM ---------- Previous post was at 08:44 PM ----------

    Answer:

    I have forgotten to add

    "_group_# = CreateGroup East;"

    at every groups.

    It works now


  9. Ok, I have this in one other thread, but that thread is about eject, and now my eject are working.

    But its not working as I would like it to.

    Check this.

    Working

    {unassignvehicle _x;} foreach units _leader;
    {_x action ["EJECT", _vcl_new];} foreach units _leader;
    

    NOT working

    {
    unassignvehicle _x;
    _x action ["EJECT", _vcl_new];
    sleep 0.5;
    } foreach units _leader;
    

    I cant get this second code to work. Why cant I that?

    This code seems to work for others when using in it.

    But mine is not working, I cant get this sleep to work.

    Please help.


  10. Cause you forgot a semicolon behind sleep 0.5 ^^;

    The version above is wrong too... behind every line must be a ";" (but this dont seems to produce errors, buts its quite wrong);

    This is correct:

    {unassignvehicle _x;} foreach units _leader;
    {_x action ["EJECT", _vcl_new];} foreach units _leader; 

    or

    {
    unassignvehicle _x;
    _x action ["EJECT", _vcl_new];
    sleep 0.5;
    } foreach units _leader; 

    Thanks, but the second one is not working, they dont eject =/

    Working

    {unassignvehicle _x;} foreach units _leader;
    {_x action ["EJECT", _vcl_new];} foreach units _leader;
    

    NOT working

    {
    unassignvehicle _x;
    _x action ["EJECT", _vcl_new];
    sleep 0.5;
    } foreach units _leader;
    


  11. I use this in one other code I use to get a squad to a chopper, then eject and so on...

    _leader = _Grp1 createUnit ["RU_Soldier_SL", [(position _pos) select 0,(position _pos) select 1,0], [], 3, "FORM"];
    

    Now, I want to get some more.

    How to put in this, where and how do I do it?:

    -Rank (CAPTAIN)

    -Skill (0.7)

    -Init (this addWeapon binocular)


  12. I have finaly got it to work ok.

    Maybe someone could optimize this, but it all works fine here now.

    I dont know if it work in MP or so.

    I got it working in editor/preview.

    // heli_eject.sqf ****************
    
    // Create Chopper and crew
    Pilots = CreateGroup East;
    _vcl_new = "Mi17_rockets_RU" createVehicle [(position start_heli select 0)+1, (position start_heli select 1)+1,0];
    _vcl_new setVehicleVarName "heli";
    _crewPilot0 = Pilots createUnit ["RU_Soldier_Crew", [(position start_pilot) select 0,(position start_pilot) select 1,0], [], 3, "FORM"];
    _crewPilot1 = Pilots createUnit ["RU_Soldier_Crew", [(position start_pilot) select 0,(position start_pilot) select 1,0], [], 3, "FORM"];
    
    // Move crew into chopper
    _crewPilot0 moveinDriver _vcl_new;
    _crewPilot1 moveinCargo _vcl_new;
    
    
    // Create Squad
    GroupSquad1 = CreateGroup East;
    _leader = GroupSquad1 createUnit ["RU_Soldier_SL", [(position start_soldier) select 0,(position start_soldier) select 1,0], [], 3, "FORM"];
    _unit = GroupSquad1 createUnit ["RU_Soldier_MG", [(position start_soldier) select 0,(position start_soldier) select 1,0], [], 3, "FORM"];
    _unit = GroupSquad1 createUnit ["RU_Soldier_AT", [(position start_soldier) select 0,(position start_soldier) select 1,0], [], 3, "FORM"];
    _unit = GroupSquad1 createUnit ["RU_Soldier_LAT", [(position start_soldier) select 0,(position start_soldier) select 1,0], [], 3, "FORM"];
    _unit = GroupSquad1 createUnit ["RU_Soldier_Marksman", [(position start_soldier) select 0,(position start_soldier) select 1,0], [], 3, "FORM"];
    _unit = GroupSquad1 createUnit ["RU_Soldier_LAT", [(position start_soldier) select 0,(position start_soldier) select 1,0], [], 3, "FORM"];
    _unit = GroupSquad1 createUnit ["RU_Soldier_AR", [(position start_soldier) select 0,(position start_soldier) select 1,0], [], 3, "FORM"];
    _unit = GroupSquad1 createUnit ["RU_Soldier_GL", [(position start_soldier) select 0,(position start_soldier) select 1,0], [], 3, "FORM"];
    _unit = GroupSquad1 createUnit ["RU_Soldier_Medic", [(position start_soldier) select 0,(position start_soldier) select 1,0], [], 3, "FORM"];
    
    // Make leader
    _leader = leader GroupSquad1;
    
    // Move squad inside chopper
    {_x moveInCargo _vcl_new} foreach units _leader;
    
    
    // Create waypoint for chopper
    _waypoint0 = Pilots addwaypoint[position eject1,10];
    _vcl_new flyinHeight 150;
    _waypoint0 setWaypointSpeed "FULL"
    _waypoint0 setwaypointtype "MOVE";
    
    _waypoint0 = Pilots addwaypoint[position heli_stop,10];
    _waypoint0 setWaypointSpeed "FULL"
    _waypoint0 setwaypointtype "MOVE";
    
    @_vcl_new distance eject1 < 200;
    
    // Make squad to eject the chopper
    {_x action ["EJECT", _vcl_new]} foreach units _leader;
    {unassignvehicle _x} foreach units _leader;
    
    // Create waypoint for squad
    _waypoint1 = GroupSquad1 addwaypoint[position eject1,500];
    _waypoint1 setWaypointSpeed "LIMITED"
    _waypoint1 setwaypointtype "SAD";
    
    // Create waypoint 2 for squad
    _waypoint2 = GroupSquad1 addwaypoint[position eject1,10];
    _waypoint2 setWaypointSpeed "LIMITED"
    _waypoint2 setwaypointtype "DISMISS";
    
    // Land the chopper
    @_vcl_new distance heli_stop < 200;
    {unassignvehicle _x} foreach units _crewPilot0;
    
    // Wait 60 seconds
    ~60
    // Delete Chopper and crew
    deleteVehicle _vcl_new;
    deleteVehicle _crewPilot0;
    deleteVehicle _crewPilot1;
    EXIT
    

    got a trigger to set all of.

    And the best is that I can use the same trigger and the same code over and over.


  13. Why are you doing all of that via scripts and not the editor itself?

    As for ejecting, search for eject there's been plenty of threads about it.

    please dont answer me again... you dont think I have search, there is 2 pages with hit on searsh of the word eject, I was doing this over and over and over for 5 hours last night, and testing all things out, and searched this forum and tested things out. Then I desided to register and write all my code I got so far and ask in this forum...

    ---------- Post added at 10:47 AM ---------- Previous post was at 10:42 AM ----------

    I think you dont passed the names of the squad and the heli as parameter to the script.

    _group = _this select 0;
    _vehicle = _this select 1;

    Means that the 1 param, will be stored in _group and the second param in _vehicle.

    If you exec the script, you must write this:

    dumvar = [groupname,yourchopper] execVM "eject.sqf";

    This:

    _group = _leader;
    _vehicle = _vcl_new;

    wont work because a var with the "_" prefix is local in each script. In a new script, this _VCL_new and _leader is empty.

    If you have the eject code in the same file, you just need this:

    {
    unassignvehicle _x;
    _x action ["EJECT", _vcl_new];
    sleep 0.5;
    } foreach units GroupSquad1;

    You dont need the "if"-thing because you KNOW that the params are correct (your created them^^)

    Well, I have not created them at all, I have read this forum and copy and paste, and try thing out, to learn some things... so none of these code are my.

    and thanks for this answer

    "wont work because a var with the "_" prefix is local in each script. In a new script, this _VCL_new and _leader is empty."

    Now I know that. But I have all code on the same page/file... strange?

    like this, this is my entire code and script:

    // heli_eject.sqf
    
    Pilots = CreateGroup East;
    _vcl_new = "Mi17_rockets_RU" createVehicle [(position start_heli select 0)+1, (position start_heli select 1)+1,0];
    _vcl_new setVehicleVarName "heli";
    _crewPilot0 = Pilots createUnit ["RU_Soldier_Crew", [(position start_pilot) select 0,(position start_pilot) select 1,0], [], 3, "FORM"];
    _crewPilot1 = Pilots createUnit ["RU_Soldier_Crew", [(position start_pilot) select 0,(position start_pilot) select 1,0], [], 3, "FORM"];
    _crewPilot0 moveinDriver _vcl_new;
    _crewPilot1 moveinCargo _vcl_new;
    
    
    
    GroupSquad1 = CreateGroup East;
    _leader = GroupSquad1 createUnit ["RU_Soldier_SL", [(position start_soldier) select 0,(position start_soldier) select 1,0], [], 3, "FORM"];
    _unit = GroupSquad1 createUnit ["RU_Soldier_MG", [(position start_soldier) select 0,(position start_soldier) select 1,0], [], 3, "FORM"];
    _unit = GroupSquad1 createUnit ["RU_Soldier_AT", [(position start_soldier) select 0,(position start_soldier) select 1,0], [], 3, "FORM"];
    _unit = GroupSquad1 createUnit ["RU_Soldier_LAT", [(position start_soldier) select 0,(position start_soldier) select 1,0], [], 3, "FORM"];
    _unit = GroupSquad1 createUnit ["RU_Soldier_Marksman", [(position start_soldier) select 0,(position start_soldier) select 1,0], [], 3, "FORM"];
    _unit = GroupSquad1 createUnit ["RU_Soldier_LAT", [(position start_soldier) select 0,(position start_soldier) select 1,0], [], 3, "FORM"];
    _unit = GroupSquad1 createUnit ["RU_Soldier_AR", [(position start_soldier) select 0,(position start_soldier) select 1,0], [], 3, "FORM"];
    _unit = GroupSquad1 createUnit ["RU_Soldier_GL", [(position start_soldier) select 0,(position start_soldier) select 1,0], [], 3, "FORM"];
    _leader = leader GroupSquad1;
    
    {_x moveInCargo _vcl_new} foreach units _leader;
    
    sleep 1;
    
    
    _vcl_new move (position flyTo1);
    @_vcl_new distance flyTo1 < 130;
    _vcl_new move (position eject);
    @_vcl_new distance eject < 130;
    
    _group = _leader;
    _vehicle = _vcl_new;
    
    if ( (typename _group != "GROUP") or (typename _vehicle != "OBJECT") ) exitwith {
    hintSilent "Invalid Parameters parsed";
    };
    
    sleep 1;
    
    {
    unassignvehicle _x;
    _x action ["EJECT", _vehicle];
    sleep 0.5;
    } foreach units _group;
    

    you see, I have all on the same page... but it still not working

    Done some update on the code...

    {_x action ["EJECT", _vcl_new];
    sleep 0.5;
    } 	foreach units _leader;
    {unassignvehicle _x} foreach units _leader;
    

    now, that code will get down the chopper and let my squad out.. so unassignvehicle is working OK =)

    Now, can you help me with this code and get it to work fine.

    {_x action ["EJECT", _vcl_new];
    sleep 0.5;
    } 	foreach units _leader;
    


  14. I have read some, and I am trying to create some stuff.

    Here I am creating a chopper, and two pilots, and make them to get in.

    and this works for me.

    Pilots = CreateGroup East;
    _vcl_new = "Mi17_rockets_RU" createVehicle [(position start_heli select 0)+1, (position start_heli select 1)+1,0];
    _vcl_new setVehicleVarName "heli";
    _crewPilot0 = Pilots createUnit ["RU_Soldier_Crew", [(position start_pilot) select 0,(position start_pilot) select 1,0], [], 3, "FORM"];
    _crewPilot1 = Pilots createUnit ["RU_Soldier_Crew", [(position start_pilot) select 0,(position start_pilot) select 1,0], [], 3, "FORM"];
    _crewPilot0 moveinDriver _vcl_new;
    _crewPilot1 moveinCargo _vcl_new;
    

    Next step is to create a squad.

    This also works fine for me.

    GroupSquad1 = CreateGroup East;
    _leader = GroupSquad1 createUnit ["RU_Soldier_SL", [(position start_soldier) select 0,(position start_soldier) select 1,0], [], 3, "FORM"];
    _unit = GroupSquad1 createUnit ["RU_Soldier_MG", [(position start_soldier) select 0,(position start_soldier) select 1,0], [], 3, "FORM"];
    _unit = GroupSquad1 createUnit ["RU_Soldier_AT", [(position start_soldier) select 0,(position start_soldier) select 1,0], [], 3, "FORM"];
    _unit = GroupSquad1 createUnit ["RU_Soldier_LAT", [(position start_soldier) select 0,(position start_soldier) select 1,0], [], 3, "FORM"];
    _unit = GroupSquad1 createUnit ["RU_Soldier_Marksman", [(position start_soldier) select 0,(position start_soldier) select 1,0], [], 3, "FORM"];
    _unit = GroupSquad1 createUnit ["RU_Soldier_LAT", [(position start_soldier) select 0,(position start_soldier) select 1,0], [], 3, "FORM"];
    _unit = GroupSquad1 createUnit ["RU_Soldier_AR", [(position start_soldier) select 0,(position start_soldier) select 1,0], [], 3, "FORM"];
    _unit = GroupSquad1 createUnit ["RU_Soldier_GL", [(position start_soldier) select 0,(position start_soldier) select 1,0], [], 3, "FORM"];
    _leader = leader GroupSquad1;
    
    {_x moveInCargo _vcl_new} foreach units _leader;
    

    Now I will create some move for the chopper.

    This also works fine for me.

    _vcl_new move (position flyTo1);
    @_vcl_new distance flyTo1 < 130;
    _vcl_new move (position eject);
    @_vcl_new distance eject < 130;
    

    And now we are at the part where I get error.

    I want to eject my squad, I have this code for that

    _group = _this select 0;
    _vehicle = _this select 1;
    
    if ( (typename _group != "GROUP") or (typename _vehicle != "OBJECT") ) exitwith {
    hintSilent "Invalid Parameters parsed";
    };
    
    sleep 1;
    
    {
    unassignvehicle _x;
    _x action ["EJECT", _vehicle];
    sleep 0.5;
    } foreach units _group;
    

    Now, I have try some out, like:

    _group = _leader;
    _vehicle = _vcl_new;
    

    And

    _group = GroupSquad1;
    _vehicle = heli;
    

    At the top of the eject code, instead of:

    _group = _this select 0;
    _vehicle = _this select 1;
    

    But I cant get it to work, my men will not eject. why?

    How can I do so they will eject?

    And please, its my first time here, and my first code and script of this game.

    I have no experience of arma or arma2 at all. and not there codes and so on.

    I was learning from this forum and from this site tonight: http://community.bistudio.com/wiki/Category:Scripting_Commands_ArmA2

    thanks

×