NPC Scripting Language

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

Moderator: Gamemasters

User avatar
Nitram
Developer
Posts: 7638
Joined: Fri Oct 31, 2003 9:51 am
Contact:

NPC Scripting Language

Post by Nitram »

During the last weeks, martin and I created a kind of new programming
language that can be used to develop NPCs for Illarion. This was done to
make it possible to develop NPCs much faster/easier and to support our GMs
to write the NPCs they need on their own. This language is really easy
and its possible to create nice small NPCs and Quests using this
language. For example the small quest with the NPC in Trollsbane who waits
for his hams was done completely using the possibilities of that language.

We decided that it would be good a good idea to present that language to
the players in order to give you the possibility to support us developing
Illarion and to implement your own ideas into the game.

What you really write at the end is not that important. Some quests that
come into your mind, or a NPC with a small quest to represent your guild.
Or just a drunken town guard that stands or runs around at the gate of Trollsbane
and does nothing but being drunk. What ever it is. At the end one of the
developers will check the script and put it into the server (in case its
not something like, giving one special character as many goldcoins as he
wants ;-) )

Martin wrote a small description of all basic possibilities of the language
>> Click me! <<

And I put some example scripts on the server
>> Click me! <<

The NPC scripts are those strange files with the ".npc" file extension.
But we just chose that file extension randomly, it's really not important.
The files are after all only simple plain text files.
You can open these files with a simple editor software like Notepad for
Windows or Vi for Linux.
The scripts look at the first gaze a little filled up and chaotic. But its
really easy to read those scripts, if you keep the description in mind.

So if you wrote a cool NPC script you can check of course if you wrote
anything correctly. On the Homepage in the Development section there is a
new link "Scripts". If you click it, a small editor will show up where you
can either upload your file or paste the content into. That editor
will check the script and try to transform it into a real LUA Script. In
case a mistake is found that editor will let you know ;-) for sure. It
shows the line and part of the line where the problem happend.

If the parser runs over the script and everything is fine, you can send the
NPC Script (not the Lua Script) to one of the script developers.
To name them: abcfantasy, Ardian, Cassandra Fjurin, Kadiya, martin,
Ogerawa, pharse, vilarion or Nitram.

Any questions, concerns, flames?
Last edited by Nitram on Sun Oct 21, 2007 4:00 pm, edited 1 time in total.
User avatar
Ilyamorion
Posts: 38
Joined: Thu Mar 22, 2007 4:41 am
Location: The shadows of the forrest

Post by Ilyamorion »

Wow I like this idea quite a lot. Also I cant think of anything that is really bad about this idea as long as the NPCs monitored well. (e.g. say a guild has an NPC guard, king, smith, dunker, etc/ if the guild becomes inactive over time the NPC should be discarded. Same thing for other created NPCs no point having them if they arent used, right?


Another question can merchant NPCs be submitted? Take for instance a Gladiator trainer at the arena that buy weapons and a few armors (e.g. morning stars, longswords, heraldic shield, nightplate, and/or blue plate?)

Lastly, Does this mean the mage teaching NPC will be here soon?
User avatar
Nitram
Developer
Posts: 7638
Joined: Fri Oct 31, 2003 9:51 am
Contact:

Post by Nitram »

1. The NPCs are monitored be sure.
2. In case its needed we can remove NPC as well ;-)
3. About a merchenant. If you read the description, can you think of a possibility to do this?
4. Its possible to write such teachers with that language.

Nitram
User avatar
Korm Kormsen
Posts: 2414
Joined: Tue Jun 27, 2006 5:46 pm
Location: Illarion nordpol, wenns den gibt...

Post by Korm Kormsen »

na, dann wollen wir gobaith mal bevoelkern!

dies sieht schon leichter aus, als lua.

fragen:
in the guild <frac> (albar, gynk, salkamar, thiefs, explorer)
was hat das mit diesen fractionen und gilden auf sich? ist das schon implementiert?

