Jump to content
Sign in to follow this  
Doodle

Multiplayer Dedicate Message

Recommended Posts

Again forever in your debt -

Downloaded your example opened in editor and preview from there - items spawn, mortor, smoke etc but no message.

I tried changing _transmit = parseText _transmit; to _transmit = hint parseText _transmit; and that gave me the message with the pic but kicked up an error

Error in expression <arseText _transmit;

BroadcastMessage = _transmit;

publicVariableServer "Broad>

Error position: <_transmit;

publicVariableServer "Broad>

Error Undefined variable in expression: _transmit

line 14

Now I am even more confused.

Im on stable too.

Share this post


Link to post
Share on other sites

1. As I said, you CANNOT just throw the command "hint" right there without removing it on the other end. You are getting that error because hint hint isn't a thing. Can't command a command.

2. Just to confirm, you are aware that the "message" will be a hint in the upper right corner, correct? I'm sorry friend but I can't think of anything else. Is your A3 on Steam? Either way, make sure it is up to date to the latest stable version.

3. In your Debug Console (hit escape, if you don't see it, put enableDebugConsole = true; in your description.ext and restart), put the following and hit Global.

_startuf = "<img size='4' image='icons\mortor1.paa' align='left'/><br/>";       _titletuf = "<t color='#FFFFFF' size='1.2' align='left'><br/>Mortor Support.</t><br/>";   _texttuf = "<t color='#58FA58' size='1.0' align='left'>A member of your sqaud is deploying a Mortor.<br/><br/>It is marked with green smoke and chemlight.</t><br/><br/>";    _transmit = _startuf + _titletuf + _texttuf;  _transmit = parseText _transmit; hint _transmit;

You should get no errors from that. Your message will display or it will not. If it does not, I again urge you to verify your game cache or update it or something.

Share this post


Link to post
Share on other sites

Once again thanks

1. I only chucked the "hint" in there to see what happens.

2 Yep I know exactly what the hint looks like as I have used it numerous times

3 Up to date, on steam debug console enabled in editor and on dedi, files verified fine, and showscripterros enabled in startup

Can i Just confirm when you load your demo mission into editor - hit preview and the scroll to HELLO you get no errors, you see the message and you are running with showscripterrors?

Doing a complete reinstall - though my scripting abilities aint great I am sure there must be something not right with my ARMA - will report back.

Edited by Doodle
Update

Share this post


Link to post
Share on other sites

Yessir. I did it both through Preview and the normal way, in an attempt to repro the issue you're having. I get the message, no popup errors, nor any errors that you'd see with showscripterrors, which I always have enabled.

You shouldn't need to do a complete reinstall, just right click ArmA 3 in your Steam library and Verify Game Cache. Also, try running without mods. Plain, stock, Stable ArmA 3.

As well, if anyone else would like to chime in, feel free. I'm out of ideas since this works perfectly on my end.

Share this post


Link to post
Share on other sites

I "think" it maybe working.....yet to test proper on dedi but looking good. Will let you know

Did a clean install and no errors - no idea!

thank you so much for your help it was driving me nuts.

Thanks

ready for the next one.....? :-)

Share this post


Link to post
Share on other sites

Always happy to help. Bring it on! Just be sure to make a new thread if its unrelated to this, for the sake of people searching.

Share this post


Link to post
Share on other sites

Posted a fix in the thread. Let's keep the discussion there, keeping this thread on track.

Share this post


Link to post
Share on other sites

@Grimes

Think I might be about to spoil your day. Messages dont broadcast on our dedi. In fact there are no messages at all.

Previously only the person who activated the script saw the message (wanted it so all see message) and items were spawned

now no message at all - items do get spawned.

Time to give up maybe,,

Will take a look in other thread - thanks

Share this post


Link to post
Share on other sites

Take the addEH out of the isServer scope. The message IS opening, but only for the DS. So your init.sqf should look like:

if (isServer) then {
   pre_fnc_broadcastMsg = {
       _broadcastString = _this select 0;
       hint _broadcastString;
   };
};  

"BroadcastMessage" addPublicVariableEventHandler {
       [_this select 1] call pre_fnc_broadcastMsg;
};

This will have the EH on all clients + the server. If this doesn't work just remove the isServer bit all together, and have all machines define the function and call it.

Share this post


Link to post
Share on other sites

this is whats in my init

if (isServer) then {
pre_fnc_broadcastMsg = {
 _broadcastString = _this select 0;
 hint _broadcastString;
};

"BroadcastMessage" addPublicVariableEventHandler {
 [_this select 1] call pre_fnc_broadcastMsg;
};
};

the only difference between the one above is semi colons slightly different, is this the change?

thanks

Share this post


Link to post
Share on other sites

No sir. The "minor" details are important. I strongly suggest you use an advanced editor such as Notepad++ so that you can better see when scopes begin and end. What you have still has both sets of code in the isServer scope. Please copy what I most recently put, because it IS different. Look at the curly brackets.

Share this post


Link to post
Share on other sites

I thought the minor details were important (just didn't kow why) was just double checking that the only difference was the semi colons being in slightly different place - though I have no idea what it means. Testing on dedi today so will report back

once again many thanks

Share this post


Link to post
Share on other sites

just curious, why jumping thru all the hoops with eventhandlers ? does BIS_fnc_MP not work on dedicated?

BIS_fnc_MP was made just for these locality issues. and it makes it really easy to use.

here is the parameters for that - just fyi :)

Parameter(s):
	0: ANY - function params
	1: STRING - function name
	2 (Optional):
		BOOL - true to execute on every client, false to execute it on server only
		OBJECT - the function will be executed only where unit is local [default: everyone]
		GROUP - the function will be executed only on client who is member of the group
		SIDE - the function will be executed on all players of the given side
		NUMBER - the function will be executed only on client with the given ID
		ARRAY - array of previous data types
	3 (Optional): BOOL - true for persistent call (will be called now and for every JIP client) [default: false]

with that you could just make a function that has your message then have BIS_fnc_MP execute it to all players.

example

// function to display message
sendMessage = 
{
_startuf = "<img size='4' image='icons\mortor1.paa' align='left'/><br/>";     
_titletuf = "<t color='#FFFFFF' size='1.2' align='left'><br/>Mortor Support.</t><br/>"; 
_texttuf = "<t color='#58FA58' size='1.0' align='left'>A member of your sqaud is deploying a Mortor.<br/><br/>It is marked with green smoke and chemlight.</t><br/><br/>";

hintSilent parseText (_startuf + _titletuf + _texttuf);
};

// execute message to all clients
[[],"sendMessage",true,false] call BIS_fnc_MP;

Share this post


Link to post
Share on other sites

@ Grimes

Still no messages on dedi with the latest code from above.

You mention in previous post "If this doesn't work just remove the isServer bit all together, and have all machines define the function and call it."

Could you point me in right direction please does it become this? - I removed the (isServer) part.

if then {

pre_fnc_broadcastMsg = {

_broadcastString = _this select 0;

hint _broadcastString;

};

};

"BroadcastMessage" addPublicVariableEventHandler {

[_this select 1] call pre_fnc_broadcastMsg;

};

Once again many thanks in advance.

---------- Post added at 11:47 AM ---------- Previous post was at 11:40 AM ----------

@Nimrod

Many thanks for this - the reason not going this route is I didnt know how.:o

Will take a look at the above - would I have to add anything to my init to use the above?

Thanks in advance

Share this post


Link to post
Share on other sites
@ Grimes

Still no messages on dedi with the latest code from above.

You mention in previous post "If this doesn't work just remove the isServer bit all together, and have all machines define the function and call it."

Could you point me in right direction please does it become this? - I removed the (isServer) part.

if then {

pre_fnc_broadcastMsg = {

_broadcastString = _this select 0;

hint _broadcastString;

};

};

"BroadcastMessage" addPublicVariableEventHandler {

[_this select 1] call pre_fnc_broadcastMsg;

};

Once again many thanks in advance.

---------- Post added at 11:47 AM ---------- Previous post was at 11:40 AM ----------

@Nimrod

Many thanks for this - the reason not going this route is I didnt know how.:o

Will take a look at the above - would I have to add anything to my init to use the above?

Thanks in advance

the function part (your message stuff) would have to go somewhere where every player would get it, so putting that in init.sqf would be safe bet.

then you could just put the BIS_fnc_MP line directly into the script that is called when addaction is activated. I use it all the time like that since addactions are only local effect.

using your original post as example

//nul = execVM "spawn_mortor1.sqf"; 
//Spawn Mortor 
playsound "drill"; 

// execute message to all clients
[[],"sendMessage",true,false] call BIS_fnc_MP;

if (!isServer) exitWith {};  


