Jump to content
Sign in to follow this  
ToM666

Triggered messages

Recommended Posts

Hi Guys

I would like messages to appear in the top left hand corner of the screen when activated by a trigger.

Now I know how to do hints but I would prefer to have the type of message you get on some welcome screens.

The type I am refferring to is the one that looks like it is being typed much like the old ticker machines effect?

Is this possible?

Share this post


Link to post
Share on other sites

Hey Tom,

I don't know if this is what you want but you can do this,

Set a trigger down,

On Act:

hint "write your text here";

Or if you want them Colored do this:

OnAct:

hint parseText "<t color='#ff0000'>write your text here</t>"; 

just change the #ff0000 to the color code you want!

You must have the activation set to the unit you want it to be activated for tho! :)

Hope this helped

~MacRae~

Share this post


Link to post
Share on other sites
Hey Tom,

I don't know if this is what you want but you can do this,

Set a trigger down,

On Act:

hint "write your text here";

Or if you want them Colored do this:

OnAct:

hint parseText "<t color='#ff0000'>write your text here</t>"; 

just change the #ff0000 to the color code you want!

You must have the activation set to the unit you want it to be activated for tho! :)

Hope this helped

~MacRae~

Hi MacRae

Thanks for that. I did know how to do hints already but didn't realise you could change the colour so your efforts werent wasted :)

I am however looking for text that appears letter by letter from left to right. Rather than in one go in a box.

Share this post


Link to post
Share on other sites

oh i see well im sorry but i dont know hot to make that happen :/

if i find out tho you will be first to know!

Share this post


Link to post
Share on other sites

There isn't a built-in script yet, but you can use the one BIS used in their missions.

Bis_printText =
{
   private["_blocks","_block","_blockCount","_blockNr","_blockArray","_blockText","_blockTextF","_blockTextF_","_blockFormat","_formats","_inputData","_processedTextF","_char","_cursorBlinks","_cursorInvis"];

   _blockCount = count _this;

   _invisCursor = "<t color ='#00000000' shadow = '0'>_</t>";

   //process the input data
   _blocks = [];
   _formats = [];

   {
       _inputData = _x;

       _block     = [_inputData, 0, "", [""]] call BIS_fnc_param;
       _format = [_inputData, 1, "<t align = 'center' shadow = '1' size = '0.7'>%1</t><br/>", [""]] call BIS_fnc_param;

       //convert strings into array of chars
       _blockArray = toArray _block;
       {_blockArray set [_forEachIndex, toString [_x]]} forEach _blockArray;

       _blocks  = _blocks + [_blockArray];
       _formats = _formats + [_format];
   }
   forEach _this;

   //do the printing
   _processedTextF  = "";

   {
       _blockArray  = _x;
       _blockNr      = _forEachIndex;
       _blockFormat = _formats select _blockNr;
       _blockText   = "";
       _blockTextF  = "";
       _blockTextF_ = "";

       {
           _char = _x;

           _blockText = _blockText + _char;

           _blockTextF  = format[_blockFormat, _blockText + _invisCursor];
           _blockTextF_ = format[_blockFormat, _blockText + "_"];

           //print the output
           [(_processedTextF + _blockTextF_), 0, 0.15, 5, 0, 0, 90] spawn BIS_fnc_dynamicText;
           playSound "click";
           sleep 0.08;
           [(_processedTextF + _blockTextF), 0, 0.15, 5, 0, 0, 90] spawn BIS_fnc_dynamicText;
           sleep 0.02;
       }
       forEach _blockArray;

       if (_blockNr + 1 < _blockCount) then
       {
           _cursorBlinks = 5;
       }
       else
       {
           _cursorBlinks = 15;
       };

       for "_i" from 1 to _cursorBlinks do
       {
           [_processedTextF + _blockTextF_, 0, 0.15, 5, 0, 0, 90] spawn BIS_fnc_dynamicText;
           sleep 0.08;
           [_processedTextF + _blockTextF, 0, 0.15, 5, 0, 0, 90] spawn BIS_fnc_dynamicText;
           sleep 0.02;
       };

       //store finished block
       _processedTextF  = _processedTextF + _blockTextF;
   }
   forEach _blocks;

   //clean the screen
   ["", 0, 0.15, 5, 0, 0, 90] spawn BIS_fnc_dynamicText;
}; 

Set your text like this:

Bis_printSampleText =
{
   [
       ["CAMP ROGAIN, RESSUPLY POINT","<t align = 'center' shadow = '1' size = '0.7'>%1</t><br/>"],
       ["10 MINUTES LATER ...","<t align = 'center' shadow = '1' size = '1.0'>%1</t><br/>"]

   ] spawn Bis_printText;
};

Call via:

0 = [] call BIS_printSampleText;

Edited by kylania

Share this post


Link to post
Share on other sites
There isn't a built-in script yet, but you can use the one BIS used in their missions.

