Scripts / Draw panel at same offset as 'PromptLocal'

Author
Message
benjiboy
7
Years of Service
User Offline
Joined: 24th Mar 2017
Location: In the depths of rural Norfolk
Posted: 29th Oct 2019 18:26
I've been watching Lee's broadcast #15 which is about simple questing.
I don't like just having bare text displayed - I'd much rather have a little speech box around it.
Adopting Lees trick with a light, I tried to achieve that with the following code:-

It doesn't work.
I don't get an error, but I don't get a panel either.
I presume my use of g_Entity[e]['x'] , (etc.) is at fault.
Can someone tell me what I'm doing wrong, please?
You can't teach an old dog.
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 29th Oct 2019 19:40
This may be of some use:

https://forum.game-guru.com/thread/207801?page=23#msg2600701

You can't use 3d world coordinates where screen coordinates are required!
Been there, done that, got all the T-Shirts!
PM
benjiboy
7
Years of Service
User Offline
Joined: 24th Mar 2017
Location: In the depths of rural Norfolk
Posted: 29th Oct 2019 19:52
Of course. Wasn't thinking. The screen position of the entity is going to be dependent upon the camera posn and rotation, isn't it? I shall read smallg's thread and hope for enlightenment . . .
You can't teach an old dog.
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 29th Oct 2019 21:49 Edited at: 29th Oct 2019 21:49
The panel is 2D and always placed in screen coordinates, the PromptLocal text is placed in the game world and is located relative to the origin of the model.

With the best will in the world you aren't going to get them lined up decently!

What you could do is use a 3d model for your 'panel' and place text on it using particles (assuming you only have a limited range of text to display, particles can now have up to 64x64 frames or 4096 iow).

This might give you some idea of what I mean:
https://forum.game-guru.com/thread/220804#msg2616252
Been there, done that, got all the T-Shirts!
PM
benjiboy
7
Years of Service
User Offline
Joined: 24th Mar 2017
Location: In the depths of rural Norfolk
Posted: 30th Oct 2019 07:00
Quote: "text is placed in the game world"

Really?
So, if I make a prompt which continually updates, a new object is created on the fly, the old one is deleted and the new one placed?

How very annoying.
You can't teach an old dog.
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 30th Oct 2019 20:34
That's what PromptLocal is for!

If you want text on the screen use the Text commands (like DisplayText for example).

The only other option I know of is to use the particles as I did in the link I posted, it's pretty easy to make sprite sheets with all your potential messages in and it has the added advantage that you are then unlimited by font or size constraints.

What would be cool would be a way to create a texture on the fly by redirecting the sprite commands or text commands to a texture file and then loading that as a decal or particle sheet (admittedly it would probably have to be a single image particle sheet though) for projection into the game world.
Been there, done that, got all the T-Shirts!
PM

Login to post a reply

Server time is: 2024-12-22 09:26:55
Your offset time is: 2024-12-22 09:26:55