• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

NPC Keywords, Flags, Fighting back NPC

RealRolePlayer

New Member
Joined
Oct 28, 2015
Messages
19
Reaction score
0
Hi, I have already posted here a few months ago (maybe years) and now I'm back to the development of a custom OT server following the medieval theme for start. I wanted people to roleplay and focus more on the lore than on the hunting itself.

1. The first problem is: I want to add voices (same as monsters) to the NPC's but it is not working at all

Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Henford" script="default.lua" walkinterval="1000" floorchange="1" speed="220">
    <health now="840" max="840" />
    <look type="151" head="38" body="3" legs="120" feet="114" addons="2" />
    <parameters>
        <parameter key="module_keywords" value="1" />
        <parameter key="keywords" value="|PLAYERNAME|;Big Mike;no;yes;crew;bye;" />
        <parameter key="message_greet" value="Do I know you???"/>
        <parameter key="keyword_reply1" value="Oh... Well... I am <BURP> Sorry about that... I am Henford. I used to work with Big Mike but I have no regrets on leaving the crew..." />
        <parameter key="keyword_reply2" value=" Do YOU know Big Mike?!" />
        <parameter key="keyword_reply3" value="Well, just don/'t. Just don't." />
        <parameter key="keyword_reply4" value="Well, so you get me, don't ya?" />
        <parameter key="keyword_reply5" value="Yeah, I used to sail with him around Daergel in this ship... What's the name again? Ah yes, Seahook, have you heard of it?" />
        <parameter key="keyword_reply6" value="Before you go... Do you have any spare coin for a friend? Alright, nevermind..." />
    </parameters>
    <flags>
        <flag summonable="0" />
        <flag attackable="1" />
        <flag hostile="0" />
        <flag illusionable="0" />
        <flag convinceable="0" />
        <flag pushable="0" />
        <flag canpushitems="1" />
        <flag canpushcreatures="0" />
        <flag targetdistance="1" />
        <flag staticattack="60" />
        <flag runonhealth="5" />
        <flag drunk="1" />
    </flags>
    <voices interval="30000" chance="90">
    <voice sentence="Lizzy, get me another dose of rum, will ya?" />
    <voice sentence="<BURP> Sorry  'bout that..." />
    </voices>
</npc>

2. The second problem can also be viewed in this script: I wanted to add keywords to make the interaction NPCxPlayer, but some keywords the NPC does not give the reply I want it to. So I want to know if I need to write a .lua script to each and every NPC I want to add keywords to, and if I have to wirte it, how do I do it? I have no knowledge to start a lua script on my own.

3. Also, as you can read, I have added a flag for the npc to behave as if he was drunk and it is not working also, could you guys help me out?

4. And one last thing (sorry for the long post) I wish the NPC's were neutral towards players but only if the player does not attack him. How can I do such things?
I know subjects are not that related with each other but I have been trying to look around for a solution and I haven't found it so far...

I am working on TFS 1.2 and client 10.98
 
Last edited:
Hi, I have already posted here a few months ago (maybe years) and now I'm back to the development of a custom OT server following the medieval theme for start. I wanted people to roleplay and focus more on the lore than on the hunting itself.

