This is an small documentation I made for myself for some of the functions from the Lua script files used for scripted events and quests.
I haven't tested most of them, and in general the whole script system is a bit messy, but if you decide to start creating stuff with it (like new quests or custom events) this may be helpful:
Code:
InsertPayItemCodeName(int Amount, <String CodeName>) Return value: Unk Result: Set the codename of the item to be given with the LuaAddItem_EXT function. InsertPayItemRatio(int Amount, <float ratio (0 min, 100 max)>) Return value: Unk Result: Set the probability of obtaining the item selected on the payitemcodename function (follows the same order as the declared on that function) LuaInsertDropItem(int Amount, <String CodeName, float dropProbability>) Return value: Unk Result: Set the items to be dropped from monsters and the probability of drop for each item (from 0 to 100) InsertMenuStringList(String NPC_CodeName, int stringCount, <String msgType, String msgCodeName>) Return value: Unk Result: Assign specified chat strings to an NPC LuaInsertNPC(int NPC_Count, <String NPC_CodeName>) Return value: Unk Result: Assign the functions previously declared on the specified NPC's. LuaEventInQuireSameItem(int Unknown, String itemCodeName, int inquireType, int Unknown) Return value: If inquireType = 0, return the slot number where the item is located, if 1 or 2 return the amount of items found on the stack. Result: Find an specified item on the inventory and returns either the slot number or the amount of items found on the stack. LuaDelItem_EXT(int Unknown, int slotNum, int Amount, int Reason, int Unknown) Return value: Unk Result: Delete the item placed on the specified slot on the inventory of the character. LuaRanged_rand_f(int Min, int Max) Return value: Random float number Result: Returns a random float number on the range specified on the parameters. Result must be assigned to a variable. LuaRangedRand(int Min, int Max) Return value: Random int number Result: Returns a random integer number on the range specified on the parameters. Result must be assigned to a variable. LuaAddItem_EXT(int eventID, int Unknown, int Amount, int Reason, boolean Unknown, boolean Unknown, int itemID) Return value: Unk Result: Adds an specified item into the character's inventory. The itemID is the ID that the InsertPayItemCodeName assigns to the specified items (1 = first item, 2 = second item...). LuaNpcHandlerNum() Return value: NPC Handler ID Result: Obtain the handler ID of the NPC that calls this function and assigns it into a variable, for later usage. LuaShowMenu(int currentPage, int EventID, int listIndex, int Button, int NPCHandlerID) Return value: Unk Result: Displays the specified strings and options on the specified NPC. LuaSetCurPage(int Page) Return value: Unk Result: Set the npc chat message page to the specified on the parameter. LuaGetCurPage() Return value: Page number Result: Return the current page where the user is on. LuaGetEventMenuResponse() Return value: The ID of the option selected by the player on the NPC chat. Result: Obtain the ID of the option choosen on the NPC chat, usually it must be recalculated after obtain it with "MenuOffset = MenuOffset - TALK_RESPONSE_LIST_BASE" LuaGetCountEmptyInventory(int Unk, int Unk) Return value: Amount of slots Result: Return the amount of slots available on the character's inventory. LuaTerminateMenu() Return value: None Result: Close the NPC chat window on the game's client. LuaEngageBuffSkill(String skillCodeName) Return value: None Result: Cast the specified buff on the character invoking the function. LuaIsActiveBuff(String skillCodeName) Return value: Return the skillID if the buff is not affecting the character, or 1 if the buff is already casted on him. Result: Returns a value depending on the state of the specified buff on the character that invokes the function. LuaGiveEventPoint_EXP_Gold(int Exp, int spExp, int Gold) Return value: None Result: Gives the character who invoke the function the specified amount of exp, spexp and gold given on the parameters. Capped characters won't get any exp. LuaGetPlayerLevel() Return value: Char level Result: Return the current character's level that invokes the function. LuaGetPlayerGender() Return value: Char gender Result: Return the gender of the character, 0 if female, 1 if male. LuaCompareGold(int Amount) Return value: The result of the comparision Result: Returns -1 if the gold of the player is less than the given amount, 0 if its the same, or 1 if its higher.







