thx to wuyazui
[ Sharing ] is towed the person shares the AI research course first step!
part1: Each NPC corresponds which under the NPCDATA.TXT document all has its corresponding attribute, including one item of npc_ai= { } the attribute (says regarding compilation, this may regard as one □□ function) now carries on in some research npcdata to this looks for one example again
eg1: npc_ai= { [ tetrarch_thifiell ]; { [ fnHi ] = [ tetrarch_thifiell001.htm ] }; { [ fnClassMismatch ] = [ tetrarch_thifiell002.htm ] }; { [ fnClassList1 ] = [ tetrarch_thifiell003f.htm ] }; { [ fnClassList2 ] = [ tetrarch_thifiell003m.htm ] }; { [ fnYouAreSecondClass ] = [ tetrarch_thifiell004.htm ] }; { [ fnYouAreThirdClass ] = [ tetrarch_thifiell005.htm ] }; { [ fnLowLevelNoProof11 ] = [ tetrarch_thifiell008fa.htm ] }; { [ fnLowLevelNoProof12 ] = [ tetrarch_thifiell008fb.htm ] }; { [ fnLowLevelNoProof13 ] = [ tetrarch_thifiell008fc.htm ] }; { [ fnLowLevelNoProof21 ] = [ tetrarch_thifiell008ma.htm ] }; { [ fnLowLevelNoProof22 ] = [ tetrarch_thifiell008mb.htm ] }; { [ fnLowLevelNoProof23 ] = [ tetrarch_thifiell008mc.htm ] }; { [ fnLowLevel11 ] = [ tetrarch_thifiell009fa.htm ] }; { [ fnLowLevel12 ] = [ tetrarch_thifiell009fb.htm ] }; { [ fnLowLevel13 ] = [ tetrarch_thifiell009fc.htm ] }; { [ fnLowLevel21 ] = [ tetrarch_thifiell009ma.htm ] }; { [ fnLowLevel22 ] = [ tetrarch_thifiell009mb.htm ] }; { [ fnLowLevel23 ] = [ tetrarch_thifiell009mc.htm ] }; { [ fnNoProof11 ] = [ tetrarch_thifiell010fa.htm ] }; { [ fnNoProof12 ] = [ tetrarch_thifiell010fb.htm ] }; { [ fnNoProof13 ] = [ tetrarch_thifiell010fc.htm ] }; { [ fnNoProof21 ] = [ tetrarch_thifiell010ma.htm ] }; { [ fnNoProof22 ] = [ tetrarch_thifiell010mb.htm ] }; { [ fnNoProof23 ] = [ tetrarch_thifiell010mc.htm ] }; { [ fnAfterClassChange11 ] = [ tetrarch_thifiell011fa.htm ] }; { [ fnAfterClassChange12 ] = [ tetrarch_thifiell011fb.htm ] }; { [ fnAfterClassChange13 ] = [ tetrarch_thifiell011fc.htm ] }; { [ fnAfterClassChange21 ] = [ tetrarch_thifiell011ma.htm ] }; { [ fnAfterClassChange22 ] = [ tetrarch_thifiell011mb.htm ] }; { [ fnAfterClassChange23 ] = [ tetrarch_thifiell011mc.htm ] } } first [ tetrarch_thifiell ] is the corresponding NPC name { [ fnHi ] =? } Sheds inlays mixed Phi is noisy 悄 懿 asks □ in here fnHi everybody may understand first time says the hello for everybody with him, he must do movement! If here must demonstrate tetrarch_thifiell001.htm this page, behind [ fnClassMismatch ] all
In here fnHi everybody may understand first time says the hello for everybody with him, he must do movement! If here must demonstrate tetrarch_thifiell001.htm this page, behind [ fnClassMismatch ] all is same, why but regarding is [ fnHi ] [ fnClassMismatch ] and so on the symbol? Then we study AI this document AI synopsis: ai was defines all npc intelligence (includes monster), all was was object-oriented (oo) method structure massive kind of default_npc this kind is the all kind of fathers class other kinds all is this kind of subclass, 子子 kind and so on, regarding these kind of center object, the parameter and other first did not make the thorough research, first introduced inherited the relations. default_npc is the highest kind receives □ whetstone □ citizen guard guard_stand warrior and so on all is the default subclass, here and inside NPCDATA citizen guard guard_stand warrior all is same receives us again finds tetrarch_thifiell, this also is one kind, inherits the relations through the multilayer, finds him the order high-level father class is guild_master_lv1, but the guild_master_lv1 order high-level father class is guild_master we finds guild_master the definition section finds under parameter_define_begin and the parameter_define_end middle parameter, has fnHi fnClassMismatch this is his method, npc_ai { } center transfers also is these method research contrasts, All has the definition regarding in NPCDATA each NPC in ai, carries on the new AI hypothesis regarding NPC also must revise in ai.obj, like must realize 2 revolutions, must carry on judgement, execution and so on, to two revolution of conditions but if wants own completely to revise □@ is one very huge project, □K also must have very many comprehensive materials
PART2: Monster skill research: First looks one simple single skill example: npc_begin warrior 792 [ farhite ] level=55. npc_ai= { [ farhite ]; { [ DDMagic ] =@s_aden_flame } } corpse_time=7 no_sleep_mode=0 npc_end here appeared DDMagic we to looks after AI class farhite: warrior_aggressive_casting_ddmagic class_end finds his order high-level father class warrior_casting_ddmagic but the warrior_casting_ddmagic order high-level father class is warrior we looks this section
class warrior_casting_ddmagic: What condition warrior parameter_define_begin int DDMagic 1024257 parameter_define_end does here indirectly transfer to warrior in the attribute carries on the use skill under the transfer carries on the judgement and so on in the under definition everybody may see eg2: The multi- skills use first looks one double skill simple example npc_ai= { [ baium ]; { [ PhysicalSpecial ] =@baiumsk3 }; { [ DDMagic ] =@baiumsk2 } } here wrote 2 skills we sees baium the AI section
class baium : warrior_aggressive_casting_ddmagic
parameter_define_begin
int PhysicalSpecial 1057281
parameter_define_end
handler 1 // ATTACKED
variable_begin
"attacker"
"damage"
"myself"
"_choiceN"
"_code"
"_from_choice"
variable_end
push_event // attacker
push_const 36
add
fetch_i // is_pc
push_const 108
add
fetch_i
push_const 0
not_equal
push_reg_sp
fetch_i
branch_true L2041
shift_sp 1
push_const 9
push_event // attacker
push_const 36
add
fetch_i // npc_class_id
push_const 1620
add
fetch_i
func_call 143 // func[IsInCategory]
shift_sp -2
or
L2041
branch_false L2043
L2042
shift_sp 1
push_const 100
func_call 55 // func[Rand]
shift_sp -1
push_const 10
less
push_reg_sp
fetch_i
branch_false L2044
push_event // myself
push_const 28
add
fetch_i // top_desire_target
push_const 2412
add
fetch_i
push_event // attacker
push_const 36
add
fetch_i
equal
and
L2044
branch_false L2046
L2045
shift_sp 1
push_parameter PhysicalSpecial
func_call 155 // func[Skill_GetConsumeMP]
shift_sp -1
push_event // myself
push_const 28
add
fetch_i // sm
push_const 2400
add
fetch_i // mp
push_const 352
add
fetch_d
less
push_reg_sp
fetch_i
branch_false L2047
shift_sp 1
push_parameter PhysicalSpecial
func_call 154 // func[Skill_GetConsumeHP]
shift_sp -1
push_event // myself
push_const 28
add
fetch_i // sm
push_const 2400
add
fetch_i // hp
push_const 344
add
fetch_d
less
and
push_reg_sp
fetch_i
branch_false L2047
shift_sp 1
push_parameter PhysicalSpecial
func_call 160 // func[Skill_InReuseDelay]
shift_sp -1
push_const 0
equal
and
L2047
branch_false L2049
L2048
shift_sp 1
push_event // attacker
push_const 36
add
fetch_i
push_parameter PhysicalSpecial
push_const 0
push_const 1
push_const 1000000
func_call 10 // func[AddUseSkillDesire]
shift_sp -5
shift_sp -1
L2049
L2046
L2043
call_super
handler_end
handler 23 // CLAN_ATTACKED
variable_begin
"attacker"
"damage"
"myself"
"_choiceN"
"_code"
"_from_choice"
variable_end
shift_sp 1
func_call 20 // func[GetLifeTime]
push_const 7
greater
push_reg_sp
fetch_i
branch_false L2050
push_event // attacker
push_const 36
add
fetch_i // is_pc
push_const 108
add
fetch_i
push_const 0
not_equal
push_reg_sp
fetch_i
branch_true L2051
shift_sp 1
push_const 9
push_event // attacker
push_const 36
add
fetch_i // npc_class_id
push_const 1620
add
fetch_i
func_call 143 // func[IsInCategory]
shift_sp -2
or
L2051
and
push_reg_sp
fetch_i
branch_false L2050
push_event // myself
push_const 28
add
fetch_i // p_state
push_const 2308
add
fetch_i
push_const 3
not_equal
and
L2050
branch_false L2053
L2052
shift_sp 1
push_const 100
func_call 55 // func[Rand]
shift_sp -1
push_const 10
less
branch_false L2055
L2054
shift_sp 1
push_parameter PhysicalSpecial
func_call 155 // func[Skill_GetConsumeMP]
shift_sp -1
push_event // myself
push_const 28
add
fetch_i // sm
push_const 2400
add
fetch_i // mp
push_const 352
add
fetch_d
less
push_reg_sp
fetch_i
branch_false L2056
shift_sp 1
push_parameter PhysicalSpecial
func_call 154 // func[Skill_GetConsumeHP]
shift_sp -1
push_event // myself
push_const 28
add
fetch_i // sm
push_const 2400
add
fetch_i // hp
push_const 344
add
fetch_d
less
and
push_reg_sp
fetch_i
branch_false L2056
shift_sp 1
push_parameter PhysicalSpecial
func_call 160 // func[Skill_InReuseDelay]
shift_sp -1
push_const 0
equal
and
L2056
branch_false L2058
L2057
shift_sp 1
push_event // attacker
push_const 36
add
fetch_i
push_parameter PhysicalSpecial
push_const 0
push_const 1
push_const 1000000
func_call 10 // func[AddUseSkillDesire]
shift_sp -5
shift_sp -1
L2058
L2055
L2053
call_super
handler_end
class_end here first directly transferred one parameter_define_begin int PhysicalSpecial 1057281 parameter_define_end his inferior father class is warrior_casting_ddmagic but the warrior_casting_ddmagic inferior father class is warrior class warrior_casting_ddmagic: warrior parameter_define_begin int DDMagic 1024257 parameter_define_end but DDMagic controls sends the condition looks how under in warrior did write certainly definitely may transform the such simple one double skill completes
eg3: Multiple skill multi- skills this also has with the AI in father class directly relates the skill which father class attribute class more certainly he returns are also more because is others achievement this no longer says duplicated him looks for everybody but under I simply says in direct transfer class AI the subclass 里加 controlled by direct transfer like parameter_define_begin int PhysicalSpecial1 xxxxxxxx int PhysicalSpecial2 xxxxxxxx int PhysicalSpecial3 xxxxxxxx int PhysicalSpecial4 xxxxxxxx parameter_define_end under to the skill sends the condition carries on compiles in NPCDATA transfers the direction certainly is npc_ai={[xxx];{[PhysicalSpecial1]=@xxx};{[PhysicalSpecial2]=@xxx};{[PhysicalSpecial3]=@xxxx};{[PhysicalSpecial4]=@xxxx}}corpse_time=7 no_sleep_mode=0 npc_end also may carry on new subclass and the father class between compilation achieves this effect! Course 1 PS: Transferred one everybody before familiar person some materials, but he now already did not study day 2, I only was the transmitter, thanked
pd:translated by google
|