Jump to content
Sign in to follow this  
Norbak

I'm at grid...

Recommended Posts

Hello. I'm trying to find a precious script but i'm failing at all.

Anyone know anything for this?:

-Where are you?

-I'm at grid...

Is there a script for answer that kind of question for a full coop multiplayer?

Share this post


Link to post
Share on other sites

I found and modified this: (TitleText for each player on server)

_gridPos = mapGridPosition getPos player;

TitleText [format["I'm at grid: %1",_gridPos], "PLAIN"];

copyToClipboard format ["Grid Pos: %1",_gridpos];

But i need to show who's sending this message, something like: "Transmission from "player" at grid %1"...

Any idea?

Share this post


Link to post
Share on other sites

Need more information about what you are trying to accomplish? Do you want players to be able to send messages to each other containing their grid location?

Share this post


Link to post
Share on other sites

A quick mockup so that players can send their grid location to another player, worked fine for me when I tested it on a dedicated server:

e0a0c357aa.jpg

You can put everything in the main init.sqf except for the last part. Might not contain full functionality of what you are after but should provide a basic starting point at least.

//Server relays the message from one sourceclient to the targetclient
if (isServer) then {
"relayPosMsg" addpublicvariableeventhandler {
	_arr = _this select 1;
	_source = _arr select 0;
	_destination = _arr select 1;
	receivePosMsg = _source;
	(owner _destination) publicvariableclient "receivePosMsg";
};
};

if (!isDedicated) then {
//Sends the messageinformation to the server that relays it further, also removes the addactions and starts the main addaction.
sendMessage = {
	relayPosMsg = [player, (_this select 0)];
	publicvariableserver "relayPosMsg";
	{player removeaction _x;} forEach actions;
	[] spawn addLocAction;
};

//Removes the main addaction and compiles an addaction list of all the players on the server so the player can choose who to send the message to.
compilePlayerList = {
	actions = [];
	player removeAction action1;
	_action = player addAction ["Cancel", "actionHandler.sqf", "{player removeaction _x;} forEach actions; [] spawn addLocAction;",0,false,true,"","alive player"];
	actions = actions + [_action];
	{
		_text = format ["Send gridlocation to %1",name _x];
		_args = format ['[%1] spawn sendMessage;',_x];
		_action = player addaction [_text, "actionHandler.sqf", _args,0,false,true,"","alive player"];
		actions = actions + [_action];
	} forEach playableUnits;
};

//When server relays the message to the client this processes and shows it.
"receivePosMsg" addpublicvariableeventhandler {
	_name = name (_this select 1);
	_gridpos = mapGridPosition (_this select 1);
	_message = format ["Transmission from %1 at grid %2...",_name,_gridpos];
	titleText [_message, "PLAIN"];
};

//Just simply adds the main addaction to the player
addLocAction = {
	action1 = player addAction ["Send gridlocation to a player...", "actionHandler.sqf", "[] spawn compilePlayerList;",0,false,true,"","alive player"];
};
[] spawn addLocAction;
};



//Put this in actionHandler.sqf in the main mission folder
call compile format ["%1", _this select 3];

Feel free to modify to your needs.

Edited by Viba

Share this post


Link to post
Share on other sites

Great! .You're Great!. Nice job bro!

Hmm. This is great but my idea is to mix the message "Transmission from %1 at grid %2 requesting medical assistant...." using a radio channel / trigger.

Edited by kyopower

Share this post


Link to post
Share on other sites

Well. i was trying to make one transmisison by every option : Help transmission, Transport Transmission, Medical Assistance Transmission and Sending Position Transmission (Sending %1 and %2 in message) but they mix in one and makes them unusable.

What am i doing wrong?

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  

×