Jump to content
Sign in to follow this  
Woodstock21

Delete marker script.

Recommended Posts

Hello there so just wondering if any expert could help me out, Basically i kinda tossed a script together for a insurgency mission where by my playerID has the ability to see where the cache has spawned, my issue is that it would like to have the marker disappear off my map after a period of time,

Init

if ((getPlayerUID player) in ["myplayerID"]) then {
       player addAction ["<t color='#FF0000'>Cache Location</t>", "cacheloc.sqf"];
};

Cacheloc.sqf

_m = createMarker [format ["box%1",random 1000],getposATL cache];
_m setMarkerShape "ICON"; 
_m setMarkerType "mil_dot";
_m setMarkerColor "ColorRed";

I've messed around with the deletevechile function and sleep, but i just don't know enough about the scripting language to get it to work, The above stuff works and shows the red dot for the cache in MP just its always there. Any help would be appreciated. Thanks in advance

Share this post


Link to post
Share on other sites
_m = createMarker [format ["box%1",random 1000],getposATL cache];
_m setMarkerShape "ICON"; 
_m setMarkerType "mil_dot";
_m setMarkerColor "ColorRed";

uiSleep _someTime;

for "_i" from 1 to 0 step -0.1 do
{
_m setMarkerAlpha _i;
uiSleep 1;
};

deleteMarker _m;

Share this post


Link to post
Share on other sites

First can you confirm you want only you to see the marker not everyone on the server, in which case you may need to use https://community.bistudio.com/wiki/createMarkerLocal rather than createMarker

Also if you're trying to use deleteVehicle to get rid of the marker you need to use deletemarker or https://community.bistudio.com/wiki/deleteMarkerLocal depending on the createmarker command used.

Edit: ah JShock beat me!

Share this post


Link to post
Share on other sites

Yes i would like it so that only i can see the marker that gets placed on the map, Just so that it doesn't ruin it for everyone. .

So just changing createmarker to createMarkerLocal would only create the marker on my map correct

Also thanks for the help and quick response. i shall try it out later on

Share this post


Link to post
Share on other sites

Yes WoodStock I believe it will if you're only running the script on the guy's computer that you want to see it (which it looks like you are) if it gets run on the server, I'm not so sure

Share this post


Link to post
Share on other sites

Well the scripts will be part of the mission which is of course hosted on the server, um sure in a couple days i will have it tested

Share this post


Link to post
Share on other sites

Since you are using an addAction all the code ran will be ran locally on the player that executed the action, in other words as long as you use createMarkerLocal/deleteMarkerLocal/setMarkerAlphaLocal (just make sure all the marker commands end with "local") inside that code the marker will only be made for that particular player, no one else will see it.

Share this post


Link to post
Share on other sites

Alright so i was finally able to test out the script and it kinda worked, couple issues i came across was the marker still didn't delete after the 10 seconds and upon respawn the addaction to call the script was no longer in my scroll wheel

Share this post


Link to post
Share on other sites

Did you replace the "_someTime" with a 10?:

_m = createMarkerLocal [format ["box%1",random 1000],getposATL cache];
_m setMarkerShapeLocal "ICON"; 
_m setMarkerTypeLocal "mil_dot";
_m setMarkerColorLocal "ColorRed";

uiSleep _someTime;[color="#FF0000"][b]//<<<<<<here[/b][/color]

for "_i" from 1 to 0 step -0.1 do
{
_m setMarkerAlphaLocal _i;
uiSleep 1;
};

deleteMarkerLocal _m;

And for respawn put the following in the initPlayerLocal.sqf (create it if you don't have one):

player addEventHandler
[
"Respawn",
{
	if ((getPlayerUID player) in ["myplayerID"]) then 
	{
		player addAction ["<t color='#FF0000'>Cache Location</t>", "cacheloc.sqf"];
	};
}
];

Share this post


Link to post
Share on other sites

Wow i cannot belive i missed that, im a idiot thanks a lot for the help on that one JShock you are the man dude. Much thanks and praise

Share this post


Link to post
Share on other sites

with the initPlayerLocal.sqf just put that code into that save the file and leave it onthe root i don`t need to call it from anywhere

Share this post


Link to post
Share on other sites
with the initPlayerLocal.sqf just put that code into that save the file and leave it onthe root i don`t need to call it from anywhere

Correct, it's no different than the init.sqf.

Share this post


Link to post
Share on other sites

and i should leave the orginal code inthe init like on my frist post

---------- Post added at 05:16 PM ---------- Previous post was at 05:11 PM ----------

ok tested it and it works thanks again man muchly appreciate all the help

---------- Post added at 06:58 PM ---------- Previous post was at 05:16 PM ----------

Well to be correct i tested with just myself and it was working, i finally got some guys on the server to test and what seems to happen, is that the marker will show up for everone and not go away, except for off my map, so it seems like its being done server wide

Share this post


Link to post
Share on other sites

Ok im back again, and things seem to kind work, what i've come across is that the marker is being placed for everyone and the marker says on the map, But my map the maker will disappear. this is what i have for the full scripts and code, any help would be great if not im just going to remove it.

initPlayerLocal.sqf

if ((getPlayerUID player) in ["myplayerID"]) then {
       player addAction ["<t color='#FF0000'>Cache Location</t>", "cacheloc.sqf"];
};

player addEventHandler
[
"Respawn",
{
	if ((getPlayerUID player) in ["myplayerID"]) then 
	{
		player addAction ["<t color='#FF0000'>Cache Location</t>", "cacheloc.sqf"];
	};
}
;]

cacheloc.sqf

_m = createMarkerLocal [format ["box%1",random 1000],getposATL cache];
_m setMarkerShape "ICON"; 
_m setMarkerType "mil_dot";
_m setMarkerColor "ColorGreen";

uiSleep 10;

for "_i" from 1 to 0 step -0.1 do
{
_m setMarkerAlphaLocal _i;
uiSleep 1;
};

deleteMarkerLocal _m;

Im kinda thinking that the cacheloc.sqf should have a" if ((getPlayerUID player) in ["myplayerID"]) then { " thing around it but im not sure. if that would do anything

Share this post


Link to post
Share on other sites

See if changing the shape, type, and color commands to their local counterparts helps any. (setMarkerShapeLocal, setMarkerTypeLocal, setMarkerColorLocal)

Share this post


Link to post
Share on other sites

Ok so ya i went ahead and changed all the markers to their local counterparts and it works the way intended now, Thanks for the help, and thought i'd post that it works correctly in case someone else runs into the same issue.

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  

×