Hello otlanders, as some of you know the brand new Enhanced NPC System is now part of the TFS project. Since we would like to make it more popular, I am creating this thread, where you can request me any kind of NPC you would like to see (for fun, academic or comparison porpouses), and I'll answer every request with one or two posible implementations.
Keep in mind that I'll use the latest (private) version of the system, so you might not be able to test the NPC with your Enhanced NPC System copy (temporary)!
Post your ideas or the code of a Jiddo's npc to be translated!
Examples so far:
Prison Guard Npc
The first one would be a prison guard npc. Normally he'd just talk to you about the prison, the people in the prison and just information about the town in general.
BUT! When a world event would be happening, say for example.. a prisoner escaped from his jail.. he would have a completely different set of responses, plus a quest line for finding the escaped prisoner.
AI.DeclarativeTalk (Conversation) implementation:
Keep in mind that I'll use the latest (private) version of the system, so you might not be able to test the NPC with your Enhanced NPC System copy (temporary)!
Post your ideas or the code of a Jiddo's npc to be translated!
Examples so far:
Prison Guard Npc
The first one would be a prison guard npc. Normally he'd just talk to you about the prison, the people in the prison and just information about the town in general.
BUT! When a world event would be happening, say for example.. a prisoner escaped from his jail.. he would have a completely different set of responses, plus a quest line for finding the escaped prisoner.
AI.DeclarativeTalk (Conversation) implementation:
Lua:
local Guard = AI.SocialNpc:New()
Guard.config = {
jailbreakStorage = 12345,
questStorage = 54321
}
Guard.GreetReply = function(talk)
if getGlobalStorageValue(Guard.config.jailbreakStorage) == -1 then
talk:Say("Hello |PLAYERNAME|, I don't have too much time to spent talking as I'm the only guard here")
else
talk:Say("What!? There has been a leak I can't speak for long..")
-- This is the switch for the normal/leaked speech
talk:SetVar('prisonBreak', true)
end
end
Guard.Conversation = {
-- This response is the same every time
{['job|occupation'] = "For years I have been the sole guard of this prison"},
-- We handle all quest 'paths' here
{['quest|mission|help'] = {
-- Quest in development/over
{[HasStorage(Guard.config.questStorage)] = {
-- Quest over, we don't care if theres a leak or not since the player already completed the quest
{[Equal(GetStorage(Guard.config.questStorage), 3)] = "I don't have more quests for you, thanks again!"},
-- Quest finished (by another script) but awaiting reward, we don't care if theres a leak or not since the player wants his reward
{[Equal(GetStorage(Guard.config.questStorage), 2)] = function(talk)
talk:End("You did it! Take this")
doPlayerAddMoney(talk.player, 10000)
-- State 3, "quest completed"
doPlayerSetStorageValue(talk.player, Guard.config.questStorage, 3)
end},
-- Quest state must be 1(just started not completed) then
{[Default] = {
-- Prisoner event still going, but player wants to cheat us!
{[HasVar('prisonBreak')] = "You haven't found Sirius! Come back when you have some clues"},
-- Prison event finished and this player didnt completed the quest, we 'reset' it, the next time the prisoner escape, the quest is available again
{[Default] =
"I'm sorry, everything has been a missunderstanding, Sirius never left the prison, thank you anyway",
RemoveStorage(Guard.config.questStorage)
}
}}
}},
-- No quest in development
{[Default] = {
-- Leak, offer quest
{[HasVar('prisonBreak')] = Ask("As you know Sirius has escaped, if you can find him the Minister will be grateful, Do you want to help us?",
-- Yes
{End("Thank you, if you got any news, don't hesitate to tell me!"),
SetStorage(Guard.config.questStorage, 1)},
-- No
End("Ok, then don't waste my time..")
)},
-- No leak, just be cocky
{[Default] = "Being a guard is a stressful job, even so, I do not need your help"}
}}
}},
-- Lines when someone escaped
{[HasVar('prisonBreak')] = {
{['prison'] = "Can't you see what happens? Sirius Black has escaped!"},
{['sirius'] = "We will need all the resources available to find him.."},
{['jason|statham'] = "All the prisoners are locked down, don't worry"}
}},
-- Normal lines
{['prison'] = "This prison was founded several centuries ago, but no prisoner has ever escaped it, all thanks to my excellent work as a guard"},
{['sirius'] = "A big mouth, he has never left this prison"},
{['jason|statham'] = "A tough guy, he was imprisoned for killing the king's son"},
}
Guard:Register()
Last edited: