Hmm, let me try to make a 'newbie guide' for ai. :P In the AI all the 'pieces' are linked. I.e, you make a new merchant, that you call Gon.
It'll be like
class gon : merchant
class_end
What happens here is, you define a new class called 'gon' and you load all the 'merchant'-class ai aswell. If you look in the ai.obj and you look for 'merchant :', you'll see what all the merchant AI is. Overall, for a thing like a level-check, 'citizen' will be appropiate.
Let's keep the idea of Gon, but make it a citizen that checks your level:
class gon : citizen
Every part has handlers. All the handlers are written down somewhere, you can find it with the search. There are handlers for being attacked, being talked to, or being asked. In this case we work with talk select. This is handler 4.
Let's start:
handler 4 // TALK_SELECTED
variable_begin
"fhtml0"
"i0"
"quest_id"
"talker"
"myself"
"_choiceN"
"_code"
"_from_choice"
variable_end
If you search through the ai.obj, you'll see that talk_select things always start with a check if it's from choice. So:
push_event // _from_choice
push_const 332
add
fetch_i
push_const 0
equal
branch_false L1
Ok, the first part is ready. If it's not from choise there shouldn't be done anything. L1 will be at the bottom, so nothing gets loaded anymore. Let's continue with your part
L2
push_event // talker
push_const 32
add
fetch_i // level
push_const 888
add
fetch_i
push_const 30
greater_equal
branch_flase L4
Ok, what we have above is fairly simple. The player is push_const 32. With the fetch_i push_const 888 command you get his level. This should be greater, or equal, to the value '30'. If it's not, then you should go to L4, otherwise continue.
L3
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
S1. "IS_LVL_30.htm"
push_string S1
func_call 43 // func[ShowPage]
shift_sp -2
shift_sp -1
jump L1
Ok, obvious. It should show the page and after this it shouldn't parse any more code. The L1 is the empty label at the end. Ok, if we're >= 30, you get a page and the rest isn't parsed. So, if you're < 30, the ai should have a code to show you a page. So:
L4
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
S2. "IS_NOT_LVL_30.htm"
push_string S2
func_call 43 // func[ShowPage]
shift_sp -2
shift_sp -1
L1
handler_end
class_end