Post Pacific  

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

Notices

 
 
Thread Tools Search this Thread Display Modes
Old 19.03.2006, 12:20   #1
drugolo
Архивный участник
 
Join Date: Jun 2005
Posts: 93
Default [Share] Looter

nothing special, just a looter.

Code:
class warrior_looter : warrior
handler 7	//  SEE_ITEM
	variable_begin
		"item"
		"myself"
		"_choiceN"
		"_code"
		"_from_choice"
	variable_end

	shift_sp 1
	push_event	//  item
	push_const 76
	add
	fetch_i
	push_const 10
	func_call 4	//  func[AddGetItemDesire]
	shift_sp -2
	shift_sp -1
	call_super
handler_end
drugolo is offline  
Old 19.03.2006, 12:27   #2
Shawnmb
Архивный участник
 
Join Date: Feb 2005
Posts: 307
Default

Interesting, nice.
Shawnmb is offline  
Old 19.03.2006, 12:31   #3
rar
Архивный участник
 
Join Date: Feb 2006
Posts: 139
Default

thx drake)
rar is offline  
Old 19.03.2006, 12:33   #4
drugolo
Архивный участник
 
Join Date: Jun 2005
Posts: 93
Default

someone knows the structure of the item object? ( CSharedItemData )
because if you do

if item == 57

it will not work ( item is an object ) then means there should be something like item.class_id or something like that but there is no documentation about...
drugolo is offline  
Old 19.03.2006, 12:36   #5
Shawnmb
Архивный участник
 
Join Date: Feb 2005
Posts: 307
Default

Did you compile this or write it as it is now?
Shawnmb is offline  
Old 19.03.2006, 13:00   #6
drugolo
Архивный участник
 
Join Date: Jun 2005
Posts: 93
Default

wrote manually. i don't like nasc and by manual "pseudoAsm" you can get a cleaner and more compact code...
drugolo is offline  
Old 19.03.2006, 13:03   #7
Xellos
Архивный участник
 
Join Date: Feb 2006
Posts: 88
Default

u can compile it with:
[php:1:e1a31c9568].
class warrior_loot : warrior
{
handler:
EventHandler SEE_ITEM(item)
{
AddGetItemDesire(item, 10);
super;
}

}
.[/php:1:e1a31c9568]
to get exactly this ai.obj snippet ^^

prob is to deal with the looted items
- how much items can such a looter carry
- what happens with the items
- only to pickup specific items
etc.
Xellos is offline  
Old 19.03.2006, 13:18   #8
Alien003
Архивный участник
 
Join Date: Jun 2005
Posts: 143
Default

humm ..try 272
or first 40 and then 272
or 44
or first 40 and then 44

...one of them should work ..give it a try and post results
Alien003 is offline  
Old 19.03.2006, 15:57   #9
Shawnmb
Архивный участник
 
Join Date: Feb 2005
Posts: 307
Default

The items collected by the NPC are still in the database, char_id = 0 so they should be cleared with the unkown items. Just fyi.

Has anyone gotten waypoints working properly? If you could combine this with waypoints it would be infinitely more useful.
Shawnmb is offline  
Old 19.03.2006, 16:11   #10
SoaPy
Архивный участник
 
Join Date: Feb 2005
Posts: 705
Default

mmmm better is with a delay, because if you are fighting with 2 or more mobs, you kill one of the mobs and the others will take your drops.
SoaPy is offline  
Old 19.03.2006, 16:13   #11
Shawnmb
Архивный участник
 
Join Date: Feb 2005
Posts: 307
Default

I was thinking of patroling guards like on retail, just that they loot too
Shawnmb is offline  
Old 19.03.2006, 16:36   #12
drugolo
Архивный участник
 
Join Date: Jun 2005
Posts: 93
Default

