Scripts / [SOLVED] Text on screen in the middle

Author
Message
Tiger1980
3
Years of Service
User Offline
Joined: 21st Mar 2021
Location:
Posted: 4th Apr 2021 20:32
Is there a way to make an text in the middle of the screen ?

The author of this post has marked a post as an answer.

Go to answer
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 4th Apr 2021 20:49
This post has been marked by the post author as the answer.
TextCenterOnX(x,y,size,txt)
TextCenterOnXColor(x,y,size,txt,r,g,b)

With x,y = 50,50

e.g.:
TextCenterOnXColour( 50, 50, 5, "Some text", 255, 0, 0 )
Been there, done that, got all the T-Shirts!
PM
Tiger1980
3
Years of Service
User Offline
Joined: 21st Mar 2021
Location:
Posted: 5th Apr 2021 08:07
THX This works great,

i have do this:

function textonscreen2_init(e)
end

function textonscreen2_main(e)
if g_Entity[e]['plrinzone']==1 then
TextCenterOnXColor(50,50,5,"Some text",0,0,255)
end
end


..The text apears on the middle on the screen and it works great
But is it possible to slowly fade in and Fade Out the text ?

PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 5th Apr 2021 11:32
Try starting with colour at 0 and increase it each frame till it reaches 255.

You may find this interesting as well: https://forum.game-guru.com/thread/219811#msg2602351
Been there, done that, got all the T-Shirts!
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 5th Apr 2021 17:55
Flashing text;

if GetPlayerDistance(e) < 400 then
TextCenterOnXColor(50,50,3, "Warning!", math.random()*250, math.random()*250, math.random()*250)
local distcol = 600 - ( GetPlayerDistance(e) + 100 )
TextCenterOnXColor(50,55,3, "Getting too close!", distcol/2, distcol/4, distcol/2 )
TextCenterOnXColor(50.3,55.3,3, "Getting too close!", distcol/2, distcol/2, distcol/4 )
end

Warning! Any call for color over 255 or negative is a quick way to shut down GG.
Experiment on an empty map.

PM
Tiger1980
3
Years of Service
User Offline
Joined: 21st Mar 2021
Location:
Posted: 5th Apr 2021 19:50
THX AmenMoses, this are very nice text fonts.
Hey if i have everything ready to make my first Game is it okay for you if i add your nickname in my credits in the game ?
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 5th Apr 2021 20:30
Yep, that's all I ask if you use any of my Lua efforts in your game, a simple credit.

Been there, done that, got all the T-Shirts!
PM
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 7th Apr 2021 14:14
Quote: "Yep, that's all I ask if you use any of my Lua efforts in your game, a simple credit. "


Really? OK, i'm sending the lollypops back
Primary Desktop:
i7 7700,k NV1070 8GB, 16GB 3200mhz memory, 1x 2TB Hybrid, Win10.

Secondary Desktop:
i5 4760k, NV960 2GB, 16GB 2333mhz memory, 1x 2TB Hybrid, Win10.

Primary Laptop:
i5, NV1050 4GB, 8GB memory, 1x 1TB HDD, Win10.

Secondary Laptop:
i3, Intel 4000 series graphics, 6GB memory, 1x 500gb HDD, Win8.1.


Login to post a reply

Server time is: 2024-12-22 02:05:03
Your offset time is: 2024-12-22 02:05:03