Post Pacific

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

krapno 12.10.2005 09:48

Priest of Dawn/Dusk AI
 
Hello,

I need help with AI, i would like to make an AI for 7Signs quest registration :)

I have 6 Marks:

[dawn_seal_of_avarice] = 60101
[dawn_seal_of_gnosis] = 60102
[dawn_seal_of_strife] = 60103
[dusk_seal_of_avarice] = 60104
[dusk_seal_of_gnosis] = 60105
[dusk_seal_of_strife] = 60106

1) I would like in a 1st time learn how to make AI able to give 1 of those item to players (by a link in HTML)

2) I would like players able to get only 1 on those items. I mean HTML display a choice between 6 items and if i have 1 of the 6, NPC dont give me more or in other way i cannot get the list until i have 1 of those 6 items.

3) I would like players cannot choose a Dusk mark if they have a castle.

Tx in advance for any help :)

[localhost] 12.10.2005 10:16

I've already started to do this! Now learning AI programming, sometning already done! I'll share some code later, when i have to finish it (will take me few days).

krapno 12.10.2005 10:33

ok take your time, i try to do something on my side, i try to learn quest structure, i use "Find Sir Windawood" quest atm :D

[localhost] 12.10.2005 11:18

What exactly you don't understand in quests structure?

krapno 12.10.2005 12:00

Quote:

Originally Posted by [localhost
]What exactly you don't understand in quests structure?

i mean how to make a quest...

then i made something able to get quest items from NPC and i would like that NPC doesnt give that item if i have one yet and getting the item it cost 600 adenas, here a part of my code:

Code:

...
        push_event                // talker
        push_const 32
        add
        fetch_i
        push_const 60101        // (Item Given by NPC)
        push_const 1
        func_call 77                // func[GiveItem1]
        shift_sp -3
        shift_sp -1
        shift_sp 1
        push_event                // talker
...

Tx for help :)

TheOrder 12.10.2005 12:18

Krapno Download Hami's Tool Pach 1.3 maybe this will help you . Here is link :) Hami's Tools . Iff you manage to complete the 7 Sign maybe you will share it . Tnx in advance

krapno 12.10.2005 12:39

Quote:

Originally Posted by TheOrder
Krapno Download Hami's Tool Pach 1.3 maybe this will help you . Here is link :) Hami's Tools . Iff you manage to complete the 7 Sign maybe you will share it . Tnx in advance

tx for your answer but i have all about AI var/functions/handlers, what i need is how and when use them... atm i need to make a sort of:

Code:

if (item 60101 is owned) then
 dont give more
else
 give one item 60101
 take 600 adena
end

and that code give an item but i dunno how to implement conditions wit AI :?

Code:

  push_event      // talker
  push_const 32
  add
  fetch_i
  push_const 60101  // (Item Given by NPC)
  push_const 1
  func_call 77      // func[GiveItem1]
  shift_sp -3
  shift_sp -1
  shift_sp 1
  push_event      // talker

Regards :)

[localhost] 12.10.2005 12:47

Understood! I'm trying to do this! Just wait for my share, think it will help u!

2TheOrder PM me password for l2tools1.3 plz ij u know...

krapno 12.10.2005 13:18

Quote:

Originally Posted by Enishi
(23:48:19) (@hami) pass : datakey


[localhost] 12.10.2005 13:55

I'm blind) Sorry)

Sauron 12.10.2005 14:04

Quote:

Originally Posted by krapno
tx for your answer but i have all about AI var/functions/handlers, what i need is how and when use them... atm i need to make a sort of:

Code:

if (item 60101 is owned) then
 dont give more
else
 give one item 60101
 take 600 adena
end



[php:1:8dae0dd365] shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 60101
func_call 81 // func[OwnItemCount]
shift_sp -2
push_const 0
equal
push_reg_sp
fetch_i
branch_false L0
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 57
func_call 81 // func[OwnItemCount]
shift_sp -2
push_const 599
greater
and
L0
branch_false L2
L1
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 60101
push_const 1
func_call 77 // func[GiveItem1]
shift_sp -3
shift_sp -1
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 57
push_const 600
func_call 80 // func[DeleteItem1]
shift_sp -3
shift_sp -1
L2
[/php:1:8dae0dd365]

Kenster 12.10.2005 14:09

Kranpo, You also have to make sure

if(they have any mark)
do not allow buy
else if (they have no mark)
allow buy 1
else if (you own a castle)
allow only dawn mark
end.

krapno 12.10.2005 14:28

Tx a lot Sauron, i m gonna try this :)

so, does "shift_sp 1" mean "if" or something like that ?

Quote:

Originally Posted by Kenster
Kranpo, You also have to make sure

if(they have any mark)
do not allow buy
else if (they have no mark)
allow buy 1
else if (you own a castle)
allow only dawn mark
end.

