Post Pacific  

Go Back   Post Pacific > Восстановленный архив > Темы без сохранившегося раздела

Notices

 
 
Thread Tools Search this Thread Display Modes
Old 16.04.2007, 16:15   #1
JotaC
Архивный участник
 
Join Date: Mar 2006
Posts: 69
Default [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 ^^
JotaC is offline  
Old 16.04.2007, 16:46   #2
alysia
Архивный участник
 
Join Date: Apr 2005
Posts: 151
Default

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
alysia is offline  
Old 16.04.2007, 16:51   #3
JotaC
Архивный участник
 
Join Date: Mar 2006
Posts: 69
Default

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~~
JotaC is offline  
Old 17.04.2007, 17:57   #4
ateh
Архивный участник
 
Join Date: Apr 2006
Posts: 118
Default

There is no such option. Unless you rewrite server exe..
ateh is offline  
Old 17.04.2007, 18:27   #5
JotaC
Архивный участник
 
Join Date: Mar 2006
Posts: 69
Default

So, you know if thats on the Exe or it is in AI?
JotaC is offline  
Old 17.04.2007, 18:44   #6
alysia
Архивный участник
 
Join Date: Apr 2005
Posts: 151
Default

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 ) and create for the AI a new handler called "See_new_item"
but that are all dreams just forget it
alysia is offline  
Old 17.04.2007, 20:20   #7
ateh
Архивный участник
 
Join Date: Apr 2006
Posts: 118
Default

npc can see item while it's beeing droped on ground, but it can't see items which were on ground already.
ateh is offline  
Old 18.04.2007, 12:06   #8
JotaC
Архивный участник
 
Join Date: Mar 2006
Posts: 69
Default

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
JotaC is offline  
Old 18.04.2007, 12:27   #9
Haygor
Архивный участник
 
Join Date: Apr 2006
Posts: 36
Default

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.
Haygor is offline  
Old 18.04.2007, 12:30   #10
JotaC
Архивный участник
 
Join Date: Mar 2006
Posts: 69
Default

Quote:
Originally Posted by Haygor View Post
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
JotaC is offline  
Old 18.04.2007, 12:41   #11
m4rk
Архивный участник
 
Join Date: Jan 2006
Posts: 607
Default

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.
m4rk is offline  
Old 18.04.2007, 12:48   #12
JotaC
Архивный участник
 
Join Date: Mar 2006
Posts: 69
Default

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.loc-online.com/f...item+inventory


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

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 18:49.