_mortor2tuf = "Chemlight_green" createVehicle (position s5); 
_mortor2tuf setDir 0; 
sleep 1.0; 

_mortor2tufe = createVehicle ["SmokeShellGreen", getPos s5, [],1,"NONE"]; 
_mortor2tufe setDir 0; 
sleep 1.0; 

_mortor2tuff = "B_Mortar_01_F" createVehicle (position s5); 
_mortor2tuff setDir 180; 
sleep 1.0; 

if (true) exitWith {};  

and in your init.sqf

// function to display message
sendMessage = 
{
_startuf = "<img size='4' image='icons\mortor1.paa' align='left'/><br/>";     
_titletuf = "<t color='#FFFFFF' size='1.2' align='left'><br/>Mortor Support.</t><br/>"; 
_texttuf = "<t color='#58FA58' size='1.0' align='left'>A member of your sqaud is deploying a Mortor.<br/><br/>It is marked with green smoke and chemlight.</t><br/><br/>";

hintSilent parseText (_startuf + _titletuf + _texttuf);
};

Share this post


Link to post
Share on other sites

Didn't even think of BIS_fnc_MP because I was too distracted by nit picking the originally proposed method :P

Anyway, to finish with the EH method, we are going to have a little lesson. By "remove the isServer bit" I meant remove that if/then scope all together and put its content in the main scope, allowing all machines to execute it. if then { doesn't exist because it has no conditions, thus is technically redundant.

pre_fnc_broadcastMsg = {
  _broadcastString = _this select 0;
   hint _broadcastString;
}; 

"BroadcastMessage" addPublicVariableEventHandler {
       [_this select 1] call pre_fnc_broadcastMsg;
};  

Both scopes are executed on all machines, which includes all clients and the server, be it hosted or DS.

As well, for what its worth, if {true} exitWith {} at the end of a script is also redundant, as the script exits at the end anyway.

Share this post


Link to post
Share on other sites
the function part (your message stuff) would have to go somewhere where every player would get it, so putting that in init.sqf would be safe bet.

then you could just put the BIS_fnc_MP line directly into the script that is called when addaction is activated. I use it all the time like that since addactions are only local effect.

using your original post as example

//nul = execVM "spawn_mortor1.sqf"; 
//Spawn Mortor 
playsound "drill"; 

// execute message to all clients
[[],"sendMessage",true,false] call BIS_fnc_MP;

if (!isServer) exitWith {};  


_mortor2tuf = "Chemlight_green" createVehicle (position s5); 
_mortor2tuf setDir 0; 
sleep 1.0; 

_mortor2tufe = createVehicle ["SmokeShellGreen", getPos s5, [],1,"NONE"]; 
_mortor2tufe setDir 0; 
sleep 1.0; 

_mortor2tuff = "B_Mortar_01_F" createVehicle (position s5); 
_mortor2tuff setDir 180; 
sleep 1.0; 

if (true) exitWith {};  

and in your init.sqf

// function to display message
sendMessage = 
{
   _startuf = "<img size='4' image='icons\mortor1.paa' align='left'/><br/>";     
   _titletuf = "<t color='#FFFFFF' size='1.2' align='left'><br/>Mortor Support.</t><br/>"; 
   _texttuf = "<t color='#58FA58' size='1.0' align='left'>A member of your sqaud is deploying a Mortor.<br/><br/>It is marked with green smoke and chemlight.</t><br/><br/>";

   hintSilent parseText (_startuf + _titletuf + _texttuf);
};

Still no joy exactly with any of these - the above version on dedi displays messag ok but does not spawn items - any idea?

thanks in advance

Share this post


Link to post
Share on other sites

like I said, it was just an example :) if this is the actual script that is called from the addaction then your issue is

if (!isServer) exitwith {};

that means only the server can use the addaction and that's not to likely on a dedicated server :)

additional edit:

if you ONLY want the server to create these items you could again put the script stuff that spawns the items into a function and use the BIS_fnc_MP again but this time set it to only execute on the server. (remember the previous 1 was only for clients)..

spawnMorters = 
{
          _mortor2tuf = "Chemlight_green" createVehicle (position s5); 
          _mortor2tuf setDir 0; 
          waitUntil {!isNil {_mortor2tuf}};

          _mortor2tufe = createVehicle ["SmokeShellGreen", getPos s5, [],1,"NONE"]; 
          _mortor2tufe setDir 0; 
          waitUntil {!isNil {_mortor2tufe}};

          _mortor2tuff = "B_Mortar_01_F" createVehicle (position s5); 
          _mortor2tuff setDir 180; 
          waitUntil {!isNil {_mortor2tuff}};
};

