NPC Scripting Language

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

Moderator: Gamemasters

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

Post by Estralis Seborian »

Can you elaborate on the following commands: busy, idle, begin, end?

begin sets the "status" of the NPC to busy - forever? Or will the NPC turn idle by itself with time?

end sets the status to idle, right?

idle means the NPC walks around?

busy means the NPC stops? For how long?

So, when I script the following, what happens? Is the "busy" state bond to a character? Like, when char A talks to the NPC, does he get treated different as character B when A has said "hello" as the first one?

"hello",idle->"Hi there", begin
"hello",busy->"Get lost, I am busy"
"bye",busy->"Yeah, bye", end

*puzzled*
LifeWonder
Posts: 727
Joined: Wed Jun 18, 2008 2:43 am
Location: !! Don't send PMs/doves to this account. Send them to Karl !!

Post by LifeWonder »

As players, we are limited to a certain amount of characters we can submit when doing a #me or normal speech. Are NPCs limited to how much they can say in a single line too?
User avatar
Nitram
Developer
Posts: 7638
Joined: Fri Oct 31, 2003 9:51 am
Contact:

Post by Nitram »

They are limited as well. But for very long lines the NPC will split the text automatically and says it in 2 lines.

But you should know that this looks crappy for #me's

Nitram
LifeWonder
Posts: 727
Joined: Wed Jun 18, 2008 2:43 am
Location: !! Don't send PMs/doves to this account. Send them to Karl !!

Post by LifeWonder »

Thanks
User avatar
Tanistian_Kanea
Posts: 646
Joined: Mon Aug 14, 2006 2:22 am

Post by Tanistian_Kanea »

for finding location what i 1) you are not working on the script on a computer with internet. or 2) the server is down and you are unable to get the location or 3) the place you wish to put the npc is to dangerous for any inexperienced fighters to get to (like all of mine) but you wish to put this npc there to make a quest more difficult by using natural monsters.

also, is it possible to create npc's who defend themselves? but not start fights with others.

edit: also in martin's example the npc heals. how much health and food does a character actually have?

also, to think of creating guards what would happen if the command was just:
item(1, body)
"sword", item(1, body) <------ what it looked liked.
as the condition? i'm thinking like a guard to a sanctuary. no swords allowed type thing that would affect those that went bye.

edit2: another question, how is it scripted that npc merchants only have os much money or have only so many items to sell. or is this done automatically?

edit3: i can't figure out what is wrong with this. can someone help?
Parser Error
Message: Invalid Input
Line: 31
At: item(4,belt)
User avatar
Juniper Onyx
Master NPC Scripter
Posts: 1557
Joined: Mon May 22, 2006 12:13 am
Location: Columbia, MO USA

Post by Juniper Onyx »

Tanistian_Kanea wrote: item(4,belt)
I think you need a space after the comma.
User avatar
pharse
Posts: 1787
Joined: Wed Oct 04, 2006 9:33 pm

Post by pharse »

no, you need a compare value

Code: Select all

item(1,all)>0
User avatar
Juniper Onyx
Master NPC Scripter
Posts: 1557
Joined: Mon May 22, 2006 12:13 am
Location: Columbia, MO USA

Post by Juniper Onyx »

pharse wrote:no, you need a compare value

Code: Select all

item(1,all)>0
Yeah, that's what I meant. :lol:
User avatar
Tanistian_Kanea
Posts: 646
Joined: Mon Aug 14, 2006 2:22 am

Post by Tanistian_Kanea »

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

Post by Estralis Seborian »

Code: Select all

deleteitem(<ID>,<amount>)
    <amount> items with item-ID <ID> are deleted from the characters inventory.
Is it possible to delete ALL items of one kind from the inventory?
User avatar
Estralis Seborian
Posts: 12308
Joined: Wed Nov 10, 2004 9:14 pm
Location: Sir Postalot
Contact:

Post by Estralis Seborian »

Code: Select all

