After I saw this question alot, I thaught about thinkin' to write some BEGINNING, this will be NOT a Copy'n'Paste Tutorial, you have to do those things ON YOUR OWN!
But now to my tut:
What we need:
- A program to edit .lua's
- Databaseaccess
- Brain.exe (Note: If you can't find it: Give up.)
Part 1: Database
- If you don't want to use disabled NPC's, then skip this step.
Well, I know, it's the wrong beginning, but I said it before: This is not a Copy'n'Paste-Tut.
First of all search for a disabled NPC (select * from npcresource where local_flag IS NOT '0')
Here you have to edit x, y, contact_script and local_flag.
X & Y should be clear, local_flag, too. If you don't know, what you have to replace here, give up. :3
Now contact_script:
Think about some good name, for our example we'll take "NPC_DarknessFight".
Here you have to insert "NPC_DarknessFight()" - "(" & ")" are important!
Part 2: Lua-Files
Now you have the choise:
Use a existing .lua, or create a new one.
If you want to create a new one, you have to put this at the beginning:
Code:
function get_module_name() return "DESCRIPTION" -- Example: -- return "DarknessFight" end
First of all, you must remember the Databasename, in this case "NPC_DarknessFight".
This will be our beginning
Code:
-- Initalize Script function get_module_name() return "DarknessFight" end -- Start NPC function NPC_DarknessFight() -- ( & ), again important, else it wont work! -- ToDo: Function end
But we want that awesome window, how can we get this?
Code:
dlg_title( "Xijezu" ) dlg_text( "Hello, nice to meet you. And now GTFO." ) dlg_menu( "Menu 1", 'open_market("lalalalala")' ) dlg_menu( "Uhuh, close this shit! :D", '' )
So the full code would be this:
Code:
-- Initalize Script function get_module_name() return "DarknessFight" end -- Start NPC function NPC_DarknessFight() -- ( & ), again important, else it wont work! dlg_title( "Xijezu" ) dlg_text( "Hello, nice to meet you. And now GTFO." ) dlg_menu( "Menu", 'open_market("lalalalala")' ) dlg_menu( "Uhuh, close this shit! :D", '' ) end
If you want a custom function, like add state or insert item, then you have to write a new function
Code:
function test_function() warp(99999, 99999) -- This will warp you into CV end
Code:
dlg_menu( "Menu", 'test_function()' )
Good.
Questions?
Yes? Then use search.
Greets,
Xijezu