Post Pacific

Post Pacific (https://postpacific.loc-online.com/index.php)
-   Темы без сохранившегося раздела (https://postpacific.loc-online.com/forumdisplay.php?f=10001)
-   -   Help Ai (https://postpacific.loc-online.com/showthread.php?t=2693)

dar55 01.12.2005 01:33

Help Ai
 
I have this code
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
        and
        branch_false L7672

        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
L7672
L7670
        call_super
handler_end

If i kill 1 monster, then all good work. But, if kill many monsters, error...
12/01/2005 04:02:xx.xx1, Kicked for invalid items. (nick)(276)

Who know how fix this error?

kvoxi 01.12.2005 17:36

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 :)

dar55 02.12.2005 10:21

Quote:

Originally Posted by kvoxi
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 :)

<rus> что что? ниче не понял...хотя в принципе проблема решена уже, там всего то одна масенькая не правильность...и для справки, метка должна быть уникальна исключительно в одном хандлере,т.е. по другому говоря, если эта метка уже где то используется, ничего в этом страшного ;)<rus>

kvoxi 03.12.2005 10:57

Quote:

Originally Posted by dar55
...хотя в принципе проблема решена уже, там всего то одна масенькая не правильность...

How u resolve a problem? Pls, share.
From my experience: two sequential DeleteItem() calls cause client disconnect and L2server error: kicked for invalid items (items more than two in PC inventory)
<rus>Можешь поделиться как ты решил проблему? У меня два вызова подряд функции DeleteItem() вызывают kicked for invalid items, даже тогда когда итемов более двух. PS: в коде, что я привел в своем ответе нет оператора "and". Спасибо за инфу про ссылки<rus>

dar55 09.12.2005 01:09

Quote:

Originally Posted by kvoxi
Quote:

Originally Posted by dar55
...хотя в принципе проблема решена уже, там всего то одна масенькая не правильность...

How u resolve a problem? Pls, share.
From my experience: two sequential DeleteItem() calls cause client disconnect and L2server error: kicked for invalid items (items more than two in PC inventory)
<rus>Можешь поделиться как ты решил проблему? У меня два вызова подряд функции DeleteItem() вызывают kicked for invalid items, даже тогда когда итемов более двух. PS: в коде, что я привел в своем ответе нет оператора "and". Спасибо за инфу про ссылки<rus>

<rus> я решил проблему?) да я ее уже две недели пытаюсь решить)
короче если убивать по одному все отлично пашет. а вот если сразу несколько...) да и заметил еще такую ерунду, что если даже прокатывает убийство большого количества мобов и не кикает, все равно последнее действие это deleteitem. То что я написал выше, что проблема решена, это я погорячился)<rus>

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  //  level
        push_const 888
        add
        fetch_i
        push_const 60
        less_equal
        branch_false L900610
L900499
        push_event        //  c1
        push_const 276
        add
        fetch_i 
        push_const 2336  //id i_ai0
        add
        push_reg_sp
        fetch_i
        shift_sp 1
        push_const 400   
        func_call 55  //  func[Rand]
        shift_sp -1
        assign   
        shift_sp -1

L900500
        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 1
        equal
        branch_true L900511
L900501
        shift_sp 1
        push_event  //  c1
        push_const 276
        add
        fetch_i
        push_const 4630
        func_call 81  //  func[OwnItemCount]
        shift_sp -2
        push_const 1
        equal
        branch_true L900512
L900502
        shift_sp 1
        push_event  //  c1
        push_const 276
        add
        fetch_i
        push_const 4631
        func_call 81  //  func[OwnItemCount]
        shift_sp -2
        push_const 1
        equal
        branch_true L900513
L900503
        shift_sp 1
        push_event  //  c1
        push_const 276
        add
        fetch_i
        push_const 4632
        func_call 81  //  func[OwnItemCount]
        shift_sp -2
        push_const 1
        equal
        branch_true L900514
L900504
        shift_sp 1
        push_event  //  c1
        push_const 276
        add
        fetch_i
        push_const 4633
        func_call 81  //  func[OwnItemCount]
        shift_sp -2
        push_const 1
        equal
        branch_true L900515
L900505
        shift_sp 1
        push_event  //  c1
        push_const 276
        add
        fetch_i
        push_const 4634
        func_call 81  //  func[OwnItemCount]
        shift_sp -2
        push_const 1
        equal
        branch_true L900516
L900506
        shift_sp 1
        push_event  //  c1
        push_const 276
        add
        fetch_i
        push_const 4635
        func_call 81  //  func[OwnItemCount]
        shift_sp -2
        push_const 1
        equal
        branch_true L900517
L900507
        shift_sp 1
        push_event  //  c1
        push_const 276
        add
        fetch_i
        push_const 4636
        func_call 81  //  func[OwnItemCount]
        shift_sp -2
        push_const 1
        equal
        branch_true L900518
