Post Pacific

Post Pacific (https://postpacific.mmorpg-game.online/index.php)
-   Темы без сохранившегося раздела (https://postpacific.mmorpg-game.online/forumdisplay.php?f=10001)
-   -   [Help] Npcs Auto Attacking & Item Disappear, How? (https://postpacific.mmorpg-game.online/showthread.php?t=7369)

JotaC 16.04.2007 16:15

[Help] Npcs Auto Attacking & Item Disappear, How?
 
Hi all,

Well.. some day i searched about this but today i searched again and found nothing -.-"

My questions are:

[Solved, Ty alysia] 1- How make city (citizen) Npc's attack the players with a skill if the players attack it?

[Changed, Not Solved] 2- How to make drops go directly to player inventory?

I am using C4 Retail =)

Thats all, sorry for the incovinience =P
Ty all ^^

alysia 16.04.2007 16:46

1) You can add in the citizen AI a small attack code but be careful you have to test it because some AI must be change after it (for example the Bingo chest from the Clan Level 4 quest)



this is for the citizen AI
There is a random value because I think that sometime it can be also a mistake that a player attack a NPC so there is only a 30% chance that the NPC cast the skill (just change it)

Code:

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

        push_event        //  gg
        push_const 632
        add
        fetch_i
        push_const 100
        func_call 218169344        //  func[Rand]
        shift_sp -1
        push_const 30
        less
        branch_false L4829800
L4829001
        push_event        //  myself
        push_const 704
        add
        fetch_i
        push_event        //  attacker
        push_const 48
        add
        fetch_i
        push_const add_skill_here
        push_const 0
        push_const 1
        push_const 1000000
        func_call 184877074        //  func[AddUseSkillDesire]
        shift_sp -5
        shift_sp -1
L4829800
        call_super
handler_end
class_end


to the second thing I can't help you because I have also no idea about this, I think this must be coded but you must also obey that when a player dies he can be really mad when his weapon/armor disapear after 60seconds on the ground :D

JotaC 16.04.2007 16:51

Tanks, well.. not my problem, its a pvp server i dont care if the weapon disappear, they only die for other players and i dont think others players will let the weapon on the ground =D~~

ateh 17.04.2007 17:57

There is no such option. Unless you rewrite server exe.. :)

JotaC 17.04.2007 18:27

So, you know if thats on the Exe or it is in AI?

alysia 17.04.2007 18:44

don't think it is AI because the NPC-Server doesn't care for items on the ground (and he can't see them)

maybe you teach the npc-server (hex :D) and create for the AI a new handler called "See_new_item"
but that are all dreams :) just forget it

ateh 17.04.2007 20:20

npc can see item while it's beeing droped on ground, but it can't see items which were on ground already.

JotaC 18.04.2007 12:06

Ok, great, Then its possible to make the itens that mobs drop go directly to players inventory?

That would be much better =)

Once again ty for the support =P

Haygor 18.04.2007 12:27

You wanting an auto-loot feature, only way I know of to do this would be to use a hook on l2server.exe and custom write it. GL with that.

JotaC 18.04.2007 12:30

Quote:

Originally Posted by Haygor (Post 84147)
You wanting an auto-loot feature, only way I know of to do this would be to use a hook on l2server.exe and custom write it. GL with that.

i was thiking that that was in AI.. since Quest itens go directy to inventory, cant we use the same function to normal itens? i mean then the itens appear directly in players inventory =O

m4rk 18.04.2007 12:41

yes, you just have to write it in AI and make a logic for party drops... or you could check if it's a party and make it drop the item instead of giving it to inventory.

JotaC 18.04.2007 12:48

Well.. i found this but i dont really know if it can help me, cause i dont have any idea in how to use it:

Code:

EventHandler SEE_ITEM(item)
  {
      if (debug == 1) { Say("SEE_ITEM Handler Fired");}
     
      if (myself.c_ai0 <= 0)
      {
        myself.c_ai0 = item;
        AddTimerEx(100002, 120000);
      }
      else if (myself.c_ai1 <= 0)
      {
        myself.c_ai1 = item;
        AddTimerEx(100003, 120000);
      }
      else if (myself.c_ai2 <= 0)
      {
        myself.c_ai2 = item;
        AddTimerEx(100004, 120000);
      }
      else if (myself.c_ai3 <= 0)
      {
        myself.c_ai3 = item;
        AddTimerEx(100005, 120000);
      }
      else if (myself.c_ai4 <= 0)
      {
        myself.c_ai4 = item;
        AddTimerEx(100006, 120000);
      }
      else
      {// just pick it up
        AddGetItemDesire(item, 10);
      }
  }
 
  EventHandler GET_ITEM_FINISHED(item)
  {
      if (debug == 1) { Say("GET_ITEM_FINISHED Handler Fired");}
     
      Say("The item belongs to me now!");
     
      if (myself.c_ai0 == item)
      {
        myself.c_ai0 = 0;
      }
      else if (myself.c_ai1 == item)
      {
        myself.c_ai1 = 0;
      }
      else if (myself.c_ai2 == item)
      {
        myself.c_ai2 = 0;
      }
      else if (myself.c_ai3 == item)
      {
        myself.c_ai3 = 0;
      }
      else if (myself.c_ai4 == item)
      {
        myself.c_ai4 = 0;
      }

      DeleteItem1(myself, item, (OwnItemCount(myself, item)));
  }
 
  EventHandler MOVE_TO_WAY_POINT_FINISHED(way_point_index, next_way_point_index)
  {
      if (debug == 1) { Say("MOVE_TO_WAY_POINT_FINISHED Handler Fired");}
 
      myself.i_ai4 = next_way_point_index;

      AddTimerEx(100001, (GetWayPointDelay(varWayPointDelays, way_point_index)*1000));
  }
 
  EventHandler TIMER_FIRED_EX(timer_id)
  {
      if (debug == 1) { Say("TIMER_FIRED_EX Handler Fired");}
 
      if (timer_id == 100001)
      {
        if (myself.i_ai4 > 0)
        {
            AddMoveToWayPointDesire(varWayPoints, varWayPointDelays, myself.i_ai4, 10);
        }
        else
        {
            AddMoveToWayPointDesire(varWayPoints, varWayPointDelays, 1, 10);
        }
      }
      else if (timer_id == 100002)
      {
        AddGetItemDesire(myself.c_ai0, 10);
      }
      else if (timer_id == 100003)
      {
        AddGetItemDesire(myself.c_ai1, 10);
      }
      else if (timer_id == 100004)
      {
        AddGetItemDesire(myself.c_ai2, 10);
      }
      else if (timer_id == 100005)
      {
        AddGetItemDesire(myself.c_ai3, 10);
      }
      else if (timer_id == 100006)
      {
        AddGetItemDesire(myself.c_ai4, 10);
      }
  }

I get this form here: https://postpacific.mmorpg-game.onli...item+inventory


Any help with this will be greatfully apreciated, tanks all.


All times are GMT. The time now is 22:31.