Jump to content
SuperDudeplayer

Unable to change marker location

Recommended Posts

I know this might seem stupid of me to not be able to do this but i'm still a beginner to coding. I tried to make a script to move the markers to another location but it doesn't seem to work on my Altis life server. When i try it on another mission it works. I have no idea it doesn't work on my altis life server but works on another mission.

This is the addaction that i have on the item that changes the position of the markers: 

this addaction ["West","fn_westcheckpoint.sqf"];this addaction ["East","fn_eastcheckpoint.sqf"];

fn_westcheckpoint.sqf:

_Open = parseText format ["<t color='#00ff2e'>THE WEST CHECKPOINT IS NOW OPEN</t>"];
_Closed = parseText format ["<t color='#ff0000'>The west Border is Closed.<br/>ALL PASSAGE FROM THERE IS NOW ILLEGAL</t>"];
if (westCheckpoint > 0) then{
	"westClosed" setMarkerPos getMarkerPos "pointOut";
	"westOpen" setMarkerPos getMarkerPos "westPoint";
	westCheckpoint = 0;
	hint _Open;
}else{
	"westClosed" setMarkerPos getMarkerPos "westPoint";
	"westOpen" setMarkerPos getMarkerPos "pointOut";
	westCheckpoint = 1;
	hint _Closed;
};

fn_eastcheckpoint.sqf:

_Open = parseText format ["<t color='#00ff2e'>THE EAST CHECKPOINT IS NOW OPEN</t>"];
_Closed = parseText format ["<t color='#ff0000'>The east Border is Closed.<br/>ALL PASSAGE FROM THERE IS NOW ILLEGAL</t>"];
if (eastCheckpoint > 0) then{
	"eastOpen" setMarkerPos getMarkerPos "eastPoint";
	"eastClosed" setMarkerPos getMarkerPos "pointOut";
	eastCheckpoint = 0;
	hint _Open;
}else{
	"eastClosed" setMarkerPos getMarkerPos "eastPoint";
	"eastOpen" setMarkerPos getMarkerPos "pointOut";
	eastCheckpoint = 1;
	hint _Closed;
};

This is what I added in the initServer.sqf so that the markers are set in place since the start:

eastCheckpoint = 1;
westCheckpoint = 1;
if (eastCheckpoint > 0) then{
	"eastOpen" setMarkerPos getMarkerPos "eastPoint";
	"eastClosed" setMarkerPos getMarkerPos "pointOut";
}else{
	"eastClosed" setMarkerPos getMarkerPos "eastPoint";
	"eastOpen" setMarkerPos getMarkerPos "pointOut";
};
if (westCheckpoint > 0) then{
	"westClosed" setMarkerPos getMarkerPos "pointOut";
	"westOpen" setMarkerPos getMarkerPos "westPoint";
}else{
	"westClosed" setMarkerPos getMarkerPos "westPoint";
	"westOpen" setMarkerPos getMarkerPos "pointOut";
};

I don't know why it doesn't work in the altis life mission but works on another mission. Please help me.

Spoiler

I'm also trying to find a way so that only certain people can use it(E.G.: ["life_coplevel", "SCALAR", 2]

 

Edited by SuperDudeplayer

Share this post


Link to post
Share on other sites

Why do you have so many markers? You do know that you can just change a markers name with setMarkerText?

"Marker1" setMarkerText "West CP Open"; // Open
"Marker1" setMarkerText "West CP Closed"; // Closed

Also there is no need to format this text:

parseText format ["<t color='#ff0000'>The west Border is Closed.<br/>ALL PASSAGE FROM THERE IS NOW ILLEGAL</t>"]

parseText "<t color='#ff0000'>The west Border is Closed.<br/>ALL PASSAGE FROM THERE IS NOW ILLEGAL</t>"

 

Edited by KillerAussie

Share this post


Link to post
Share on other sites
35 minutes ago, KillerAussie said:

Why do you have so many markers? You do know that you can just change a markers name with setMarkerText?

"Marker1" setMarkerText "West CP Open"; // Open
"Marker1" setMarkerText "West CP Closed"; // Closed

 

The reason why I have so many markers is due to the fact that i don't know the proper way to change the form of a marker.

 

37 minutes ago, KillerAussie said:

Also there is no need to format this text:

parseText format ["<t color='#ff0000'>The west Border is Closed.<br/>ALL PASSAGE FROM THERE IS NOW ILLEGAL</t>"]