now your script that action calls would look like this

//nul = execVM "spawn_mortor1.sqf"; 
//Spawn Mortor 
playsound "drill"; 

// execute message to all clients
[[],"sendMessage",true,false] call BIS_fnc_MP;

// call server to spawn objects
[[],"spawnMorters",false,false] call BIS_fnc_MP;

Edited by Nimrod_Z

Share this post


Link to post
Share on other sites

OK Guys

Firstly thankyou for all the assistance at last we got there and now everyone can see the messages and I learnt a lot along the way - though some things I just cant get my head round I knew that it was locallity but for the life of me couldnt work it out.

- of course as soon as one thing works then I discover something else that would be nice to change but not essential

I do have another queery - not that its a major issue but I would like to know

I have several radio triggers placed in the editor that anyone can access.

So for example in the above player S5 can deploy a mortor by pressing 0 0 5 Radio Echo but also if player s3 activates the trigger it will deploy a mortor at S5's position

I am guessing it is because triggers placed in editor are global? - If I limit the trigger condition to "isplayer and ==s5" so ONLY s5 can activate the trigger then we get no message and nothing spawned.

does adding the "isplayer and ==s5" make the trigger local? its no big deal but it would be nice to limit the radio channels 1 per player

player s1 - Radio Alpha

player s2 - Radio Bravo

etc etc

Like I said no big deal but would be nice

Thanks in advance

Share this post


Link to post
Share on other sites
OK Guys

Firstly thankyou for all the assistance at last we got there and now everyone can see the messages and I learnt a lot along the way - though some things I just cant get my head round I knew that it was locallity but for the life of me couldnt work it out.

- of course as soon as one thing works then I discover something else that would be nice to change but not essential

I do have another queery - not that its a major issue but I would like to know

I have several radio triggers placed in the editor that anyone can access.

So for example in the above player S5 can deploy a mortor by pressing 0 0 5 Radio Echo but also if player s3 activates the trigger it will deploy a mortor at S5's position

I am guessing it is because triggers placed in editor are global? - If I limit the trigger condition to "isplayer and ==s5" so ONLY s5 can activate the trigger then we get no message and nothing spawned.

does adding the "isplayer and ==s5" make the trigger local? its no big deal but it would be nice to limit the radio channels 1 per player

player s1 - Radio Alpha

player s2 - Radio Bravo

etc etc

Like I said no big deal but would be nice

Thanks in advance

glad to hear its working bud.

triggers placed in editor are global. so if you want only s5 to activate said trigger you should use trigger condition

vehicle player == s5

now as far as locality in arma, that's tricky to learn. it became a little easier with the BIS_fnc_MP function but you still need to learn the basics because every command has a different argument and effect locality. all locality of commands can be found on the wiki in the top corner of whatever command your looking to use. (AL = argument local) (AG = argument global) (EL = effect local) (EG = effect global). here is a link to killzone kids page that has the basics of locality and a few examples.

http://killzonekid.com/arma-scripting-tutorials-locality/

Share this post


Link to post
Share on other sites

Just tried this on dedi

Currently trigger COND is this

Everything works perfectly. Items spawned - messages broadcast across network

If I change the COND to vehicle player == s5 then nothing happens at all.

Surely the script is dedi server friendly already as it works when the trigger is not limited to a specific player?

Thanks (confused) in advance.

Share this post


Link to post
Share on other sites
Just tried this on dedi

Currently trigger COND is this

Everything works perfectly. Items spawned - messages broadcast across network

If I change the COND to vehicle player == s5 then nothing happens at all.

Surely the script is dedi server friendly already as it works when the trigger is not limited to a specific player?

Thanks (confused) in advance.

that's my bad, sorry. that condition will only fire trigger if that player goes into that trigger radius. it will not make him be the only one able to use radio to trip it. I actually don't think I ever looked into limiting a radio call trigger to a certain person. is that really the only way that you want it so only a specific player can use it? if not , and you want anybody to use it (just not multiple times) you could simply name the trigger then in you script that creates the mortor, smoke and stuff just use deleteVehicle triggername at the top of script so it deletes trigger preventing anyone else using it. just another option.

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  

×