![]() |
|
|
#1 |
|
Архивный участник
Join Date: Jun 2005
Posts: 93
|
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 |
|
|
|
|
#2 |
|
Архивный участник
Join Date: Feb 2005
Posts: 307
|
Interesting, nice.
|
|
|
|
|
#3 |
|
Архивный участник
Join Date: Feb 2006
Posts: 139
|
thx drake)
|
|
|
|
|
#4 |
|
Архивный участник
Join Date: Jun 2005
Posts: 93
|
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... |
|
|
|
|
#5 |
|
Архивный участник
Join Date: Feb 2005
Posts: 307
|
Did you compile this or write it as it is now?
|
|
|
|
|
#6 |
|
Архивный участник
Join Date: Jun 2005
Posts: 93
|
wrote manually. i don't like nasc and by manual "pseudoAsm" you can get a cleaner and more compact code...
|
|
|
|
|
#7 |
|
Архивный участник
Join Date: Feb 2006
Posts: 88
|
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. |
|
|
|
|
#8 |
|
Архивный участник
Join Date: Jun 2005
Posts: 143
|
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 |
|
|
|
|
#9 |
|
Архивный участник
Join Date: Feb 2005
Posts: 307
|
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. |
|
|
|
|
#10 |
|
Архивный участник
Join Date: Feb 2005
Posts: 705
|
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.
|
|
|
|
|
#11 |
|
Архивный участник
Join Date: Feb 2005
Posts: 307
|
I was thinking of patroling guards like on retail, just that they loot too
|
|
|
|
|
#12 | |
|
Архивный участник
Join Date: Jun 2005
Posts: 93
|
Quote:
|
|
|
|
|
|
#13 |
|
Архивный участник
Join Date: Feb 2006
Posts: 88
|
so it's not possible to obtain the loot from the npc like in other mmogs?
|
|
|
|
|
#14 |
|
Архивный участник
Join Date: Feb 2005
Posts: 307
|
Well, the NPC doesn't actually take ownership of the items, so I'm not sure on that one >.>
|
|
|
|
|
#15 |
|
Архивный участник
Join Date: Feb 2005
Posts: 307
|
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?
|
|
|
|
|
#16 |
|
Архивный участник
Join Date: Feb 2006
Posts: 88
|
most of the things i got from my decompiler project
or from ressourcetables inside nasc / server |
|
|
|
|
#17 |
|
Архивный участник
Join Date: Feb 2005
Posts: 307
|
Would you be willing to share that info? I'm interested ^^ Haven't done much AI work, but I'm very willing to start.
|
|
|
|
|
#18 | |
|
Архивный участник
Join Date: Feb 2005
Posts: 357
|
Quote:
|
|
|
|
|
|
#19 |
|
Архивный участник
Join Date: Jun 2005
Posts: 143
|
so did the numbers I said worked?
|
|
|
|
|
#20 |
|
Архивный участник
Join Date: Feb 2006
Posts: 88
|
hmm, the pets can loot too and the items go to their inventory, there have to be a way to get the inventory
|
|
|
|
|
#21 |
|
Архивный участник
Join Date: Oct 2005
Posts: 267
|
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);
}
}
|
|
|
|
|
#22 |
|
Архивный участник
Join Date: Oct 2005
Posts: 267
|
See handler GET_ITEM_FINISHED for deleting the item after the mob is done poicking it up
|
|
|
|
|
#23 |
|
Архивный участник
Join Date: Oct 2005
Posts: 267
|
Code:
DeleteItem1(myself, item, (OwnItemCount(myself, item))); |
|
|
|
|
#24 |
|
Архивный участник
Join Date: Oct 2005
Posts: 267
|
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);
}
}
|
|
|
|
|
#25 |
|
Архивный участник
Join Date: May 2005
Posts: 2,033
|
|
|
|
|
|