Test your NPCs/Testet eure eigenen NPCs!

Everything about Illarion that fits nowhere else. / Alles über Illarion was inhaltlich in kein anderes Board passt.

Moderator: Gamemasters

martin
Posts: 7382
Joined: Sun Feb 25, 2001 7:12 am
Location: vienna

Test your NPCs/Testet eure eigenen NPCs!

Post by martin »

There are two news concerning development:
First of all, we have compiled a central list where you can see what fields of development there are, what is roughly done there and who the contact persons are. You can find this list as sticky posting on all of our forums.
Secondly, there is an additional feature which really helps you to develop NPCs using the easyNPC language: We enabled a public testserver-account for everyone to be able to easily and immediately test your NPC scripts on the real, actual VBU testserver using the real, actual VBU testclient! This can be done by everyone. For more information, have a look at this site: http://illarion.org/development/us_npcs.php


Es gibt zwei Neuigkeiten, die sich auf die Entwicklung beziehen:
Zuerst gibt es eine zentrale Anlaufstelle, wo man sehen kann, wo man in der Entwicklung mithelfen kann, worum es jeweils grob geht und wer die jeweiligen Ansprechpartner sind. Ihr findet diese Liste als sticky Posting auf all unseren Foren.
Außerdem gibt es ein neues Feature, das die Entwicklung von NPCs mit der easyNPC-Sprache erleichtern soll, indem man sie sofort und jederzeit selbst testen kann. Dazu stellen wir euch einen öffentlichen Testserverzugang und den aktuellen VBU-Testclient zur Verfügung, womit ihr jederzeit auf den aktuellen VBU-Testserver einloggen und dort euren NPC testen könnt. Näheres dazu findet ihr hier: http://illarion.org/development/de_npcs.php
User avatar
Po Will
Posts: 885
Joined: Sun Nov 14, 2010 3:27 pm

Re: Test your NPCs/Testet eure eigenen NPCs!

Post by Po Will »

Just checking, but in the NPC example thingy, do we have to put in the German text as well? Gods know I have enough trouble with english :lol:
User avatar
Llama
Posts: 7685
Joined: Sun May 29, 2005 7:02 pm
Location: The VBU is awesome
Contact:

Re: Test your NPCs/Testet eure eigenen NPCs!

Post by Llama »

Po Will wrote:Just checking, but in the NPC example thingy, do we have to put in the German text as well? Gods know I have enough trouble with english :lol:
Find some nice German person to translate it for you. Generally you can/should trade with them. You correct the english on their NPCs, and they translate yours to German. Everyone wins.
User avatar
Nitram
Developer
Posts: 7638
Joined: Fri Oct 31, 2003 9:51 am
Contact:

Re: Test your NPCs/Testet eure eigenen NPCs!

Post by Nitram »

For the first tests the german texts are not needed. You can write a NPC that speaks only english. How ever for the final version both languages are needed.
User avatar
Po Will
Posts: 885
Joined: Sun Nov 14, 2010 3:27 pm

Re: Test your NPCs/Testet eure eigenen NPCs!

Post by Po Will »

Righty ho :)
martin
Posts: 7382
Joined: Sun Feb 25, 2001 7:12 am
Location: vienna

Re: Test your NPCs/Testet eure eigenen NPCs!

Post by martin »

It would be nice if people who use(d) this drop a line here and give us some feedback, like what to improve or if they like the possibility etc.

Martin
martin
Posts: 7382
Joined: Sun Feb 25, 2001 7:12 am
Location: vienna

Re: Test your NPCs/Testet eure eigenen NPCs!

Post by martin »

If you need help, on the top right there is an icon looking like a life belt where you can find information and examples for all commands.
You might want to create NPCs that are more complex than just question-answer-NPCs, try to use items, status etc. (see the built in help!)

More information to come, feedback wanted!

Martin
User avatar
Estralis Seborian
Posts: 12308
Joined: Wed Nov 10, 2004 9:14 pm
Location: Sir Postalot
Contact:

Re: Test your NPCs/Testet eure eigenen NPCs!

Post by Estralis Seborian »

Please find a very simple quest below. You can implement many very simple quests like this.

Code: Select all