Quote:

Originally Posted by krapno
3) I would like players cannot choose a Dusk mark if they have a castle.

:D next step Kenster :!:
i try to make it step by step to understand :wink:

Sauron 12.10.2005 15:01

nope shift_sp 1 is like "function begin"
shift_sp -3 "function has 3 vars"
shift_sp -1 "function ends"
and in the end, (equal, greater, less, not_equad, etc)

krapno 12.10.2005 15:39

ok it works fine :)

i need to get some lines explained please, here my ai:

Code:

...
L60150
        shift_sp 1
                push_event                //  talker
                push_const 32
                add
                fetch_i
                push_const 60101
                func_call 81                //  func[OwnItemCount]
                shift_sp -2

                push_const 0                //  if 0 item 60101 in pc inventory
                equal

                push_reg_sp                // ??
                fetch_i                        // ??

        branch_false L60152                //  if return false goto L60152

        shift_sp 1
                push_event                //  talker
                push_const 32
                add
                fetch_i
                push_const 57
                func_call 81                //  func[OwnItemCount]
                shift_sp -2

                push_const 599                //  if adenas > 599 in pc inventory
                greater

                and                        // ??

        branch_false L60152                //  if return false goto L60152
...

what does mean lines where i put // ?? please (push_reg_sp, fetch_i, and) ... does "and" mean that 2 functions are linked ?

Tx

ps: In other part, i have to check if pc has a castle but i dont find func to get that...

toolpunk 12.10.2005 19:06

Code:

shift_sp 1
    push_event    //  talker
    push_const 32
    add
    fetch_i
    push_const 60101
    func_call 81    //  func[OwnItemCount]
    shift_sp -2
    push_const 0
    equal
    push_reg_sp
    fetch_i
    branch_false L0
    shift_sp 1
    push_event    //  talker
    push_const 32
    add
    fetch_i
    push_const 57
    func_call 81    //  func[OwnItemCount]
    shift_sp -2
    push_const 599
    greater
    and
L0
    branch_false L2
L1
    shift_sp 1
    push_event    //  talker
    push_const 32
    add
    fetch_i
    push_const 60101
    push_const 1
    func_call 77    //  func[GiveItem1]
    shift_sp -3
    shift_sp -1
    shift_sp 1
    push_event    //  talker
    push_const 32
    add
    fetch_i
    push_const 57
    push_const 600
    func_call 80    //  func[DeleteItem1]
    shift_sp -3
    shift_sp -1
L2

im not sure... but:
the "and"...
does it mean that if the condition:
Code:

    shift_sp 1
    push_event    //  talker
    push_const 32
    add
    fetch_i
    push_const 57
    func_call 81    //  func[OwnItemCount]
    shift_sp -2
    push_const 599
    greater
    and
L0
    branch_false L2

is false L0 shall be executed and jumps to L2 then? and otherwise (condition is true) it just skips L0?

Sauron 12.10.2005 23:24

hmm look, think it this way.

when u use

push_reg_sp
fetch_i

then it will be replace by the 1st (and, or) u use.

so u have
[php:1:6cb3d588cd]
shift_sp 1 // function begins
push_event // talker - 1st var talker
push_const 32
add
fetch_i
push_const 60101 // 2nd var, const 60101 (item id)
func_call 81 // func[OwnItemCount]
shift_sp -2 // end 2 vars function

// note in this case there is no need for the shift_sp -1
// so far we have "OwnItemCount(talker, 60101)"

push_const 0 // pust const 0 :P
equal // this means function and value pushed has to be compared

// "if(OwnItemCount(talker, 60101) == 0)"

push_reg_sp // the if will continue
fetch_i
branch_false L0 // if return false it will jump to L0 else continue
shift_sp 1 // function begin
push_event // talker
push_const 32
add
fetch_i
push_const 57
func_call 81 // func[OwnItemCount]
shift_sp -2
push_const 599
greater
and // to write it like a nomal languaje, this should be where the "push_reg_sp; fetch_i" is

so we get

if(OwnItemCount(talker, 60101) == 0 && OwnItemCount(talker, 57) > 599)
{
..........
}
else
{
jump L0
}
[/php:1:6cb3d588cd]

krapno 13.10.2005 00:09

well, here my code updated including conditions following Sauron's instructions:

Get Mark 60101 if
- 0 mark owned (between 60101 to 60106)
- 600 adena (or more) owned

Code:

