Jump to content
  • 0

taskHint Method of Text - Help needed


CRAFT

Question

I'd like to replace some DZMS mission text fields with the more visable taskHint text.

 

I have seen the taskHint method used on a few scripts recently, but notice they do not use the RGBA field and instead create a variable in a seperate sqf.

 

Here's what I'm trying to replace as well as my current taskHint (which is not working):

[nil,nil,rTitleText,"A Weapons Truck has Crashed!\nGo Recover the Supplies!", "PLAIN",10] call RE;

taskHint ["A Weapons Truck has Crashed!\nGo Recover the Supplies!", [1, 1, 1, 1], "taskNew"];

The mission runs fine with no errors in the RPT, but never displays any text while starting. Any idea on where I'm going wrong?

Link to comment
Share on other sites

13 answers to this question

Recommended Posts

  • 0

I never worked with DZMS so i dont know how they execute the message, but the 2nd one cant work, a mission system does not run on the players client, so if you replace the first one with the 2nd one, the text will only be visible on the server, you need to remote execute it via call RE; like in the first titletext, otherwise no players is able to see it.

 

If that not work you can maybe try to write a eventhandler for it and use publicvariableclient to broadcast the message to the clients.

 

but before we go this way, try this:

taskHint ["A Weapons Truck has Crashed!\nGo Recover the Supplies!", [1, 1, 1, 1], "taskNew"] call RE;

P.S. arma use his own "RGBA" ( the [1, 1, 1, 1] means white) if you want to change the color, here is a color picker which include the arma format: http://lostvar.com/flashtrash/SPUNsColorPicker.html

Link to comment
Share on other sites

  • 0

The color picker is pretty sweet :D I think I can help you here.

 

Wherever this RE call is, serverside, replace it with-

myVariable = 'Mission text!';
publicVariable 'myVariable';

Then clientside add this-

'myVariable' addPublicVariableEventHandler
{
    taskHint [(_this select 1),[1,1,1,1],'taskNew'];
};

You can also define the color serverside aswell if you'd like, maybe to reflect the mission difficulty or type or whatever.

To do this just edit the serverside part of this to be-

myVariable = ['Mission text!',[1,1,1,1]];
publicVariable 'myVariable';

Then modify the eventHandler clientside to be-

'myVariable' addPublicVariableEventHandler
{
    taskHint [(_this select 1) select 0,(_this select 1) select 1,'taskNew'];
};

Inside a publicVariableEventHandler, the name of the variable is addressed by _this select 0. The actual values are in _this select 1.

So that's why the mission text and text color are addressed by (_this select 1) select n.

Hope I made it clear enough :)

Link to comment
Share on other sites

  • 0

CordlAsis, thank you for the response and information. I failed to mention DZMS resides, and is called from the dayz_server.pbo via the serverMonitor.sqf.

 

Could this still work being the files are all server side? Sorry I'm a bit confused.

 

Cheers,

CRAFT

Link to comment
Share on other sites

  • 0

Don't worry about being confused :')

 

I've not used DZMS but I'll use a basic example which should help you understand. Somewhere in the DZMS files, it's possibly using something like this to broadcast a message to all players to say has mission has started.

[nil,nil,rTITLETEXT,'A mission has started!','PLAIN'] call RE:

You want to replace all these calls with this-

[nil,nil,rTITLETEXT,'A mission has started!','PLAIN'] call RE:
myVariable = 'Mission text!';
publicVariable 'myVariable';

This is going to send the message directly to the clients.

 

In you mission files, even in your init.sqf add this-

'myVariable' addPublicVariableEventHandler
{
    taskHint [(_this select 1),[1,1,1,1],'taskNew'];
};

Every time the server broadcasts the specified variable to the clients, the clients will react by displaying the text that has been sent to them.

Link to comment
Share on other sites

  • 0

Thanks for the info CorlAsis! I couldn't wrap my head around it last night, but have a better understanding this morning. I got it to display the text following you instruction! The other scripts made this look easy b/c they are all client side, which you informed me the taskHint needs to be. I made a MissionHint.sqf and called it from my init.sqf, as to not to crowd my init.

 

The text does only stay for ~1.5 seconds, which I believe is default. Is there a way to increase this display/fade time? Perhaps a ctrlSetFade and ctrlFade?

 

Thank you again for the help, I've learned quite much from you!

 

Cheers,

CRAFT

Link to comment
Share on other sites

  • 0

I duplicated the public variable and gave it another name and then ran them back to back. The text fades in and out in within 5 seconds and then repeats.

 

Here's a look of it in action.

 

Thanks again for the help!

 

Cheers,

CRAFT

Thats sucks if you post it 2 times, cause it will use alot of traffic and can cause desync, maybe that would be a better way todo it:

'myVariable' addPublicVariableEventHandler
{

for "_i" from 1 to 6 do {sleep 1.5; taskHint [(_this select 1),[1,1,1,1],'taskNew'];};
};
Link to comment
Share on other sites

  • 0

 

Thats sucks if you post it 2 times, cause it will use alot of traffic and can cause desync, maybe that would be a better way todo it:

'myVariable' addPublicVariableEventHandler
{

for "_i" from 1 to 6 do {sleep 1.5; taskHint [(_this select 1),[1,1,1,1],'taskNew'];};
};

 

Thank you, this is more of what I had in mind but lacked the skill to do.

 

The text shows 6 times as you scripted, definitely solves the problem.  :)  I get an error though:

YagwXrl.png

 

Do I need to replace "_i" with a different variable?

 

Cheers,

CRAFT

Link to comment
Share on other sites

  • 0

No it's fine, it's because suspending isn't allowed inside a scheduled environment. Or in plain English, you can't use sleep, while loops, waitUntil inside a called function which this is, it must be spawned.

So use this instead-

'myVariable' addPublicVariableEventHandler
{
    (_this select 1) spawn {for "_i" from 1 to 6 do {sleep 1.5; taskHint [_this,[1,1,1,1],'taskNew'];};};
};

You'll notice that you don't use (this select 1) inside the task hint call now. You must pass that into the spawn instead then access it inside the spawn with _this.

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...