parseText "<t color='#ff0000'>The west Border is Closed.<br/>ALL PASSAGE FROM THERE IS NOW ILLEGAL</t>"

 

That i didn't know, thank you very much for telling about that.

Share this post


Link to post
Share on other sites

No problem mate @SuperDudeplayer

What do you mean by the "form"? Do you mean the shape and colour? That can be done with setMarkerType  and setMarkerColor

"westClosed" setMarkerType "hd_warning" // This will set the marker to a exclamation mark.

The different marker classes can be found at the bottom of this page: https://community.bistudio.com/wiki/cfgMarkers

Alternatively you can find them by going into editor and hovering over the individual markers, the classname will be the bottom text on the tooltip. It should be of similar syntax to "mil_dot" or "hd_dot".

"westClosed" setMarkerColor "ColorRed";// Will change the new exclamation mark to red

The different colours that are available can be found by going into editor >> place a marker >> enter properties of marker >> expand marker colour drop down.(Found at bottom of properties)

Some of them are as simple as:

"ColorGreen",

"ColorRed",

"ColorYellow",

"ColorOrange"

And so on, I think you get the idea lol.

Here is an example of a bit of code that changes the shape and colour of a marker:

Spoiler
KAG_mapMarker = {
	createMarker ["Marker1", position player];
	"Marker1" setMarkerShape "ICON";
	"Marker1" setMarkerType "mil_triangle";
	"Marker1" setMarkerText profileName;
	while {true} do {
		"Marker1" setMarkerPos position player;
		"Marker1" setMarkerDir (getDir player);
		if (damage player <= 0.25) then {
			"Marker1" setMarkerColor "ColorGreen";
		};
		if ((damage player > 0.25) && (damage player < 0.75)) then {
			"Marker1" setMarkerColor "ColorYellow";
		};
		if (damage player >= 0.75) then {
			"Marker1" setMarkerColor "ColorRed";
		};
	};
};

 

 

Edited by KillerAussie

Share this post


Link to post
Share on other sites
12 hours ago, KillerAussie said:

That can be done with setMarkerType  and setMarkerColor

"westClosed" setMarkerType "hd_warning" // This will set the marker to a exclamation mark.

The different marker classes can be found at the bottom of this page: https://community.bistudio.com/wiki/cfgMarkers

Alternatively you can find them by going into editor and hovering over the individual markers, the classname will be the bottom text on the tooltip. It should be of similar syntax to "mil_dot" or "hd_dot".

"westClosed" setMarkerColor "ColorRed";// Will change the new exclamation mark to red

The different colours that are available can be found by going into editor >> place a marker >> enter properties of marker >> expand marker colour drop down.(Found at bottom of properties)

Some of them are as simple as:

"ColorGreen",

"ColorRed",

"ColorYellow",

"ColorOrange"

And so on, I think you get the idea lol.

 

I didn't know all of this, thank you very much for teaching me about this. I'll work again on the script on a local mission then after on my altis life server. Sadly, due to the area in which i am, i can't edit my server so i can only send info about the fact if the script works or not on the server tomorrow.

I'm still asking myself why the script works on a local mission file but not on the AL server.

Share this post


Link to post
Share on other sites

Here's my V2.0 of my script (i'm gona test if it works once i have access to better internet either tomorrow morning or tonight):

initServer.sqf:

eastCheckpoint = 0;
westCheckpoint = 0;
if (eastCheckpoint < 1) then{
	"eastPoint" setMarkertype "mil_join_noshadow";
	"eastPoint" setMarkercolor "ColorGreen";
	"eastPoint" setMarkertext "Open";
	eastCheckpoint = 1;
}else{
	"eastPoint" setMarkertype "mil_objective_noshadow";
	"eastPoint" setMarkercolor "ColorRed";
	"eastPoint" setMarkertext "Close";
	eastCheckpoint = 0;
};
if (westCheckpoint < 1) then{
	"westPoint" setMarkertype "mil_join_noshadow";
	"westPoint" setMarkercolor "ColorGreen";
	"westPoint" setMarkertext "Open";
	westCheckpoint = 1;
}else{
	"westPoint" setMarkertype "mil_objective_noshadow";
	"westPoint" setMarkercolor "ColorRed";
	"westPoint" setMarkertext "Closed";
	westCheckpoint = 0;
};

fn_westcheckpoint:

