Post Pacific

Post Pacific (https://postpacific.loc-online.com/index.php)
-   Темы без сохранившегося раздела (https://postpacific.loc-online.com/forumdisplay.php?f=10001)
-   -   [small share] c4 no-pets ai (https://postpacific.loc-online.com/showthread.php?t=4490)

TuMBLer 20.05.2006 11:07

[small share] c4 no-pets ai
 
nonagro NPC
if u use on him s_food_for_wolves skill (need changes on skilldata) it will follow u and heal every 9 sec.

u can change type of heal
PS
im not a coder anyway. and C# for me is strange symbol :lol:

[align=left:096f6c0528]
Code:

class warrior_lc : warrior
{
parameter:
        int HealMagic = @s_npc_heal1;
        float Attack_DecayRatio = 6.6;
        float UseSkill_DecayRatio = 66000;

        float Attack_BoostValue = 500.0;
        float UseSkill_BoostValue = 100000.0;

handler:
        EventHandler CREATED()
        {               
                                Say("I'm  good ");
        }

        EventHandler NO_DESIRE()
        {
                AddMoveAroundDesire(5, 5);

        }

        EventHandler ATTACKED(attacker, damage)
        {
                AddFleeDesire(attacker, 50);
                Say("ouhh...");
        }

        EventHandler CLAN_ATTACKED(attacker, damage, i6)
        {
                AddFleeDesire(attacker, 50);
                Say("Why people so are severe?");
                Say("Please ! Leave us alone !");
        }
        EventHandler SEE_CREATURE(creature, i6)
        {
                AddFleeDesire(creature, 50);

        }
        EventHandler SPELLED(skill_name_id, speller, i5)
        {
                                if (skill_name_id == 524289)
                                {
                                        Say("Yammii...more");
                                        AddFollowDesire(speller, 20);
                                        AddTimerEx(200001, 1200000); //        20 min 1000 is 1 sec
                                        AddTimerEx(200002, 30000); //        30 sec                                        myself.c_ai0 = speller;
                                                if(speller.max_hp/2 > speller.hp)
                                                {
                                                        //Say("heall"); //debug
                                                        AddUseSkillDesire(speller, HealMagic, @ST_HEAL, @AMT_MOVE_TO_TARGET, 1000000);
                                                }
                                                else
                                                {
                                                        Say("you are good.");
                                                }
                                }
                                else
                                {
                                        Say("ouhh...");
                                }

        }

        EventHandler TIMER_FIRED_EX(speller, timer_id)
        {
                if (timer_id == 200002)
                {
                //Say("heall");//debug
                AddUseSkillDesire(myself.c_ai0, HealMagic, @ST_HEAL, @AMT_MOVE_TO_TARGET, 1000000);
                AddTimerEx(200002, 9000); //        9 sec
                }
                else if (timer_id == 200001)
                {
                //Say("despawn");// debug
                Despawn();
                }

        }
        EventHandler MY_DYING(c1)
        {

                       
                Say("NOOOO ! I'm so young ...!");

        }
}

[/align:096f6c0528]

Code:

class warrior_lc : warrior
parameter_define_begin
        int HealMagic 1040641
        float Attack_DecayRatio 6.600000
        float UseSkill_DecayRatio 660xx.xx0000
        float Attack_BoostValue 5xx.xx0000
        float UseSkill_BoostValue 1000xx.xx0000
parameter_define_end
handler 13        //  CREATED
        variable_begin
                "myself"
                "_choiceN"
                "_code"
                "_from_choice"
        variable_end

        shift_sp 1
S0.        "I'm  good  "
        push_string S0
        func_call 37        //  func[Say]
        shift_sp -1
        shift_sp -1
handler_end

handler 0        //  NO_DESIRE
        variable_begin
                "myself"
                "_choiceN"
                "_code"
                "_from_choice"
        variable_end

        shift_sp 1
        push_const 5
        push_const 5
        func_call 0        //  func[AddMoveAroundDesire]
        shift_sp -2
        shift_sp -1
handler_end

handler 1        //  ATTACKED
        variable_begin
                "attacker"
                "damage"
                "myself"
                "_choiceN"
                "_code"
                "_from_choice"
        variable_end

        shift_sp 1
        push_event        //  attacker
        push_const 36
        add
        fetch_i
        push_const 50
        func_call 6        //  func[AddFleeDesire]
        shift_sp -2
        shift_sp -1
        shift_sp 1
S1.        "ouhh..."
        push_string S1
        func_call 37        //  func[Say]
        shift_sp -1
        shift_sp -1
handler_end

handler 23        //  CLAN_ATTACKED
        variable_begin
                "attacker"
                "damage"
                "i6"
                "myself"
                "_choiceN"
                "_code"
                "_from_choice"
        variable_end

        shift_sp 1
        push_event        //  attacker
        push_const 36
        add
        fetch_i
        push_const 50
        func_call 6        //  func[AddFleeDesire]
        shift_sp -2
        shift_sp -1
        shift_sp 1
S2.        "Why people so are severe?"
        push_string S2
        func_call 37        //  func[Say]
        shift_sp -1
        shift_sp -1
        shift_sp 1
S3.        "Please ! Leave us alone !"
        push_string S3
        func_call 37        //  func[Say]
        shift_sp -1
        shift_sp -1
handler_end

handler 5        //  SEE_CREATURE
        variable_begin
                "creature"
                "i6"
                "myself"
                "_choiceN"
                "_code"
                "_from_choice"
        variable_end

        shift_sp 1
        push_event        //  creature
        push_const 68
        add
        fetch_i
        push_const 50
        func_call 6        //  func[AddFleeDesire]
        shift_sp -2
        shift_sp -1
handler_end

handler 2        //  SPELLED
        variable_begin
                "skill_name_id"
                "speller"
                "i5"
                "myself"
                "_choiceN"
                "_code"
                "_from_choice"
        variable_end

        push_event        //  skill_name_id
        push_const 120
        add
        fetch_i
        push_const 524289
        equal
        branch_false L1
L0
        shift_sp 1
S4.        "Yammii...more"
        push_string S4
        func_call 37        //  func[Say]
        shift_sp -1
        shift_sp -1
        shift_sp 1
        push_event        //  speller
        push_const 56
        add
        fetch_i
        push_const 20
        func_call 7        //  func[AddFollowDesire]
        shift_sp -2
        shift_sp -1
        shift_sp 1
        push_const 200001
        push_const 1200000
        func_call 28        //  func[AddTimerEx]
        shift_sp -2
        shift_sp -1
        shift_sp 1
        push_const 200002
        push_const 30000
        func_call 28        //  func[AddTimerEx]
        shift_sp -2
        shift_sp -1
        push_event        //  myself
        push_const 28
        add
        fetch_i        //  c_ai0
        push_const 2380
        add
        push_reg_sp
        fetch_i
        push_event        //  speller
        push_const 56
        add
        fetch_i
        assign
        shift_sp -1
        push_event        //  speller
        push_const 56
        add
        fetch_i        //  max_hp
        push_const 1000
        add
        fetch_d
        push_const 2
        div
        push_event        //  speller
        push_const 56
        add
        fetch_i        //  hp
        push_const 344
        add
        fetch_d
        greater
        branch_false L3
L2
        shift_sp 1
S5.        "heall"
        push_string S5
        func_call 37        //  func[Say]
        shift_sp -1
        shift_sp -1
        shift_sp 1
        push_event        //  speller
        push_const 56
        add
        fetch_i
        push_parameter HealMagic
        push_const 1
        push_const 1
        push_const 1000000
        func_call 10        //  func[AddUseSkillDesire]
        shift_sp -5
        shift_sp -1
        jump L4
L3
        shift_sp 1
S6.        "you are good."
        push_string S6
        func_call 37        //  func[Say]
        shift_sp -1
        shift_sp -1
L4
        jump L5
L1
        shift_sp 1
S7.        "ouhh...bliin"
        push_string S7
        func_call 37        //  func[Say]
        shift_sp -1
        shift_sp -1
L5
handler_end

handler 12        //  TIMER_FIRED_EX
        variable_begin
                "speller"
                "timer_id"
                "myself"
                "_choiceN"
                "_code"
                "_from_choice"
        variable_end

        push_event        //  timer_id
        push_const 176
        add
        fetch_i
        push_const 200002
        equal
        branch_false L7
L6
        shift_sp 1
S8.        "heall"
        push_string S8
        func_call 37        //  func[Say]
        shift_sp -1
        shift_sp -1
        shift_sp 1
        push_event        //  myself
        push_const 28
        add
        fetch_i        //  c_ai0
        push_const 2380
        add
        fetch_i
        push_parameter HealMagic
        push_const 1
        push_const 1
        push_const 1000000
        func_call 10        //  func[AddUseSkillDesire]
        shift_sp -5
        shift_sp -1
        shift_sp 1
        push_const 200002
        push_const 9000
        func_call 28        //  func[AddTimerEx]
        shift_sp -2
        shift_sp -1
        jump L8
L7
        push_event        //  timer_id
        push_const 176
        add
        fetch_i
        push_const 200001
        equal
        branch_false L10
L9
        shift_sp 1
S9.        "is4ezau"
        push_string S9
        func_call 37        //  func[Say]
        shift_sp -1
        shift_sp -1
        shift_sp 1
        func_call 175        //  func[Despawn]
        shift_sp -1
L10
L8
handler_end

handler 10        //  MY_DYING
        variable_begin
                "c1"
                "myself"
                "_choiceN"
                "_code"
                "_from_choice"
        variable_end

        shift_sp 1
S10.        "NOOOO ! I'm so young ...!"
        push_string S10
        func_call 37        //  func[Say]
        shift_sp -1
        shift_sp -1
handler_end

class_end


GamesX 20.05.2006 14:35

Thnx.

But...

To catch the patch he does have to create a special NPC?

I tried a lot to arrange these C4 Pets and I didn't have success until today!

See; https://postpacific.loc-online.com/f...r=asc&start=15

Thnx Again!

FidoW 20.05.2006 15:24

You dont need create a new npc, you can set this AI to any NPC througt //setai command .. or... spawn with npcpos (yes, u can set AI in npcpos.txt)

2Rain 22.05.2006 15:10

Cood idea!
But what about skilldata ("if u use on him s_food_for_wolves skill (need changes on skilldata)")?


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