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