_Open = parseText "<t color='#00ff2e'>THE WEST CHECKPOINT IS NOW OPEN</t>";
_Closed = parseText "<t color='#ff0000'>The west Border is Closed.<br/>ALL PASSAGE FROM THERE IS NOW ILLEGAL</t>";
if (westCheckpoint < 1) then{
	"westPoint" setMarkertype "mil_join_noshadow";
	"westPoint" setMarkercolor "ColorGreen";
	"westPoint" setMarkertext "Open";
	westCheckpoint = 1;
	hint _Open;
}else{
	"westPoint" setMarkertype "mil_objective_noshadow";
	"westPoint" setMarkercolor "ColorRed";
	"westPoint" setMarkertext "Closed";
	westCheckpoint = 0;
	hint _Closed;
};

fn_eastcheckpoint:

_Open = parseText "<t color='#00ff2e'>THE EAST CHECKPOINT IS NOW OPEN</t>";
_Closed = parseText "<t color='#ff0000'>The east Border is Closed.<br/>ALL PASSAGE FROM THERE IS NOW ILLEGAL</t>";
if (eastCheckpoint < 1) then{
	"eastPoint" setMarkertype "mil_join_noshadow";
	"eastPoint" setMarkercolor "ColorGreen";
	"eastPoint" setMarkertext "Open";
	eastCheckpoint = 1;
	hint _Open;
}else{
	"eastPoint" setMarkertype "mil_objective_noshadow";
	"eastPoint" setMarkercolor "ColorRed";
	"eastPoint" setMarkertext "Close";
	westCheckpoint = 0;
	hint _Closed;
};

I hope it's easier on the eyes (I did test it on a local mission and it does work).

Share this post


Link to post
Share on other sites

I discovered something called remoteExec. I did learn that it's made to do the same thing that addAction does but does it with every player. I'll try it out and see if it works.

Update: No, it doesn't. Here's what I put on the object that should do the action:

this addaction ["Open/Close West Checkpoint",{[[],"core\fn_westcheckpoint.sqf"] remoteExec ["execVM",0];}];

 

Edited by SuperDudeplayer

Share this post


Link to post
Share on other sites
51 minutes ago, SuperDudeplayer said:

I discovered something called remoteExec. I did learn that it's made to do the same thing that addAction does but does it with every player. I'll try it out and see if it works.

That's not really what it does: https://community.bistudio.com/wiki/remoteExec

It goes what it says, it executes a function on target clients. 

Share this post


Link to post
Share on other sites
7 minutes ago, imthatguyhere said:

That's not really what it does: https://community.bistudio.com/wiki/remoteExec

It goes what it says, it executes a function on target clients. 

Ok, but it does say that if the "targets" is set to 0 then it applies to all players. But since it doesn't work, what can i use/change to make my scripts work?

Share this post


Link to post
Share on other sites
1 hour ago, SuperDudeplayer said:

Ok, but it does say that if the "targets" is set to 0 then it applies to all players. But since it doesn't work, what can i use/change to make my scripts work?

What is the issue you are having?

Share this post


Link to post
Share on other sites

The issue that i'm having is that for some reason, the script that i made and set on my Altis Life dedicated server and activate the scroll wheel option, it doesn't seem to work. But, when I activate the script on a mission launched on my pc, it works. I don't understand why it works on one but not the other and I'm trying to make it work on both.

Share this post


Link to post
Share on other sites
5 minutes ago, SuperDudeplayer said:

The issue that i'm having is that for some reason, the script that i made and set on my Altis Life dedicated server and activate the scroll wheel option, it doesn't seem to work. But, when I activate the script on a mission launched on my pc, it works. I don't understand why it works on one but not the other and I'm trying to make it work on both.

The only functional difference would be that your client was the server when you launched it on your PC. To recreate that, you could make a function to do the changes you want on the server side, then the client addAction would remoteExec that function to cause the server to do the changes.

Share this post


Link to post
Share on other sites
13 hours ago, imthatguyhere said:

The only functional difference would be that your client was the server when you launched it on your PC.

Oh, ok, thank you for telling me that.

 

13 hours ago, imthatguyhere said:

To recreate that, you could make a function to do the changes you want on the server side, then the client addAction would remoteExec that function to cause the server to do the changes.

Sorry for my ignorance, but how would I be able to make it do changes on the server side?

Share this post


Link to post
Share on other sites

I just arrived to the chapter in [FOCK]ERS Arma 3 Scripting guide where they talk about how to make functions work depending on what they are needed for.

Edit: It didn't help at all

Edited by SuperDudeplayer

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...