1. The first problem is: I want to add voices (same as monsters) to the NPC's but it is not working at all

Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Henford" script="default.lua" walkinterval="1000" floorchange="1" speed="220">
    <health now="840" max="840" />
    <look type="151" head="38" body="3" legs="120" feet="114" addons="2" />
    <parameters>
        <parameter key="module_keywords" value="1" />
        <parameter key="keywords" value="|PLAYERNAME|;Big Mike;no;yes;crew;bye;" />
        <parameter key="message_greet" value="Do I know you???"/>
        <parameter key="keyword_reply1" value="Oh... Well... I am <BURP> Sorry about that... I am Henford. I used to work with Big Mike but I have no regrets on leaving the crew..." />
        <parameter key="keyword_reply2" value=" Do YOU know Big Mike?!" />
        <parameter key="keyword_reply3" value="Well, just don/'t. Just don't." />
        <parameter key="keyword_reply4" value="Well, so you get me, don't ya?" />
        <parameter key="keyword_reply5" value="Yeah, I used to sail with him around Daergel in this ship... What's the name again? Ah yes, Seahook, have you heard of it?" />
        <parameter key="keyword_reply6" value="Before you go... Do you have any spare coin for a friend? Alright, nevermind..." />
    </parameters>
    <flags>
        <flag summonable="0" />
        <flag attackable="1" />
        <flag hostile="0" />
        <flag illusionable="0" />
        <flag convinceable="0" />
        <flag pushable="0" />
        <flag canpushitems="1" />
        <flag canpushcreatures="0" />
        <flag targetdistance="1" />
        <flag staticattack="60" />
        <flag runonhealth="5" />
        <flag drunk="1" />
    </flags>
    <voices interval="30000" chance="90">
    <voice sentence="Lizzy, get me another dose of rum, will ya?" />
    <voice sentence="<BURP> Sorry  'bout that..." />
    </voices>
</npc>

2. The second problem can also be viewed in this script: I wanted to add keywords to make the interaction NPCxPlayer, but some keywords the NPC does not give the reply I want it to. So I want to know if I need to write a .lua script to each and every NPC I want to add keywords to, and if I have to wirte it, how do I do it? I have no knowledge to start a lua script on my own.

3. Also, as you can read, I have added a flag for the npc to behave as if he was drunk and it is not working also, could you guys help me out?

4. And one last thing (sorry for the long post) I wish the NPC's were neutral towards players but only if the player does not attack him. How can I do such things?
I know subjects are not that related with each other but I have been trying to look around for a solution and I haven't found it so far...

I am working on TFS 1.2 and client 10.98
Maybe you can make the npc speak with lua code in his defailt.lua
Code:
function onPlayerSpeak(message)
    message = string.lower(message) -- Convert the message to lowercase for case-insensitive comparisons

    -- Check for specific keywords and respond accordingly
    if message == "hi" or message == "hello" then
        npcSpeak("NPC: Hello! How can I assist you?")
    elseif message == "how are you" then
        npcSpeak("NPC: I'm doing well, thank you!")
    elseif message == "i'm good" or message == "thank you" then
        npcSpeak("NPC: That's great to hear!")
    elseif message == "bye" then
        npcSpeak("NPC: Goodbye! Have a nice day!")
    else
        npcSpeak("NPC: I'm sorry, I didn't understand. Could you please repeat?")
    end
end

function npcSpeak(message)
    print(message) -- Replace with your desired NPC speech output implementation
end

[CODE]
Post automatically merged:

Also , you cant add flags to the xml without editting the sourcecode , im trying the same thing you are doing , the monsters when you set the hostile flag to 0 it still follows you because its coded in the source like that. The only way is to edit the source code. There is no way around this issue.
 
Last edited:
Maybe you can make the npc speak with lua code in his defailt.lua
Code:
function onPlayerSpeak(message)
    message = string.lower(message) -- Convert the message to lowercase for case-insensitive comparisons

    -- Check for specific keywords and respond accordingly
    if message == "hi" or message == "hello" then
        npcSpeak("NPC: Hello! How can I assist you?")
    elseif message == "how are you" then
        npcSpeak("NPC: I'm doing well, thank you!")
    elseif message == "i'm good" or message == "thank you" then
        npcSpeak("NPC: That's great to hear!")
    elseif message == "bye" then
        npcSpeak("NPC: Goodbye! Have a nice day!")
    else
        npcSpeak("NPC: I'm sorry, I didn't understand. Could you please repeat?")
    end
end

function npcSpeak(message)
    print(message) -- Replace with your desired NPC speech output implementation
end

[CODE]
Post automatically merged:

Also , you cant add flags to the xml without editting the sourcecode , im trying the same thing you are doing , the monsters when you set the hostile flag to 0 it still follows you because its coded in the source like that. The only way is to edit the source code. There is no way around this issue.
2017....
 
Back
Top