Hello elitepvpers,
Today proudly present you my new Quest Writing tutorial.
In this tutorial I show you how you can write quests, but I show it to you in my way this means,
I show you how to write good quest code, and tell you what you can do and what you can’t.
To follow this tutorial you need no special knowledge, but some basics wouldn’t be bad.
Let me tell you a little story about what we will do in this tutorial.
We start at the total beginning. You will start with doing some simple stuff ending with writing real complex things. In this Lessons I will give you tasks, you don’t have to do them but it’s easier when you do them. At the end of the tutorial you will find the solutions to the tasks. Please don’t try to learn all of this at one single day take you time, this tutorial should not distract you from something like tasks for your server or other private matters. After you completed this tutorial you should be in the enviable position to write complex quests .
I think many of you will ask why I write this tutorial in English, it was my first decision because it’s really important that everyone can understand this tutorial.
The shiny beginning thingymabbabery
So you want to learn Quest writing this means also you want to learn something about LUA.
If you want to learn something about the big history of LUA read .
Afterwards come back to this tutorial!
If you don’t want to learn the big history of LUA here the shorter version:
Visit http://en.wikipedia.org/wiki/Lua_(programming_language), Wikipedia (for the win)
Now after you did or not you have some questions?
Why does Metin2 use LUA for Quests?
I don’t know exactly. But maybe because it’s easy to use, easy to learn and it has many possibilities.
So the .quest Language is LUA?
No, not exactly. It’s basically LUA but it has lot of modifications you will see later.
When it’s not exactly LUA why does anybody talk about LUA?
Because there is a program in the quest folder called ‘qc’, this program is a quest compiler (QC).
The quest compiler loads a quest file and compiles it into pure LUA the pure LUA code is in the object folder. When you look at the object folder you will see many other folders, each folder means one NPC, one timer or some other things I explain later in this tutorial. The only thing you should now is that everything you write in quests gets to the object folder.
Quest editors are bad?!
In the moment there a quest editors but no really good one, I have nothing against them you can use them but you should be able to write quests without quest editors. If you find a good IDE for quests use it. A editor is not very good for writing quest… take you time use macros or something like auto completion scripts if you want to save time or simply write template quest (I will post some on the end of this tutorial.)
Writing the first quest?
No, we do the Basics now.
Prepare your brains and keep in mind this takes time.
Variables
What’s that?
So we work with a computer (server) and we have many different values, we must remember. We need them later. This data is in the memory of the computer. The way the computer transfers the data into the memory. But for LUA we don’t need to know how the computer is doing it.
Named Variables
How we name them is pointless, but there are some rules
• A variable must begin with a letter or a underscore
• A variable is Case sensitive that’s very important
• They may not contain characters other than letters, numbers and underscores.
Variable Scope in Lua
How the word shows there are areas where variables are valid. This has many different reasons and is very useful.
In many languages there are some scopes.
In LUA there are only two Global and Local.
Global variables are avail everywhere.
Local variables only in the code block where there were created.
Something about code blocks, in LUA anything is in code blocks these blocks begin with a command then the block were you work and then the word ‘end’. These blocks can have other code blocks inside them.
Variables without a local before them are avail in any code block, when there is a local before a variable then they are only valid in their own block.
You can’t use end and local as variable name.
Variable types
Variables store values. These values can be different formats there are states, numbers, characters and functions.
• Nil (nothing)(empty)(not existing)
• Numbers
• Characters (Letters, Word, etc.)
• States (true/false)(yes/no)(1/0)
• Functions (special state of a block)
• Tables (explained later)
WTF? Functions are Variables?
Yes, in Lua a variable can store a function so you get a named function. You can do
plantTree = function()
or you do
function plantTree()
functions end with
end
WTF? Tables ? “something to sit on?!? xD”
No, I personally do not sit on tables I sit on chairs.
But let’s get back to the LUA tables.
A table is nothing more than a variable with more than one level, or if you know the word array it describes it good. I personally think tables are much cooler than arrays.
PHP Code:
myTable = {}
PHP Code:
myTable = { “soup”, “egg”, “spoon”, 6}
So I do it like this.
PHP Code:
myTable[1] -> contains my nice hot Chinese soup when I print it or do some other stuff with it I’ll get -> soup
when I now say myTable{4] I get 6 back (muahahaha 6pack )
I don’t want to say myTable[1] to get my item named soup let’s do it again.
PHP Code:
myNewShinyTable = {soup=”Chinese soup”, egg=”egg for the soup”, spoon=”spoon to eat the soup”}
now I can do it like this
PHP Code:
myNewShinyTable.soup -> Chinese soup
myNewShinyTable.egg -> egg for the soup
myNewShinyTable.spoon -> spoon to eat the soup
Comments and Keywords
Welcome Back!
We are getting deeper into Lua, I hope you understood my freaky tutorial. : /
Now you learn the keywords you can’t use for variable names and how to make comments
Comments are essential for understanding your own code after some time and they are also essentials when you share your code.
A comment is made with two ‘-‘ -> ‘—‘
PHP Code:
--This is a single line comment
––[[ this is a multi
Line comment! ]]
PHP Code:
and break do else elseif
end false for function if
in local nil not or
repeat return then true until while
The Syntax of each quest
Like said above anything in Lua is in code blocks and Ymir has done it also in this way.
Any block ends with ‘end’, the Ymir blocks are
• Quest
• State
• When
The blocks are arranged in this order.
This means you have to start a quest like this
PHP Code:
quest name begin
PHP Code:
end
PHP Code:
quest name begin
end
quest says the quest compiler that a new quest begins (you could put more than one quest in one files)
the word begin is only on the Ymir blocks, at the LUA blocks it’s like listed here
• If -> then
• For -> do
• Elseif -> then
• Quest -> begin
• State -> begin
• When -> begin
Let’s go further:
The quest compile parses
PHP Code:
quest questname begin
quest -> new quest block
questname -> the name of the quest
begin -> start the block
____________________________________________
Quests have multiple States like a state where you have to bring an item to a NPC.
These states are inside of the quest tag
The Server automatically starts the state named start
PHP Code:
quest questname begin
state start begin
end
end
PHP Code:
state start begin
start -> state name
begin -> begin the state
You can’t put code into an state without Events
It gets more complicated by now
You have some Events you can use.
• Login (is cast on login)
• Logout (is cast on login)
• Enter (is cast when entering a new state)
• Leave (is cast wen leaving a state)
• Vnum.kill (is cast when killing the monster with the given vnum e.g. 101.kill = wilddog)
• Kill (is cast when the player kills something)
• npcvnum.chat (is cast when the player click on a npc, opens a menu with all chat events)
• npcvnum.click (is cast when the player clicks on a npc, doesn’t work together with chat)
• letter (quest letter related)
• button(quest letter related)
• info (quest letter related)
• timer (is cast when timer reaches zero)
• server_timer (is cast when server_timer reaches zero)
• .target (with marked target more to this later on our journey) you can bind it with events like click
Let us do a simple example:
We want to display a welcome message to the player every time he changes the map or even does login
We use the function syschat it shows the message in the client message color.
And we use a player related function names pc.get_name()
pc means player character
we connect the string Hello with the return of the function pc.get_name() in lua with two normal points
PHP Code:
quest questname begin
state start begin
when login begin
syschat("Hello"..pc.get_name())
end
end
end
Now we have our first little quest, but what if we want to show the message only to player who are over level 25
We could do an if query or we use it the Ymir style.
If Query:
PHP Code:
quest questname begin
state start begin
when login begin
if pc.get_level() > 25 then
syschat("Hello "..pc.get_name())
end
end
end
end
PHP Code:
quest questname begin
state start begin
when login with pc.get_level() > 25 begin
syschat("Hello "..pc.get_name(())
end
end
end
The Ymir Style is the better way, its only cast when the player is over level 25
quest functions
The serversoftware has some functions you can use,
these functions are the quest functions
they are all in the file quest_functions
When you add a new function you have to add it in the quest_function file too.
Here is a little list of quest functions:
PHP Code:
item.get_cell()
Werte: Keine Werte
Beschreibung: gibt bei take und use das Aktuell benutzte Item aus.
Rückgabe: false wenn ein fehler aufgetreten ist ansonsten die Zellennumer im Inventar
item.select_cell(slot)
Werte: Slot im Inventar
Beschreibung: wählt ein Item im Inventar aus so das die item befehle auf das ausgewählte Item angewendet werden.
Rückgabe: Boolean
item.get_socket(socketid)
Werte: sockel nummer 0 bis 2
Beschreibung: Erwartet die Socket ID, wenn diese gegeben ist gibt es den Inhalt des Sockets aus also welches item sich im Sockel befindet.
Rückgabe: false oder item vnum
item.remove(void)
Werte: keine
Beschreibung: Entfernt das Aktuell ausgewählte Item.
Rückgabe: keine
item.get_id(void)
Werte: keine
Beschreibung: Gibt die ID des Aktuell ausgewählten Items aus.
Rückgabe: false oder itemid
item.select(itemid)
Werte: Id des Items welches man auswählen will (nicht Vnum)
Beschreibung: Setzt das ausgewählte Item auf die angegebene ID so das die Item befehle für dieses Item gelten.
Rückgabe: Boolean
item.get_count(void)
Werte: Keine
Beschreibung: Gibt die Anzahl wie groß der Stack des aktuell gewählten Items ist also z.B 50 Perlen zurrück
Rückgabe: false oder count
item.get_level(void)
Werte: keine
Rückgabe: refine_level des gewählten Items z.b Schwert+1 = 1
item.get_name(void)
Werte: keine
Rückgabe: Name des gewählten Items
item.get_refine_vnum(void)
Werte: keine
Rückgabe: refined_vnum des gewählten Items.
item.get_size(void)
Werte: keine
Rückgabe: größe des gewählten items <- Datenbank feld size
item.get_sub_type(void)
Werte: keine
Rückgabe: subtype des gewählten Items
item.get_type(void)
Werte: keine
Rückgabe: type des gewählten Items
item.get_value(value)
Werte: value
Rückgabe: Wert eines Value felds des gewählten Items( value felder= value1 bis 5)
item.get_vnum(void)
Werte: keine
Rückgabe: Vnum des gewählten Items
item.has_flag(flag)
Werte: flag
Beschreibung: prüft ob das ausgewählte item den angegebenen flag
Rückgabe: Boolean
item.set_socket(socketnum, value)
Werte: Sockelnummer, Wert der gesetzt werden soll
Beschreibung: Setzt bei der Aktuell gewählten Waffe in den angegebenen sockel das angegbene item ein (socketnum max = 2)
game.drop_item_with_ownership(item_vnum, anzahl)
Beschreibung: Droppt ein Item unter dem Spieler mit seinem Namen darüber der Name bleibt 10 Sekunden darüber
__give_char_priv(rate_type, rate)
Beschreibung: Gibt dem Aktuell ausgewählten Charakter einen Rate Bonus
Werte: rate_type = 1 bis 4 (YANG, DROP, YANGBOMB, EXP)
rate = höhe der Rate
__get_empire_priv_string()
Beschreibung: Die Aktuellen Boni eines Reiches als String ausgeben
__give_empire_prive(empire, rate_type, rate, time) -- einem Reich einen Bonus geben
Beschreibung: Gibt einem bestimmten Reich oder allen Reichen einen Rate Bonus
Werte: rate_type= 1-4 (DROP, GOLD_DROP,TEN_GOLD_DROP, EXP)
empire = 0-3 0 = alle reiche
__getnpcid(npc_name)
Beschreibung gibt einem die NPC ID aus wenn man den npc namen als wert angibt
is_test_server()
Beschreibung: Gibt einen booleschen wert zurrück je nach dem ob der server ein Test Server ist oder nicht
kill_all_in_map(mapindex)
Beschreibung: Tötet alle NPCs und Monster auf der angegebenen Map eventuell auch Spieler
Werte: mapindex der Ziel Map
bool_to_str()
Beschreibung: Konvertiert einen Booleschen Wert zu einem String = "true" oder "false"
cmdchat(clientCMD)
Beschreibung: Sendet einen Befehl in einem Chat Channel den der Client annimt.
Wird genutzt für Sachen wie das öffnen eines Privaten Ladens oder die Meldungen beim Uppen
command(cmd)
Beschreibung: Wie /befehl als Spieler genauso von rechten eingeschränkt
enable_over9refine(int, int)
Beschreibung: /
Werte: /
regen_in_map(mapindex, path)
Beschreibung: Lädt die regen Datei die mit path angeben wird und aktiviert sie auf der mit mapindex angegebenen Map
say_in_map(mapindex, text)
Beschreibung: Wie say nur das es auf dem angegebenen Map Index für alle angezeigt wird
set_quest_state(questname, state)
Beschreibung: Setzt bei der angegeben Quest den angegeben State als Aktiv bzw führt ihn aus
set_skin(skin_type)
Beschreibung: Setzt den Stil des sich öffnenden Quest Fensters (Balken oder nicht, sichtbar oder nicht usw)
syschat(text)
Beschreibung: Gibt den eingegebenen Text in Metin2 Fehler schrift für den Spieler aus
syserr(text)
Beschreibung: Gibt einen Quest Fehler im Chat aus wenn der Server ein test_server ist
time_to_str()
Beschreibung: Gibt die Aktulle Zeit als String zurrück
warp_all_to_village(mapindex, time)
Beschreibung: Teleportiert alle Spieler die sich auf der Map
mit dem angegebenen Map Index befinden
in ihre Dörfer zurrück.
time setzt die Wartezeit wie lange es dauert bis die Spieler geportet werden.
warp_to_village()
Beschreibung: Teleportiert den Aktuell gewählten Charakter in sein Dorf zurrück
affect.add(applytype, applyvalue, time)
Beschreibung: Fügt einen Affect mit dem Type 1000 hinzu somit kann er zusätzlich zu allen anderen Affects gelten
Gültige applytype's sind 1 bis 80 also Boni ID's
affect.remove()
Beschreibung: Entfernt den angegebenen affecttype
Anmerkung: Affect 223 kann nicht entfernt werden
210 = GM Stun
211 = GM Slow
203 = Unsichtbarkeit
223 = Chatblock
500 bis 509 = EXP Boni usw
514 = Haar
532 = Pferdename
affect.remove_all_collect()
Beschreibung: Entfernt alle Collect Affects = Bio Quest Affects
affect.remove_bad()
Beschreibung: Entfernt alle Negativen Affects wie Brennen, Gift und Sonstiges
affect.remove_good()
Beschreibung: Entfernt jegliche Positive Affects auch Skill Buffs usw
affect.remove_hair()
Beschreibung: Entfernt das aktuelle Haar
building.get_land_id() -- Id des Landes ausgben
building.get_land_info() -- Info über das land ausgeben
building.has_land() -- hat land? 0 oder 1
building.set_land_owner() -- setzt den Besitzer des landes
char_log() -- schreibt was in die log tabelle?
clear_server_timer() -- Server timer zurücksezen
clearmapsignal() -- Blinkenden Punkt auf der Map Löschen
cleartimer() -- timer zurück setzen
color(r,g,b) -- farbe rgb glaubich
complete_quest() -- quest abschließen
complete_quest_state() -- complete sate
confirm() -- bestätigen Ja nein?
sys_log() -- etwas in den system log schreiben?
d.check_eliminated() -- Checken ob alle Monster im Dungeon Berreich getötet wurden.
d.clear_regen() -- Den Respawn im Dungeon anhalten.
d.count_monster() -- Monster Anzahl im Dungeon
d.exit() -- Spieler verlässt den Dungeon
d.exit_all() -- Alle verlassen den Dungeon
d.exit_all_to_start_position() -- Alle werden wieder an die Startposition gesetzt.
d.get_kill_mob_count() -- Gibt die anzahl der im Dungeon getöteten Mobs aus
d.get_kill_stone_count() -- Gibt die anzahl der im Dungeon getöteten Metins aus
d.get_map_index() -- Dungeon Map Index
d.getf() -- Dungeon Flag
d.is_unique_dead() -- Ist ein einziger gestorben?
d.is_use_potion() -- Benutzt jemand einen Pott
d.join() -- Einer Gruppe im Dungeon beitreten
d.jump_all() -- Alle zu einer Position warpen. Dungeon
d.jump_all_local() -- Alle Lokal Warpen Dungeon
d.kill_unique() -- Wurde ein einzelner getötet
d.new_jump() -- Neuer Warp
d.new_jump_all() -- Alle Spieler Warpen neu.
d.purge() -- Ebene einmalig von Monstern säubern
d.purge_unique() -- Eine einziges Monster oder einige verschwinden lassen im Dungeon
d.regen_file() -- Monster Respawn datei laden
d.revived() -- Wiederbelebt
d.select() -- Dungeon Auswahl
d.set_dest() -- Dungeon Ziel setzen
d.set_exit_all_at_eliminate() -- Wenn ein Gegner getötet wurde verlassen alle die Map
d.set_regen_file() -- Respawn datei setzen.
d.set_unique() -- Einzelnen setzen im Dungeon
d.set_warp_at_eliminate() -- Warp wenn Gegner besiegt.
d.setf() -- Dungeon Flag setzen.
d.spawn() -- Monster im Dungeon Spawnen
d.spawn_goto_mob() -- Spawnt den Mob in Dungeon und teleport dich zu ihm
d.spawn_group() -- Spawnt eine Gruppe im Dungeon
d.spawn_mob() -- Monster Spawnen im Dungen
d.spawn_move_group() -- gruppe spawnen und bewegen?
d.spawn_move_unique() -- einen mob spawnen und bewegen?
d.spawn_name_mob() -- Mob mit namen spawnen ???
d.spawn_stone_door() -- Steintür Spawnen
d.spawn_unique() -- Einzeln Spawnen
d.spawn_wooden_door() -- Holztür spawnen
d.unique_get_hp_perc() -- Leben des einzelnen Monsters abrufen oder Spielers kp
d.unique_set_def_grade() -- Verteidigung des monsters setzen oder Spielers kp
d.unique_set_hp() -- Leben des einzelnen Monsters setzen oder Spielers kp
d.unique_set_maxhp() -- Max Leben des einzelnen Monsters setzen oder Spielers kp
delay() -- Verzögerung
find_npc_by_vnum() -- NPC mit vnum suchen
find_pc_by_name() -- spieler bei namen suchen
find_pc_cond() -- Spieler auswählen der Konditionen erfüllt
game.drop_item() -- Item fallen lassen
game.get_event_flag() -- Event Flag abrufen
game.get_guild_name() -- Gilden Namen abrufen
game.get_safebox_level() -- Lager größe abrugen
game.get_warp_guild_war_list() -- Gildenkriegsliste abrufen
game.open_mall() -- Itemshop Lager öffnen
game.open_safebox() -- Lager öffnen
game.request_make_guild() -- Anfrage auf Gilde erstellen senden
game.set_event_flag() -- Event Flag setzen
game.set_safebox_level() -- Lager größe ändern
get_global_time() -- Globale Zeit ausgeben
get_locale() -- gewählte locale ausgeben
get_server_timer_arg() -- Server Timer value ausgeben
get_time() -- zeit ausgeben
guild.around_ranking_string() -- Gilden Ranking als String ausgeben
guild.get_any_war() -- Jeden Gildenkrieg abrufen
guild.get_ladder_point() -- Leader Punkte abrufen
guild.get_name() -- Gildenname ausgeben
guild.get_rank() -- Gilden Rank ausgeben
guild.get_reserve_war_table() -- Gildenkriegs liste
guild.get_warp_war_list() -- Gildenkrieg Warpliste
guild.high_ranking_string() -- Highscore als Steing (Gilde)
guild.is_bet() -- Wurde auf die Gilde geboten
guild.is_war() -- nimmt die gilde an einem gildenkrieg teil?
guild.level() -- Gildenlevel ausgeben
guild.name() -- Gildennamen ausgeben
guild.war_bet() -- Auf Gildenkrieg setzen
guild.war_enter() -- Gildenkrieg beitreten
horse.advance() -- Pferd 1 Level up
horse.feed() -- Pferd füttern.
horse.get_grade() -- Pferde Rang ausgeben
horse.get_health() -- Pferde Leben ausgeben
horse.get_health_pct() -- Pferde Leben in Prozent
horse.get_hp() -- Pferde leben ausgeben
horse.get_level() PFerde Level ausgeben
horse.get_stamina() -- Pferde ausdauer ausgeben
horse.get_stamina_pct() -- Pferde ausdauer in Prozenzt
horse.is_dead() -- Ist das Pferd tot?
horse.is_mine -- Ist das mein Pferd
horse.is_riding() -- Sitze ich auf einem Reittier
horse.revive() -- Reittier wiederbeleben
horse.ride() -- Pferd reiten
horse.set_level() -- Pferde level steigen
horse.summon() -- pferd rufen
horse.unride() -- vom pferd absteigen
horse.unsummon() -- Pferd wegschicken
input() -- input feld erstellen wo man was eingeben kann
is_test_server() -- Gibt aus ob es auf Testserver gestellt ist.
loop_timer() -- Loop Timer
npc.is_quest() -- Prüft ob der NPC gerade für eine Quest benötigt wird
pc.change_gold() -- Gold ändern
pc.change_money() -- Gold ändern
pc.change_sp() -- SP ändern
pc.changealignment() -- Rang ändern
pc.changegold() -- Gold ändern
pc.changemoney() -- gold ändern
pc.clear_skill() -- Skill säubern
pc.clear_sub_skill() -- Unterskill leermachen
pc.clear_one_skill() -- einen skill säubern
pc.count_item() -- item zählen
pc.countitem()-- item zählen
pc.delqf() -- was in der quest tabelle löschen
pc.destroy_guild() -- Gilde auflösen
pc.enough_inventory() -- Prüft ob im Inventar platz ist
pc.forget_my_attacker() -- Wie Weiße Flagge monster in der nähe beachten dich kurze zeit nicht
pc.get_armor() -- Rüstung ausgeben
pc.get_empire() -- reich ausgeben
pc.get_equip_refine_level()
pc.get_exp()
pc.get_gold()
pc.get_guild()
pc.get_horse_level()
pc.get_hp()
pc.get_job()
pc.get_leadership() -- Leaderschafft ausgeben
pc.get_level()
pc.get_local_x()
pc.get_local_y()
pc.get_map_index()
pc.get_max_hp()
pc.get_max_sp()
pc.get_money()
pc.get_name()
pc.get_next_exp()
pc.get_part()
pc.get_playtime()
pc.get_sex()
pc.get_skill_level()
pc.get_sp()
pc.get_start_location()
pc.get_vid()
pc.get_war_map()
pc.get_weapon()
pc.get_x()
pc.get_y()
pc.getarmor()
pc.getcurrentmapindex()
pc.getempire()
pc.getf()
pc.getgold()
pc.getguild()
pc.gethp()
pc.getleadership()
pc.getmaxhp()
pc.getmaxsp()
pc.getmoney()
pc.getname()
pc.getplaytime()
pc.getqf(name)
pc.get_skill_group()
pc.getsp()
pc.getweapon()
pc.getx()
pc.gety()
pc.give_exp(exp)
pc.give_exp2(exp)
pc.give_exp_perc(percent)
pc.give_gold(gold)
pc.give_item(vnum)-- gibt Rang punkte zurück
pc.give_item2(vnum)
pc.give_item_from_special_item_group(is_item?)
pc.give_lotto()
pc.has_guild() -- Gibt zurück ob man in einer Gilde ist(1) oder eben nicht(0)
pc.has_master_skill() -- Gibt zurück ob man irgendwas auf hat(1) oder eben nicht(0)
pc.hasguild() -- Gibt zurück ob man in einer Gilde ist(1) oder eben nicht(0)
pc.have_map_scroll()
pc.have_pos_scroll()
pc.in_dungeon() -- Gibt zurück ob man greade in einem Dungeon ist(1) oder eben nicht(0)
pc.is_guild_master() -- Gibt zurück ob man Gilden Leader ist(1) oder eben nicht(0)
pc.is_horse_alive() -- Gibt zurück das Pferd des Spielers lebt(1) oder eben nicht(0)
pc.is_married() -- Gibt zurück ob man in verheiratet ist(1) oder eben nicht(0)
pc.is_mount()
pc.is_polymorphed() -- Gibt zurück ob man verwandelt ist(1) oder eben nicht(0)
pc.isguildmaster() -- Gibt zurück ob man Gilden Leader ist(1) oder eben nicht(0)
pc.mount(vnum,time) -- auf ein reittier aufsteigen
pc.pc_attract_ranger() -- abstand messen?
pc.polymorph(mob_vnum) -- Spieler Verwandeln
pc.refine_equip() -- Gegenstand Verbeßern
pc.remove_from_guild() -- Aus Gilde löschen
pc.remove_item(item_vnum) -- Gegenstand aus Inventar löschen
pc.remove_polymorph() -- Verwandlund rückgangig machen
pc.removeitem() -- Gegenstand aus Inventar löschen
pc.reset_point() -- Punkte zurück setzen (Status?)
pc.revive_horse()
pc.select() -- Auswahl
pc.set_part() -- Part wie Harr usw setzen
pc.set_warp_location()
pc.set_warp_location_local()
pc.setf() -- das selbe wie setqf
pc.setqf(name,value)
pc.set_skill_group() --Lehre wechseln
pc.set_skill_level() -- skill level ändern
pc.unmount() -- Vom reittier absteigen
pc.warp() -- Teleportieren
pc.warp_exit() -- Teleportieren (Ausgang)
pc.warp_local() -- Lokal warpen wie Tele Hack
pc.warp_to_guild_war_observer_position() -- Teleportieren zu Gildenkrieg wächter Typie
pc.is_clear_skill_group()
pc_find_skill_teacher_vid()
pc_find_square_guard_vid()
pc_get_exp_bonus() -- Gibt dem EXP Bonus aus
pc_get_village_map_index() -- gibt den map index des Dorfes aus
pc_is_novice() -- gibt aus ob der Spieler noch unter level 15 ist
raw_script()
restart_quest() -- Setzt den Quest State wieder auf Start
say() -- Einfaches [SAY]
say_npc_name() -- gibt Text mit Formatierung für den NPC Namen aus
say_pc_name() -- gibt Text mit Formatierung für den Spieler Namen aus
say_reward() -- gibt Text mit Formatierung für eine Belohnunh aus
say_title() -- gibt Text mit Formatierung für den Titel aus
say_item() -- gibt Text mit Formatierung für ein Item aus
say_item_vnum()--gibt Text mit Formatierung für ein Item aus<-Wie bei mt2de bei Schmied und Bio
select() -- Auswahl die Values müsst ihr selber machen Jede value = 1 auswahl feld wie Ja Nein
target.clear()
target.delete()
target.id()
target.npc()
target.pc()
target.pos()
target.vid()
test_chat()
time_hour_to_sec()
time_min_to_sec()
type()
pc.is_engaged() -- Ist der Spieler verlobt
string.format()
pc.is_gm() -- gibt aus ob der Spieler GM ist 1 oder 0
pc.get_gm_level() -- gibt das GM level zurück also implementor usw IMPLEMENTOR = 5 absteigend
pc.get_alignment()
pc.get_real_alignment()
pc.learn_grand_master_skill()
pc.is_skill_book_no_delay() -- wenn eine Exxo gelesen wurde 1 wenn nicht 0
pc.remove_skill_book_no_delay() -- entfernt den exxo effekt
Thank you Risan for reminding me.
when use - part 1
So we make progress, now lets get startet with the item stuff.
normal:
PHP Code:
quest test begin
when use begin
end
end
PHP Code:
quest test begin
when itemvnum.use begin
end
end
We begin with what you can do with use
The use event is cast when a player clicks on a item that has the type 18 you can make quests use able with the flag field in the database but i don't know if that works out correctly the flag would be 1024.
When the use event is cast, you have access to all commands item. commands binds the item you use to the item. commands. You can select other items with item.select. The use event allows you to make items that interact like there were hard coded. You can even use it as quest scrolls or things like that.
More about when use in when use part 2 and when use part 3
when use - part 2: The normal way
In the normal way you do it like this:
PHP Code:
quest test begin
when itemvnum.use begin
-- do something
end
end
PHP Code:
quest test begin
when itemvnum.use or item2vnum.use or item2vnum.use begin
local type = item.get_value(0) -- local variable will be set to the value0 field of the item
if type == 1 then
syschat("You used item type1")
elseif type==2 then
syschat("You used item type1")
elseif type==3 then
syschat("You used item type1")
end
end
end
MORE IS COMING SOON