Alex116 1 Posted December 21, 2012 (edited) Hey, I've been trying to create an chinook when a trigger is activated, upon the triggers activation a chinook spawn, gets his waypoints assigned and thats it. So I created this sqf for the chinook the spawn when the trigger gets activated. Tough it keeps giving me line errors. It say's that theres a line error, missing a "]" at line 34. Tough I dont see any problem with this line. Line 34 bolded. hint "extraction.sqf loaded"; _sv = [-1798.3533,0.66139376,8885.2871,258.047,CH_47F_EP1,WEST] call BIS_fnc_spawnVehicle; // Name the vehicle and group chinook1 = _sv select 0; // vehicle spawned. chinookgrp = _sv select 2; // group of vehicle so waypoints work. pilot2 = (driver _drophelo); // get pilot of drophelo pilot2 setSkill 1; // set high skill on pilot. // set what height drophelo will fly in: this seems to fix the crash when spawned at altitude _drophelo flyInHeight 25; _wp0 = chinookgrp addWaypoint [-4269.061,0.83947325,7436.7705,0]; _wp0 setWaypointType "MOVE"; _wp0 setWaypointSpeed "NORMAL"; _wp0 setWaypointBehaviour "CARELESS"; // set to "CARELESS" if trouble with enemys distracting heli. _wp0 setWaypointStatements [true, chinook1 flyInHeight 2.5]; _wp0 setWaypointStatements [true, chinook1 animate "Ani_Ramp"]; _wp0 setWaypointVisible false; pilot2 doMove (getWPPos _wp0); _wp1 = chinookgrp addWaypoint [-4380.979,0.91219687,7593.9014]; _wp1 setWaypointType "MOVE"; _wp1 setWaypointSpeed "NORMAL"; _wp1 setWaypointBehaviour "CARELESS"; // set to "CARELESS" if trouble with enemys distracting heli. _wp1 setWaypointStatements [!isEngineOn crrc1 AND crrc1 distance chinook1 < 5, chinook1 flyInHeight 2.5, "nul=[crrc1, chinook1] execVM ""scripts\crrcload\onceAboard.sqf]; _wp1 setWaypointVisible false; _wp2 = chinookgrp addWaypoint [-6858.374,0.98020089,6515.7158]; _wp2 setWaypointType "MOVE"; [b]_wp2 setWaypointSpeed "NORMAL";[/b] _wp2 setWaypointBehaviour "CARELESS"; _wp2 setWaypointVisible false; Does any of you see the problem with this sqf? Also, as you can see, on the _wp1 statement the onact executes another .sqf, could this cause any problems? Thanks in advance, Edited December 21, 2012 by Alex116 Share this post Link to post Share on other sites
Deadfast 43 Posted December 21, 2012 Trigger statements have to be strings. You also forgot to terminate the string at line 29. hint "extraction.sqf loaded"; _sv = [-1798.3533,0.66139376,8885.2871,258.047,CH_47F_EP1,WEST] call BIS_fnc_spawnVehicle; // Name the vehicle and group chinook1 = _sv select 0; // vehicle spawned. chinookgrp = _sv select 2; // group of vehicle so waypoints work. pilot2 = (driver _drophelo); // get pilot of drophelo pilot2 setSkill 1; // set high skill on pilot. // set what height drophelo will fly in: this seems to fix the crash when spawned at altitude _drophelo flyInHeight 25; _wp0 = chinookgrp addWaypoint [-4269.061,0.83947325,7436.7705,0]; _wp0 setWaypointType "MOVE"; _wp0 setWaypointSpeed "NORMAL"; _wp0 setWaypointBehaviour "CARELESS"; // set to "CARELESS" if trouble with enemys distracting heli. _wp0 setWaypointStatements ["true", "chinook1 flyInHeight 2.5"]; _wp0 setWaypointStatements ["true", "chinook1 animate 'Ani_Ramp'"]; _wp0 setWaypointVisible false; pilot2 doMove (getWPPos _wp0); _wp1 = chinookgrp addWaypoint [-4380.979,0.91219687,7593.9014]; _wp1 setWaypointType "MOVE"; _wp1 setWaypointSpeed "NORMAL"; _wp1 setWaypointBehaviour "CARELESS"; // set to "CARELESS" if trouble with enemys distracting heli. _wp1 setWaypointStatements ["!isEngineOn crrc1 AND crrc1 distance chinook1 < 5, chinook1 flyInHeight 2.5", "nul=[crrc1, chinook1] execVM 'scripts\crrcload\onceAboard.sqf'"]; _wp1 setWaypointVisible false; _wp2 = chinookgrp addWaypoint [-6858.374,0.98020089,6515.7158]; _wp2 setWaypointType "MOVE"; _wp2 setWaypointSpeed "NORMAL"; _wp2 setWaypointBehaviour "CARELESS"; _wp2 setWaypointVisible false; Share this post Link to post Share on other sites
Alex116 1 Posted December 21, 2012 Mhmm. I see the mistake I made at line 29. Tough, I'm not entirely sure what "Trigger statements have to be strings." means. What is it you actually changed? Share this post Link to post Share on other sites
conroy 13 Posted December 21, 2012 the parameters for setWaypointStatements have to be strings. see http://community.bistudio.com/wiki/setWaypointStatements _wp0 setWaypointStatements [true, chinook1 animate "Ani_Ramp"]; becomes _wp0 setWaypointStatements ["true", "chinook1 animate 'Ani_Ramp'"]; for example, like Deadfast posted. Share this post Link to post Share on other sites
Alex116 1 Posted December 21, 2012 (edited) Aha, I see. Thanks a lot. That seemed to have fixed the errror with my extraction.sqf file. However, I am reciving a new error. This is the line I am using to create a vehicle. waituntil {!isnil "bis_fnc_init"}; hint "extraction.sqf loaded"; _sv = [-1798.3533,0.66139376,8885.2871,258.047, 258.047 , "CH_47F_EP1", WEST] call BIS_fnc_spawnVehicle; // Name the vehicle and group _chinook1 = _sv select 0; // vehicle spawned. _chinookgrp = _sv select 2; // group of vehicle so waypoints work. _pilot2 = (driver _chinook1); // get pilot of drophelo _pilot2 setSkill 1; // set high skill on pilot. // set what height drophelo will fly in: this seems to fix the crash when spawned at altitude _chinook1 flyInHeight 25; _wp0 = _chinookgrp addWaypoint [-4269.061,0.83947325,7436.7705,0]; _wp0 setWaypointType "MOVE"; _wp0 setWaypointSpeed "NORMAL"; _wp0 setWaypointBehaviour "CARELESS"; // set to "CARELESS" if trouble with enemys distracting heli. _wp0 setWaypointStatements ["true", "_chinook1 flyInHeight 2.5"]; _wp0 setWaypointStatements ["true", "_chinook1 animate 'Ani_Ramp'"]; _wp0 setWaypointVisible false; _pilot2 doMove (getWPPos _wp0); _wp1 = _chinookgrp addWaypoint [-4380.979,0.91219687,7593.9014]; _wp1 setWaypointType "MOVE"; _wp1 setWaypointSpeed "NORMAL"; _wp1 setWaypointBehaviour "CARELESS"; // set to "CARELESS" if trouble with enemys distracting heli. _wp1 setWaypointStatements ["!isEngineOn crrc1 AND crrc1 distance _chinook1 < 5, _chinook1 flyInHeight 2.5", "nul=[crrc1, _chinook1] execVM 'scripts\crrcload\onceAboard.sqf'"]; _wp1 setWaypointVisible false; _wp2 = _chinookgrp addWaypoint [-6858.374,0.98020089,6515.7158]; _wp2 setWaypointType "MOVE"; _wp2 setWaypointSpeed "NORMAL"; _wp2 setWaypointBehaviour "CARELESS"; _wp2 setWaypointVisible false; Edited December 21, 2012 by Alex116 Share this post Link to post Share on other sites
conroy 13 Posted December 21, 2012 check the arguments in _sv = [-1798.3533,0.66139376,8885.2871,258.047, 258.047 , "CH_47F_EP1", WEST] call BIS_fnc_spawnVehicle; the first 3 values are the position where you want to spawn the vehicle I guess and should be passed together in an array. Also it seems like you got the direction (258.047) twice in there. _sv = [[-1798.3533,0.66139376,8885.2871],258.047,"CH_47F_EP1",WEST] call BIS_fnc_spawnVehicle; This might work, but better check the wiki page to make sure http://community.bistudio.com/wiki/BIS_fnc_spawnVehicle Share this post Link to post Share on other sites
tryteyker 28 Posted December 21, 2012 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: Share this post Link to post Share on other sites
Alex116 1 Posted December 21, 2012 I created this helicopter in the editor, and created waypoints for it there. Only to discover that I wanted it only to spawn and follow those waypoints after a unit activated a trigger. Hence I created a trigger, which activates the above script for thhe heli to spawn and follow the waypoints. I took the exact xyz position from mission script and copied them to the extraction script. I dont know how to use markerpositions or anything else more simple. Thanks Conroy for your response, I'll have a look at the code you provided and check the wikipage. I'll let you know what works and not. Share this post Link to post Share on other sites
tryteyker 28 Posted December 21, 2012 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. Share this post Link to post Share on other sites
Alex116 1 Posted December 21, 2012 (edited) Mhmm, I understand the concept. And the above are indeed better concepts for my mission. What I actually am trying to achieve here is a extraction by helicopter. 1. - Player activates a trigger by radio. 2. - Chinook spawns, gets an assigned waypoint where it should hover untill everyone is in. 3. - Chinook dusts off towards the next waypoint. I'd like for the chinook to have an exact spot where it would hover, as I will inform the player of the exact grid the extraction heli will be waiting for him. EDIT: I used the markers and reffered to them to set the waypoints. _wp0 = _chinookgrp addWaypoint [(getmarkerpos "marker1"),0]; It doesnt give me any errors anymore when running extraction.sqf This is what extraction.sqf currently looks like ; waituntil {!isnil "bis_fnc_init"}; hint "extraction.sqf loaded"; _sv = [[-1798.3533,0.66139376,8885.2871],258.047,"CH_47F_EP1",WEST] call BIS_fnc_spawnVehicle; _chinook1 = _sv select 0; _chinookgrp = _sv select 2; _pilot2 = (driver _chinook1); _pilot2 setSkill 1; _chinook1 flyInHeight 25; _wp0 = _chinookgrp addWaypoint [(getmarkerpos "marker1"),0]; _wp0 setWaypointType "MOVE"; _wp0 setWaypointSpeed "NORMAL"; _wp0 setWaypointBehaviour "CARELESS"; _wp0 setWaypointStatements ["true", "_chinook1 flyInHeight 2.5"]; _wp0 setWaypointStatements ["true", "_chinook1 animate 'Ani_Ramp'"]; _wp0 setWaypointVisible false; _pilot2 doMove (getWPPos _wp0); _wp1 = _chinookgrp addWaypoint [(getmarkerpos "marker2"),0]; _wp1 setWaypointType "MOVE"; _wp1 setWaypointSpeed "NORMAL"; _wp1 setWaypointBehaviour "CARELESS"; _wp1 setWaypointStatements ["!isEngineOn crrc1 AND crrc1 distance _chinook1 < 5, _chinook1 flyInHeight 2.5", "nul=[crrc1, _chinook1] execVM 'scripts\crrcload\onceAboard.sqf'"]; _wp1 setWaypointVisible false; However its not spawning the helicopter, hence nothing happens. EDIT2: I changed the position where the chinook will spawn with a marker position. Wich seemed to do the trick. I'll do some finetuning to the rest. Thanks a lot guys. Edited December 21, 2012 by Alex116 Share this post Link to post Share on other sites