Jump to content
  • 0

auto claim missions


totis

Question

Recommended Posts

  • 0

@totis i dont know what kind of code uses that mission that youre talking about , but basically  is something like this:

waitUntil{{isPlayer _x && _x distance _Your_Mission_Location_Variable_Here <= 1000  } count playableunits > 0};
_playerName = name _x;
[nil,nil,rTitleText,format["Mission Claimed by %1",_playerName], "PLAIN",10] call RE;

 

Link to comment
Share on other sites

  • 0
Just now, totis said:

Normal missions Juan to be auto claimed by players name on map (next to mission name preferably.

Would be handy in a pve server that all are fighting to have a mission :)

Tnx for helping m8.

That would work for a static mission though am i right?

 

send me by private msg the code of your mission , to see around.

Link to comment
Share on other sites

  • 0
1 hour ago, totis said:

i mean any dynamic mission. like mv22 mission for eaxmple. so wherever it spawns on map and if  a player gets close to be autoclaimed by tha player's name on map next to mission marker for example.

Trying to but says you cant receive msgs :)

This is for the event missions. but im sure you could use parts of this to get what you need.

 

 

The only thing is adding it next to the mission name itself. i think the best way would be to add an extra marker.

We have PVE servers too, our rule is you can only claim once you are READY to shoot. we dont have a set distance, it caused problems having a distance. For the most part players have no problems following the rules. and when new players come on the server, the vets make sure everyone is on the same page which is great.

Another issue with auto claim would be a player driving by not noticing hes ran by a mission and the marker would appear as claimed.

Link to comment
Share on other sites

  • 0

You are right that small code will be in handy althought im really below newb in coding hehe

Well i always say pve servers are success from their players they have. If players are willing to cooperate its a bless :)

So my thinking  was ,having in mind the above, to missions to be autoclaimed if a players gets close and if its claimed by someone who passes by mistake other players that will want the mission will still ask i quess.

Link to comment
Share on other sites

  • 0

@totis  not sure cuz cannot test,, but in a quick look..

check this line in WAI/compile/mission_winorfail.sqf

{
			if((isPlayer _x) && (_x distance _position <= wai_timeout_distance)) then {
				_player_near = true;
			};
			
		} count playableUnits;

see an example below:  (Note: this line is into a loop and its not a good idea put a text into a loop but for an example its fine).

{
			if((isPlayer _x) && (_x distance _position <= wai_timeout_distance)) then {
				_player_near = true;
				_playerName = name _x;
                [nil,nil,rTitleText,format["Mission Claimed by %1",_playerName], "PLAIN",10] call RE;
			};
			
		} count playableUnits;

 

Link to comment
Share on other sites

  • 0
Just now, DAmNRelentless said:

The mission_winorfail file just holds the information what happens if the mission is cleared by whatever. To include the playername into the name, you have to add the same part in the mission_init where the marker name is setup.

hey dam what do think about this:

a lil modify into the loop block  in mission_init.sqf

Spoiler

while {_running} do {

				_type	= (wai_mission_data select _mission) select 1;
				
				if (ai_show_remaining) then {
				_airemain	= (wai_mission_data select _mission) select 0;
				_text	= format["%1 [%2 Remaining]",_name,_airemain];
				} else {_text = _name};

				_marker 		= createMarker [_type + str(_mission), _position];
				_marker 		setMarkerColor _color;
				_marker 		setMarkerShape "ELLIPSE";
				_marker 		setMarkerBrush "Solid";
				_marker 		setMarkerSize [300,300];
				_marker 		setMarkerText _text;

				_dot 			= createMarker [_type + str(_mission) + "dot", _position];
				_dot 			setMarkerColor "ColorRed";
				_dot 			setMarkerType "mil_dot";
				//////////////####MODIFY############################################////////
               {if((isPlayer _x) && (_x distance _position <= 1000)) then {
				
				_playerName = name _x;
				_dot 			setMarkerText _playerName;
				}else{
				_dot 			setMarkerText _text;
				};
                }forEach playableUnits;
               
                //////////////####END MODIFY############################################////////
				sleep 1;

				deleteMarker 	_marker;
				deleteMarker 	_dot;

			   _running = (typeName (wai_mission_data select _mission) == "ARRAY");
  
			};

 

 

Link to comment
Share on other sites

  • 0

That's a good way to do it. The only thing that's not good is that you are replacing the whole text of the dot marker with the player name. An advantage to add it to the loop is that it will update automatically whenever there's a new player near the mission. I would do it like that, so you still have the mission name:

Spoiler

			while {_running} do {

				_type	= (wai_mission_data select _mission) select 1;
				
				if (ai_show_remaining) then {
				_airemain	= (wai_mission_data select _mission) select 0;
				_text	= format["%1 [%2 Remaining]",_name,_airemain];
				} else {_text = _name};
				
				_marker 		= createMarker [_type + str(_mission), _position];
				_marker 		setMarkerColor _color;
				_marker 		setMarkerShape "ELLIPSE";
				_marker 		setMarkerBrush "Solid";
				_marker 		setMarkerSize [300,300];
				_marker 		setMarkerText _text;
				
				{
					if ((isPlayer _x) && (_x distance _position <= 1000)) then {
						_playerName = name _x;

						_dot 			= createMarker [_type + str(_mission) + "dot", _position];
						_dot 			setMarkerColor "ColorBlack";
						_dot 			setMarkerType "mil_dot";
						_dot 			setMarkerText format ["%1 (claimed by: %2)", _text, _playerName];
					} else {
						_dot 			= createMarker [_type + str(_mission) + "dot", _position];
						_dot 			setMarkerColor "ColorBlack";
						_dot 			setMarkerType "mil_dot";
						_dot 			setMarkerText _text;
					};
				} forEach playableUnits;

				sleep 1;

				deleteMarker 	_marker;
				deleteMarker 	_dot;

				_running = (typeName (wai_mission_data select _mission) == "ARRAY");

			};

 

 

