Home   Help Search Login Register  

Author Topic: MapClick, MarkerPos, and CreateWayPoint help plz.  (Read 1611 times)

0 Members and 1 Guest are viewing this topic.

Offline Bingoz

  • Members
  • *
MapClick, MarkerPos, and CreateWayPoint help plz.
« on: 08 Feb 2011, 00:05:56 »
Hello all, I am having a hell of a time trying to figure out how to get my script working.

I need to use waypoints for a Helo to follow, The Waypoints are created onSingleMapClick, Each Waypoint gets its own color, that works, but when it comes to the "SetPos" on the Marker its a no go, marker dont move, and I wonder if the Waypoints are being created.

Any one willing to over look this script and provide some helpfull intell is muchly apprechated, and I thank you now.

There is a lot more to this script then provided in this simplyfied virsstion, however if nessacery I will post the original script.

Code: [Select]
//----------[[ Test Script for MapClick Landing. ]] ----------
//----------[[ Created by: Locks_g HcE "Cc-Systems Scripts" ]] ----------
//----------[[ Project: Spooky.                                                           ]] ----------
//------------------------------------------------------------------------------------------
//------ Use: Null = ExecVM "Scriptname.sqf"; in trigger or Init.  -------------

_A= 0;
_pilot = driver Spook;
_WpSpoky = group Spook;

openMap True;
//Hint "Select up to 5 approch points.";

while {visibleMap} do {
_i = 10;
GetClick = true;

_MarkName = format ["%1%2", "Mark",_A];
//Hint _MarkName;

MarkNamez = str _MarkName;
//Hint MarkNamez;

_WPName = format ["%1%2", "WP",_A];
//Hint _WPName;

_WPNamez = str _WPName;
//Hint _WPNamez;

_MarkName = createMarker[MarkNamez,[10,10,10]];
_MarkName setMarkerShape "ICON";
MarkNamez setMarkerType "DOT";

If ( _A == 0 ) then {MarkNamez setMarkerColor "ColorBlue"};
If ( _A == 1 ) then {MarkNamez setMarkerColor "ColorGreen"};
If ( _A == 2 ) then {MarkNamez setMarkerColor "ColorYellow"};
If ( _A == 3 ) then {MarkNamez setMarkerColor "ColorRed"};
If ( _A == 4 ) then {MarkNamez setMarkerColor "ColorYellow"};
If ( _A == 5 ) then {MarkNamez setMarkerColor "ColorGreen"};

// ---------  Debug Intel
Message0 =[ _MarkName ,MarkNamez, _WPName, _WPNamez, _A ];
Hint str Message0;

If ( _A == 0 ) then {_Message1 = format ["%1", "Please place THE STARTIING Point, Or close map."]; titletext [_Message1,"PLAIN DOWN"]};
If ( _A == 1 ) then {_Message1 = format ["%1", "Please place 4 Way Points, Or close map."]; titletext [_Message1,"PLAIN DOWN"]};
If ( _A == 2 ) then {_Message1 = format ["%1", "Please place 3 Way Points, Or close map."]; titletext [_Message1,"PLAIN DOWN"]};
If ( _A == 3 ) then {_Message1 = format ["%1", "Please place THE LANDING Point."]; titletext [_Message1,"PLAIN DOWN"]};
If ( _A == 4 ) then {_Message1 = format ["%1", "Please place 1 Way Points, Or close map."]; titletext [_Message1,"PLAIN DOWN"]};
If ( _A == 5 ) then {_Message1 = format ["%1", "Please place THE ENDING Point, Or close map."]; titletext [_Message1,"PLAIN DOWN"]};
If ( _A == 6 ) then { _Message1 = format ["%1", "Next click will close map!"]; titletext [_Message1,"PLAIN DOWN"]};

onMapSingleClick
{
MarkNamez setMarkerPos _pos;
_WPName = _WpSpoky addWaypoint [_pos, 10,_A];
If ( _A == 0 ) then {_WPName setWaypointType "MOVE"};
If ( _A == 1 ) then {_WPName setWaypointType "MOVE"};
If ( _A == 2 ) then {_WPName setWaypointType "MOVE"};
If ( _A == 3 ) then {_WPName setWaypointType "CYCLE"; _WPName setWaypointStatements ["This && A < 3;", "Spook Land 'GET OUT",""];};
If ( _A == 4 ) then {_WPName setWaypointType "CYCLE"};
If ( _A == 5 ) then {_WPName setWaypointType "HOLD"};
GetClick = false;
};

waitUntil{!GetClick};
onMapSingleClick "";
_A= _A + 1;

If (_A >5) then
{
openMap False;
};
};