///////////////////////////////////////////////////////////////////////// Controls
L60150
        shift_sp 1
                push_event                //  talker
                push_const 32
                add
                fetch_i
                push_const 60101
                func_call 81                //  func[OwnItemCount]
                shift_sp -2
                push_const 0                //  if 0 item 60101 in pc inventory
                equal
                push_reg_sp
                fetch_i       
        branch_false L60152                //  if return false goto L60152
        shift_sp 1
                push_event                //  talker
                push_const 32
                add
                fetch_i
                push_const 60102
                func_call 81                //  func[OwnItemCount]
                shift_sp -2
                push_const 0                //  if 0 item 60102 in pc inventory
                equal
                push_reg_sp
                fetch_i       
        branch_false L60152                //  if return false goto L60152
        shift_sp 1
                push_event                //  talker
                push_const 32
                add
                fetch_i
                push_const 60103
                func_call 81                //  func[OwnItemCount]
                shift_sp -2
                push_const 0                //  if 0 item 60103 in pc inventory
                equal
                push_reg_sp
                fetch_i       
        branch_false L60152                //  if return false goto L60152
        shift_sp 1
                push_event                //  talker
                push_const 32
                add
                fetch_i
                push_const 60104
                func_call 81                //  func[OwnItemCount]
                shift_sp -2
                push_const 0                //  if 0 item 60104 in pc inventory
                equal
                push_reg_sp
                fetch_i       
        branch_false L60152                //  if return false goto L60152
        shift_sp 1
                push_event                //  talker
                push_const 32
                add
                fetch_i
                push_const 60105
                func_call 81                //  func[OwnItemCount]
                shift_sp -2
                push_const 0                //  if 0 item 60105 in pc inventory
                equal
                push_reg_sp
                fetch_i       
        branch_false L60152                //  if return false goto L60152
        shift_sp 1
                push_event                //  talker
                push_const 32
                add
                fetch_i
                push_const 60106
                func_call 81                //  func[OwnItemCount]
                shift_sp -2
                push_const 0                //  if 0 item 60106 in pc inventory
                equal
                push_reg_sp
                fetch_i       
        branch_false L60152                //  if return false goto L60152

        shift_sp 1
                push_event                //  talker
                push_const 32
                add
                fetch_i
                push_const 57
                func_call 81                //  func[OwnItemCount]
                shift_sp -2
                push_const 599                //  if adenas > 599 in pc inventory
                greater

                and                        // ??

        branch_false L60152                //  if return false goto L60152
///////////////////////////////////////////////////////////////////////// NPC Give Items
L60151
        shift_sp 1
                push_event                //  talker
                push_const 32
                add
                fetch_i
                push_const 60101
                push_const 1
                func_call 77                //  func[GiveItem1]
                shift_sp -3
                shift_sp -1
                shift_sp 1
                push_event                //  talker
                push_const 32
                add
                fetch_i
                push_const 57                //  adenas
                push_const 600                //  take 600 adenas
                func_call 80                //  func[DeleteItem1]
        shift_sp -3
        shift_sp -1

        shift_sp 1
                push_event                // talker
                push_const 32
                add
                fetch_i
                S60152.        "sevensign601_d.htm"        // Quest Description
                push_string S60152
                func_call 43                // func[ShowPage]
        shift_sp -2
        shift_sp -1

        shift_sp 1
                push_event                // talker
                push_const 32
                add
                fetch_i
                S60153.        "ItemSound.quest_accept"
                push_string S60153
                func_call 173                // func[SoundEffect]
        shift_sp -2
        shift_sp -1
L60152
        exit_handler
/////////////////////////////////////////////////////////////////////////

now we need to check castle condition in order to filter Dawn Marks...

in other part, if i set marks as "is_destruct=1" in order player can change if he made a mistake registering (should i ?), then if i do like that and i destruct the Mark, quest memo stay ... then i need to delete that memo with the mark... i dunno how to do it too.

finally, will i have to delete automatically all marks owned each 2 weeks ? because i cannot use MSSQL Agent do to that, it doesnt work in real time, it only deletes in databases, not in Cache :? well maybe u know a way to delete items in real time to all players who own it/them ?

Regards

PS: Again tx a lot to Sauron for all explanations :)

toolpunk 13.10.2005 16:12

so the "and" makes ai check if both/all conditions are true?
means in this case the item to be given isnt already in the inventory and the player has to have more than 599 adena (so at least 600) in order to continue...
so otherwise it executes L0, right?
sorry if im confusing somebody with all this but i really wanna learn this and this is my desperate attempt to it :p

toolpunk 24.10.2005 20:51

ok thanks...
i understood it now...
must have been kinda blackout XD
sorry for disturbing. lol

xarion 22.01.2006 18:51

2 Krapno
Did you complete quest on 7 signs?
Can you share your files?

Flamestrike 22.01.2006 22:16

Why are you still breathing?

TheOrder 23.01.2006 00:55

I doubth you will get that fix , and one more thing i last saw Krapno 2 mounths ago . I think he kinda left the community , hope i am wrong and he will reply . Srry for the OFFTOPIC

Kenster 23.01.2006 02:13

And his c4 server shut down.


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