-- deposit into npc entity local PlayerDist_near = 100; local PlayerDist_far = 100; local talking = {} --local convo = {} function talking_npc_init(e) Include("ai_cover.lua") talking[e] = 0 -- convo[e] = 0 end function talking_npc_main(e) PlayerDist = GetPlayerDistance(e) if PlayerDist <= PlayerDist_near then RotateToPlayer(e) Prompt ( "Press E to talk" ) if g_KeyPressE == 1 then if pressed == 0 then pressed = 1 if talking[e] == 0 then FreezePlayer() talking[e] = 1 else UnFreezePlayer() talking[e] = 0 end end else pressed = 0 end else talking[e] = 0 end if talking[e] == 1 then Panel(30,60,70,100) -- npc's conversation panel Panel(70,60,100,100) -- player's response panel -- npc says TextColor(32,62,3,"Hi. I'm Tim. You survived, huh?",100,255,100) -- player response TextColor(72,62,1,"1) Yes, just barely.",100,100,255) TextColor(72,65,1,"2) Yes, but I need some information.",100,100,255) if g_InKey == "1" then talking[e] = 2 elseif g_InKey == "2" then talking[e] = 3 end end if talking[e] == 2 then Panel(30,60,70,100) -- npc's conversation panel Panel(70,60,100,100) -- player's response panel -- npc says TextColor(32,62,3,"Well done. Have you had a hard time of it?",100,255,100) -- player response TextColor(72,62,1,"1) Not too bad.",100,100,255) TextColor(72,65,1,"2) Yes, but I need some information.",100,100,255) if g_InKey == "1" then talking[e] = 4 elseif g_InKey == "2" then talking[e] = 3 end end if talking[e] == 3 then Panel(30,60,70,100) -- npc's conversation panel Panel(70,60,100,100) -- player's response panel -- npc says TextColor(32,62,3,"What do you want to know?",100,255,100) -- player response TextColor(72,62,1,"1) Why arent people fighting against the Militia?",100,100,255) TextColor(72,65,1,"2) What should I be aware of?",100,100,255) if g_InKey == "1" then talking[e] = 5 elseif g_InKey == "2" then talking[e] = 6 end end if talking[e] == 4 then Panel(30,60,70,100) -- npc's conversation panel Panel(70,60,100,100) -- player's response panel -- npc says TextColor(32,62,3,"Glad to hear it. Many people are counting on you.",100,255,100) TextColor(72,62,1,"",100,100,255) TextColor(72,65,1,"",100,100,255) end end