Bis_printText =
{
   private["_blocks","_block","_blockCount","_blockNr","_blockArray","_blockText","_blockTextF","_blockTextF_","_blockFormat","_formats","_inputData","_processedTextF","_char","_cursorBlinks","_cursorInvis"];
hint "in";
   _blockCount = count _this;

   _invisCursor = "<t color ='#00000000' shadow = '0'>_</t>";

   //process the input data
   _blocks = [];
   _formats = [];

   {
       _inputData = _x;

       _block     = [_inputData, 0, "", [""]] call BIS_fnc_param;
       _format = [_inputData, 1, "<t align = 'center' shadow = '1' size = '0.7'>%1</t><br/>", [""]] call BIS_fnc_param;

       //convert strings into array of chars
       _blockArray = toArray _block;
       {_blockArray set [_forEachIndex, toString [_x]]} forEach _blockArray;

       _blocks  = _blocks + [_blockArray];
       _formats = _formats + [_format];
   }
   forEach _this;

   //do the printing
   _processedTextF  = "";

   {
       _blockArray  = _x;
       _blockNr      = _forEachIndex;
       _blockFormat = _formats select _blockNr;
       _blockText   = "";
       _blockTextF  = "";
       _blockTextF_ = "";

       {
           _char = _x;

           _blockText = _blockText + _char;

           _blockTextF  = format[_blockFormat, _blockText + _invisCursor];
           _blockTextF_ = format[_blockFormat, _blockText + "_"];

           //print the output
           [(_processedTextF + _blockTextF_), 0, 0.15, 5, 0, 0, 90] spawn BIS_fnc_dynamicText;
           playSound "click";
           sleep 0.08;
           [(_processedTextF + _blockTextF), 0, 0.15, 5, 0, 0, 90] spawn BIS_fnc_dynamicText;
           sleep 0.02;
       }
       forEach _blockArray;

       if (_blockNr + 1 < _blockCount) then
       {
           _cursorBlinks = 5;
       }
       else
       {
           _cursorBlinks = 15;
       };

       for "_i" from 1 to _cursorBlinks do
       {
           [_processedTextF + _blockTextF_, 0, 0.15, 5, 0, 0, 90] spawn BIS_fnc_dynamicText;
           sleep 0.08;
           [_processedTextF + _blockTextF, 0, 0.15, 5, 0, 0, 90] spawn BIS_fnc_dynamicText;
           sleep 0.02;
       };

       //store finished block
       _processedTextF  = _processedTextF + _blockTextF;
   }
   forEach _blocks;

   //clean the screen
   ["", 0, 0.15, 5, 0, 0, 90] spawn BIS_fnc_dynamicText;
}; 

Set your text like this:

Bis_printSampleText =
{
   [
       ["CAMP ROGAIN, RESSUPLY POINT","<t align = 'center' shadow = '1' size = '0.7'>%1</t><br/>"],
       ["10 MINUTES LATER ...","<t align = 'center' shadow = '1' size = '1.0'>%1</t><br/>"]

   ] spawn Bis_printText;
};

Call via:

0 = [] call BIS_printSampleText;

Looks promising.

How do I implement that into the game? PHP in ArmA3 is new to me.

Share this post


Link to post
Share on other sites

It's not PHP, that's just a forum mockup for pretty colors.

Just take all three parts, put it in a file called init.sqf and just before the 0 = [] line put:

sleep 1;

Then 1 second after the game starts you'll get "CAMP ROGAIN..." typing across the screen.

Share this post


Link to post
Share on other sites
It's not PHP, that's just a forum mockup for pretty colors.

Just take all three parts, put it in a file called init.sqf and just before the 0 = [] line put:

sleep 1;

Then 1 second after the game starts you'll get "CAMP ROGAIN..." typing across the screen.

Mate, This was exactly what I was looking for. It looks awesome :cool:

Thanks kylania, you really are a star sir!

---------- Post added at 22:54 ---------- Previous post was at 21:44 ----------

Probably pushing my luck here.

But would it be possible to have messages formatted in the same way that would be activated by a trigger later on in the mission.

And would that message be seen by the whole server or just the people in the vicinity when it activated?

Share this post


Link to post
Share on other sites

Yes and yes.

The last line, this one:

0 = [] call BIS_printSampleText; 

is what displays the text. So just putting that in an OnAct field of a trigger will run it for everyone.

If you wanted it trigger based and only for certain people you could have the trigger run a script, then exit the script if you're not near the trigger.

OnAct:

0 = thisTrigger execVM "typeMessage.sqf";

typeMessage.sqf:

if (player distance _this > 30) exitWith {};

0 = [] call BIS_printSampleText;  

That should only run for clients within 30 meters of the trigger.

Share this post


Link to post
Share on other sites

@kylania

Super genius! You on BIS payroll? You should be!!

Your help on these forums have been nothing short

of amazing. Thank you so much.

:thumb:

Share this post


Link to post
Share on other sites
@kylania

Super genius! You on BIS payroll? You should be!!

Your help on these forums have been nothing short

of amazing. Thank you so much.

:thumb:

Yep, everything goblin said except I also want to have his children but unfortunatley being as I'm a bloke a simple nod of appreciation and a virtual handshake will have to do.

Cheers buddy :)

Share this post


Link to post
Share on other sites

I'd also like to extend my thanks to kylania - this script will prove most useful!

On a side note, is it possible to position the text elsewhere on the screen (e.g. bottom left)?

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  

×