splatsh 10 Posted January 21, 2011 (edited) I am playing with som stuff, and now I am trying to build one support script that will fly in some medics and so on.. And to get my medics into the chopper I use this call_medic.sqf {_x assignAsCargo _transporthelo; _x moveInCargo _transporthelo} forEach Units _spawngroup; Now the transporthelo is flying to me and land and the medics are coming to me (player) So far so god... Now I have done one addAction to get cancel on my medics, and I want to let them go inside this chopper again and the chopper will lift of and go home. menuID0_7 = _unit addaction ["Cancel Medic", "scripts\request\medic\cancel.sqf", [], 1, false, true, "", ""]; cancel_medic.sqf _unit = _this select 0; // who called it. hint "Medic team returning to base!"; {_x assignAsCargo _transporthelo; _x action ["getIn", _transporthelo]} foreach units _spawngroup; How do I get right arguments in my addAction to get my code to work proper in cancel_medic.sqd file? Edited January 21, 2011 by splatsh Share this post Link to post Share on other sites
Muzzleflash 111 Posted January 21, 2011 The unit who called it is: _this select [b]1[/b] not 0. How, does cancel_medic.sqf know what _transporthelo and _spawngroup is? Share this post Link to post Share on other sites
splatsh 10 Posted January 21, 2011 Well, I think that is that I am trying to find out and I did think that my addAction could tell cancel_medic.sqf Is that wrong? How does the cancel_medic.sqf file know what _trasporthelo and _spawngrop is then? =) Share this post Link to post Share on other sites
Muzzleflash 111 Posted January 22, 2011 Oh I see. Do your script know what those to variables are when you add the action? If it does then you can do something like this: menuID0_7 = _unit addaction ["Cancel Medic", "scripts\request\medic\cancel.sqf", [_transporthelo, _spawngroup], 1, false, true, "", ""]; I see you refer to medic\cancel.sqf, however, here you write cancel_medic.sqf. You are using the right name right? In you cancel.sqf you can then: _unit = _this select 1; _transporthelo = (_this select 3) select 0; _spawngroup = (_this select 3) select 1; Share this post Link to post Share on other sites
splatsh 10 Posted January 22, 2011 Oh sorry, I mean cancel.sqf =) And I have this in my code: _ch = [[_start select 0, _start select 1, 50], _flightPath, _chopperType, side _unit] call BIS_fnc_spawnVehicle; transporthelo = _ch select 0; _chGroup = _ch select 2; _ch select 0 setVehicleInit "transporthelo = this; this setVehicleVarName ""transporthelo"""; But I don't have any like that for my group of medics, I use _spawngroup = [_start, WEST, ["US_Soldier_TL_EP1", "US_Soldier_MG_EP1", "US_Soldier_Medic_EP1", "US_Soldier_Medic_EP1", "US_Soldier_Medic_EP1", "US_Soldier_Medic_EP1"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; And my waypoints is working fine wp01 = _chGroup addwaypoint [_landPos, 0]; wp01 setwaypointtype "TR UNLOAD"; wp01 setWaypointStatements ["true","MedicOut=1;transportHelo land ""LAND"""]; waitUntil {MedicOut == 1}; wp02 = _spawngroup addwaypoint [_cpos, 10]; wp02 setwaypointtype "MOVE"; wp02 setWaypointSpeed "FULL"; wp02 setWaypointStatements ["true","MedicReady=1"]; And I am at this part right now waitUntil {MedicReady == 1}; hint "You can now cancel your support medic team!"; menuID0_7 = _unit addaction ["Cancel Medic", "scripts\request\medic\cancel.sqf", ["_transporthelo", "_spawngroup"], 1, false, true, "", ""]; And the last part is not working cancel.sqf _unit = _this select 1; _transporthelo = (_this select 3) select 0; _spawngroup = (_this select 3) select 1; hint "Medic team returning to base!"; {_x assignAsCargo _transporthelo; _x action ["getIn", _transporthelo]} foreach units _spawngroup; Share this post Link to post Share on other sites
Muzzleflash 111 Posted January 22, 2011 Here is your problem: [[color="Red"]"[/color]_transporthelo[color="Red"]"[/color], [color="Red"]"[/color]_spawngroup[color="Red"]"[/color]] Your sending the actual string (text) "_transportHelo" not the value.. So later you are saying for example '_x assignAsCargo (SomeString)' instead of doing it to the actual vehicle. Remove the above 4 red quotes and I think it should work. Share this post Link to post Share on other sites
splatsh 10 Posted January 22, 2011 I am sorry, but that did not work =/ Share this post Link to post Share on other sites
Muzzleflash 111 Posted January 22, 2011 Can you put the entire contents of your scripts in separate code blocks? Eg.: File A ... File B ... ..... Share this post Link to post Share on other sites
splatsh 10 Posted January 22, 2011 I have now remaked my code and after the help I got from you I got this to wirk fine now, and I got it all to work as I wanted. Thanks My code are: call_medic.sqf menuID0_7 = _unit addaction ["Cancel Medic", "scripts\request\medic\cancel.sqf", [transporthelo, _spawngroup, _chGroup], 1, false, true, "", ""]; cancel.sqf _unit = _this select 0; // who called it. _position = (_this select 3) select 0; // Helo position _spawngroup = (_this select 3) select 1; // Group with medic _chGroup = (_this select 3) select 2; // Helo pilot group DeleteAll = 0; HomeReady = 0; hint "Medic team returning to base!"; // Assign group to helo {_x assignAsCargo _position;} forEach Units _spawngroup; // Create waypoint to get group inside helo wp03 = _spawngroup addwaypoint [_position, 10]; wp03 setwaypointtype "GETIN NEAREST"; wp03 setWaypointStatements ["true","HomeReady=1"]; waitUntil {HomeReady == 1}; // Create waypoint to get helo to fly home wp04 = _chGroup addwaypoint [getMarkerPos "hStart", 10]; wp04 setwaypointtype "MOVE"; wp04 setWaypointStatements ["true","DeleteAll=1; {deleteVehicle _x} forEach crew transporthelo; deletevehicle transporthelo;"]; waitUntil {DeleteAll == 1}; deleteMarker hStart; // Delete marker. hint "Medic team are ready for new orders!" Thanks for the assist and help. And I am sure this code can get better and so on, but it works anyway so I am happy, feel free to make it better if you want to =) Share this post Link to post Share on other sites