-- 1st quest: Gather 10 apples
"quest", "mission", queststatus(118) = 0, english -> inform("[New quest] Lonely Gardens I"), "Ah, you want to help me? Look, I'd like to plant some apple trees in my garden. But for that, I need apple seeds. So, please, bring me ten apples!", queststatus(118) = 1
"quest", "mission", queststatus(118) = 0 -> inform("[Neues Quest] Die Gärten der Einsamkeit I"), "Ah, ihr wollt mir also helfen? Ich würde gerne einige Apfelbäume in meinem Garten pflanzen. Aber dafür brauche ich Apfelsamen. Also bringt mir doch bitte zehn Äpfel!", queststatus(118) = 1
"task", "adventure", "order", queststatus(118) = 0 -> inform("[New quest] Lonely Gardens I"), "Ah, you want to help me? Look, I'd like to plant some apple trees in my garden. But for that, I need apple seeds. So, please, bring me ten apples!", queststatus(118) = 1
"Auftrag", "Aufgabe", "Abenteuer", "Befehl", queststatus(118) = 0 -> inform("[Neues Quest] Die Gärten der Einsamkeit I"), "Ah, ihr wollt mir also helfen? Ich würde gerne einige Apfelbäume in meinem Garten pflanzen. Aber dafür brauche ich Apfelsamen. Also bringt mir doch bitte zehn Äpfel!", queststatus(118) = 1

-- 1st quest solved, reward: goblet with cider (1844)
".+", queststatus(118) = 1, item(15, all) > 9, english -> inform("[Quest solved] You are awarded a goblet with cider."), "How marvellous! Now I can plant new friends for me. You know, I love cider, it makes me forget... Have one goblet with me!", deleteItem(15, 10), item(1844, 1, 699, 0), queststatus(118) = 2
".+", queststatus(118) = 1, item(15, all) > 9 -> inform("[Quest gelößt] Du erhältst einen Krug Cidre."), "Wie wunderbar! Jetzt kann ich mir neue Freunde pflanzen. Wisst ihr, ich liebe Cidre, er hilft mir zu vergessen... Hebt einen Krug mit mir!", deleteItem(15, 10), item(1844, 1, 699, 0), queststatus(118) = 2

-- 1st quest not solved, repeat the instructions
"quest", "mission", queststatus(118) = 1, english -> "Some new trees would be so fine, please, get me ten apples so I can plant new friends for me."
"quest", "mission", queststatus(118) = 1 -> "Ein paar neue Bäume wären so fein, bitte, holt mir zehn Äpfel, damit ich mir neue Freund pflanzen kann."
"task", "adventure", "order", queststatus(118) = 1 -> "Some new trees would be so fine, please, get me ten apples so I can plant new friends for me."
"Auftrag", "Aufgabe", "Abenteuer", "Befehl", queststatus(118) = 1 -> "Ein paar neue Bäume wären so fein, bitte, holt mir zehn Äpfel, damit ich mir neue Freund pflanzen kann."

-- 2nd quest: Gather 10 grapes
"quest", "mission", queststatus(118) = 2, english -> inform("[New quest] Lonely Gardens II"), "I am honest: I enjoy sweet fruits once in a whiles. Makes me feel... alive. Could you bring me ten grapes? That'd be so nice!", queststatus(118) = 3
"quest", "mission", queststatus(118) = 2 -> inform("[Neues Quest] Die Gärten der Einsamkeit II"), "Ich bin ganz offen: Ich nasche gerne süße Früchte. Dann fühl ich mich irgendwie lebendig. Könntet ihr mir zehn Trauben bringen? Das wäre so nett!", queststatus(118) = 3
"task", "adventure", "order", queststatus(118) = 2 -> inform("[New quest] Lonely Gardens II"), "I am honest: I enjoy sweet fruits once in a whiles. Makes me feel... alive. Could you bring me ten grapes? That'd be so nice!", queststatus(118) = 3
"Auftrag", "Aufgabe", "Abenteuer", "Befehl", queststatus(118) = 2 -> inform("[Neues Quest] Die Gärten der Einsamkeit II"), "Ich bin ganz offen: Ich nasche gerne süße Früchte. Dann fühl ich mich irgendwie lebendig. Könntet ihr mir zehn Trauben bringen? Das wäre so nett!", queststatus(118) = 3