L900508
        shift_sp 1
        push_event  //  c1
        push_const 276
        add
        fetch_i
        push_const 4637
        func_call 81  //  func[OwnItemCount]
        shift_sp -2
        push_const 1
        equal
        branch_true L900519
L900509
        shift_sp 1
        push_event  //  c1
        push_const 276
        add
        fetch_i
        push_const 4638
        func_call 81  //  func[OwnItemCount]
        shift_sp -2
        push_const 1
        equal
        branch_true L900520

        jump 900610
L900511
        push_event        //  c1
        push_const 276
        add
        fetch_i  //  i_ai0
        push_const 2336
        add
        fetch_i
        push_const 41
        less
        branch_true L900525

        push_event        //  c1
        push_const 276
        add
        fetch_i  //  i_ai0
        push_const 2336
        add
        fetch_i
        push_const 395
        greater
        branch_true L900526
        jump L900610
L900512
        push_event        //  c1
        push_const 276
        add
        fetch_i  //  i_ai0
        push_const 2336
        add
        fetch_i
        push_const 39
        less
        branch_true L900527

        push_event        //  c1
        push_const 276
        add
        fetch_i  //  i_ai0
        push_const 2336
        add
        fetch_i
        push_const 394
        greater
        branch_true L900528
        jump L900610
L900513
        push_event        //  c1
        push_const 276
        add
        fetch_i  //  i_ai0
        push_const 2336
        add
        fetch_i
        push_const 37
        less
        branch_true L900529

        push_event        //  c1
        push_const 276
        add
        fetch_i  //  i_ai0
        push_const 2336
        add
        fetch_i
        push_const 393
        greater
        branch_true L900530
        jump L900610
L900514
        push_event        //  c1
        push_const 276
        add
        fetch_i  //  i_ai0
        push_const 2336
        add
        fetch_i
        push_const 35
        less
        branch_true L900531

        push_event        //  c1
        push_const 276
        add
        fetch_i  //  i_ai0
        push_const 2336
        add
        fetch_i
        push_const 392
        greater
        branch_true L900532
        jump L900610
L900515
        push_event        //  c1
        push_const 276
        add
        fetch_i  //  i_ai0
        push_const 2336
        add
        fetch_i
        push_const 33
        less
        branch_true L900533

        push_event        //  c1
        push_const 276
        add
        fetch_i  //  i_ai0
        push_const 2336
        add
        fetch_i
        push_const 391
        greater
        branch_true L900534
        jump L900610
L900516

        push_event        //  c1
        push_const 276
        add
        fetch_i  //  i_ai0
        push_const 2336
        add
        fetch_i
        push_const 31
        less
        branch_true L900535

        push_event        //  c1
        push_const 276
        add
        fetch_i  //  i_ai0
        push_const 2336
        add
        fetch_i
        push_const 390
        greater
        branch_true L900536
        jump L900610
L900517
        push_event        //  c1
        push_const 276
        add
        fetch_i  //  i_ai0
        push_const 2336
        add
        fetch_i
        push_const 26
        less
        branch_true L900537

        push_event        //  c1
        push_const 276
        add
        fetch_i  //  i_ai0
        push_const 2336
        add
        fetch_i
        push_const 389
        greater
        branch_true L900538
        jump L900610
L900518
        push_event        //  c1
        push_const 276
        add
        fetch_i  //  i_ai0
        push_const 2336
        add
        fetch_i
        push_const 23
        less
        branch_true L900539

        push_event        //  c1
        push_const 276
        add
        fetch_i  //  i_ai0
        push_const 2336
        add
        fetch_i
        push_const 388
        greater
        branch_true L900540
        jump L900610
L900519
        push_event        //  c1
        push_const 276
        add
        fetch_i  //  i_ai0
        push_const 2336
        add
        fetch_i
        push_const 20
        less
        branch_true L900541

        push_event        //  c1
        push_const 276
        add
        fetch_i  //  i_ai0
        push_const 2336
        add
        fetch_i
        push_const 387
        greater
        branch_true L900542
        jump L900610
L900520
        push_event        //  c1
        push_const 276
        add
        fetch_i  //  i_ai0
        push_const 2336
        add
        fetch_i
        push_const 16
        less
        branch_true L900543

        push_event        //  c1
        push_const 276
        add
        fetch_i  //  i_ai0
        push_const 2336
        add
        fetch_i
        push_const 386
        greater
        branch_true L900544
        jump L900610
L900525
        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
L900526
        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
        jump L900600 
L900527
        shift_sp 1
        push_event  //  c1
        push_const 276
        add
        fetch_i
        push_const 4631
        push_const 1
        func_call 77  //  func[GiveItem1]
        shift_sp -3
        shift_sp -1
