Jump to content
Sign in to follow this  
gerix

Need a quick scirpt fixing

Recommended Posts

Hello!

I'm currently working on a SupplyDrop Script and I got a Error wich I can't fix and I hope somebody of you can help me with this:

Beginning of the Code:

diag_log "CARGODROP-SCRIPT LOADED!";
sleep 120;

while {true} do
{

private["_cargoPlaneStart","_cargoPlaneEnd","_cargoPlane","_this","_cargoPlaneWP","_cargoPlanePos","_ammoBox","_ammoBoxType","_chute1","_ammoBoxPos","_markerBig","_markerSmall","_boxType","_log","_varNameCargo","_cargoGroup","_paraGroup","_paraWP"];

_cargoPlaneStart = [[3461.92,5021.77,200],[8582.35,14077.7,200]] call BIS_fnc_selectRandom;
_cargoPlaneEnd = [[3461.92,5021.77,200],[8582.35,14077.7,200]] call BIS_fnc_selectRandom;

//CREATE CARGOPLANE AND GROUP

_cargoPlane =  createVehicle ["C130J", getPos _cargoPlaneStart, [], 0, "FLY"];

createVehicleCrew _cargoPlane;

_cargoGroup = createGroup east;

_varNameCargo="CARGOPLANE";
_cargoPlane SetVehicleVarName _varNameCargo;


//MESSAGE TO DISPLAY
cutText("A supplydrop has just started! Go get it!");
diag_log(format["CARGODROP: C130J started flying from %1 to %2 NOW! (TIME:%3)", str(_cargoPlaneStart), str(_cargoPlaneEnd), round(time)]);


//CREATE WAYPOINT FOR CARGOPLANE
_cargoPlaneWP = _cargoGroup addWaypoint [getPos _cargoPlaneEnd];
_cargoPlaneWP setWaypointType "Move";

Error:

"CARGODROP-SCRIPT LOADED!"
Error in expression <c_selectRandom;_cargoPlane =  createVehicle ["C130J", getPos _cargoPla>
 Error position: <createVehicle ["C130J", getPos _cargoPla>
 Error cuttext: 0 elements provided, 3 expected
File C:\Users\GA\Documents\ArmA 2 Other Profiles\GeriX\missions\ScriptTest.Chernarus\cargodrop.sqf, line 20

Thanks for your help!

Cheers

Share this post


Link to post
Share on other sites
cutText("A supplydrop has just started! Go get it!");

Try this:

cutText ["A supplydrop has just started! Go get it!","PLAIN"];

Also you've got a loop with no "};" to close it. But I doubt you want the loop in there anyway do you? Is this the full script? There's a fair few variables declared that don't exist in the script to I'm guessing no.

And I guess you don't need the getPos in the createVehicle array, since it should be a position array thats returned from BIS_fnc_selectRandom afaik.

_cargoPlane =  createVehicle ["C130J", _cargoPlaneStart, [], 0, "FLY"];

Similarly when you add the waypoints, no need for getPos. Also addWaypoint needs a radius adding.

_cargoPlaneWP = _cargoGroup addWaypoint [_cargoPlaneEnd, 0];

One last thing. You create a group for the aircrafts waypoints, but you need to use the actual aircraft group.

Try replacing this:

_cargoGroup = createGroup east;

With this:

 _cargoGroup = group _cargoplane;

Edited by Foxy

Share this post


Link to post
Share on other sites

Ok first of all thanks for your quick reply ;)

Second, I changed the cutText as you said but now I get the following Error:

Error in expression <tart, [], 0, "FLY"];createVehicleCrew _cargoPlane;_cargoGroup = createGroup >
 Error position: <_cargoPlane;_cargoGroup = createGroup >
 Error Missing ;
File C:\Users\GA\Documents\ArmA 2 Other Profiles\GeriX\missions\ScriptTest.Chernarus\cargodrop.sqf, line 22
Error in expression <tart, [], 0, "FLY"];createVehicleCrew _cargoPlane;_cargoGroup = createGroup >
 Error position: <_cargoPlane;_cargoGroup = createGroup >
 Error Missing ;
File C:\Users\GA\Documents\ArmA 2 Other Profiles\GeriX\missions\ScriptTest.Chernarus\cargodrop.sqf, line 22
"CARGODROP-SCRIPT LOADED!"

The Script has about 170 lines more of code, what I postet is just the beginning part where the error was :)

-GeriX

Share this post


Link to post
Share on other sites

Sorry for all my edits. Have you tried the additional things I mentioned above yet?

---------- Post added at 17:11 ---------- Previous post was at 16:54 ----------