wenn ich recht geschaut hab, reagieren die NPC auf sprache.gibt es auch eine moeglichkeit, dass sie auf annaeherung reagieren?
(zb betreten bestimmter felder? - oder bestimmte entfernung vom NPC?)

woher bekommen wir bei bedarf die item IDs?

danke,korm
User avatar
Nitram
Developer
Posts: 7638
Joined: Fri Oct 31, 2003 9:51 am
Contact:

Post by Nitram »

das Fraktionssystem ist implementiert aber noch im Aufbau. Damit sollen sich Gruppen von NPCs zusammenschalten lassen und so eine größere Hintergrundgeschichte und praktisch auch Gilden formen.

NPCs die mit diesem System geschrieben werden reagieren nur auf Sprache. Felder zu überwachen müsste erst eingebaut werden, da weis ich aber noch nicht wie man das einfach machen könnte.

ItemIDs gibts auf Anfrage. Bzw. wenns uns zu viel wird geben wir an die sehr aktiven NPC Bastler auch die Itemliste raus.

Anzumerken ist noch das die NPCs in Deutsch und Englisch geschrieben werden müssen. Ergo wäre es gut wenn hier etwas Teamwork zwischen unseren Sprachgruppen entstehen würde um NPCs hinzubekommen die auf beide Sprachen reagieren. :D

-------------------------------------------------------------------

The fraction system is implemented but not fully in use. Its meant to create kind of big quests where many many npcs takes part in. So the NPCs become kinds of guilds with own stories where the characters can get involved. ( in far future ;-) )

NPCs written with that language react only on speech. To watch single tiles is rather difficult and i don't have a real idea how to put this in.

ItemIDs are handed out at request. Or the amount of requests for IDs gets to much then we hand out the Itemlist. We will see.

One addition. The NPCs written in that language need to be written in german and english. So it would be good if there would be some teamwork between our two language groups. To get NPCs who react on both languages. :D

Nitram
User avatar
Amras Telemnar
Posts: 472
Joined: Sat Nov 25, 2006 4:17 pm
Location: Tol Vanima

Post by Amras Telemnar »

mhhh, soweit wirklich gut erklärt und einleutend....., allerdings hätte ich da doch noch die ein oder andere frage....


wenn ich mir da nun mal http://illarion.org/~nitram/npc/npc_augham.npc angucke. wie müsste ich das nun schreiben das dies hier:

"helfen" -> "Ihr wolld mir helfennn? Gud, bringt miir eine Flascheee Wein! *hicks*"

eine mini quest startet mit der man dem wachmann eine flasche wein bringen muss?



und wie würde ich festlegen das er mir beim bringen von der flasche wein zB 5 Kupfermünzen gibt?

---------------------------------------------------------------

jut ich nehme mal an das die position durch einen developer bestimmt wird, sollte man also ein screen vom platz den man sich für den npc vorstellt mitschicken?

------------------------------------------------------------


gut falls ich es nicht überlesen habe hab ich gar keine möglichkeit gefunden dem npc nur auf die muttersprache reagieren zu lassen, wie zB der Elf in Tol Vanima.....


---------------------------------------------------------------

danke schonmal für die antworten.


lg
amras
User avatar
Korm Kormsen
Posts: 2414
Joined: Tue Jun 27, 2006 5:46 pm
Location: Illarion nordpol, wenns den gibt...

Post by Korm Kormsen »

"helfen" -> "Ihr wolld mir helfennn? Gud, bringt miir eine Flascheee Wein! *hicks*"
eine mini quest startet mit der man dem wachmann eine flasche wein bringen muss?
nimm dir die beispiele vor. z.b. den schinken quest.
da kannst du sehen, was du schreiben musst, damit es ein quest wird.


