Post Pacific  

Go Back   Post Pacific > Восстановленный архив > Темы без сохранившегося раздела
FAQ Community Calendar Today's Posts Search

Notices

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 17.07.2006, 21:56   #1
Aikeleer
Архивный участник
 
Join Date: Jun 2005
Posts: 374
Default [Share] C4 Attacked handler (warrior-class) decompiled

Just a little thing for the other AI-coders out there. Creating a C4-AI decoder isn't that hard. This is old work, not entirely fixed. The pieces of the puzzle are there, you just gotta put them down the right way.

Also there are a few new functions in (CanAttack i.e). You can just comment those out or create a workaround if you don't have the C4 L2NPC.
Code:
 EventHandler ATTACKED(attacker, damage, f0, myself) {
    if ((attacker.is_pc != 0)  ||  IsInCategory(11, attacker.npc_class_id)) {
      f0 = 0;
      if (SetHateGroup >= 0) {
        if (IsInCategory(SetHateGroup, attacker.occupation)) {
          f0 = (f0+SetHateGroupRatio);
        }
      }
      if (attacker.occupation == SetHateOccupation) {
        f0 = (f0+SetHateOccupationRatio);
      }
      if (SetHateRace == attacker.race) {
        f0 = (f0+SetHateRaceRatio);
      }
      f0 = (((1.000000*damage)/(myself.sm.level+7))+((f0/100)*((1.000000*damage)/(myself.sm.level+7))));
      AddAttackDesire(attacker, 1, (f0*100));
    }
    if (IsNullCreature(myself.top_desire_target) == 0) {
      GetPathfindFailCount(myself);
      if ((myself > 10)  &&  (attacker == myself.top_desire_target)  &&  (FloatToInt(myself.sm.hp) != FloatToInt(myself.sm.max_hp))) {
        InstantTeleportInMyTerritory(myself.sm, FloatToInt(attacker.x), FloatToInt(attacker.y), FloatToInt(attacker.z));
      }
      if ((DistFromMe(myself.top_desire_target) > 40)) {
        if (CanAttack(myself.top_desire_target) == 1) {
          if ((attacker.is_pc != 0)  ||  IsInCategory(11, attacker.npc_class_id)) {
            f0 = 0;
            if (SetHateGroup >= 0) {
              if (IsInCategory(SetHateGroup, attacker.occupation)) {
                f0 = (f0+SetHateGroupRatio);
              }
            }
            if (attacker.occupation == SetHateOccupation) {
              f0 = (f0+SetHateOccupationRatio);
            }
            if (SetHateRace == attacker.race) {
              f0 = (f0+SetHateRaceRatio);
            }
            f0 = (((1.000000*damage)/(myself.sm.level+7))+((f0/100)*((1.000000*damage)/(myself.sm.level+7))));
            AddAttackDesire(attacker, 1, (f0*100));
          }
        }
        else {
          RemoveAttackDesire(myself.top_desire_target);
          if ((attacker.is_pc != 0)  ||  IsInCategory(11, attacker.npc_class_id)) {
            f0 = 0;
            if (SetHateGroup >= 0) {
              if (IsInCategory(SetHateGroup, attacker.occupation)) {
                f0 = (f0+SetHateGroupRatio);
              }
            }
            if (attacker.occupation == SetHateOccupation) {
              f0 = (f0+SetHateOccupationRatio);
            }
            if (SetHateRace == attacker.race) {
              f0 = (f0+SetHateRaceRatio);
            }
            f0 = (((1.000000*damage)/(myself.sm.level+7))+((f0/100)*((1.000000*damage)/(myself.sm.level+7))));
            AddAttackDesire(attacker, 1, (f0*100));
          }
        }
      }
    }
    super;
  }
Aikeleer is offline  
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 16:16.