Jump to content
Sign in to follow this  
Valixx

Hint appearing for all players / Hint not disappearing for others

Recommended Posts

Hey guys.

I got some signs spawning vehicles and stuff and when my brother spawns a vehicle, i get the hint also. Maybe someone could help me out.

Code for the vehicle spawn hint:

_vehHint = format ["<t align='center' color='#40E0D0' shadow='2' size='1.75'>%1</t><br/><br/><t align='center'><img size='5' image='%3'/></t><br/><br/>%1 has been spawned.  You have %2 seconds to board it!<br/><br/>You can teleport to your vehicle using the teleport sign. Choose: Teleport to Vehicle Respawn", _vehName, _delay, _image];
GlobalHint = _vehHint;
publicVariable "GlobalHint";
hintsilent parseText _vehHint;

Secondly, i got a random mission script and after the mission is announced per hint it didn't disappear on my brothers pc.

Code for the mission spawn hint:

_smhint = format ["<t align='center' color='#ffffff' shadow='2' size='1.75'>Side Objective</t><br/><t align='center' color='#000000'>------------------------------</t><br/><br/><t align='center'><img size='5' image='%1'/></t><br/><br/><t color='#ffffff' size='1.0'>Capture the MK-6 Mortar and use it to your advantage.</t>", _image];
GlobalHint = _smhint;
publicVariable "GlobalHint";
hintsilent parseText _smhint;

I got this in my folder too:

//ENABLE GLOBAL HINT from Occupation by BangaBob
"GlobalHint" addPublicVariableEventHandler
{private ["_GHint"];
_GHint = _this select 1;
hint parseText format["%1", _GHint];
};

"GlobalSideChat" addPublicVariableEventHandler
{private ["_GSChat"];
_GSChat = _this select 1;
player sideChat _GSChat;
};

Would be awesome if someone could figure it out. :)

Cheers,

=ADG=Valixx

Share this post


Link to post
Share on other sites

publicVariable doesn't trigger on the client that sets it, so you publicVariable it for others than just hint yourself at the same time.

hintSilent parseText _smHint;

right after the publicVariable.

Share this post


Link to post
Share on other sites

Thanks kylania. I've commented the publicVariable out.

How do i approach the second problem with the hint? If the sidemission gets announced, the hint did not disappear at my brothers pc. Sry if the questions seem stupid to you but i got a blockade in my brain right know :P

Share this post


Link to post
Share on other sites

No, the publicVariable is how it works! :) That's kinda vital to leave in.

The way it works is everyone has a "publicVariableEventHandler" running. That means that everyone is waiting to see if the value of "GlobalHint" changes at any time. When it does it runs the code within the eventhandler. The command publicVariable is what tells the OTHER clients that "GlobalHint" has changed, run your code now. So you set "GlobalHint" to equal the text of the message you want to hint, then people see that value (the text) change and they hint it themselves.

The difficulty is that when you publicVariable something YOU don't know that it changed (technically your eventhandler doesn't know). That's why your brother isn't seeing the message when he spawns something since his publicVariableEventHandler doesn't trigger since he set the value. So since that won't trigger you need to ALSO hint to yourself so you see the message.

_vehHint = format ["<t align='center' color='#40E0D0' shadow='2' size='1.75'>%1</t><br/><br/><t align='center'><img size='5' image='%3'/></t><br/><br/>%1 has been spawned.  You have %2 seconds to board it!<br/><br/>You can teleport to your vehicle using the teleport sign. Choose: Teleport to Vehicle Respawn", _vehName, _delay, _image];
GlobalHint = _vehHint;
publicVariable "GlobalHint";
[color="#FF0000"]hint parseText _vehHint;[/color]

You leave all your code, just add the red part to hint to the person changing the value of GlobalHint, so they get the hint as well.

Share this post


Link to post
Share on other sites

Thank you kylania. Now i understand the publicVariable thing :P

Out of curiosity, how should i approach for the opposite? That only the player sees the hint. ( Comment the publicvariable out, right?).

The second question: To make a hint disappear i'd build in a sleep and put hint "";?

Cheers,

=ADG=Valixx

Share this post


Link to post
Share on other sites
Out of curiosity, how should i approach for the opposite? That only the player sees the hint. ( Comment the publicvariable out, right?).

Were is this all being handled, if its server side then you need to send the hint only to the person who used the sign publicVariableClient, if its a client side action from the sign just use hint without using your globalhint function.
The second question: To make a hint disappear i'd build in a sleep and put hint "";?
A hint should just disappear on its own, if it is not this suggests that there is another problem here. setting a hint of "" will just mask the error. Where is this hint originating? from the server using the global hint function?

Share this post


Link to post
Share on other sites
1. Were is this all being handled, if its server side then you need to send the hint only to the person who used the sign publicVariableClient, if its a client side action from the sign just use hint without using your globalhint function.

2. A hint should just disappear on its own, if it is not this suggests that there is another problem here. setting a hint of "" will just mask the error. Where is this hint originating? from the server using the global hint function?

1. Got it.

2. Yep, using the global hint function.

Cheers,

=ADG=Valixx

Share this post


Link to post
Share on other sites
2. Yep, using the global hint function.
Mmm dont know how to help then with out seeing the rest of your code.

Just thinking out loud:-

As shown in your first post, you fill you variable with the text, global variable the message which would then be handled client side on your brothers machine via the PVEH, and you hint the message to the server.

As i said above a hint should just disappear on its own, so if it is not then you would presume something is stuck in a loop, but if you (as the server) are only seeing the hint once then we can presume the server side mission loop is ok but client side is just a PVEH so there should be no way this is looped.

1. Is it just A mission where this is happening?

2. As the PVEH shown in your first post uses just hint (rather than hintsilent) does your brother keep getting the ping sound you get when a hint appears, whilst the hint is stuck on the screen does this ping keep happening? If it does this would suggest that the PV is being sent multiple times.

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  

×