Stupid question mate, but are you editing Arma 2 or 3? Only I just realised this is an A2 thread (not quite the right one, but I'm sure a moderator will move it) and afaik there's no createVehicleCrew in A2 as it was introduced in A3.

Share this post


Link to post
Share on other sites

I tried all of the editings, but the same Error still appears.

Could you please check if the createVehicleCrew variable is okay?

-----------------------------------------------------------------

EDIT:

Just noticed what you wrote and I'm editing Arma 2 OA, onfortunately I didn't notice it's just for A3 :o

I read this in a forum and I thought it was nescessary.

I'm gonna try it without...

Share this post


Link to post
Share on other sites

createVehicleCrew is fine... assuming your playing Arma 3.

---------- Post added at 17:25 ---------- Previous post was at 17:18 ----------

EDIT:

Just noticed what you wrote and I'm editing Arma 2 OA, onfortunately I didn't notice it's just for A3 :o

I read this in a forum and I thought it was nescessary.

I'm gonna try it without...

Easily done. I'm sure you'll get it working now then.

Share this post


Link to post
Share on other sites

Ok so i deleted the createVehicleCrew thing and it shows properly the cutText. I got some errors in the further script wich I can fix but theres still this "Error 0 elements provided, 3 expected" error wich drives me crazy D:

Can you solve this one?

"CARGODROP-SCRIPT LOADED!"
"CARGODROP: C130J started flying from  to  NOW! (TIME:23)"
Error in expression <c_selectRandom;_cargoPlane =  createVehicle ["C130J", _cargoPlaneStart>
 Error position: <createVehicle ["C130J", _cargoPlaneStart>
 Error 0 elements provided, 3 expected
File C:\Users\GA\Documents\ArmA 2 Other Profiles\GeriX\missions\ScriptTest.Chernarus\cargodrop.sqf, line 20

Share this post


Link to post
Share on other sites

Check that _cargoPlaneStart actually has an array with position coordinates. Error indicates it doesn't.

Share this post


Link to post
Share on other sites

Well I would make sure that BIS_fnc_selectRandom is returning what you want it to return, i.e: a position array. I don't use it myself tbh, but the error may indicate the spawn position in the createVehicle array is not right. You could add a diag_log to see what its returning by adding this after the start/end positions are selected:

diag_log ["_cargoPlaneStart", _cargoPlaneStart];
diag_log ["_cargoPlaneEnd", _cargoPlaneEnd];

Or just place one of the possible starting position arrays straight into the createVehicle array.

Share this post


Link to post
Share on other sites

If I put a starting position in the array it works, but have you any alternatives for a "random coordinate selection" ?

And how do I give a variable a coordinate so I can put in a variable and not a coord in the array?

Share this post


Link to post
Share on other sites

_startList = [[3461.92,5021.77,200],[8582.35,14077.7,200]];
_endList =  [[3461.92,5021.77,200],[8582.35,14077.7,200]];

_cargoPlaneStart = _startList select floor(random (count _startList));
_cargoPlaneEnd = _endList select floor(random (count _endList));

EDIT: Just noticed that you've got the same positions in your list of start positions as you have in the end positions. You'll need to change this otherwise the start and end positions may be the same.

Edited by Foxy

Share this post


Link to post
Share on other sites

Thanks for all your help, it is now fully working and just needs some "finetuning" :D

If I get any other problems I'll inform you!

Greeding GeriX

Share this post


Link to post
Share on other sites

Hey!

I got another problem with spawning some paratroopers.

Could somebody please tell me what I did wrong?

TK_Soldier_SL_EP1 createUnit [getPos _cargoPlane, _paraGroup,"this moveInCargo [_cargoPlane, 5]; sleep 0.1; this action ["Eject", vehicle _cargoPlane]" , 0.9, "colonel"];

Error:

Error in expression <argoPlane, 5]; sleep 0.1; this action ["Eject", vehicle _cargoPlane]" , 0.9, "co>
 Error position: <Eject", vehicle _cargoPlane]" , 0.9, "co>
 Error Missing ]
File C:\Users\GA\Documents\ArmA 2 Other Profiles\GeriX\missions\ScriptTest.Chernarus\cargodrop.sqf, line 60

-GeriX

Edited by GeriX

Share this post


Link to post
Share on other sites
"TK_Soldier_SL_EP1" createUnit [getPos _cargoPlane, _paraGroup,"this moveInCargo [_cargoPlane, 5]; sleep 0.1; this action [""Eject"", vehicle _cargoPlane]" , 0.9, "colonel"];

Share this post


Link to post
Share on other sites

Thanks, works now ;)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×