Thread: Help Ai
View Single Post
Old 01.12.2005, 17:36   #2
kvoxi
Архивный участник
 
Join Date: Oct 2005
Posts: 102
Default

Try this
Code:
handler 10   //  MY_DYING 
   variable_begin 
      "c1" 
      "myself" 
      "_choiceN" 
      "_code" 
      "_from_choice" 
   variable_end 

   push_event   //  c1 
   push_const 276 
   add 
   push_reg_sp 
   fetch_i 
   shift_sp 1 
   func_call 83   //  func[GetLastAttacker] 
   assign 
   shift_sp -1 

   shift_sp 1 
   push_event   //  c1 
   push_const 276 
   add 
   fetch_i 
   push_const 4629 
   func_call 81   //  func[OwnItemCount] 
   shift_sp -2 
   push_const 0 
   equal 
   branch_false L<N>

   shift_sp 1 
   push_event   //  c1 
   push_const 276 
   add 
   fetch_i 
   push_const 4630 
   push_const 1 
   func_call 77   //  func[GiveItem1] 
   shift_sp -3 
   shift_sp -1 

   shift_sp 1 
   push_event   //  c1 
   push_const 276 
   add 
   fetch_i 
   push_const 4629 
   push_const 1 
   func_call 80   //  func[DeleteItem1] 
   shift_sp -3 
   shift_sp -1 
L<N>
   call_super 
handler_end
L<N> - must be unique
If u kill many mobs simultaneously, OwnItemCount() will return the items amount to all mobs handler. If mobs count > items count, then ur AI code will try to delete an nonexistent item => error. IMHO
To check the OwnItemCount(), DeleteItem1() func`s work, try this:
...
c1=GetLastAttacker();
SayInt(OwnItemCount(c1));
DeleteItem1(c1,...);
SayInt(OwnItemCount(c1));
...
U should get the same value after both SayInt(OwnItemCount(c1)) functions execution.
IMHO, CacheD.exe
kvoxi is offline