L900528
        shift_sp 1
        push_event  //  c1
        push_const 276
        add
        fetch_i
        push_const 4630
        push_const 1
        func_call 80  //  func[DeleteItem1]
        shift_sp -3
        shift_sp -1
        jump L900600
L900529
        shift_sp 1
        push_event  //  c1
        push_const 276
        add
        fetch_i
        push_const 4632
        push_const 1
        func_call 77  //  func[GiveItem1]
        shift_sp -3
        shift_sp -1
L900530
        shift_sp 1
        push_event  //  c1
        push_const 276
        add
        fetch_i
        push_const 4631
        push_const 1
        func_call 80  //  func[DeleteItem1]
        shift_sp -3
        shift_sp -1
        jump L900600
L900531
        shift_sp 1
        push_event  //  c1
        push_const 276
        add
        fetch_i
        push_const 4633
        push_const 1
        func_call 77  //  func[GiveItem1]
        shift_sp -3
        shift_sp -1
L900532
        shift_sp 1
        push_event  //  c1
        push_const 276
        add
        fetch_i
        push_const 4632
        push_const 1
        func_call 80  //  func[DeleteItem1]
        shift_sp -3
        shift_sp -1
        jump L900600
L900533
        shift_sp 1
        push_event  //  c1
        push_const 276
        add
        fetch_i
        push_const 4634
        push_const 1
        func_call 77  //  func[GiveItem1]
        shift_sp -3
        shift_sp -1
L900534
        shift_sp 1
        push_event  //  c1
        push_const 276
        add
        fetch_i
        push_const 4633
        push_const 1
        func_call 80  //  func[DeleteItem1]
        shift_sp -3
        shift_sp -1
        jump L900600
L900535
        shift_sp 1
        push_event  //  c1
        push_const 276
        add
        fetch_i
        push_const 4635
        push_const 1
        func_call 77  //  func[GiveItem1]
        shift_sp -3
        shift_sp -1
L900536
        shift_sp 1
        push_event  //  c1
        push_const 276
        add
        fetch_i
        push_const 4634
        push_const 1
        func_call 80  //  func[DeleteItem1]
        shift_sp -3
        shift_sp -1
        jump L900600
L900537
        shift_sp 1
        push_event  //  c1
        push_const 276
        add
        fetch_i
        push_const 4636
        push_const 1
        func_call 77  //  func[GiveItem1]
        shift_sp -3
        shift_sp -1
L900538
        shift_sp 1
        push_event  //  c1
        push_const 276
        add
        fetch_i
        push_const 4635
        push_const 1
        func_call 80  //  func[DeleteItem1]
        shift_sp -3
        shift_sp -1
        jump L900600
L900539
        shift_sp 1
        push_event  //  c1
        push_const 276
        add
        fetch_i
        push_const 4637
        push_const 1
        func_call 77  //  func[GiveItem1]
        shift_sp -3
        shift_sp -1
L900540
        shift_sp 1
        push_event  //  c1
        push_const 276
        add
        fetch_i
        push_const 4636
        push_const 1
        func_call 80  //  func[DeleteItem1]
        shift_sp -3
        shift_sp -1
        jump L900600
L900541
        shift_sp 1
        push_event  //  c1
        push_const 276
        add
        fetch_i
        push_const 4638
        push_const 1
        func_call 77  //  func[GiveItem1]
        shift_sp -3
        shift_sp -1
L900542
        shift_sp 1
        push_event  //  c1
        push_const 276
        add
        fetch_i
        push_const 4637
        push_const 1
        func_call 80  //  func[DeleteItem1]
        shift_sp -3
        shift_sp -1
        jump L900600
L900543
        shift_sp 1
        push_event  //  c1
        push_const 276
        add
        fetch_i
        push_const 4639
        push_const 1
        func_call 77  //  func[GiveItem1]
        shift_sp -3
        shift_sp -1
L900544
        shift_sp 1
        push_event  //  c1
        push_const 276
        add
        fetch_i
        push_const 4638
        push_const 1
        func_call 80  //  func[DeleteItem1]
        shift_sp -3
        shift_sp -1
        jump L900600
L900600

        shift_sp 1
        push_event        //  c1
        push_const 276
        add
        fetch_i
S99087.        "ItemSound.quest_middle"
        push_string S99087
        func_call 173        //  func[SoundEffect]
        shift_sp -2
        shift_sp -1
L900610
        call_super
handler_end


toolpunk 09.12.2005 08:21

digital...
could you please re-add the specific language sections.
this here is pretty annoying. :(
and i guess im not the only one who feels so...

Truffe 09.12.2005 09:39

+1 :mrgreen:


All times are GMT. The time now is 15:39.