fencr0c 10 Posted September 6, 2010 This is driving me mad, probably my lack of knowledge or something, but the results aren’t as expected/ Basically the script should generate a saboteur, who’s instructed to go to a position, place a pipe bomb and touch it off. The script is executed from another script that determines the target position and creates the saboteur if he dies. The first couple of times the script runs fine, the saboteur is created, he moves to the end of the waypoint, places the pipe bomb, triggers it and dies. Then it all starts going wrong, the pipe bomb is placed 2/3 of the way along the waypoint path, and gets triggered at the end of the waypoint. This gets progressively worse as the pipe bomb is placed closer and closer to the start of the waypoint, ending up with the satchel being placed at the start of the waypoint and then being triggered at the end. I’ve displayed the position of the target using hint and its correct, it never changes. Any help would be appreciated as I’m new to this scripting lark. private ["_spawnPos","_targetPos","_group","_osfBomberWp1","_osfBomberWp0"]; _spawnPos = _this select 0; _group = _this select 1; _targetPos = _this select 2; // create bomber unit "TK_INS_Soldier_EP1" createUnit [_spawnPos, _group, "this addMagazine ""pipebomb"";osfBomber = this", .05, "private"]; // assign waypoint and targets for bomber _osfBomberWp0 = _group addWaypoint [_targetPos, 0]; _osfBomberWp0 setWaypointType "MOVE"; //_osfBomberWp0 setWaypointBehaviour "STEALTH"; _osfBomberWp0 setWaypointStatements ["","osfBomber fire [""pipebombmuzzle"", ""pipebombmuzzle"", ""pipebomb""]"]; _osfBomberWp1 = _group addWaypoint [_targetPos, 1]; _osfBomberWp1 setWaypointStatements ["","osfBomber action [""TOUCHOFF"", osfBomber];osfBomber setDamage 1"]; exit; Share this post Link to post Share on other sites
Woodpeckersam 18 Posted September 6, 2010 (edited) private ["_spawnPos","_targetPos","_group","_osfBomberWp1","_osfBomberWp0"]; _spawnPos = _this select 0; _group = _this select 1; _targetPos = _this select 2; // create bomber unit "TK_INS_Soldier_EP1" createUnit [_spawnPos, _group, "this addMagazine ""pipebomb"";osfBomber = this", .05, "private"]; [color="Red"]//tells bomber to move to waypoint _group doMove getMarkerPos "firstwp"; _group setBehaviour "Stealth"; waituntil {(_group distance getMarkerPos "firstwp") <= 4}; deleteMarker "firstwp"; osfBomber fire ["pipebombmuzzle", "pipebombmuzzle", "pipebomb"]; sleep 5; //tells bomb to move to second waypoint _group doMove getMarkerPos "secondwp"; waituntil {(unitReady osfBomber)&&(_group distance getMarkerPos "secondwp") <= 4}; //waituntil {(_group distance getMarkerPos "secondwp") <= 4}; <- OR USE THIS ONE IF ABOVE DONT WORK <- deleteMarker "secondwp"; [color="Blue"] //_group doMove getMarker Pos "thirdwp"; //waitUntil {(unitReady osfBomber)}; //deleteMarker "thirdwp"l;[/color] sleep 5; osfBomber action ["TOUCHOFF", osfBomber]; sleep 5; osfBomber setDamage 1; playSound "sniper"; // If you have a sound of a sniper shot, and you know how to add custom sounds in, this would be good :)[/color] [color="Green"]/* //assign waypoint and targets for bomber _osfBomberWp0 = _group addWaypoint [_targetPos, 0]; _osfBomberWp0 setWaypointType "MOVE"; //_osfBomberWp0 setWaypointBehaviour "STEALTH"; _osfBomberWp0 setWaypointStatements ["","osfBomber fire [""pipebombmuzzle"", ""pipebombmuzzle"", ""pipebomb""]"]; _osfBomberWp1 = _group addWaypoint [_targetPos, 1]; _osfBomberWp1 setWaypointStatements ["","osfBomber action [""TOUCHOFF"", osfBomber];osfBomber setDamage 1"]; */[/color] exit; All you do is add 2 plain waypoint to where you want osfBomber (or _group) to move to. Waypoint 1 name = firstwp Waypoint 2 name = secondwp Waypoint 3 name = thirdwp I also added a choice for you by commenting out the blue code... if you want the unit to move to a third waypoint, touching off the bomb then getting shot. where you see a /* and */ that means its commenting out all the codes between them. the red bit of code is what i added. Oh and i must recommened an editor "Squint" for error checking and script neatness blah blah... its just an amazing application if you are not using it. http://forums.bistudio.com/showthread.php?t=105860 You may not like the colours, dont worry though you can change them in the settings, one of the many amazing things about this application :D Edited September 6, 2010 by WoodyUK Share this post Link to post Share on other sites
fencr0c 10 Posted September 7, 2010 (edited) Thanks WoodyUK that's helped a lot using move is a lot easier. And yes I do use Squint, its invaluable. Edited September 7, 2010 by fencr0c Share this post Link to post Share on other sites