View Full Version : [Share] Looter
nothing special, just a looter.
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
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...
Did you compile this or write it as it is now?
wrote manually. i don't like nasc and by manual "pseudoAsm" you can get a cleaner and more compact code...
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.
Alien003
19.03.2006, 13:18
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
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.
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.
I was thinking of patroling guards like on retail, just that they loot too :)
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 )
so it's not possible to obtain the loot from the npc like in other mmogs?
Well, the NPC doesn't actually take ownership of the items, so I'm not sure on that one >.>
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?
most of the things i got from my decompiler project
or from ressourcetables inside nasc / server
Would you be willing to share that info? I'm interested ^^ Haven't done much AI work, but I'm very willing to start.
so it's not possible to obtain the loot from the npc like in other mmogs?
i'm sure it can be coded.
Alien003
19.03.2006, 18:21
so did the numbers I said worked?
hmm, the pets can loot too and the items go to their inventory, there have to be a way to get the inventory ;)
Firedaemon
19.03.2006, 22:02
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.
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
19.03.2006, 22:05
See handler GET_ITEM_FINISHED for deleting the item after the mob is done poicking it up
Firedaemon
19.03.2006, 22:13
DeleteItem1(myself, item, (OwnItemCount(myself, item)));
Firedaemon
19.03.2006, 22:35
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
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);
}
}
toolpunk
19.03.2006, 22:35
@shawnmb
lookie-lookie (https://postpacific.mmorpg-game.online/forum/viewtopic.php?t=2519&highlight=) :D
i don't want to DELETE the item...
let the monster drop the picked up items on dying
do u found a way to enumerate the inventory?
btw - why do u set the AddGetItemDesire via timer?
set it on create with 15 (have to be more than the waypoint desire)
and the monster will pick up the item and continue with moving to next waypoint
(hmm, u like to double or triple post?)
Firedaemon
19.03.2006, 23:19
enumerate the inventory?
No, there is no function in the AI that I have seen from my investigations which will get items in inventory into an array which you could loop through. That is pretty much the only way it would be achievable I am thinking.
Can you elaborate on your statement "set it on create with 15"
(And yes, Im to lazy to hit the edit button on my first post :P)
@shawnmb
lookie-lookie (https://postpacific.mmorpg-game.online/forum/viewtopic.php?t=2519&highlight=) :D
Thanks ^^
Firedaemon
18.04.2006, 02:39
The SEE_ITEM handler is only envoked when a mob sees the actual items drop within its sight. The see_item handler should have actually been called "SEE_ITEM_DROP" because its the dropping action that gets the handler to envoke. The handler is not envoked if an item is sitting on the ground and the NPC passes by.
All items that the mobs pickup are dropped when they are killed. If you have cached set to auto delete unowned items on start, then those collected items will be deleted on the next cached restart.
Nice aspect of this, it's a when mob was killed, he drops all what he's pickup! :P
angelicmercer
24.04.2006, 07:00
i dont have any use for this at the moment but thanks for the share =)