Scripts / Textbox help

Author
Message
Knicker Thief
10
Years of Service
User Offline
Joined: 12th Jun 2014
Location:
Posted: 2nd Jul 2015 03:33
Hey guys I was hoping somebody could help.
Im trying to make a script that when I talk to an NPC (press E) I get a pop up image (like final fantasy blue dialog box) with text. Then I have to press it again to remove the image and text.
Thanks in advance, I feel as if im drowning on scripts and modeling lol

!nullptr
Forum Support
9
Years of Service
User Offline
Joined: 27th Mar 2015
Location: Australia
Posted: 2nd Jul 2015 09:41 Edited at: 2nd Jul 2015 09:48
Try this. I prefer to keep the process of triggering an action separated from the action itself. Easier to debug and makes for more efficient code.

AKA SisterMatic (Steam)
Development/ Gaming Rigs
Sys 1: i7-4770 (3.5)/16Gb/128 SSD/3Tb/970gtx/2 x 23, 1 x 27 LCD - Sys 2: i7/8Gb/670gtx/1.5Tb/1 x 23 LCD - Sys 3: Amd Quad/8Gb/645gtx/1Tb/30" LCD
PM
Knicker Thief
10
Years of Service
User Offline
Joined: 12th Jun 2014
Location:
Posted: 2nd Jul 2015 14:16
Thanks !nullptr man!
It works a treat.
My only problem is if you are holding any direction button when you press E, the image pops up but the player only looks frozen but is in fact actually moving. Which means you become outta range I think, so pressing E again wont undo freeze and remove image. Its the same as the Camera movement, it looks frozen, when in fact when you press E again you are facing opposite direction.

Thanks for the help already and hopefully you can help alittle more

!nullptr
Forum Support
9
Years of Service
User Offline
Joined: 27th Mar 2015
Location: Australia
Posted: 2nd Jul 2015 22:34 Edited at: 2nd Jul 2015 22:38
I noticed that when testing. Seems key and mouse movements are polled when the player is frozen, it's nothing to do with the script.

I find it easier to simply not freeze player - players will find out by themselves. ie: walk away from someone speaking... he stops speaking

or
increase range from player to help with random movements. 250-300 would be ok.
AND hide image when player goes out of range.

eg:
if PlayerDist > 150 and box_showing == 1 then
hideimage etc....
AKA SisterMatic (Steam)
Development/ Gaming Rigs
Sys 1: i7-4770 (3.5)/16Gb/128 SSD/3Tb/970gtx/2 x 23, 1 x 27 LCD - Sys 2: i7/8Gb/670gtx/1.5Tb/1 x 23 LCD - Sys 3: Amd Quad/8Gb/645gtx/1Tb/30" LCD
PM
Knicker Thief
10
Years of Service
User Offline
Joined: 12th Jun 2014
Location:
Posted: 3rd Jul 2015 01:58
I really appreciate the time you have given in helping me.
I have gotten it working perfectly...
I have used this code


Now the problem is, getting the text to appear on top of the box and not behind it. I know there is the prompt command but I think thats only one line and i cant find any info on how to get that to appear and disappear on the press of the E button.
If I dont get this one sorted then the whole script would be pointless.lol

I appreciate the help and kind words I have been getting for my project. Thanks
!nullptr
Forum Support
9
Years of Service
User Offline
Joined: 27th Mar 2015
Location: Australia
Posted: 3rd Jul 2015 06:01
Can't put text over images last I checked sorry. Whether this is to be changed or optioned later I do not know.

You need to either put the text on the image or use Panel(x1,y1,x2,y2) to display text.
AKA SisterMatic (Steam)
Development/ Gaming Rigs
Sys 1: i7-4770 (3.5)/16Gb/128 SSD/3Tb/970gtx/2 x 23, 1 x 27 LCD - Sys 2: i7/8Gb/670gtx/1.5Tb/1 x 23 LCD - Sys 3: Amd Quad/8Gb/645gtx/1Tb/30" LCD
PM
Knicker Thief
10
Years of Service
User Offline
Joined: 12th Jun 2014
Location:
Posted: 3rd Jul 2015 07:17
Oh, that really sucks!
That would mean I would have to have an image for every piece of dialog that I want ingame that has a textbox.
That could run into hundreds, maybe close to a thousand depending how big the game is. Is that even possible? or recommended?

Thanks
!nullptr
Forum Support
9
Years of Service
User Offline
Joined: 27th Mar 2015
Location: Australia
Posted: 3rd Jul 2015 07:24 Edited at: 3rd Jul 2015 07:24
Then you'll need to use panels - which you can modify anyway - to some extent.

See hud folders in languagebank.
AKA SisterMatic (Steam)
Development/ Gaming Rigs
Sys 1: i7-4770 (3.5)/16Gb/128 SSD/3Tb/970gtx/2 x 23, 1 x 27 LCD - Sys 2: i7/8Gb/670gtx/1.5Tb/1 x 23 LCD - Sys 3: Amd Quad/8Gb/645gtx/1Tb/30" LCD
PM
Knicker Thief
10
Years of Service
User Offline
Joined: 12th Jun 2014
Location:
Posted: 3rd Jul 2015 09:48
Ok I see where your going with this.
I cant just have any image as a text background, but GameGuru has its own with the panels in language/gamecore folder. Which I can loosely edit to look how I want.

Please stick with me alittle longer mate, I have already learnt quite abit from you already.

So how would I incoperate that into my script? I have tried but it pops up real fast and quickly disappears and wont work a second time.
This is what I have



Im not just copying and pasting code, Im studying and trying to understand it. Im also trying it myself before I ask you guys for help aswell. So please dont think Im abusing your help

Thanks again
!nullptr
Forum Support
9
Years of Service
User Offline
Joined: 27th Mar 2015
Location: Australia
Posted: 3rd Jul 2015 11:41 Edited at: 3rd Jul 2015 11:42
Why didn't your script work?

- With an image you can make a single draw call and it will stay there until you turn it off.
- With "text", the call needs to be made repeatedly to keep the text on screen.

So we need to structure it differently. Again I've separated process (getting the E) and the talk itself. I also added a "bonus" prompt... )

Note, your panels are off and I did not correct them but now you'll be able to see them and make your own adjustments.

Incidentally - you want text in the middle?

Use

TextCenterOnX(50,50,1,"My text here")

If you want color center use

r= 255
g =255
b=255

TextCenterOnXColor(50,50,1,"My text here",r,g,b)

Enjoy...

AKA SisterMatic (Steam)
Development/ Gaming Rigs
Sys 1: i7-4770 (3.5)/16Gb/128 SSD/3Tb/970gtx/2 x 23, 1 x 27 LCD - Sys 2: i7/8Gb/670gtx/1.5Tb/1 x 23 LCD - Sys 3: Amd Quad/8Gb/645gtx/1Tb/30" LCD
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 3rd Jul 2015 18:48
you can use a somewhat transparent image and it will display text through it (not great but might be some use - they kinda end up looking like panels anyway in the end)
i use paint.net (free) and you can easily adjust the transparency under the layer settings.

life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11

Login to post a reply

Server time is: 2024-12-22 01:04:03
Your offset time is: 2024-12-22 01:04:03