Scripts / [SOLVED] Help with script

Author
Message
LGoat
5
Years of Service
User Offline
Joined: 16th Sep 2018
Location:
Posted: 9th Oct 2018 13:53
I want to a script to interact with an object. Exemple: i put an apple on the table and when you get close to it, Press E to investigate and then a dialog...Just an apple.Is it possible?

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

Go to answer
PM
LGoat
5
Years of Service
User Offline
Joined: 16th Sep 2018
Location:
Posted: 9th Oct 2018 15:35
Maybe something like this

local PlayerDist_near = 100;
local PlayerDist_far = 100;
local sat = {}
local talking = {}
function talking_npc_init(e)
talking[e] = 0
end

function talking_npc_main(e)
PlayerDist = GetPlayerDistance(e)
if PlayerDist <= PlayerDist_near then
Prompt ( "Press E to talk" )
if g_KeyPressE == 1 then
if pressed == 0 then
pressed = 1
if talking[e] == 0 then
talking[e] = 1
else
talking[e] = 0
end
end
else
pressed = 0
end
else
talking[e] = 0
end

if talking[e] == 1 then
Panel(25,40,75,60)
TextCenterOnXColor(50,45,1, "Hello" ,100,255,100)
PromptTextSize(4) --does this need to be here?
end

end

PM
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 10th Oct 2018 18:18 Edited at: 10th Oct 2018 18:24
This post has been marked by the post author as the answer.
I did a video on simple speech ages ago.
https://www.youtube.com/watch?v=z-twGF9UYvU&t=4s
That should give you some tips. No idea why I can't embed the vid but it refuses to work
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.

Login to post a reply

Server time is: 2024-04-25 15:21:41
Your offset time is: 2024-04-25 15:21:41