Link to comment
Share on other sites

  • 0

@totis  @DAmNRelentless  maybe this help a lil to take a diferent way.

i was using it for another thing--- in a pre-defined area to recognize when thers player in the area.

real_time_static_marker.sqf

Spoiler

while {true} do {

_gm = createMarker ["deathmatch", [3412.77, 3929.4153, 0]];
_gm setMarkerText "DEATHMATCH ZONE";
_gm setMarkerType "Defend";
_gm setMarkerColor "ColorGreen";
_gm setMarkerBrush "Solid";
_gm setMarkerSize [0.8, 0.8];

waitUntil{{isPlayer _x && _x distance [3412.77, 3929.4153, 0] < 110  } count playableunits > 0};
deletemarker _gm;

_rm = createMarker ["deathmatch", [3412.77, 3929.4153, 0]];
_rm setMarkerText "DEATHMATCH ZONE";
_rm setMarkerType "Defend";
_rm setMarkerColor "ColorRed";
_rm setMarkerBrush "Solid";
_rm setMarkerSize [0.8, 0.8];

hint "<DMZONE>:SURVIVORS IN DM ZONE";
playsound "Radio_Message_Sound";
waitUntil{{isPlayer _x && _x distance [3412.77, 3929.4153, 0] < 110  } count playableunits < 1};
deletemarker _rm;
uisleep 0.5;
};

 

 

Link to comment
Share on other sites

  • 0

Ok. Great advices from all  and works like a charm :)

Only thing i wanna change is, can i make name stay permanent and not unclaimed when someone gets out of the 1000m radius?? I mean until mission is cleared of course.

Maybe you guys can help me with 2 more issues i have also.

1. A player cant blood another player. Thought this was build in on epoch! I have self blood and works btw and

2. My static buildings are not precise where my coords are neither they have godmode. I call them from client side with a custom sqf. Is there a way to remedy this?

Tnx guys you are all super helpfull!!

 

Btw your code is installed in every mission itself Juan?

Link to comment
Share on other sites

  • 0

Well i just join server now with full of ppl and all missions are just colour patches on map without any names. So i quess the code is working but something is causing it to fail after some time.. Maybe when there are more ppl near or if the one claimed died thats when the error happens.

Is there a way to make the name permanent until mission is finished? Even if player leaves area or dies..

Link to comment
Share on other sites

  • 0
2 minutes ago, totis said:

Well i just join server now with full of ppl and all missions are just colour patches on map without any names. So i quess the code is working but something is causing it to fail after some time.. Maybe when there are more ppl near or if the one claimed died thats when the error happens.

Is there a way to make the name permanent until mission is finished? Even if player leaves area or dies..

That would be easy to do, the question is whether you want to update the player name when there is a new player that's near the mission when the old player who claimed the mission before him/her died.

Link to comment
Share on other sites

  • 0

I am pretty tired but if I am not completely dumb, this should work:

Spoiler

			while {_running} do {

				_type	= (wai_mission_data select _mission) select 1;
				if (isNil "_playerName") then {
					{
						if ((isPlayer _x) && (_x distance _position <= 1000)) then {
							_playerName = name _x;
						};
					} forEach playableUnits;
				};
				
				if (ai_show_remaining) then {
				_airemain	= (wai_mission_data select _mission) select 0;
				_text	= format["%1 [%2 Remaining]",_name,_airemain];
				} else {_text = _name};
				
				_marker 		= createMarker [_type + str(_mission), _position];
				_marker 		setMarkerColor _color;
				_marker 		setMarkerShape "ELLIPSE";
				_marker 		setMarkerBrush "Solid";
				_marker 		setMarkerSize [300,300];
				_marker 		setMarkerText _text;

				_dot 			= createMarker [_type + str(_mission) + "dot", _position];
				_dot 			setMarkerColor "ColorBlack";
				_dot 			setMarkerType "mil_dot";
				if (isNil "_playerName") then {
					_dot 			setMarkerText _text;
				} else {
					_dot 			setMarkerText format ["%1 (claimed by: %2)", _text, _playerName];
				};	

				sleep 1;

				deleteMarker 	_marker;
				deleteMarker 	_dot;

				_running = (typeName (wai_mission_data select _mission) == "ARRAY");

			};

 

 

Link to comment
Share on other sites

  • 0

@totis you should setup a test server on your pc and make the changes on your pc instead of the live server. This way you can test things right away without affecting the players.

Theres a detailed guide somewhere in these forums. do a search for "70 detailed steps" and im sure you'll find it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Discord

×
×
  • Create New...