Jump to content
Sign in to follow this  
meaty

Typewriter intro text help

Recommended Posts

I'm a bit stuck, in arma2 i had this nice little bit of code that showed the players name, rank, and (rough) location in the lower right hand corner,

introTItle = toUpper(format["%1 %2",rank (player), name (player)]);
introLocation = toUpper(getText (configFile >> "CfgWorlds" >> worldName >> "description"));

I've been trying to get this working in arma3 but havnt had any luck, has something changed? I've done a search but all the stuff includes fadeing screens or text you have to change on a per-mission basis (which for a server with many missions, isnt all that practical :( ). Also is there a way to display the mission name as well?

Share this post


Link to post
Share on other sites

This function(post #8) will, when spawned, create a typewriter like effect displaying the text you want on the centre of the screen. You can put the following in your init.sqf.

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; 
}; 

You can spawn it using the following:

[ 
   [format["%1 %2",toUpper(rank (player)), toUpper(name (player))],"<t align = 'center' shadow = '1' size = '0.7'>%1</t><br/>"], 
   [format["%1",toUpper(getText (configFile >> "CfgWorlds" >> worldName >> "description"))],"<t align = 'center' shadow = '1' size = '1.0'>%1</t><br/>"]
] spawn BIS_PrintText;   

This will show the player's name, rank and the world name like you mentioned.

Also, if you're interested in changing how the text looks on the screen, have a look at the wiki page on Structured Text and then alter the parts between <t and </t> accordingly.

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  

×