-- deposit into npc entity local PlayerDist_near = 100 local talking = {} local pressed = 0 local choice_made = false function talking_npc_init(e) Include("ai_cover.lua") talking[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() FreezeAI() for a = 1, 9999 do if g_Entity[a] ~= nil and a ~= e then StopAnimation(a) end end talking[e] = 1 else UnFreezePlayer() UnFreezeAI() for a = 1, 9999 do if g_Entity[a] ~= nil and a ~= e then PlayAnimation(a) end end talking[e] = 0 end end else pressed = 0 end else talking[e] = 0 end if talking[e] == 1 then Panel(30,70,70,100) -- npc's conversation panel Panel(70,70,100,100) -- player's response panel -- npc says TextColor(32,73,3,"Hi. I'm Tim. You survived, huh?",100,255,100) -- player response TextColor(72,73,3,"1) Yes, just barely.",100,100,255) TextColor(72,76,3,"2) Yes, but I need some information.",100,100,255) if g_InKey == "1" and not choice_made then talking[e] = 2 choice_made = true elseif g_InKey == "2" and not choice_made then talking[e] = 3 choice_made = true end end if talking[e] == 2 then Panel(30,70,70,100) -- npc's conversation panel Panel(70,70,100,100) -- player's response panel -- npc says TextColor(32,73,3,"Well done. Have you had a hard time of it?",100,255,100) -- player response TextColor(72,73,3,"1) Not too bad.",100,100,255) TextColor(72,76,3,"2) Yes, but I need some information.",100,100,255) if g_InKey == "1" and not choice_made then talking[e] = 4 choice_made = true elseif g_InKey == "2" and not choice_made then talking[e] = 3 choice_made = true end end if talking[e] == 3 then Panel(30,70,70,100) -- npc's conversation panel Panel(70,70,100,100) -- player's response panel -- npc says TextColor(32,73,3,"What do you want to know?",100,255,100) -- player response TextColor(72,73,3,"1) Why arent people fighting against",100,100,255) TextColor(72,76,3," the Militia?",100,100,255) TextColor(72,80,3,"2) What should I be aware of?",100,100,255) if g_InKey == "1" and not choice_made then talking[e] = 5 choice_made = true elseif g_InKey == "2" and not choice_made then talking[e] = 6 choice_made = true end end if talking[e] == 4 then Panel(30,70,70,100) -- npc's conversation panel Panel(70,70,100,100) -- player's response panel -- npc says TextColor(32,73,3,"Glad to hear it. Many people are counting on you.",100,255,100) TextColor(72,73,3,"Press 'E' to walk away",100,100,255) TextColor(72,76,3,"",100,100,255) end if talking[e] == 5 then Panel(30,70,70,100) -- npc's conversation panel Panel(70,70,100,100) -- player's response panel -- npc says TextColor(32,73,3,"I agreed to abide by their law so I could study the area.",100,255,100) TextColor(32,76,3,"I'm not proud of that.",100,255,100) -- player response TextColor(72,73,3,"Press 'E' to walk away",100,100,255) TextColor(72,76,3,"",100,100,255) end if talking[e] == 6 then Panel(30,70,70,100) -- npc's conversation panel Panel(70,70,100,100) -- player's response panel -- npc says TextColor(32,73,3,"Be prepared. Mutants in the next valley. The",100,255,100) TextColor(32,76,3,"radioactivity has... changed them.",100,255,100) -- player response TextColor(72,73,3,"Press 'E' to walk away",100,100,255) TextColor(72,76,3,"",100,100,255) end -- Reset choice_made when player releases the key if g_InKey == "" then choice_made = false end end