Scripts / Set Text Location?

Author
Message
Nathan38
13
Years of Service
User Offline
Joined: 13th Feb 2011
Location:
Posted: 25th Feb 2016 12:36 Edited at: 25th Feb 2016 12:37
Hi all,
I've been fiddling around with the health types scripts that Lee made for the public preview, and I was just wondering if there was a command to set some text to a certain location? I've checked the stickied post with all of the LUA commands but I could only find ones that refer to prompt

http://imgur.com/CXJytrY

as you can see in the image, the prompt shows the players health and armour along the bottom, but I'd like to know if it is possible to align these as individual elements next to their appropriate icons?

Regards,
Nathan
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 25th Feb 2016 13:26
There's only a few dozen posts with this info on, so yeah it's quite easy to miss :p


The following will print Hello World with the H in Hello in the centre of the screen:
Text(50,50,1,"Hello World")
The first number is the horizontal position (percentage from left to right), the second number is the vertical position (percentage from top to bottom), the third number is the size of the font.

The following will print Hello World centred in the middle of the screen:
TextCenterOnX(50,90,4,"Hello World")
The first number is the horizontal position (percentage from left to right), the second number is the vertical position (percentage from top to bottom), the third number is the size of the font.

The following will create a bordered box similar to the health box on the screen at the locations specified:
Panel(10,10,20,20)
The first two numbers are the horizontal and vertical percentage coordinates for the top left corner of the box, the second two numbers are the horizontal and vertical percentage coordinates for the bottom right corner of the box.


i7, NV960 4GB, 16GB memory, 2x 4TB Hybrid, Win10.
i5 , AMD 6770 1GB, 8GB memory, 512GB Generic SATAIII + 2TB Seagate Baracuda SATAIII, Win7.
i3, Radeon integrated graphics, 4GB memory, 512gB Generic SATAII, Win8.1.
Q6600, Intel integrated graphics, 2GB memory, 180GB Generic SATAII, WinXP.
Nathan38
13
Years of Service
User Offline
Joined: 13th Feb 2011
Location:
Posted: 25th Feb 2016 14:24 Edited at: 25th Feb 2016 14:32
Belidos, you hero! Here's what happened: http://imgur.com/unZsPY5 Thank you so much friend!

EDIT: I went one further and included @smallg's sprint limit script: http://imgur.com/Q1Xt4T2
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 25th Feb 2016 18:14
very nice, to remove the text in the center just delete or comment ( -- ) the Prompt call (it'll be near the bottom of the sprint script)
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11
Nathan38
13
Years of Service
User Offline
Joined: 13th Feb 2011
Location:
Posted: 26th Feb 2016 08:46 Edited at: 26th Feb 2016 09:01
Hey smallg, thanks for the tip! Since you're here could I ask for some help? I was just wondering how to set up your script that detects if you're looking at an object and shows text. I've got an experiment I'd like to try. Thanks!

EDIT: The thing I wanted to try has actually already been done in GameGuru, theres a video on youtube, though I can't remember the name or the developer :/ Basically I was going to try to set up a system where when you mouse over an enemy, a box is drawn around them and their name is displayed, similar to Deus Ex (Possibly with a health bar as well)
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 26th Feb 2016 10:18 Edited at: 26th Feb 2016 10:19
detect if player is looking at an object
https://forum.game-guru.com/thread/207801?page=7#msg2515459
detect if an object is looking at an object
https://forum.game-guru.com/thread/207801?page=12#msg2538121
check if an object is looking at the player
https://forum.game-guru.com/thread/207801?page=12#msg2541409
i7, NV960 4GB, 16GB memory, 2x 4TB Hybrid, Win10.
i5 , AMD 6770 1GB, 8GB memory, 512GB Generic SATAIII + 2TB Seagate Baracuda SATAIII, Win7.
i3, Radeon integrated graphics, 4GB memory, 512gB Generic SATAII, Win8.1.
Q6600, Intel integrated graphics, 2GB memory, 180GB Generic SATAII, WinXP.
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 26th Feb 2016 11:42
as belidos already linked the example script can be found in the post, basically the function works in the same way as the normal functions from global.lua, you can copy the function into your global.lua file (note it will get removed each time the file is updated or verified) or you can simply paste it to the bottom of any script that needs it (only need to do it once per map)


now your request requires more than my basic function can give but if you added x and z angles it should work ok.
*note, this is without*

life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11
Nathan38
13
Years of Service
User Offline
Joined: 13th Feb 2011
Location:
Posted: 26th Feb 2016 13:20
So that second code snippet you posted just above the video can be put into global.lua or applied to always active object? Or did i misunderstand?

Login to post a reply

Server time is: 2024-05-03 12:20:41
Your offset time is: 2024-05-03 12:20:41