Quote:
Originally Posted by SoaPy
mmmm better is with a delay, because if you are fighting with 2 or more mobs, you kill one of the mobs and the others will take your drops.
Desire level is too much low if the mob is fighting ( 200 < 10 )
drugolo is offline  
Old 19.03.2006, 17:16   #13
Xellos
Архивный участник
 
Join Date: Feb 2006
Posts: 88
Default

so it's not possible to obtain the loot from the npc like in other mmogs?
Xellos is offline  
Old 19.03.2006, 17:18   #14
Shawnmb
Архивный участник
 
Join Date: Feb 2005
Posts: 307
Default

Well, the NPC doesn't actually take ownership of the items, so I'm not sure on that one >.>
Shawnmb is offline  
Old 19.03.2006, 17:21   #15
Shawnmb
Архивный участник
 
Join Date: Feb 2005
Posts: 307
Default

Sorry for the double post, but where do you guys get your referances to functions etc of uncompiled AI code? Is there a post somewhere I'm overlooking?
Shawnmb is offline  
Old 19.03.2006, 17:23   #16
Xellos
Архивный участник
 
Join Date: Feb 2006
Posts: 88
Default

most of the things i got from my decompiler project
or from ressourcetables inside nasc / server
Xellos is offline  
Old 19.03.2006, 17:25   #17
Shawnmb
Архивный участник
 
Join Date: Feb 2005
Posts: 307
Default

Would you be willing to share that info? I'm interested ^^ Haven't done much AI work, but I'm very willing to start.
Shawnmb is offline  
Old 19.03.2006, 17:56   #18
Sauron
Архивный участник
 
Join Date: Feb 2005
Posts: 357
Default

Quote:
Originally Posted by Xellos
so it's not possible to obtain the loot from the npc like in other mmogs?
i'm sure it can be coded.
Sauron is offline  
Old 19.03.2006, 18:21   #19
Alien003
Архивный участник
 
Join Date: Jun 2005
Posts: 143
Default

so did the numbers I said worked?
Alien003 is offline  
Old 19.03.2006, 18:41   #20
Xellos
Архивный участник
 
Join Date: Feb 2006
Posts: 88
Default

hmm, the pets can loot too and the items go to their inventory, there have to be a way to get the inventory
Xellos is offline  
Old 19.03.2006, 22:02   #21
Firedaemon
Архивный участник
 
Join Date: Oct 2005
Posts: 267
Default

This is how I am using it. Basically all my mobs now pickup drops not owned. You can also have the mob delete the item too simply by using the DeleteItem functions.

Code:
   EventHandler SEE_ITEM(item)
   {  
      myself.i_ai5 = item;
      
      AddTimerEx(100002, 60000);
   }

   EventHandler TIMER_FIRED_EX(timer_id)
   {   
      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.i_ai5, 10);
      }
   }
Firedaemon is offline  
Old 19.03.2006, 22:05   #22
Firedaemon
Архивный участник
 
Join Date: Oct 2005
Posts: 267
Default

See handler GET_ITEM_FINISHED for deleting the item after the mob is done poicking it up
Firedaemon is offline  
Old 19.03.2006, 22:13   #23
Firedaemon
Архивный участник
 
Join Date: Oct 2005
Posts: 267
Default

Code:
DeleteItem1(myself, item, (OwnItemCount(myself, item)));
Firedaemon is offline  
Old 19.03.2006, 22:35   #24
Firedaemon
Архивный участник
 
Join Date: Oct 2005
Posts: 267
Default

Here is the complete code "untested" which works on a timer to support up to 5 simutaneous items seen by the mob as well as with a 120 second delay on picking up the item. It also deletes the item after it is picked up.

Should work in theory, just needs to be tested. Waypoint code also included

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);
      }
   }
Firedaemon is offline  
Old 19.03.2006, 22:35   #25
toolpunk
Архивный участник
 
Join Date: May 2005
Posts: 2,033
Default

@shawnmb
lookie-lookie
toolpunk 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:28.