Jump to content
Sign in to follow this  
kuwahara<ANZAC>

onMapSingleClick help!

Recommended Posts

can someone help me with a script that alows the player to set there waypoint from (onmapsingleclick _shift).

doesnt bother me if its an []exec script or on an init of a unit/veh/object.

any help would be great..8)

Share this post


Link to post
Share on other sites

You'll need to explain your request in greater detail.

Share this post


Link to post
Share on other sites

ok ill try and explain better.

what im afetr is>

at any time the player can open there map and hold the shift button down and single click the map and have there squads (move) waypoint moved to the spot clicked on the map.

the MP mission "EVOLUTION" has this feature in it but when iv pulled it down i cant convert it to my own use cos the script is way beond my capabilities..

ok this is what im working with.

in the editor i create a unit and give it a (move) waypoint. and call this script>

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">onMapSingleClick "if (_alt and debug) then {vehicle player setpos _pos};

if ((local player) and player == leader player and _shift and onmission) then {hint localize ""EVO_004""};

if ((local player) and player == leader player and _shift and not onmission) then

{

[group player, 1] setWaypointStatements [""never"",""never""];

[group player, 1] setWaypointDescription ""MOVE"";

_base = ""HeliHEmpty"" createVehicleLocal _pos;

[group player, 1] setWaypointPosition [position _base, 0];

deleteVehicle _base;group player setCurrentWaypoint [group player, 1];

hint localize ""EVO_005"";

}

";

i know there is stuff in there i dont need like the hint line and the alt debug mode and the if onmission.. but i think there is something that im missing like what is "HeliHEmpty"?.. is that a marker that i dont have yet??

so basicly i need help with cleaning this .sqf up, and help with what im missing to get this working.

Share this post


Link to post
Share on other sites

Ok, it's a simple enough script if you break it into single steps. You have an effect (then), nested inside a condition (if), all put inside an onMapSingleClick string. Reading it from the start makes it look intimidating.

The example you provided uses the "HeliHEmpty" (an invisible helicopter landing pad) as an invisible object to get the height of the ground at the chosen point so the waypoint appears at ground level. Simply setting the waypoint's position to _pos will result in a waypoint at 0 height (ie, underground). There are other ways to solve this problem, although the method used seems as good as any other.

You should be able to rebuild your own script based on the example. Or get permission to use the evolution script and cut out the unnecessary bits.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

//when the map is clicked, check it was done by the local player, who is leading a group and holding down the shift button, and if so execute the then block...

onMapSingleClick "if ((local player) and (player == leader player) and _shift) then

//start of the then block

{

//sets the waypoints condition and on activation script. If never is not defined as true, the waypoint can not complete/activate. The second ""never"" is the activation code and as such is completely meaningless and has no use since the waypoint will never activate!

[group player, 1] setWaypointStatements [""never"",""never""];

//this line sets the waypoints HUD description. It will change to wait when the player gets close.

[group player, 1] setWaypointDescription ""MOVE"";

//create and name the invisible object at the clicked map location. note it will be created at ground level.

_base = ""HeliHEmpty"" createVehicleLocal _pos;

//set the waypoint to the position of the _base object, within a random radius of 0 meters.

[group player, 1] setWaypointPosition [position _base, 0];

//delete the invisible object

deleteVehicle _base;

//change the player groups current waypoint to the new waypoint.

group player setCurrentWaypoint [group player, 1];

//give some feedback so the player knows something has happened

hint localize ""EVO_005"";

//close the then block

}

//close the onMapSingleClick string

";

Share this post


Link to post
Share on other sites

awsome brakedown.

i should be able to work this this now..

very steep learning curve when you know nothing about scripting besides what iv picked up in games like this.

Share this post


Link to post
Share on other sites

by the way this script presumes you alredy have a waypoint for your group. Check out the version 1.2 scipt it creates a waypoint

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">onMapSingleClick "

if ((local player) and player == leader player and _shift) then

{

deleteWaypoint [group player, 1];

_wp1 = group player addWaypoint [[0,0,0], 0];

[group player, 1] showWaypoint ""NEVER"";

[group player, 1] setWaypointStatements [""never"",""never""];

[group player, 1] setWaypointDescription ""MOVE"";

_base = ""HeliHEmpty"" createVehicleLocal _pos;

[group player, 1] setWaypointPosition [position _base, 0];

deleteVehicle _base;

group player setCurrentWaypoint [group player, 1];

hint ""Waypoint Set"";

}

I have edited it here to be more generic

Share this post


Link to post
Share on other sites

i tried using the code kiljoy provided but now i get a generic expression error any ideas?

Share this post


Link to post
Share on other sites

ok i caught the missing end " at the bottom. Now the marker doesnt show on the map, but the move cursor does in game. how do we fix it?

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  

×