und wie würde ich festlegen das er mir beim bringen von der flasche wein zB 5 Kupfermünzen gibt?
genauso, wie in dem beispiel mit dem haendler. du ziehst ihm geld ab. bloss, dass du ihm keine ware kreierst.
oder eben geld kreiert und dier flasche loescht, je nachdem, was du hier meintest.
jut ich nehme mal an das die position durch einen developer bestimmt wird, sollte man also ein screen vom platz den man sich für den npc vorstellt mitschicken?
keine ahnung, aber ich werd zumindest den vorschlag, wo "meine" NPCs hin sollen, immer mitschicken.

gut falls ich es nicht überlesen habe hab ich gar keine möglichkeit gefunden dem npc nur auf die muttersprache reagieren zu lassen, wie zB der Elf in Tol Vanima.....
na, lass den doch einfach nur darauf reagieren, wenn eben ein elf den NPC anspricht.
User avatar
Nitram
Developer
Posts: 7638
Joined: Fri Oct 31, 2003 9:51 am
Contact:

Post by Nitram »

Es ist möglich als Spieler seine aktuelle position selbst zu bestimmen.

Dazu muss man einfach im Spiel "show position" sagen oder flüstern. Ein Script beginnt dann alle paar Sekunden die Position auszugeben. Solange bis man etwas anderes sagt.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Its possible for the players to find out the current position.

To do this you just have to say or whisper in the game "show position". Then a script will start to print out the current position every few seconds until you say something different.

Nitram
User avatar
pharse
Posts: 1787
Joined: Wed Oct 04, 2006 9:33 pm

Post by pharse »

Sprachen des NPCs:
Einfach dem Scripter mitteilen, dann macht der das.
User avatar
Korm Kormsen
Posts: 2414
Joined: Tue Jun 27, 2006 5:46 pm
Location: Illarion nordpol, wenns den gibt...

Post by Korm Kormsen »

pharse,

kann man nicht einfach als condition z.b. reinschreiben:
lang=dwarf ?
User avatar
pharse
Posts: 1787
Joined: Wed Oct 04, 2006 9:33 pm

Post by pharse »

Nein. Man kann nur eine Bedingung an die Rasse des Chars knüpfen. Welche Sprachen der NPC kann, können wir dann definieren.
User avatar
Korm Kormsen
Posts: 2414
Joined: Tue Jun 27, 2006 5:46 pm
Location: Illarion nordpol, wenns den gibt...

Post by Korm Kormsen »

danke
User avatar
maryday
Posts: 675
Joined: Sun Apr 30, 2006 3:33 pm
Location: Who the f**k is Wallace?

Post by maryday »

Auf die Gefahr hin, das Ich es irgendwo ueberlesen habe;

Ist es moeglich, das Vorhandensein des NPC bzgl. Tages-/Jahreszeit einzuschraenken?

((EDIT:Idee in Umsatz.. :wink: Thu Oct 25, 2007 1:51 am;))

---

