Scripts / [SOLVED] Making a text appear when interacting with an object?

Author
Message
Mongo Knight
6
Years of Service
User Offline
Joined: 18th Dec 2018
Location:
Posted: 20th Dec 2018 20:40
Good Evening. (At least if you live anywhere near central europe)

I have another text-related scripting question. I want a text to appear when I interact with an object. Sort of an inspection/commentary of what the player sees. E.g. I walk up to a shelf with books, an eye icon appears when im really close and when i press e or some other key, a text appears, saying "a bookshelf. i wish my parents still loved me" or something. Should be fairly simple, but I haven't yet delved into scripting.
Also, it would be nice if it worked infinite times as opposed to once.

Thank you!

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

Go to answer
PM
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 20th Dec 2018 20:56 Edited at: 20th Dec 2018 20:56
There are a goldmine of scripts by SmallG and AmenMoses this can work for you https://forum.game-guru.com/thread/207801?page=7#msg2515459 with a bit of modification, checkout their threads
Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD
Laptop - Helios 300 Predator - i7 7700HQ - 32GB - Nvidia GTX1060 6GB - 525GB M2 - 500 SSD - 17.3" IPS LED Panel - Windows 10 Pro x64
Various Tutorials by me
Mongo Knight
6
Years of Service
User Offline
Joined: 18th Dec 2018
Location:
Posted: 20th Dec 2018 21:05
I swept this thread already, but havent really found anything that fits what im looking for. and me trying to modify an existing script is a lost cause. at least anything that goes beyong changing parameters.
PM
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 20th Dec 2018 21:46
I would suggest you download that script and get that working first the instructions are pretty clear, if you get that working then we can look at the next step of modifying it for your needs, getting that script to work will give you the confidence to carry on, lua is only difficult if you do not try it, once you have your first script in and working you will find the rest pretty easy
Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD
Laptop - Helios 300 Predator - i7 7700HQ - 32GB - Nvidia GTX1060 6GB - 525GB M2 - 500 SSD - 17.3" IPS LED Panel - Windows 10 Pro x64
Various Tutorials by me
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 21st Dec 2018 08:49
Amen has a script like that in his pickupables or you could use the interactive pack from rolfy on the store.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 21st Dec 2018 09:50 Edited at: 21st Dec 2018 10:03
Really simple one this.

Put an eye image in scriptbank/images called eye1.png and add the attached script to all items you want to 'examine'.

I didn't add the 'press a key bit' but that's an easy change to make.




Edited to add: The text displayed is the name of the item which you can change in the entity parameters, a neater way of doing it would be to have a list of strings to display where the key is the item name then you can test to see if this particular item has an entry in the list and if so display that text instead or as well as the default.
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
Mongo Knight
6
Years of Service
User Offline
Joined: 18th Dec 2018
Location:
Posted: 21st Dec 2018 16:05
Alright, im gonna take a look at all of those suggestions. You'll hear from me if there's anything i can't get to work
PM
Mongo Knight
6
Years of Service
User Offline
Joined: 18th Dec 2018
Location:
Posted: 22nd Dec 2018 12:14
I tried your Script AmenMose, works very nice. I deleted the "You found a" part of the script, now i can just enter the text I want to display in the name parameter of the entity, so that solution is quick enough for me. A few issues I still have, maybe you can help me with those:

1. The script only seems to work on smaller objects, like non pickupable weapons and stuff. Bigger entitys like machinery, even though dynamic, dont react.

2. I got a nice pictogram png via google, its white. In the test level it gets depicted as black with a very thin white outline, looks weird. I had issues like that in other programs like photoshop, seems to be a png related problem. i know, this one is kind of off topic, but maybe someone has experience with this and knows a quick solution.

3. I didnt get the key command to work, so "eye icon appears; player presses e; text gets displayed" i tried messing around with key commands from other scripts, no success. (Which didnt really surprise me)

Maybe someone can help me out. Thank you
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 22nd Dec 2018 12:55 Edited at: 22nd Dec 2018 13:00
This post has been marked by the post author as the answer.
1) & 3) Two small tweaks to the script, this explains the changes:


2) Pop your image into gimp or paint.net and clean it up, the background of the image needs to be alpha.
Make sure the image is a RGB+Alpha image, you may need to convert it using whichever image editor you have.
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
Mongo Knight
6
Years of Service
User Offline
Joined: 18th Dec 2018
Location:
Posted: 22nd Dec 2018 13:12
That was really simple. I feel like a dumbass now haha. Thanks a lot, greatly appreciated
PM

Login to post a reply

Server time is: 2024-12-22 14:33:06
Your offset time is: 2024-12-22 14:33:06