-- 2nd quest solved, reward: +1 peasantry, 20cp
".+", queststatus(118) = 3, item(388, all) > 9, english -> inform("[Quest solved] You are awarded twenty coppercoins and your peasantry skill increases."), "Tasty, tasty, tasty! You make me smile, really! I haven't felt like this for quite a while. And this time, I can share my joy!", skill(peasantry) + 1, money + 20, deleteItem(388, 10), queststatus(118) = 4
".+", queststatus(118) = 3, item(388, all) > 9 -> inform("[Quest gelöst] Du erhältst zwanzig Kupferstücke und deine Ackerbaufähigkeit steigt."), "Lecker, lecker, lecker! Ihr macht mich froh, wirklich! So hab ich mich schon lange nicht mehr gefühlt und diesmal ist sogar jemand da, mit dem ich meine Freude teilen kann!", skill(peasantry) + 1, money + 20, deleteItem(388, 10), queststatus(118) = 4

-- 2nd quest not solved, repeat the instructions
"quest", "mission", queststatus(118) = 3, english -> "Please, I do not enjoy many things in life anymore, but some grapes could really relieve my heart."
"quest", "mission", queststatus(118) = 3 -> "Bitte, es gibt nicht mehr viele Dinge im Leben, die mich erfreuen. Einige Trauben könnten mich jetzt echt erheitern."
"task", "adventure", "order", queststatus(118) = 3 -> "Please, I do not enjoy many things in life anymore, but some grapes could really relieve my heart."
"Auftrag", "Aufgabe", "Abenteuer", "Befehl", queststatus(118) = 3 -> "Bitte, es gibt nicht mehr viele Dinge im Leben, die mich erfreuen. Einige Trauben könnten mich jetzt echt erheitern."

-- Final dialogue: No more quests, just nice hints
"quest", "mission", queststatus(118) = 4, english -> "You can help me by... staying. Stay a little longer, that's all I ask for. Please!"
"quest", "mission", queststatus(118) = 4 -> "Ihr könntet mir helfen... indem ihr noch eine Weile bleibt. Leistet mir noch etwas Gesellschaft, das ist alles, worum ich bitte!"
"task", "adventure", "order", queststatus(118) = 4 -> "You can help me by... staying. Stay a little longer, that's all I ask for. Please!"
"Auftrag", "Aufgabe", "Abenteuer", "Befehl", queststatus(118) = 4 -> "Ihr könntet mir helfen... indem ihr noch eine Weile bleibt. Leistet mir noch etwas Gesellschaft, das ist alles, worum ich bitte!"
User avatar
Po Will
Posts: 885
Joined: Sun Nov 14, 2010 3:27 pm

Re: Test your NPCs/Testet eure eigenen NPCs!

Post by Po Will »

Been fiddling with the Scripteditor for a day now, it seems really easy to use.
Should have me first one up in a day or two if I stop procrastinating :lol:
User avatar
Rakshasas
Posts: 59
Joined: Mon Mar 07, 2011 2:38 am

Re: Test your NPCs/Testet eure eigenen NPCs!

Post by Rakshasas »

The test server doesn't seem to be working on my Mac. I loaded the lua script and can login, but my character never shows up on the screen.
martin
Posts: 7382
Joined: Sun Feb 25, 2001 7:12 am
Location: vienna

Re: Test your NPCs/Testet eure eigenen NPCs!

Post by martin »

Currently, Vilarion is working on the testserver, so there might be problems at this very moment.

Martin
User avatar
Dyluck
Posts: 2354
Joined: Wed Aug 08, 2001 9:32 am
Location: The Future
Contact:

Re: Test your NPCs/Testet eure eigenen NPCs!

Post by Dyluck »

Very nice tool, although the documentation for "trigger" -> "repsonse" examples part could be a little more clear for noobs.
Also, now I can't find the form where you actually sumbit the finished NPC to.

By the way, is there anytihng that will automatically cause the NPC state to revert to 0?

Also, funny story: I created a whole bunch of text with NPC state triggers using the documentation. Then I moved all the NPC state triggers to the left of the Text triggers cause I thought it would look cleaner. Then I click on build the script and it helps me shift everything back around. :x

Also, let's say during state = 5, I want any text (no specific) to trigger the NPC to respond with "blah blah", how can I do that?
Ex:
" ", state = 5 -> "blah blah"
But the above doesn't work.