Is it possible to set borders to the NPC`s day-/yeartime of occurance?
((EDIT_II; :twisted:))
Last edited by maryday on Thu Oct 25, 2007 3:37 am, edited 2 times in total.
User avatar
Estralis Seborian
Posts: 12308
Joined: Wed Nov 10, 2004 9:14 pm
Location: Sir Postalot
Contact:

Post by Estralis Seborian »

Mit der vorgestellten Sprache: Nein.

Ansonsten: Keine Ahnung, früher nein. Aber früher waren Kühe auch nicht möglich ;-)

Lass dich davon aber nicht abhalten, mit den vorhandenen Befehlen kann man eine Unzahl von neuen NPCs schreiben. Mach deine Idee nicht von einer Kleinigkeit abhängig.
User avatar
maryday
Posts: 675
Joined: Sun Apr 30, 2006 3:33 pm
Location: Who the f**k is Wallace?

Post by maryday »

function useNPC(user,counter,param)
thisNPC:increaseSkill(1,"common language",100);
thisNPC:talkLanguage(CCharacter.say, CPlayer.german, "Finger weg!");
thisNPC:talkLanguage(CCharacter.say, CPlayer.english, "Dont you touch me!");
end
Ist es moeglich den entsprechend konvertierten LUA-Text (geringfügig) zu verändern (vor Übermittlung an entsprechenden Admin)?

Oder ist es sicherheitstechnisch abzulehnen, und solche Änderungen dem Admin zu überlassen?
((Ich frage lieber Mal, bevor Ich einen bereits konvertierten, und modifizierten Text in eine erneute Prüfung schicke :? ))

BspI;
...say, CPlayer.german, "Pfoten weg!");
thisNPC:talkLanguage(CCharacter.say, CPlayer.english, "Paws off!");
BspII;
..say, CPlayer.german, "#me brummt unfreundlich.");
thisNPC:talkLanguage(CCharacter.say, CPlayer.english, "#me grumbles unkind.");
--
If it would be possible to edit the LUA content by oneself, without causing too severe security risk.
User avatar
Nitram
Developer
Posts: 7638
Joined: Fri Oct 31, 2003 9:51 am
Contact:

Post by Nitram »

Du kannst das natürlich editieren, ich bin sowieso am überlegen ob man die im Augenblick festen Texte im Script auch noch irgendwie modifizierbar macht.

Auf jedenfall wird das ungeparste Script auch benötigt, schreib also am besten dort als Kommentar rein das diese Texte geändert werden sollten.

Nitram
User avatar
Korm Kormsen
Posts: 2414
Joined: Tue Jun 27, 2006 5:46 pm
Location: Illarion nordpol, wenns den gibt...

Post by Korm Kormsen »

wie schaut es bei NPC haendlern mit der belastung fuer den server aus?
genauer:

einem haendler, der acht artikel verkauft, sagen wir mal, vier haendler gegenueber gestellt, die je zwei artikel verkaufen.

(die idee waere, eine reihe von marktstaenden zu machen, die alle auf gewisse waren spezialisiert sind)
User avatar
Nitram
Developer
Posts: 7638
Joined: Fri Oct 31, 2003 9:51 am
Contact:

Post by Nitram »

NPC Händler sind nicht Grundlegend anders als normale Händler. Die Serverlast unterscheidet sich kaum
User avatar
Korm Kormsen
Posts: 2414
Joined: Tue Jun 27, 2006 5:46 pm
Location: Illarion nordpol, wenns den gibt...

Post by Korm Kormsen »

darum gehts mir weniger.

meine frage ist, wollt ihr lieber wenige haendler mit viel waren ins spiel stellen, oder viele haendler mit wenig waren jeder?
User avatar
Estralis Seborian
Posts: 12308
Joined: Wed Nov 10, 2004 9:14 pm
Location: Sir Postalot
Contact:

Post by Estralis Seborian »

Dies würde ich nicht unter Performance-Gesichtspunkten beurteilen, sondern was netter fürs Spiel ist. Und ein NPC, der zwei Items kauft und zwei verkauft dürfte dem Spiel nicht viel bringen.
User avatar
Jupiter
Developer
Posts: 3477
Joined: Sun May 28, 2006 11:23 am

Post by Jupiter »

Estralis Seborian wrote:Dies würde ich nicht unter Performance-Gesichtspunkten beurteilen, sondern was netter fürs Spiel ist. Und ein NPC, der zwei Items kauft und zwei verkauft dürfte dem Spiel nicht viel bringen.
Naja, wenn es halt ein armer Schlucker ist, der versucht ein paar Münzen zu machen, indem er versucht seinen alten Hut zu verkaufen? :wink:
User avatar
Miklorius
Posts: 963
Joined: Thu Feb 09, 2006 3:10 pm
Location: Germany

Post by Miklorius »

An jeder Ecke (unwichtige) NPCs fänd ich nun aber auch net so prall.
User avatar
Jupiter
Developer
Posts: 3477
Joined: Sun May 28, 2006 11:23 am

Post by Jupiter »

Miklorius wrote:An jeder Ecke (unwichtige) NPCs fänd ich nun aber auch net so prall.
Ich denke wenn, dann sollten die NPCs auch innerhalb von Sädten oder zumindest sehr nah an diesen beleiben. z.B. NPCs im Wald brauchen wir nicht unbedingt...es gibt einen NPCs im Nordwald und das sollte reichen^^
User avatar
maryday
Posts: 675
Joined: Sun Apr 30, 2006 3:33 pm
Location: Who the f**k is Wallace?

Post by maryday »

An jeder Ecke (unwichtige) NPCs fänd ich nun aber auch net so prall.
Eben das ist es, nehme ich an, was tiefschichtige lebendigkeit ausmacht.

Die alte Dame, welche zu schwach zum Holzschleppen ist, und nur trockene Zweige sammelt..

..und der Strassenkoeter, welcher selbst bei der wunderbarsten Wild und Sandbeeren Belohnung
nicht zu einem huebschen Prinz wird.
((Ach ja, hab`ich erwaehnt, das der Koeter Floehe hat?))