"deliver gold",item(234,all)>0->"At least some gold. Unless you deserve to be released - work!",deleteitem(234,expr(item(234,all))
Will this do the job to delete all gold nuggets?
User avatar
Nitram
Developer
Posts: 7638
Joined: Fri Oct 31, 2003 9:51 am
Contact:

Post by Nitram »

Code: Select all

"deliver gold",item(234,all)>0->"At least some gold. Unless you deserve to be released - work!",deleteitem(234,0)
Zananex Zane
Posts: 27
Joined: Thu Dec 11, 2008 8:34 am

Post by Zananex Zane »

i love how relatively simple this scripting language is! Very user-friendly. Needless to say, I'll probably run into some errors, but from the looks of it they will only be syntax errors most the time. Of course, debugging is a normal and probably the most common and lengthy part of scripting, more so than learning how to actually use it.



Cheers, I'll think of some useful NPCs, or rather some not-so-useful npcs that just brighten up the game with some helpful tips or funny comments and the like.
User avatar
Juniper Onyx
Master NPC Scripter
Posts: 1557
Joined: Mon May 22, 2006 12:13 am
Location: Columbia, MO USA

Post by Juniper Onyx »

Thought I'd bring this old topic back to the top for players with 'admonishments'.

Please read the first thread for a Manual from Martin and examples from Nitram.

Have fun scripting! :D
User avatar
Rincewind
Posts: 1960
Joined: Tue Mar 11, 2008 10:40 am
Location: schroedingersbox.org
Contact:

Post by Rincewind »

Uh, ich hab das schon öfters irgendwo gelesen kanns jetzt aber nicht mehr finden.

Wieviele zeichen kann ein NPC maximal auf einen Trigger ausgeben? (inclusive Leerzeichen)

danke für Eure hilfe
Rince
martin
Posts: 7382
Joined: Sun Feb 25, 2001 7:12 am
Location: vienna

Post by martin »

Das ist lediglich begrenzt durch die Sinnhaftigkeit, einen 20-Seiten-Text im Spiel zu lesen, den dir der NPC beantwortet.
Sprich: Technisch gibts keine Beschränkung, aber es gibt Grenzen dessen, was als sinnvoll zu bezeichnen ist.

Inklusive Leerzeichen.

Martin
User avatar
Rincewind
Posts: 1960
Joined: Tue Mar 11, 2008 10:40 am
Location: schroedingersbox.org
Contact:

Post by Rincewind »

An wen darf ich mich wenden um, ID's für verschiedene Items zu erhalten?

Beste Grüße
Rincewind
User avatar
Felidae
Posts: 29
Joined: Sun May 10, 2009 10:00 pm

Post by Felidae »

Item-IDs kann dir jeder GM nennen. Such dir einfach einen aus :wink:
User avatar
Rincewind
Posts: 1960
Joined: Tue Mar 11, 2008 10:40 am
Location: schroedingersbox.org
Contact:

Post by Rincewind »

Quasi könnt ich auch dich darum bitten, oder? :wink:

Außerdem wäre es toll jemanden vom Staff zu haben, der Qualität und Preis festlegt.
Wie gehe ich das am Besten an?

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

Post by Estralis Seborian »

Rincewind wrote:Außerdem wäre es toll jemanden vom Staff zu haben, der Qualität und Preis festlegt.
Wie gehe ich das am Besten an?
http://illarion.org/community/forums/pr ... ost&u=4132 :-P
User avatar
pharse
Posts: 1787
Joined: Wed Oct 04, 2006 9:33 pm

Post by pharse »

New Command

You know those blue informs e.g. during the crafting process? You can now use them with the simple NPC scripting language. The player will get the inform after the NPC said something.

Syntax:

Code: Select all

inform( <text> )
Example:

Code: Select all

"tell secret" -> "Secret? What ... what secret? I really don't know what you mean.", inform( Somehow you feel that he knows more. Perhaps you should ask again and either offer him some 'money' or threaten him with the 'guards'. )
If you add more than one inform to a trigger then one of them is randomly chosen.
User avatar
Rincewind
Posts: 1960
Joined: Tue Mar 11, 2008 10:40 am
Location: schroedingersbox.org
Contact:

Post by Rincewind »

pharse wrote:New Command

You know those blue informs e.g. during the crafting process? You can now use them with the simple NPC scripting language. The player will get the inform after the NPC said something.

Syntax:

Code: Select all

inform( <text> )
Example:

Code: Select all

"tell secret" -> "Secret? What ... what secret? I really don't know what you mean.", inform( Somehow you feel that he knows more. Perhaps you should ask again and either offer him some 'money' or threaten him with the 'guards'. )
If you add more than one inform to a trigger then one of them is randomly chosen.
Is it possible to use functions like:

Code: Select all

inform( %npcname smiles at you and handles expr(%NUMBER*10) coins. )
:?:
greetings
Rincewind
User avatar
Nitram
Developer
Posts: 7638
Joined: Fri Oct 31, 2003 9:51 am
Contact:

Post by Nitram »

the npc name stuff works. The expression does not work out.

Nitram
User avatar
Pellandria
Posts: 2604
Joined: Fri Oct 04, 2002 6:06 pm
Location: Running around
Contact:

Post by Pellandria »

Ist es möglich das ein Npc ein Gegenstand zufällige Attribute gibt?

Ich hätte eine Idee für einen "Bandit/Glücksspieler", dem man einen bestimmten Geldbetrag gibt und der mittels Skript "Itempools" durchläuft, sagen wir mal wir haben Itempool A, B und C.

Der Char gibt dem Händler 20 Münzen und will auf Itempool A setzen, dann gibt es in diesem Itempool weitere Unterteilungen.

Nehmen wir einfach mal an das Itempool A Werkzeuge sind, der Spieler will aus dne Werkzeugen einen Hammer haben, also gibt er dem Händler 20 Kupfer, daraufhin geht das Script de Chancen durch, 80% das er bei Itempool A landet, jeweils 10% das er woanderst landet.

Sollte der Spieler Glück haben und bei A landen gibt es ein weiteres Script, darin sind nun schlicht alle "Werkzeugid's" enthalten, wieder gibt es einen hohen Prozentsatz, dass er den Hammer bekommt, jedoch auch geringe Chancen das ein anderes Werkzeug ausgesucht wird.

Aber wieder haben wir Glück und landen auf dem Hammer, nun geht es um die Qualität und hier eigentlich meine Kernfrage, kann man dem Script sagen das es nun einen zufällig gewählten Wert von 0 bis 999 wählen kann und dann mal einen guten und mal einen schlechten Hammer erschafft, oder muss man dem Hammer vorgefertigte Items geben, die dann wieder über Chance verteilt werden, je höher der gegebene Geldbetrag, desto besser sollten natürlich diee Chancen sein.
User avatar
Pellandria
Posts: 2604
Joined: Fri Oct 04, 2002 6:06 pm
Location: Running around
Contact:

Post by Pellandria »

Gibt es einen einfacheren Weg folgendes zu schreiben?

"Kaufe Werkzeug", german, chance(20), queststatus=0-> queststatus=11
"Kaufe Werkzeug", german, chance(25), queststatus=0-> queststatus=10
"Kaufe Werkzeug", german, chance(30), queststatus=0 -> queststatus=9
"Kaufe Werkzeug", german, chance(35), queststatus=0 -> queststatus=8

Gibt es zudem die möglichkeit das der Npc von sich aus eine aktion durchläuft, wäre sozusagen ohne das der Spieler ihm nochmal Informationen gibt?

"Kaufe Werkzeug", german, chance(20), queststatus=12-> queststatus=11
"Kaufe Werkzeug", german, chance(25), queststatus=12-> queststatus=10
"Kaufe Werkzeug", german, chance(30), queststatus=12-> queststatus=9


questatus=11->"Ohh du hast Glück und bist auf xyz gelandet" questatus=13
questatus=10->"Ohh du hast Glück und bist auf abc gelandet" questatus=14
questatus=9->"Leider Pech, eine Niete" questatus=0

chance(20), queststatus=13->"Ohh du hast einen guten Hammer gewonnen!", item(23,1,999,0), questatus=0
chance(30), queststatus=13->"Ohh du hast einen Hammer gewonnen!", item(23,1,666,0), questatus=0
chance(40), queststatus=13->"Nimm dein Preis und verschwiden, du verschreckst meine Kunden", item(23,1,333,0), questatus=0

chance(20), queststatus=14->"Ohh du hast eine gute Schaufel gewonnen!", item(24,1,999,1), questatus=0
chance(30), queststatus=14->"Ohh du hast eine Schaufel gewonnen!", item(24,1,666,1), questatus=0
chance(40), queststatus=14->"Nimm dein Preis und verschwiden, du verschreckst meine Kunden", item(24,1,333,0), questatus=0
User avatar
Nitram
Developer
Posts: 7638
Joined: Fri Oct 31, 2003 9:51 am
Contact:

Post by Nitram »

Also zu deiner ersten Kernfrage: Ich könnte zwar einen einfachen Zufallsgenerator mit einbauen, aber den dann noch zu Skalieren über einen Betrag der Eingezahlt wird, das geht dann über die Fähigkeiten der einfachen NPC sprache hinaus.

Ich wüsste nicht mal wie ich das in der einfachen NPC Sprache formulieren sollte damit sie einigermaßen "einfach" bleibt. Also sowas geht dann nur noch mit Lua.

Zu deiner Zweiten Frage:

Nein es gibt keinen einfacheren Weg, aber ich glaube das diese Zeilen nicht das machen was du denkst. Mit chance muss man sehr aufpassen.
Die erste Zeile macht genau das was du willst. Mit einer Wahrscheinlichkeit von 20% funktioniert das und der Queststatus wird auf 11 gesetzt. Die zweite Zeile macht schon etwas anderes. ;-) Diese Zeile wird nur mit einer Wahrscheinlichkeit von 80% überhaupt erreicht und mit einer Wahrscheinlichkeit von 25% ausgeführt. Daher ist die "echte" Wahrscheinlichkeit mit der sie ausgeführt wird 80% * 25% = 20%. Die nächste Zeile wird also mit 60% Wahrscheinlichkeit erreicht und mit 30% Wahrscheinlichkeit ausgeführt. Das führt zu 60% * 30% = 18%. Also wird die letzte Zeile noch mit 42% Wahrscheinlichkeit erreicht und mit 35% Wahrscheinlichkeit ausgeführt. Da haben wir noch 42% * 35% = 14,7%. Daher wird mit einer Wahrscheinlichkeit von 27,8% keine der vier Zeilen ausgeführt.