Also my npc was responding to text with NPC state = 0 condition, but for some reason did not respond to text with state < 2 condition while state = 0. My text triggers were not the same for both conditions. Ex:

"Hello", "Greetings", "Hi", state = 0 -> "Why are you here? Do you know what this place is?"
"temple", "shrine", "ruins", "tower", "castle", "gods", state < 2 -> "This is the ruins of an ancient temple of one of the gods.
martin
Posts: 7382
Joined: Sun Feb 25, 2001 7:12 am
Location: vienna

Re: Test your NPCs/Testet eure eigenen NPCs!

Post by martin »

Dyluck wrote:Very nice tool, although the documentation for "trigger" -> "repsonse" examples part could be a little more clear for noobs.
We're currently working on that; however, if you have suggestions, please let us know!
Also, now I can't find the form where you actually sumbit the finished NPC to.
Fair point; the best idea is to send both, the .npc and the .lua file to me per mail ( martin@illarion.org ). We will eventually implement some automatism for that. You can also do that with a bunch of them, if that's easier.
By the way, is there anytihng that will automatically cause the NPC state to revert to 0?
Restarting or reloading the server. Also, the state is individual for each player, meaning that if you set state=1 when Player1 talks to him, it will not be 1 for Player2.
Also, funny story: I created a whole bunch of text with NPC state triggers using the documentation. Then I moved all the NPC state triggers to the left of the Text triggers cause I thought it would look cleaner. Then I click on build the script and it helps me shift everything back around. :x
Generally text-triggers should be on the left. That has technical reasons. The parser will always convert it into that shape.
Also, let's say during state = 5, I want any text (no specific) to trigger the NPC to respond with "blah blah", how can I do that?
Ex:
" ", state = 5 -> "blah blah"
But the above doesn't work.
That's a little advanced. For that, you need to use a concept called "regular expressions", which is some kind of "advanced" searching in texts.
For the lua-flavor of regular expressions, you can read this:
http://lua-users.org/wiki/PatternsTutorial

For your problem, the solution is easy:
".+", state = 5 -> "blah blah"
The dot (.) stands for any single character you can say, the + thereafter means "any repetition of that 'pattern'". Thus, .+ can stand for "AAaaaawekj" or "Hi" or "1", any string that is at least 1 character long.
Also my npc was responding to text with NPC state = 0 condition, but for some reason did not respond to text with state < 2 condition while state = 0. My text triggers were not the same for both conditions. Ex:

"Hello", "Greetings", "Hi", state = 0 -> "Why are you here? Do you know what this place is?"
"temple", "shrine", "ruins", "tower", "castle", "gods", state < 2 -> "This is the ruins of an ancient temple of one of the gods.
I'll have to have a deeper look at that, eventually you just discovered a bug. Did you try exchanging the lines?

Martin
User avatar
Dyluck
Posts: 2354
Joined: Wed Aug 08, 2001 9:32 am
Location: The Future
Contact:

Re: Test your NPCs/Testet eure eigenen NPCs!

Post by Dyluck »

The curent doc shows the same syntax for trigger and answer without showing where each goes in the example, or what the arrow means, so maybe this might be more clear for both:
Example:
"<player text>" -> "<npc text>"

Things on the left side of the arrow, such as "<player text>" is what the player needs to say to the NPC
Things on the right side of the arrow, such as "<npc text>" is what the npc will say in response

I tried a new npc with only 1 line of text, and it did not respond:
"hello", state < 2 -> "it does work"

It seems maybe the < operators are not supported by state?
User avatar
Quinasa
Posts: 2959
Joined: Thu Jan 29, 2004 12:34 am
Location: The land of cuteness and stuff!
Contact:

Re: Test your NPCs/Testet eure eigenen NPCs!

Post by Quinasa »

What purpose does the "2" have in the equation? I'm only a novice scripter so far, but the line looks wrong. What is state supposed to do? I think any number with a < or > in front of it should pertain to whether or not a function required by the NPC (having in your inventory the required item, i.e. 10 raw pork or 5 thread).

If all you want the NPC to do when you say hello to it, shouldn't the line look like:

Code: Select all