--
Miklorius wrote:At any corner (unimportant) NPCs wouldn`t be so nice.
Especially this, i suppose, would make a deeplayered aliveness.

The olde hag, to weak to carry firewood, who`s only collecting dry branches..

..and the dirty straying dog, which will never, despite of any game and sandberry rewardment turn to a beautiful prince.
((By the way, did i mention, the dog has fleas?))
User avatar
Nitram
Developer
Posts: 7638
Joined: Fri Oct 31, 2003 9:51 am
Contact:

Post by Nitram »

Uhm. Also. Ich denke... ja!

--

Duh. Well. I think... yes!
BadBoy
Posts: 27
Joined: Fri Oct 05, 2007 11:57 am

Post by BadBoy »

Hallo, ich bin gerade dabei, ein Zwergen-Quest-NPC zu schreiben und wollte fragen, ob mir jemand die ID für Spitzhacke, Bierkrug (mit Bier), und Hasenbraten nennen bzw. zuschicken könnte (per PN).
Danke schonmal im Vorraus.
User avatar
Estralis Seborian
Posts: 12308
Joined: Wed Nov 10, 2004 9:14 pm
Location: Sir Postalot
Contact:

Post by Estralis Seborian »

Stoopid question, me. Will this work (in principle)?

Code: Select all

"I bet %NUMBER",state=0,money>%NUMBER,queststatus<10->state=%NUMBER,"Yeah, right, you bet %NUMBER. Choose a nut!",queststatus+1
"I bet %NUMBER",state=0,queststatus>9->"I don't play with you anymore."
"right","left","middle",state<>0,chance(33)->"LOL, you win!",money+2*state,state=0
"right","left","middle",state<>0->"U LOST!",state=0
In special, I mean the "money+2*state"-part and the "state=%NUMBER"-part.
User avatar
pharse
Posts: 1787
Joined: Wed Oct 04, 2006 9:33 pm

Post by pharse »

use
expr( your calculation )
i.e.
money+expr(2*state)


Rest should work. But last time I tried the %NUMBER feature it was kind of broken....somehow only one digit was possible or something...
User avatar
Misjbar
Posts: 2641
Joined: Tue Dec 09, 2003 7:39 pm
Location: *rawrs at random people*
Contact:

Post by Misjbar »

I have one little nitpicking thingie about this, and that is the fraction part of it all. [nitpick mode on]It should be faction, not fraction, because a fraction of something is a part of something, and a faction is an actual group of people.[/nitpick mode off] Then again, I can understand that it takes a lot of work getting such a thing out of it and all, but still, it makes the NPC scripting language less intuitive.
User avatar
Nitram
Developer
Posts: 7638
Joined: Fri Oct 31, 2003 9:51 am
Contact:

Post by Nitram »

There will be sooner or later a major update of the whole language.

Mainly to include to possibility to write better traders with that language.

I will included that faction then.
Post Reply