Weitere aktionen ausführen kann der NPC nicht. Weil ohne eine Referenz auf den Spieler weis er ja nicht mit welchem Spieler er gerade interagiert.

Nitram
User avatar
Pellandria
Posts: 2604
Joined: Fri Oct 04, 2002 6:06 pm
Location: Running around
Contact:

Post by Pellandria »

Also währe bei der Berechnung
Chance(50)->x
Chance(50)->y
Chance(100)->z

Die Wahrscheinlichkeit 50%, 25% und 25%, wobei Chance jedoch wieder auf hundert springt, sobald neue Befehle ausgegeben werden, oder?

Würde man jetz z.B.
qs=10, status=1, Chance(50)->x
qs=10, status=1, Chance(40)->y
qs=10, status=2, Chance(50)->z
qs=10, status=1, Chance(50)->t

haben, würde bei T wieder die hundert Prozent benutzt werden um die Chance zu errechnen, oder nimmt das Script die Rechstwahrscheinlichkeit?
User avatar
Nitram
Developer
Posts: 7638
Joined: Fri Oct 31, 2003 9:51 am
Contact:

Post by Nitram »

Das Script arbeitet viel primitiver als du denkst ;)

Es Arbeitet die Befehle von oben nach unten ab. Wenn da eine Chance von 50% steht wird diese Zeile mit einer Wahrscheinlichkeit von 50% ausgeführt. Wenn nicht vergisst das Script alles wieder und arbeitet einfach die nächste Zeile ab. Wo die Wahrscheinlichkeit das er überhaupt zur nächsten Zeile gekommen ist ja aber nur noch bei 50% liegt.

Nitram
User avatar
HeXiS
Posts: 230
Joined: Tue Apr 01, 2008 4:23 am
Location: if you know. you know.
Contact:

Post by HeXiS »

since i'm trying to make a wandering merchant.. she only sells and does not buy but. what i want to know is if there is a list of item numbers so i can fill those in where i need to? and will the images of the items she sells pop up on it's own or do i need to add that in too .. if so how? mainly i just want to know if there is a list of items with numbers.
User avatar
Blay
Posts: 504
Joined: Tue Apr 08, 2008 8:32 pm
Location: The cake is a li(n)e!
Contact:

Post by Blay »

There is a list, but it's not public. The best way is to write the item's names he sells/buys as a comment into the script, so a dev can "convert" it to the trading system - since there will be changes with the VBU.
Post Reply