zulu1 145 Posted November 4, 2013 (edited) I need help with a couple of scripts to get them going. They deploy a M2 from a 5t truck and loads it back again. I thinks it's the _index input for select2 that is giving me problems. Deploy.sqs _truck = _this select 0 _someguy = _this select 1 _index = _this select 2 _pos = getpos _someguy _dir = getdir _someguy _truck removeaction _index titletext ["", "Black Out", 1] ~1 _mgun = "M2StaticMG" createvehicle [(getpos _truck select 0)-(sin (getdir _truck)*5), (getpos _truck select 1)-(cos (getdir _truck)*5), 1.05] _mgun setdir getdir _truck ~.5 titletext ["", "Black In", 1] #PackUp ~.1 ?(!alive _mgun): exit _truck = nearestObject [_mgun, "Truck5T"] ?(!alive _truck): goto "PackUp" ?_truck distance _mgun > 5: goto "PackUp" _load = _mgun addaction ["Load Machine Gun", "Load.sqs"] #Loop ?_truck distance _mgun > 5: _mgun removeaction _load; goto "PackUp" ?(!alive _mgun): exit ?(!alive _truck): _mgun removeaction _load; goto "PackUp" ~.1 goto "Loop" Load.sqs _mgun = _this select 0 _someguy = _this select 1 _index = _this select 2 _mgun removeaction _index _truck = nearestObject [_mgun, "Truck5T"] titletext ["", "Black Out", 1] ~1 deletevehicle _mgun titletext ["", "Black In", 1] ~1 _deploy = _truck addaction ["Deploy Machine Gun", "deploy.sqs"] #Loop ?(!alive _truck): _truck removeaction _deploy; exit ~.1 goto "Loop" Edited November 4, 2013 by Zulu1 Share this post Link to post Share on other sites
-rageQuit- 10 Posted November 4, 2013 No serious problems: needed an extra pair of parenthesis around the sin / cos terms and increasing the minimum distance from the truck - you may think you spawn it 5 metres away but that not how the game sees it, for some reason To start, addAction Deploy.sqs in the truck's init string. _mgun = "M2StaticMG" createvehicle [((getpos _truck select 0)-((sin (getdir _truck))*5)), ((getpos _truck select 1)-((cos (getdir _truck))*5)), 1.05] ?_truck distance _mgun > 7.5: goto "PackUp" ?_truck distance _mgun > 7.5: _mgun removeaction _load; goto "PackUp" Share this post Link to post Share on other sites