waitUntil{!visibleMap};
Spook Flyinheight 100;
_pilot DoMove Position Spook;
[SokPi1] DoMove Position Spook;

_Message1 = format ["%1", "Sending Route intel now."]; titletext [_Message1,"PLAIN DOWN"];
sleep 3;

_WpSpoky setCurrentWaypoint [_WpSpoky, 1];

If ( _isReconActiv == 1 ) exitWith
{
_WpSpoky setCurrentWaypoint [_WpSpoky, 5];

DoStop Spook;
sleep 2;
Spook Flyinheight 20;
//SokPi1 setBehaviour "SAFE";

men6 = caller addAction ["Back", "mainmenu.sqf", [caller],6];
};

exit;

What should happen,

a. script is called via menu selection,
b. Script opens map, and waites for clicks.
c. each click "setpos" on the marker, and Create WP for each waypoint.
d. Map closes and Helo "Move" to the first Waypoint.
Done.

Whats happening.
a. Script is called
b. Script waits for input
c. Markers are made.
d. (Dont Know, nothing.)
Done.


[[[[[[[[[[[[[[  NEW INTEL ]]]]]]]]]]]]]

I would like to create a Landing Pad at the landing wp. I was trying this but it any working, it creates the Landing Pad but at the last Wp.

Code: [Select]
If ( AA == 3 ) then
{
WPName setWaypointType "HOLD";
_WPName setWaypointStatements["true", "Spook land ""GET OUT"""];
hint "land";
_zPos = _pos
SpokLz = "HeliH" createVehicle _pos;
};

Sorry yall, this script is getting confusing, but I am trying to get it organized, your help is completely welcome and appreciated.

This is the working script with out Landing Pad, and no Delete..
Code: [Select]
//----------[[ Test Script for MapClick Landing. ]] ----------
//----------[[ Created by: Locks_g HcE "Cc-Systems Scripts" ]] ----------
//----------[[ Project: Spooky.                                                           ]] ----------
//------------------------------------------------------------------------------------------
//------ Use: Null = ExecVM "Scriptname.sqf"; in trigger or Init.  -------------

private ["_Message1","_MarkName","_WPName","_WPNamez","_Cleaner","_CallSpook1"];
caller = _this select 0;

// --------------- Remove or comment the following for testing.

_Cleaner = [Caller] ExecVM "cleaner.sqf";
waitUntil {scriptDone _Cleaner};

_CallSpook1 = [Caller] ExecVM "CallSpook.sqf";
waitUntil {scriptDone _CallSpook1};

// --------------- keep the following for testing.

A=0;
AA = 0;

B = 0;
WpSpoky = group Spook;

openMap True;

while {visibleMap} do {
GetClick = true;

_MarkName = format ["%1%2", "_Mark",A];
MarkNamez = str _MarkName;
_WPName = format ["%1%2", "_WP",A];
_WPNamez = str _WPName;

_MarkName = createMarker[MarkNamez,[10,10,10]];
_MarkName setMarkerShape "ICON";
MarkNamez setMarkerType "DOT";

If ( A == 0 ) then {MarkNamez setMarkerColor "ColorBlue"};
If ( A == 1 ) then {MarkNamez setMarkerColor "ColorGreen"};
If ( A == 2 ) then {MarkNamez setMarkerColor "ColorYellow"};
If ( A == 3 ) then {MarkNamez setMarkerColor "ColorRed"};
If ( A == 4 ) then {MarkNamez setMarkerColor "ColorYellow"};
If ( A == 5 ) then {MarkNamez setMarkerColor "ColorGreen"};

// ---------  Debug Intel
//Message0 =[ _MarkName ,MarkNamez, _WPName, _WPNamez, _A];
//Hint str Message0;

If ( A == 0 ) then {_Message1 = format ["%1", "Please place THE STARTIING Point, Or close map."]; titletext [_Message1,"PLAIN DOWN"]};
If ( A == 1 ) then {_Message1 = format ["%1", "Please place 4 Way Points, Or close map."]; titletext [_Message1,"PLAIN DOWN"]};
If ( A == 2 ) then {_Message1 = format ["%1", "Please place 3 Way Points, Or close map."]; titletext [_Message1,"PLAIN DOWN"]};
If ( A == 3 ) then {_Message1 = format ["%1", "Please place THE LANDING Point."]; titletext [_Message1,"PLAIN DOWN"]};
If ( A == 4 ) then {_Message1 = format ["%1", "Please place 1 Way Points, Or close map."]; titletext [_Message1,"PLAIN DOWN"]};
If ( A == 5 ) then {_Message1 = format ["%1", "Please place THE ENDING Point, Or close map."]; titletext [_Message1,"PLAIN DOWN"]};
If ( A == 6 ) then {_Message1 = format ["%1", "Next click will close map!"]; titletext [_Message1,"PLAIN DOWN"]};

AA = A;

onMapSingleClick
{

MarkNamez setMarkerPos _pos;
_WPName = WpSpoky addWaypoint [_pos, 0];
If ( AA == 0 ) then {_WPName setWaypointType "MOVE"};
If ( AA == 1 ) then {_WPName setWaypointType "MOVE"};
If ( AA == 2 ) then {_WPName setWaypointType "MOVE"};
If ( AA == 3 ) then {_WPName setWaypointType "MOVE"};
If ( AA == 4 ) then {_WPName setWaypointType "MOVE"; _WPName setWaypointStatements["true", "Spook land ""GET OUT"""]};
If ( AA == 5 ) then {_WPName setWaypointType "MOVE"};

DoStop Spook;
GetClick = false;
};

waitUntil{!GetClick};
onMapSingleClick "";
A = A + 1;
B = B + 1;
If (A >5) then {openMap False;};
};

waitUntil{!visibleMap};
Spook Flyinheight 80;
[SokPi1] DoMove Position Spook;
sleep 3;

waitUntil {Spook distance (position _WP4)  < 100};
Spook Land "GET OUT";
 
waitUntil {position Spook select 2 < 1};
Spooky Land "NONE";
Spook Flyinheight 1;
DoStop Spook;

exit;

Now I am trying to get it to Stop and hold at the Landing WP or WP3, until it received a domove, right now. it will land and then off it go's, I understand this as being the fact that there are additional Waypoints after the land WP.

I am also trying to delete the crew and Helo at last WP.  I was trying the following.

Code: [Select]
waitUntil {Spook distance (position _WP5)  < 100};
{ deleteVehicle _x } forEach (crew Spook); deleteVehicle Spook;
« Last Edit: 08 Feb 2011, 03:53:54 by Bingoz »

Offline i0n0s

  • Moderator
  • *****
Re: MapClick, MarkerPos, and CreateWayPoint help plz.
« Reply #1 on: 09 Feb 2011, 01:16:21 »
Can you clean up the post since I'm not able to locate your current question and it is not visible for most user how your corrected the not working code.

Offline Bingoz

  • Members
  • *
Re: MapClick, MarkerPos, and CreateWayPoint help plz.
« Reply #2 on: 09 Feb 2011, 06:53:17 »
Yes I am sorry I intend to but I am experimenting with the script at the present time, I will be sure to post all the things that were wrong from script A to script B.

Sorry, as I said, it is still in the lab..