"Hello" -> "Hello traveler!"
User avatar
Dyluck
Posts: 2354
Joined: Wed Aug 08, 2001 9:32 am
Location: The Future
Contact:

Re: Test your NPCs/Testet eure eigenen NPCs!

Post by Dyluck »

State is a name of a variable that the NPC stores. The default value of state is 0

For example:

Code: Select all

"Hello" -> "Hello traveler!", state = 1
"How are you?", state = 1 -> "I'm fine."
So the above means if player first says "How are you?", NPC won't respond because the condition is state = 1, but state is still 0 by defeault.
But if player says "Hello", NPC will say "Hello Traveler" and changes the value of state to 1. If player says "How are you ?" now, NPC will respond "I'm fine."

So you can use the state variable to control the progress of conversations, so that certain responses are only availabe after some other responses or other conditions.
martin
Posts: 7382
Joined: Sun Feb 25, 2001 7:12 am
Location: vienna

Re: Test your NPCs/Testet eure eigenen NPCs!

Post by martin »

Thanks for pointing out that bug, I found and removed it now.
Everything should work as intended now.

The state is there to make the NPC "remember" something he spoke to a player. For example, state=0 could mean that you did not pick up a quest yet, state=1 means that you picked it up, but did not finish (=bring the apple to the NPC) and state=2 could mean that you brought the apple and thereby finished the quest.

Martin
User avatar
Estralis Seborian
Posts: 12308
Joined: Wed Nov 10, 2004 9:14 pm
Location: Sir Postalot
Contact:

Re: Test your NPCs/Testet eure eigenen NPCs!

Post by Estralis Seborian »

I'd like to comment on that; if you plot quests, the use of queststatus is recommended instead of state. State is "forgotten" with each reload of the server while queststatus is saved in the database. This means that queststatus is the more permanent version of state. Or in other words, the use of state might result in quests getting reset all the time.

Also, state is saved with the NPC while queststatus is saved with the player. This means that you can access queststatus from any other script (e.g. another NPC!) easily. A quest could involve more than one NPC, e.g. delivering a message from NPC A to NPC B. Such things won't work with state.

State is used best for conversations, however, I, personally, never used state for anything else but small talk. For quests, you should always use queststatus.
User avatar
Dyluck
Posts: 2354
Joined: Wed Aug 08, 2001 9:32 am
Location: The Future
Contact:

Re: Test your NPCs/Testet eure eigenen NPCs!

Post by Dyluck »

Btw, when you say restarting/reloading the server, does that mean a periodic thing like daily, weekly, or etc? Or a rare thing like only for updates/crashes?

Let's say I want the conversation progress with an NPC to be saved as part of a longer term quest.
Since NPC state will get reset sometimes, then is the queststatus() value a more permanent thing instead and therefore a better way to store long term information? (for example so that the quest can only be completed once)

In the following code with queststatus, I say Hello and get response, but when I say Skills afterwards, NPC does not respond.

Code: Select all

"Hello" -> "Change quest status", queststatus(1) = 2
"Skills", queststatus(1) = 2 -> "Impressed with my skills? Heh."
Thanks.
User avatar
Dyluck
Posts: 2354
Joined: Wed Aug 08, 2001 9:32 am
Location: The Future
Contact:

Re: Test your NPCs/Testet eure eigenen NPCs!

Post by Dyluck »

LOL Estralis you read my mind and posted the at the exact same minute as me, but your GM status must give your post superpower priority over mine :wink:

Then my problem now is just why the code doesn't work.
Perhaps queststatus only takes + and - but not = operator when setting the value?
User avatar
Vilarion
Developer
Posts: 2008
Joined: Sun Aug 15, 2004 8:10 pm
Contact:

Re: Test your NPCs/Testet eure eigenen NPCs!

Post by Vilarion »

Dyluck wrote:Perhaps queststatus only takes + and - but not = operator when setting the value?
Exactly, to change queststatus you need to write an expression instead of an assignment. Since queststatus is zero per default queststatus(1) + 2 should work. :)
However, you should test for queststatus(1) = 0 before that, or queststatus will be increased any time when you say "Hello" (unless that is what you want).
User avatar
Nitram
Developer
Posts: 7638
Joined: Fri Oct 31, 2003 9:51 am
Contact:

Re: Test your NPCs/Testet eure eigenen NPCs!

