Post Pacific

Post Pacific (https://postpacific.mmorpg-game.online/index.php)
-   Lineage 2 Server Modifications ONLY! (https://postpacific.mmorpg-game.online/forumdisplay.php?f=28)
-   -   [SHARE] NASC class ai_boss01_queen_ant + fix (https://postpacific.mmorpg-game.online/showthread.php?t=4141)

humordwarf 22.04.2006 12:41

[SHARE] NASC class ai_boss01_queen_ant + fix
 
seems original AI.OBJ contain lot of errors and mistakes =(

here fixed handler for "queen ant" and below full class, decompiled to NASC-like syntax

Code:

class ai_boss01_queen_ant : default_npc
.....
cut
.....
handler 21        //  PARTY_DIED
        variable_begin
                "private"
                "myself"
                "_choiceN"
                "_code"
                "_from_choice"
        variable_end

        push_event        //  private
        push_const 44
        add
        fetch_i
        push_event        //  myself
        push_const 28
        add
        fetch_i        //  sm
        push_const 2400
        add
        fetch_i
        not_equal
        branch_false L2168
L2167
        shift_sp 1
        push_event        //  private
        push_const 44
        add
        fetch_i        //  npc_class_id
        push_const 1620
        add
        fetch_i
        push_event        //  private
        push_const 44
        add
        fetch_i        //  ai
        push_const 1336
        add
        fetch_i      // <<< === THIS OPCODE WAS MISSED ===
        push_event        //  private
        push_const 44
        add
        fetch_i        //  weight_point
        push_const 1624
        add
        fetch_i
        push_event        //  private
        push_const 44
        add
        fetch_i        //  respawn_time
        push_const 1628
        add
        fetch_i
        func_call 166        //  func[CreateOnePrivate]
        shift_sp -4
        shift_sp -1
L2168
handler_end

Code:

class ai_boss01_queen_ant : default_npc {

  parameter:

  string Privates = "nurse_ant:nurse_ant:2:10sec;nurse_ant:nurse_ant:2:10sec;nurse_ant:nurse_ant:2:10sec;
  ;royal_guard_ant:royal_guard_ant:1:20sec;royal_guard_ant:royal_guard_ant:1:20sec ;
  ;royal_guard_ant:royal_guard_ant:1:20sec;royal_guard_ant:royal_guard_ant:1:20sec" ;
  float Attack_DecayRatio = 6.600000;
  float UseSkill_DecayRatio = 660xx.xx0000;
  float Attack_BoostValue = 5xx.xx0000;
  float UseSkill_BoostValue = 1000xx.xx0000;

  handler:

  EventHandler NO_DESIRE() {
    AddDoNothingDesire(40, 5);
  }
  // 1 functions called (1+0)


  EventHandler CREATED(myself) {
    if (Rand(100) < 33) {
      InstantTeleportInMyTerritory(-19480, 187344, -5600, 200);
    }
    else {
      if (Rand(100) < 50) {
        InstantTeleportInMyTerritory(-17928, 180912, -5520, 200);
      }
      else {
        InstantTeleportInMyTerritory(-23808, 182368, -5600, 200);
      }
    }
    myself.sm.weight_point = 10;
    CreatePrivates(Privates);
    AddTimerEx(1001, 10000);
  }
  // 7 functions called (5+2)


  EventHandler TIMER_FIRED_EX(myself, timer_id) {
    if (timer_id == 1001) {
      if ((Rand(100) < 30)  &&  (myself.p_state == 1)) {
        if (Rand(100) < 50) {
          AddEffectActionDesire(myself.sm, 3, ((50*1000)/30), 30);
        }
        else {
          AddEffectActionDesire(myself.sm, 4, ((50*1000)/30), 30);
        }
      }
      AddTimerEx(1001, 10000);
    }
    super;
  }
  // 5 functions called (3+2)


  EventHandler PARTY_DIED(_private, myself) {
    if (_private != myself.sm) {
      CreateOnePrivate(_private.npc_class_id, _private.ai, _private.weight_point, _private.respawn_time);
    }
  }
  // 1 functions called (1+0)


  EventHandler ATTACKED(attacker, damage, myself, skill_name_id) {
    if ((attacker.is_pc != 0)  ||  IsInCategory(9, attacker.npc_class_id)) {
      if ((Skill_GetAttribute(skill_name_id) == 12)  &&  (Rand(100) < 70)  &&  InMyTerritory(attacker)) {
        if ((Skill_GetConsumeMP(@s_queen_ant_strike) < myself.sm.mp)  &&  (Skill_GetConsumeHP(@s_queen_ant_strike) < myself.sm.hp)  &&  (Skill_InReuseDelay(@s_queen_ant_strike) == 0)) {
          AddUseSkillDesire(attacker, @s_queen_ant_strike, 0, 1, 1000000);
        }
      }
      else {
        if ((DistFromMe(attacker) > 500)  &&  (Rand(100) < 10)) {
          if ((Skill_GetConsumeMP(@s_queen_ant_strike) < myself.sm.mp)  &&  (Skill_GetConsumeHP(@s_queen_ant_strike) < myself.sm.hp)  &&  (Skill_InReuseDelay(@s_queen_ant_strike) == 0)) {
            AddUseSkillDesire(attacker, @s_queen_ant_strike, 0, 0, 1000000);
          }
        }
        else {
          if ((DistFromMe(attacker) > 150)  &&  (Rand(100) < 10)) {
            if (Rand(100) < 80) {
              if ((Skill_GetConsumeMP(@s_queen_ant_strike) < myself.sm.mp)  &&  (Skill_GetConsumeHP(@s_queen_ant_strike) < myself.sm.hp)  &&  (Skill_InReuseDelay(@s_queen_ant_strike) == 0)) {
                AddUseSkillDesire(attacker, @s_queen_ant_strike, 0, 0, 1000000);
              }
            }
            else {
              if ((Skill_GetConsumeMP(@s_queen_ant_sprinkle) < myself.sm.mp)  &&  (Skill_GetConsumeHP(@s_queen_ant_sprinkle) < myself.sm.hp)  &&  (Skill_InReuseDelay(@s_queen_ant_sprinkle) == 0)) {
                AddUseSkillDesire(attacker, @s_queen_ant_sprinkle, 0, 0, 1000000);
              }
            }
          }
          else {
            if (Rand(100) < 5) {
              if ((Skill_GetConsumeMP(@s_queen_ant_brandish) < myself.sm.mp)  &&  (Skill_GetConsumeHP(@s_queen_ant_brandish) < myself.sm.hp)  &&  (Skill_InReuseDelay(@s_queen_ant_brandish) == 0)) {
                AddUseSkillDesire(myself.sm, @s_queen_ant_brandish, 0, 1, 1000000);
              }
            }
            else {
              if (Rand(100) < 5) {
                AddEffectActionDesire(myself.sm, 1, ((60*1000)/30), 3000000);
              }
            }
          }
        }
      }
      if ((attacker.is_pc != 0)  ||  IsInCategory(9, attacker.npc_class_id)) {
        AddAttackDesire(attacker, 0, (((((damage/myself.sm.max_hp)/0.050000)*damage)*myself.sm.weight_point)*1000));
      }
    }
  }
  // 34 functions called (7+27)


  EventHandler PARTY_ATTACKED(_private, attacker, damage, myself) {
    if ((attacker.is_pc != 0)  ||  IsInCategory(9, attacker.npc_class_id)  &&  (_private != myself.sm)) {
      if ((DistFromMe(attacker) > 500)  &&  (Rand(100) < 5)) {
        if ((Skill_GetConsumeMP(@s_queen_ant_strike) < myself.sm.mp)  &&  (Skill_GetConsumeHP(@s_queen_ant_strike) < myself.sm.hp)  &&  (Skill_InReuseDelay(@s_queen_ant_strike) == 0)) {
          AddUseSkillDesire(attacker, @s_queen_ant_strike, 0, 0, 1000000);
        }
      }
      else {
        if ((DistFromMe(attacker) > 150)  &&  (Rand(100) < 5)) {
          if (Rand(100) < 80) {
            if ((Skill_GetConsumeMP(@s_queen_ant_strike) < myself.sm.mp)  &&  (Skill_GetConsumeHP(@s_queen_ant_strike) < myself.sm.hp)  &&  (Skill_InReuseDelay(@s_queen_ant_strike) == 0)) {
              AddUseSkillDesire(attacker, @s_queen_ant_strike, 0, 0, 1000000);
            }
          }
          else {
            if ((Skill_GetConsumeMP(@s_queen_ant_sprinkle) < myself.sm.mp)  &&  (Skill_GetConsumeHP(@s_queen_ant_sprinkle) < myself.sm.hp)  &&  (Skill_InReuseDelay(@s_queen_ant_sprinkle) == 0)) {
              AddUseSkillDesire(attacker, @s_queen_ant_sprinkle, 0, 0, 1000000);
            }
          }
        }
        else {
          if (Rand(100) < 2) {
            if ((Skill_GetConsumeMP(@s_queen_ant_brandish) < myself.sm.mp)  &&  (Skill_GetConsumeHP(@s_queen_ant_brandish) < myself.sm.hp)  &&  (Skill_InReuseDelay(@s_queen_ant_brandish) == 0)) {
              AddUseSkillDesire(myself.sm, @s_queen_ant_brandish, 0, 1, 1000000);
            }
          }
        }
      }
      if ((attacker.is_pc != 0)  ||  IsInCategory(9, attacker.npc_class_id)) {
        AddAttackDesire(attacker, 0, (((((damage/myself.sm.max_hp)/0.050000)*damage)*_private.weight_point)*1000));
      }
    }
  }
  // 25 functions called (5+20)


  EventHandler CLAN_ATTACKED(attacker, damage, myself) {
    if ((attacker.is_pc != 0)  ||  IsInCategory(9, attacker.npc_class_id)) {
      if ((DistFromMe(attacker) > 500)  &&  (Rand(100) < 3)) {
        if ((Skill_GetConsumeMP(@s_queen_ant_strike) < myself.sm.mp)  &&  (Skill_GetConsumeHP(@s_queen_ant_strike) < myself.sm.hp)  &&  (Skill_InReuseDelay(@s_queen_ant_strike) == 0)) {
          AddUseSkillDesire(attacker, @s_queen_ant_strike, 0, 0, 1000000);
        }
      }
      else {
        if ((DistFromMe(attacker) > 150)  &&  (Rand(100) < 3)) {
          if (Rand(100) < 80) {
            if ((Skill_GetConsumeMP(@s_queen_ant_strike) < myself.sm.mp)  &&  (Skill_GetConsumeHP(@s_queen_ant_strike) < myself.sm.hp)  &&  (Skill_InReuseDelay(@s_queen_ant_strike) == 0)) {
              AddUseSkillDesire(attacker, @s_queen_ant_strike, 0, 0, 1000000);
            }
          }
          else {
            if ((Skill_GetConsumeMP(@s_queen_ant_sprinkle) < myself.sm.mp)  &&  (Skill_GetConsumeHP(@s_queen_ant_sprinkle) < myself.sm.hp)  &&  (Skill_InReuseDelay(@s_queen_ant_sprinkle) == 0)) {
              AddUseSkillDesire(attacker, @s_queen_ant_sprinkle, 0, 0, 1000000);
            }
          }
        }
        else {
          if (Rand(100) < 2) {
            if ((Skill_GetConsumeMP(@s_queen_ant_brandish) < myself.sm.mp)  &&  (Skill_GetConsumeHP(@s_queen_ant_brandish) < myself.sm.hp)  &&  (Skill_InReuseDelay(@s_queen_ant_brandish) == 0)) {
              AddUseSkillDesire(myself.sm, @s_queen_ant_brandish, 0, 1, 1000000);
            }
          }
        }
      }
      if ((attacker.is_pc != 0)  ||  IsInCategory(9, attacker.npc_class_id)) {
        AddAttackDesire(attacker, 0, (((damage/myself.sm.max_hp)/0.050000)*500));
      }
    }
  }
  // 25 functions called (5+20)


  EventHandler SEE_SPELL(myself, skill_name_id, speller) {
    if ((Skill_GetEffectPoint(skill_name_id) > 0)  &&  (Rand(100) < 15)) {
      if ((Skill_GetConsumeMP(@s_queen_ant_strike) < myself.sm.mp)  &&  (Skill_GetConsumeHP(@s_queen_ant_strike) < myself.sm.hp)  &&  (Skill_InReuseDelay(@s_queen_ant_strike) == 0)) {
        AddUseSkillDesire(speller, @s_queen_ant_strike, 0, 0, 1000000);
      }
    }
  }
  // 6 functions called (1+5)


  EventHandler OUT_OF_TERRITORY() {
    RemoveAllAttackDesire();
  }
  // 1 functions called (1+0)

}


humordwarf 22.04.2006 13:16

for full picture

Code:

class ai_boss01_nurse_ant : default_npc {

  parameter:

  float Attack_DecayRatio = 6.600000;
  float UseSkill_DecayRatio = 660xx.xx0000;
  float Attack_BoostValue = 5xx.xx0000;
  float UseSkill_BoostValue = 1000xx.xx0000;

  handler:

  EventHandler NO_DESIRE(myself) {
    if (myself.boss.alive) {
      AddFollowDesire(myself.boss, 20);
    }
    else {
      AddMoveAroundDesire(40, 20);
    }
  }
  // 2 functions called (2+0)


  EventHandler PARTY_ATTACKED(_private, myself) {
    if (_private.npc_class_id == 1012001) {
      if ((DistFromMe(_private) > 2500)  &&  (myself.p_state == 10)  &&  (myself.top_desire_target.npc_class_id == 1012002)) {
      }
      else {
        AddUseSkillDesire(_private, @s_heal_queen_ant1, 1, 1, 1000000);
      }
    }
  }
  // 2 functions called (1+1)


  EventHandler CLAN_ATTACKED(victim) {
    if (victim.npc_class_id == 1012002) {
      AddUseSkillDesire(victim, @s_heal_queen_ant1, 1, 1, 100);
      AddUseSkillDesire(victim, @s_heal_queen_ant2, 1, 1, 100);
    }
  }
  // 2 functions called (2+0)

}

Code:

class party_private : warrior {

  parameter:

  int DDMagic = 1;

  handler:

  EventHandler NO_DESIRE(myself) {
    if (myself.boss.alive) {
      AddFollowDesire(myself.boss, 5);
    }
    else {
      AddMoveAroundDesire(5, 5);
    }
  }
  // 2 functions called (2+0)


  EventHandler PARTY_ATTACKED(_private, attacker, damage, myself) {
    if ((attacker.is_pc != 0)  ||  IsInCategory(9, attacker.npc_class_id)) {
      AddAttackDesire(attacker, 1, (((((damage/myself.sm.max_hp)/0.050000)*damage)*_private.weight_point)*10));
    }
  }
  // 2 functions called (1+1)


  EventHandler ATTACKED(attacker, damage, myself) {
    if (myself.boss.alive == 0) {
      if ((attacker.is_pc != 0)  ||  IsInCategory(9, attacker.npc_class_id)) {
        AddAttackDesire(attacker, 1, (((damage/myself.sm.max_hp)/0.050000)*100));
      }
    }
  }
  // 2 functions called (1+1)


  EventHandler CLAN_ATTACKED(attacker, damage, myself) {
    if ((myself.boss.alive == 0)  &&  (GetLifeTime() > 7)) {
      if ((attacker.is_pc != 0)  ||  IsInCategory(9, attacker.npc_class_id)) {
        AddAttackDesire(attacker, 1, (((damage/myself.sm.max_hp)/0.050000)*30));
      }
    }
  }
  // 3 functions called (1+2)


  EventHandler SEE_SPELL(myself, skill_name_id, speller) {
    if (myself.boss.alive == 0) {
      if (Skill_GetEffectPoint(skill_name_id) > 0) {
        AddAttackDesire(speller, 1, (((Skill_GetEffectPoint(skill_name_id)/myself.sm.max_hp)/0.050000)*150));
      }
    }
  }
  // 3 functions called (1+2)

}

Code:

class warrior : default_npc {

  parameter:

  float Attack_DecayRatio = 6.600000;
  float UseSkill_DecayRatio = 660xx.xx0000;
  float Attack_BoostValue = 3xx.xx0000;
  float UseSkill_BoostValue = 1000xx.xx0000;
  int MoveAroundSocial = 0;
  int ShoutMsg1 = 0;
  int ShoutMsg2 = 0;
  int ShoutMsg3 = 0;
  int ShoutMsg4 = 0;

  handler:

  EventHandler NO_DESIRE() {
    AddMoveAroundDesire(5, 5);
  }
  // 1 functions called (1+0)


  EventHandler CREATED() {
    if (ShoutMsg1 > 0) {
      Shout(MakeFString(ShoutMsg1, "", "", "", "", ""));
    }
    if ((MoveAroundSocial > 0)  ||  (ShoutMsg2 > 0)  ||  (ShoutMsg3 > 0)) {
      AddTimerEx(1001, 10000);
    }
  }
  // 3 functions called (2+1)


  EventHandler TIMER_FIRED_EX(myself, timer_id) {
    if (timer_id == 1001) {
      if ((myself.p_state == 1)  ||  (myself.p_state == 2)  ||  (myself.p_state == 9)) {
        if ((MoveAroundSocial > 0)  &&  (Rand(100) < 20)) {
          AddEffectActionDesire(myself.sm, 1, ((MoveAroundSocial*1000)/30), 50);
        }
        if ((ShoutMsg2 > 0)  &&  (Rand(1000) < 17)) {
          Shout(MakeFString(ShoutMsg2, "", "", "", "", ""));
        }
      }
      else {
        if (myself.p_state == 3) {
          if ((ShoutMsg3 > 0)  &&  (Rand(100) < 10)) {
            Shout(MakeFString(ShoutMsg3, "", "", "", "", ""));
          }
        }
      }
      AddTimerEx(1001, 10000);
    }
    super;
  }
  // 9 functions called (4+5)


  EventHandler ATTACKED(attacker, damage, myself) {
    if ((attacker.is_pc != 0)  ||  IsInCategory(9, attacker.npc_class_id)) {
      AddAttackDesire(attacker, 1, (((damage/myself.sm.max_hp)/0.050000)*100));
    }
  }
  // 2 functions called (1+1)


  EventHandler CLAN_ATTACKED(attacker, damage, myself) {
    if (GetLifeTime() > 7) {
      if ((attacker.is_pc != 0)  ||  IsInCategory(9, attacker.npc_class_id)) {
        AddAttackDesire(attacker, 1, (((damage/myself.sm.max_hp)/0.050000)*30));
      }
    }
  }
  // 3 functions called (1+2)


  EventHandler SEE_SPELL(myself, skill_name_id, speller) {
    if (Skill_GetEffectPoint(skill_name_id) > 0) {
      AddAttackDesire(speller, 1, (((Skill_GetEffectPoint(skill_name_id)/myself.sm.max_hp)/0.050000)*150));
    }
  }
  // 3 functions called (1+2)


  EventHandler DESIRE_MANIPULATION(desire, speller) {
    MakeAttackEvent(speller, desire, 0);
  }
  // 1 functions called (1+0)


  EventHandler MY_DYING() {
    if ((ShoutMsg4 > 0)  &&  (Rand(100) < 30)) {
      Shout(MakeFString(ShoutMsg4, "", "", "", "", ""));
    }
  }
  // 3 functions called (1+2)

}


humordwarf 22.04.2006 13:38

some details

nurse_ant (ai=ai_boss01_nurse_ant) - party healers. when patry attacked - they heal attacked npc

royal_guard_ant (ai=party_private) - party fighters. attacks all players (and summons) who attack party members or use skills against party (e.g. heals attackers)

Validator 22.04.2006 14:34

Humo, can u post here AI for all NPC - for attack summon by default.
-rus- Можешь сделать так - чтобы все агро мобы атаковали саммонеров, а не стояли на месте - пока их саммонер не ударит?

humordwarf 22.04.2006 21:55

Quote:

Originally Posted by Validator
Humo, can u post here AI for all NPC - for attack summon by default.
-rus- Можешь сделать так - чтобы все агро мобы атаковали саммонеров, а не стояли на месте - пока их саммонер не ударит?

SEE_CREATURE handler called only on players, but not on summons and other NPCs. i do not know how to fix it.

Mattho 23.04.2006 00:04

can't summon have some "passive hate skill"?

humordwarf 23.04.2006 13:15

Quote:

Originally Posted by Mattho
can't summon have some "passive hate skill"?

i think "hate" cant be passive


All times are GMT. The time now is 23:27.