Post Pacific

Post Pacific (https://postpacific.loc-online.com/index.php)
-   Темы без сохранившегося раздела (https://postpacific.loc-online.com/forumdisplay.php?f=10001)
-   -   About AI and NPC Skills... (https://postpacific.loc-online.com/showthread.php?t=1467)

krapno 16.08.2005 00:11

About AI and NPC Skills...
 
Hello,

i tried to understand this topic: https://postpacific.loc-online.com/f...light=tutorial

so i implemented antaras skills using that chinese tutorial but i would like to implement more than only 2 skills now
and i would like to set a % for each skill because with that tutorial our npc does 1st skill 1 time and uses only second skill when it is fighting...

Here some antaras screens: (C2)

http://biohazardl2.xlteam.net/screens/Shot00372.jpg
http://biohazardl2.xlteam.net/screens/Shot00373.jpg
http://biohazardl2.xlteam.net/screens/Shot00384.jpg
http://biohazardl2.xlteam.net/screens/Shot00386.jpg
http://biohazardl2.xlteam.net/screens/Shot00388.jpg
http://biohazardl2.xlteam.net/screens/Shot00389.jpg

Any help is welcome :)

Regards

Metalmurphy 16.08.2005 11:57

Aren't antaras skills working already? oO

Osito2Dancer 16.08.2005 12:47

There's a trick that consists on setting each skill as a different modifier. For instance, set 1º skill as [DDMagic], 2º as [Debuff] and so on.

Oso

krapno 16.08.2005 16:05

Quote:

Originally Posted by Osito2Dancer
There's a trick that consists on setting each skill as a different modifier. For instance, set 1º skill as [DDMagic], 2º as [Debuff] and so on.

Oso

Here what i did:

ai.obj
Code:

class antaras_final : warrior_aggressive_casting_curse
parameter_define_begin
        int DDMagic 1051137
parameter_define_end
handler 13        //  CREATED
        variable_begin
                "myself"
                "_choiceN"
                "_code"
                "_from_choice"
        variable_end

        push_event        //  myself
        push_const 28
        add
        fetch_i        //  i_ai0
        push_const 2336
        add
        push_reg_sp
        fetch_i
        push_const 0
        assign
        shift_sp -1
        call_super
handler_end

handler 1        //  ATTACKED
        variable_begin
                "attacker"
                "damage"
                "i1"
                "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 L4042
        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
L4042
        branch_false L4044
L4043
        push_event        //  i1
        push_const 196
        add
        push_reg_sp
        fetch_i
        shift_sp 1
        push_const 100
        func_call 55        //  func[Rand]
        shift_sp -1
        assign
        shift_sp -1
        shift_sp 1
        push_event        //  attacker
        push_const 36
        add
        fetch_i
        func_call 51        //  func[DistFromMe]
        shift_sp -1
        push_const 300
        greater
        push_reg_sp
        fetch_i
        branch_false L4045
        push_event        //  myself
        push_const 28
        add
        fetch_i        //  i_ai0
        push_const 2336
        add
        fetch_i
        push_const 0
        equal
        and
L4045
        branch_false L4047
L4046
        push_event        //  i1
        push_const 196
        add
        fetch_i
        push_const 80
        less
        branch_false L4049
L4048
        shift_sp 1
        push_parameter DDMagic
        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 L4050
        shift_sp 1
        push_parameter DDMagic
        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 L4050
        shift_sp 1
        push_parameter DDMagic
        func_call 160        //  func[Skill_InReuseDelay]
        shift_sp -1
        push_const 0
        equal
        and
L4050
        branch_false L4052
L4051
        shift_sp 1
        push_event        //  attacker
        push_const 36
        add
        fetch_i
        push_parameter DDMagic
        push_const 0
        push_const 1
        push_const 1000000
        func_call 10        //  func[AddUseSkillDesire]
        shift_sp -5
        shift_sp -1
L4052
        push_event        //  myself
        push_const 28
        add
        fetch_i        //  i_ai0
        push_const 2336
        add
        push_reg_sp
        fetch_i
        push_const 1
        assign
        shift_sp -1
L4049
        jump L4053
L4047
        shift_sp 1
        push_event        //  attacker
        push_const 36
        add
        fetch_i
        func_call 51        //  func[DistFromMe]
        shift_sp -1
        push_const 100
        greater
        push_reg_sp
        fetch_i
        branch_false L4054
        push_event        //  myself
        push_const 28
        add
        fetch_i        //  i_ai0
        push_const 2336
        add
        fetch_i
        push_const 0
        equal
        and
L4054
        branch_false L4056
L4055
        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
        push_reg_sp
        fetch_i
        branch_false L4057
        push_event        //  i1
        push_const 196
        add
        fetch_i
        push_const 70
        less
        and
L4057
        push_reg_sp
        fetch_i
        branch_true L4058
        push_event        //  i1
        push_const 196
        add
        fetch_i
        push_const 30
        less
        or
L4058
        branch_false L4060
L4059
        shift_sp 1
        push_parameter DDMagic
        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 L4061
        shift_sp 1
        push_parameter DDMagic
        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 L4061
        shift_sp 1
        push_parameter DDMagic
        func_call 160        //  func[Skill_InReuseDelay]
        shift_sp -1
        push_const 0
        equal
        and
L4061
        branch_false L4063
L4062
        shift_sp 1
        push_event        //  attacker
        push_const 36
        add
        fetch_i
        push_parameter DDMagic
        push_const 0
        push_const 1
        push_const 1000000
        func_call 10        //  func[AddUseSkillDesire]
        shift_sp -5
        shift_sp -1
L4063
        push_event        //  myself
        push_const 28
        add
        fetch_i        //  i_ai0
        push_const 2336
        add
        push_reg_sp
        fetch_i
        push_const 1
        assign
        shift_sp -1
L4060
        jump L4064
L4056
        push_event        //  i1
        push_const 196
        add
        fetch_i
        push_const 10
        less
        push_reg_sp
        fetch_i
        branch_false L4065
        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
        push_reg_sp
        fetch_i
        branch_false L4065
        push_event        //  myself
        push_const 28
        add
        fetch_i        //  i_ai0
        push_const 2336
        add
        fetch_i
        push_const 0
        equal
        and
L4065
        branch_false L4067
L4066
        shift_sp 1
        push_parameter DDMagic
        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 L4068
        shift_sp 1
        push_parameter DDMagic
        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 L4068
        shift_sp 1
        push_parameter DDMagic
        func_call 160        //  func[Skill_InReuseDelay]
        shift_sp -1
        push_const 0
        equal
        and
L4068
        branch_false L4070
L4069
        shift_sp 1
        push_event        //  attacker
        push_const 36
        add
        fetch_i
        push_parameter DDMagic
        push_const 0
        push_const 1
        push_const 1000000
        func_call 10        //  func[AddUseSkillDesire]
        shift_sp -5
        shift_sp -1
L4070
        push_event        //  myself
        push_const 28
        add
        fetch_i        //  i_ai0
        push_const 2336
        add
        push_reg_sp
        fetch_i
        push_const 1
        assign
        shift_sp -1
L4067
L4064
L4053
L4044
        call_super
handler_end

handler 23        //  CLAN_ATTACKED
        variable_begin
                "attacker"
                "damage"
                "i1"
                "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 L4071
        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 L4072
        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
L4072
        and
L4071
        branch_false L4074
L4073
        push_event        //  i1
        push_const 196
        add
        push_reg_sp
        fetch_i
        shift_sp 1
        push_const 100
        func_call 55        //  func[Rand]
        shift_sp -1
        assign
        shift_sp -1
        shift_sp 1
        push_event        //  attacker
        push_const 36
        add
        fetch_i
        func_call 51        //  func[DistFromMe]
        shift_sp -1
        push_const 100
        greater
        push_reg_sp
        fetch_i
        branch_false L4075
        push_event        //  myself
        push_const 28
        add
        fetch_i        //  i_ai0
        push_const 2336
        add
        fetch_i
        push_const 0
        equal
        and
L4075
        branch_false L4077
L4076
        push_event        //  i1
        push_const 196
        add
        fetch_i
        push_const 40
        less
        branch_false L4079
L4078
        shift_sp 1
        push_parameter DDMagic
        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 L4080
        shift_sp 1
        push_parameter DDMagic
        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 L4080
        shift_sp 1
        push_parameter DDMagic
        func_call 160        //  func[Skill_InReuseDelay]
        shift_sp -1
        push_const 0
        equal
        and
L4080
        branch_false L4082
L4081
        shift_sp 1
        push_event        //  attacker
        push_const 36
        add
        fetch_i
        push_parameter DDMagic
        push_const 0
        push_const 1
        push_const 1000000
        func_call 10        //  func[AddUseSkillDesire]
        shift_sp -5
        shift_sp -1
L4082
        push_event        //  myself
        push_const 28
        add
        fetch_i        //  i_ai0
        push_const 2336
        add
        push_reg_sp
        fetch_i
        push_const 1
        assign
        shift_sp -1
L4079
L4077
L4074
        call_super
handler_end

handler 5        //  SEE_CREATURE
        variable_begin
                "creature"
                "i1"
                "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 L4083
        shift_sp 1
        push_event        //  myself
        push_const 28
        add
        fetch_i        //  sm
        push_const 2400
        add
        fetch_i
        func_call 177        //  func[InMyTerritory]
        shift_sp -1
        and
L4083
        branch_false L4085
L4084
        push_event        //  i1
        push_const 196
        add
        push_reg_sp
        fetch_i
        shift_sp 1
        push_const 100
        func_call 55        //  func[Rand]
        shift_sp -1
        assign
        shift_sp -1
        shift_sp 1
        push_event        //  creature
        push_const 68
        add
        fetch_i
        func_call 51        //  func[DistFromMe]
        shift_sp -1
        push_const 100
        greater
        push_reg_sp
        fetch_i
        branch_false L4086
        push_event        //  myself
        push_const 28
        add
        fetch_i        //  i_ai0
        push_const 2336
        add
        fetch_i
        push_const 0
        equal
        and
L4086
        branch_false L4088
L4087
        push_event        //  i1
        push_const 196
        add
        fetch_i
        push_const 20
        less
        branch_false L4090
L4089
        shift_sp 1
        push_parameter DDMagic
        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 L4091
        shift_sp 1
        push_parameter DDMagic
        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 L4091
        shift_sp 1
        push_parameter DDMagic
        func_call 160        //  func[Skill_InReuseDelay]
        shift_sp -1
        push_const 0
        equal
        and
L4091
        branch_false L4093
L4092
        shift_sp 1
        push_event        //  creature
        push_const 68
        add
        fetch_i
        push_parameter DDMagic
        push_const 0
        push_const 1
        push_const 1000000
        func_call 10        //  func[AddUseSkillDesire]
        shift_sp -5
        shift_sp -1
L4093
        push_event        //  myself
        push_const 28
        add
        fetch_i        //  i_ai0
        push_const 2336
        add
        push_reg_sp
        fetch_i
        push_const 1
        assign
        shift_sp -1
L4090
L4088
L4085
        call_super
handler_end

class_end

npcdata.txt
Code:

npc_begin        boss        12211        [antaras]        level=70        exp=4296345xx.xx5        acquire_exp_rate=200        undying=0        can_be_attacked=1        acquire_sp=120000        race=dragon        sex=male        temper=100        safe_height=100        org_jump=15        skill_list={@s_full_magic_defence;@s_antaras_body;@s_dragon_weakness}        magic_list={}        max_item=50        item_make_list={}        corpse_make_list={}        additional_make_list={}        additional_make_multi_list={{{{[adena];225000;300000;100}};5};{{{[heavy_war_axe];1;1;25};{[dasparion's_staff];1;1;12};{[dark_elven_long_bow];1;1;25};{[sword_of_damascus];1;1;19};{[lancia];1;1;19}};5};{{{[divine_hose];1;1;25};{[divine_tunic];1;1;15};{[blessed_gloves];1;1;30};{[divine_boots];1;1;30}};5};{{{[adamantite_earing];1;1;35};{[adamantite_ring];1;1;45};{[adamantite_necklace];1;1;20}};5};{{{[scroll_of_escape_to_castle];1;9;35};{[silver_arrow];100;500;40};{[greater_healing_potion];1;9;25}};5}}        slot_chest=[]        slot_rhand=[]        slot_lhand=[]        base_attack_type=fist        base_can_penetrate=0        base_attack_range=40        base_damage_range={0;0;80;120}        base_rand_dam=30        str=84        int=76        dex=73        wit=70        con=71        men=80        hp_increase=10        mp_increase=3        org_hp_regen=800        org_mp_regen=2.1        ground_low={50;0;10}        ground_high={186;-30;30}        underwater_low={50;0;10}        underwater_high={0;0;30}        fly_low={0;0;10}        fly_high={0;-30;30}        float_low={0;0;10}        float_high={0;-30;30}        org_earshot=100        sight={0;0;2500;120;5}        agro_range=4096        org_hp=4520000        org_mp=747.8        base_defend=4800        base_magic_attack=1700        base_magic_defend=440        base_physical_attack=2833        physical_hit_modify=20        physical_avoid_modify=-18        base_attack_speed=206        base_reuse_delay=0        base_critical=4        magic_use_speed_modify=0        status={normal}        align=-4900        collision_radius=300        collision_height=300        category={}        clan={}        clan_help_range=300        guild={}        pledge={}        pledge_leader=0        alliance={}        alliance_leader=0        ignore_clan_list={}        ruler=0        ruling_domain={}        npc_ai={[antaras_final];{[DDMagic]=@s_antaras_fear};{[DeBuff]=@s_antaras_jump}}        corpse_time=14        no_sleep_mode=1        npc_end
With that code i have Antaras who active {[DDMagic]=@s_antaras_fear} only 1 time and after he only use {[DeBuff]=@s_antaras_jump} ...

I would like to set him in order he uses sometimes s_antaras_fear and sometimes s_antaras_jump ... and finally try with all his other skills:

[s_antaras_jump] = 1051137
[s_antaras_tail] = 1051393
[s_antaras_fear] = 1051649
[s_antaras_debuff] = 1051905
[s_antaras_mouth] = 1052161
[s_antaras_breath] = 1052417
[s_antaras_normal_attack] = 1052673
[s_antaras_normal_attack_ex] = 1052929

By default, npc_ai is set to antaras (ai_boss04_antaras) and there is only one parameter in that class "GM_ID" ... maybe the files i got are older than yours, by default antaras doesn't attack anybody anf i had to do //setai karik to active him...

Thanks for your help :)

Osito2Dancer 16.08.2005 18:08

Antharas works based on a condition: It only attacks if he's on his lair, and theres at least 3 people that have the antharas quest READY. In any other situation, it doesnt activate and sits still. Very well done, if you ask me xD.

Oso

krapno 16.08.2005 20:36

well, tx for ur answer about antaras, so u mean if all conditions are ok he will use all his skills ? how can i test that alone, anywhere and without quest conditon ??

so maybe antaras is a bad example, i would like to create a simple agressive class able to use more than 2 skills and in that class i would like to implement X skills that npc will use with a same %, i mean with 5 skills for example my npc will use Skill1 with 20% of chance or Skill2 with 20% of chance or Skill3 with 20% etc.

Tx :)


All times are GMT. The time now is 15:40.