Post by Nitram »

The quest status has and should work with the set operator ( = ). Not sure why this one is not working right now.

Me or someone else will look into this. But the queststatus has to support addition, subtraction and setting.
User avatar
Estralis Seborian
Posts: 12308
Joined: Wed Nov 10, 2004 9:14 pm
Location: Sir Postalot
Contact:

Re: Test your NPCs/Testet eure eigenen NPCs!

Post by Estralis Seborian »

Queststatus never caused any problems for me. One recommendation: queststatus(1) might be occupied by an actual quest. For testing purposes, you can use something like queststatus(1337) or queststatus(4711).

Recommendation: Try this code:

"Hello" -> "Change quest status", queststatus(1337) = 2
"Skills", queststatus(1337) = 2 -> "Impressed with my skills? Heh."
"skills"->"Check failed!"
martin
Posts: 7382
Joined: Sun Feb 25, 2001 7:12 am
Location: vienna

Re: Test your NPCs/Testet eure eigenen NPCs!

Post by martin »

This is a rather new bug which I tracked down and which will be removed within the next minutes probably.
It was caused by a recent change of servercode, namely there was some typo in the brand new DB interface of the server... therefore, this bug is just 2 or 3 days old.
Thanks for finding it!

Martin
User avatar
Dyluck
Posts: 2354
Joined: Wed Aug 08, 2001 9:32 am
Location: The Future
Contact:

Re: Test your NPCs/Testet eure eigenen NPCs!

Post by Dyluck »

Is there some maintenance on the testserver right now or something? It's really laggy and there was some buggy behavior where the NPC was speaking out loud his variables code, something like

Test NPC : COMP:questID:1111
Test NPC : COMP:value : 1
Test NPC : COMP:p:qID:1

and the trigger text wasn't even supposed to cause this variable change yet...
martin
Posts: 7382
Joined: Sun Feb 25, 2001 7:12 am
Location: vienna

Re: Test your NPCs/Testet eure eigenen NPCs!

Post by martin »

Yes, these were some debugging messages, please ignore them.
Also, the questID might be from somewhere else. I thought I had removed these messages, seems I forgot some.

As for the lags, I don't know. Vilarion should know the answer.

Martin
User avatar
Estralis Seborian
Posts: 12308
Joined: Wed Nov 10, 2004 9:14 pm
Location: Sir Postalot
Contact:

Re: Test your NPCs/Testet eure eigenen NPCs!

Post by Estralis Seborian »

For those who did not understand it or overread it:

You can test your own NPCs on the "pre release" version of the brand new client AND you can do this on the "pre release" version of the server! What you saw in the teaser video was shot exactly in this environment!

Check it out - even if you just write some quick lines to try how scripting a NPC could feel like. Maybe you like it...?
User avatar
Dyluck
Posts: 2354
Joined: Wed Aug 08, 2001 9:32 am
Location: The Future
Contact:

Re: Test your NPCs/Testet eure eigenen NPCs!

Post by Dyluck »

No, the questID is from my own code, but it kept getting increased on its own (as shown in the debug message) even when the specific trigger word wasn't used yet. But I will try again and see if it's back to normal now.
User avatar
Dyluck
Posts: 2354
Joined: Wed Aug 08, 2001 9:32 am
Location: The Future
Contact:

Re: Test your NPCs/Testet eure eigenen NPCs!

Post by Dyluck »

Actually everything seemed to work fine when I used a new questID 1234, but if I change the code back to questID 1111 it didn't work, and when I change it back to questID 1234 a second time, it doesn't work anymore. The debug message seems to tell me that questID 1234 is at value = 1 at the first thing I say, even though I did nothing to cause that, and NPC responds as if value = 1 too.

I think somehow, the value of questID is not being reset to 0 on logout/restart, which is why it works the first time, but not aftewards.
User avatar
Estralis Seborian
Posts: 12308
Joined: Wed Nov 10, 2004 9:14 pm
Location: Sir Postalot
Contact:

Re: Test your NPCs/Testet eure eigenen NPCs!

Post by Estralis Seborian »

Indeed, queststatus is not reset but a it is a persistent variable in the database, saved with the character. You can, of course, script something like this:

"set 0"->"Queststatus reset!",queststatus(1234)=0
Post Reply