Post Pacific

Post Pacific (https://postpacific.mmorpg-game.online/index.php)
-   Lineage 2 Server Modifications ONLY! (https://postpacific.mmorpg-game.online/forumdisplay.php?f=28)
-   -   [SHARE][TUTORIAL]AI.OBJ (https://postpacific.mmorpg-game.online/showthread.php?t=2367)

RmzVoid 20.12.2005 02:26

Quote:

Originally Posted by toolpunk
i think it needs to be absolutely unique in the whole ai.obj...
at least it wont hurt lol :D

LXXX SXXX may be unique whole each class. I use this in my ai.obj and have no problems.


Question:

class some_class1 : default_npc
handler 32 // MENU_SELECTED
variable_begin
"talker"
"ask"
"reply"
"myself"
"_choiceN"
"_code"
"_from_choice"
variable_end
....
handler_end
class_end

class some_class2 : some_class1
handler 32 // MENU_SELECTED
variable_begin
"talker"
"ask"
"reply"
"myself"
"_choiceN"
"_code"
"_from_choice"
variable_end
....
call_super
handler_end
class_end

npc_ai={[some_class2]}

in some_class2 I process this URL menu_select?ask=2&reply=10
in some_class1 I process menu_select?ask=2&reply=11

If user press second URL, ask and reply in some_class1 equal to 2 and 11? Or call_super not pass parameters?

kvoxi 20.12.2005 17:03

Quote:

Originally Posted by RmzVoid
If user press second URL, ask and reply in some_class1 equal to 2 and 11? Or call_super not pass parameters?

Class inheritance (from parent to child):
some_class2 <- some_class1 <- default_npc
Event data proccessing flow (from child to parent):
some_class2 -> some_class1 -> default_npc
ASK & REPLY - is EVENT structure variables
If u will pass ask&reply pair to the some_class2 menu_selected handler, it is possible to process EVENT values in menu_selected handler of every parent class.

"call_super" never pass the parameters from child to parent class
--
sorry for my english, learn russian lang

RmzVoid 20.12.2005 21:30

Quote:

Originally Posted by kvoxi
ASK & REPLY - is EVENT structure variables
If u will pass ask&reply pair to the some_class2 menu_selected handler, it is possible to process EVENT values in menu_selected handler of every parent class.

sorry for my english, learn russian lang

that is all I want ot know :)

зачем мне учить русский? если я русский ))) в школе на 4 окончил ))))))

filrip 20.12.2005 21:42

call_super keep the parameter in the function

is you have MENU_SELECTED(talker,ask,reply)
and do a "call_super", all variables "talker", "ask" & "reply" will have correct value, not reset to 0 in the child.


AddDoNothingDesire do nothing, right. In fact it stop to do something, like attack or move. and EventHandler NO_DESIRE is called.

kvoxi 21.12.2005 06:59

Quote:

Originally Posted by filrip
AddDoNothingDesire do nothing, right. In fact it stop to do something, like attack or move. and EventHandler NO_DESIRE is called.

AddDoNothing... change NPC desire state. Its not same as "keep parameters"
Maybe, call_super pass parameters to funcs of parent classes. Ask AI lang developers about it :)

RmzVoid 21.12.2005 11:12

kvoxi, filrip wrote 2 different things. One about parameters (I asked) and 2nd about func AddNothingDesire (asked somethere above) ))

kvoxi 15.01.2006 20:24

This is complete list of C1 L2NPC.exe AI functions (my first work with IDA)

Mabus 17.01.2006 21:42

<rus>Пишу квест на страйдера. такой вот вопрос: у плеера получающего квест должен быть дракончик 55 лвл или выше тогда ему можно разрешить пройти квест на страйдера.... как узнать лвл имеющего в инвентаре дракона? или например лвл заточки вещи?</rus>

toolpunk 17.01.2006 21:47

very nice share :)
i love it...
looks very complete and informative...
thx kvoxi

kvoxi 17.01.2006 23:45

This is event variables list
Maybe StaticVoid want add some info.
He was promise to do it :)

TheOrder 18.01.2006 07:23

Tnx for the AI functions kvoxi , realy helpfull !!!

toolpunk 18.01.2006 08:57

very nice info again...
however static left us some time ago...
he visits the forum once in a while but doesnt post anymore :(

2Rain 19.01.2006 02:24

push_const 1003
func_call 65 // func[GetOneTimeQuestFlag]

This is string for 1-time quest.
How make 2-time quest (not multi)?

PS: I see... Need make dual checking in each for 1-time quest. If first checking returns (quest complete)? than go to checking2.

So, if ch1 & ch2 not conmleted - may jump to run quest.
If ch1 completed - jump ch2. If ch2 not completed - may jump to run quest.
If ch1 & ch2 are completed - jump ti "Go to asshole, dude!" :lol:

Special thanks to kvoxi for представленную инфу. :wink:

PPS: I think, in this case must found 2 different Quest ID.

kvoxi 19.01.2006 19:01

Quote:

Originally Posted by 2Rain
PPS: I think, in this case must found 2 different Quest ID.

I think too
But, i have some idea. I need a check. I will post results later

kvoxi 20.01.2006 16:11

Quote:

Originally Posted by kvoxi
But, i have some idea. I need a check. I will post results later

i got this results:
SetOneTimeQuestFlag(creature, quest_id, flag)
flag=GetOneTimeQuestFlag(creature, quest_id)
flag=[0,1]

There is QuestFlag_bitmask.
How it works (C-like language):

SetOneTimeQuestFlag():
flag<>0: creature.QuestFlag_bitmask |= 1 << quest_id;
flag==0: creature.QuestFlag_bitmask &= ~(1 << quest_id);

GetOneTimeQuestFlag():
(creature.QuestFlag_bitmask & 1 << quest_id) ? 1:0;

If quest_id <0 or quest_id > 255, then u get error.
ONLY quests with ID>=0 && ID<=255 can have a OneTimeQuestFlag
Conclusion: Set|GetOneTimeQuestFlag() functions is not usefull for making 2-time quest.

Try to use SetMemoState|GetMemoState functions.
good luck

SlayerX 20.01.2006 19:35

very nice :P

RmzVoid 25.01.2006 12:40

wtf
 
class citizen
{
EventHandler TALKED(talker)
{
ShowPage(talker,"sm_hi.htm");
}
}

class sample : citizen
{
handler:
EventHandler TALK_SELECTED(talker)
{
if ( _from_choice == 0 )
{
//Do something
}
if ( _from_choice == 1 )
{
//Do something 2
}
}

EventHandler MENU_SELECTED(talker, ask ,reply)
{
if(ask == 2)
{
if ( reply == 33 )
{
AddChoice(2,"choice 0 2");
AddChoice(3,"choice 0 2");
ShowChoicePage(talker,0);
}
if ( reply == 34 )
{
AddChoice(6,"choice 1 6");
AddChoice(7,"choice 1 7");
ShowChoicePage(talker,1);
}
}
}

When I select reply 34, I see list of choices and then press on one choice I enter in TALK_SELECTED handler and normally exec "if ( _from_choice == 1 ){..}" block. But if I select reply 33 I also see appropriate choices, but not enter to TALK_SELECTED handler then i select one of choice, I just see sm_hi.htm page again. Can anybody help me? How use ShowChoicePage func?

kvoxi 25.01.2006 21:28

Re: wtf
 
Quote:

Originally Posted by RmzVoid
Can anybody help me? How use ShowChoicePage func?

IMHO:
ShowChoicePage(crature, from_choice);
The call ShowChoicePage(talker,0) set _from_choice to 0;

RmzVoid 26.01.2006 00:26

My post explains thet is not.
ShowChoicePage (talker,2) also not works. I mean if ( _from_choce == 2 ) { ... }

kvoxi 26.01.2006 07:10

Quote:

Originally Posted by RmzVoid
My post explains thet is not.
ShowChoicePage (talker,2) also not works. I mean if ( _from_choce == 2 ) { ... }

ShowChoicePage(talker, option)
What is "option" - i dont know
All choices must be processed by TALK_SELECTED handler in <if(_from_choice==1) {...}> branch

PS:
func ShowChoicePage pass the user HTML like:
<HTML><BODY>
<a action="bypass -h quest_choice?choice="<Choice_1>"&option="<Option>" >["<Choice_1 string>"]</a>
...
<a action="bypass -h quest_choice?choice="<Choice_N>"&option="<Option>" >["<Choice_N string>"]</a>

</BODY></HTML>

RmzVoid 26.01.2006 09:10

so maybe use choice & option variables?
Or you mean
<a action="bypass -h quest_choice?_from_choice=2&_code=3">["<Choice_1 string>"]</a>
?

kvoxi 26.01.2006 10:18

Quote:

Originally Posted by RmzVoid
so maybe use choice & option variables?
Or you mean
<a action="bypass -h quest_choice?_from_choice=2&_code=3">["<Choice_1 string>"]</a>
?

I mean
<a action="bypass -h quest_choice?choice="<Choice_1>"&option="<Option>" >["<Choice_1 string>"]</a>
and NOTHING ELSE!!!
Where u see "quest_choice?_from_choice=..." ???
no more comments...
PS:
in AI u mau use:
_from_choice (=1 if TALK_SELECTED handler process "bypass -h quest_choice" user request)
_code (=choice from HTML)

RmzVoid 26.01.2006 11:25

and what is it "_code" in your case?

Квохи ты че тупишь!
choice - нет такой переменной в АИ.обж
есть _from_choice _code и _ChoiceN

проведи аналогию
MENU_SELECTED ask,reply
action="menu_select?ask=2&reply=3"
это как в ПХП, далее будут использоваться ask и reply (в скрипте)

kvoxi 29.01.2006 18:05

Quote:

Originally Posted by kvoxi
ShowChoicePage(talker, option)
What is "option" - i dont know

Correction (not tested):
if OPTION=0, then l2npc.exe generate TALKED event with followed initialized variables:
myself;
talker;
_from_choice=1;
_code;
if OPTION<>0, then l2npc.exe generate TALK_SELECTED event with followed initialized variables:
myself;
talker;
_from_choice=1;
_code;
PS
и еще обязательно надо рассказать "тупым" людям, чтоб положили на RFC HTTP протокола и сделали на веб-серверах обработку передаваемых из хтмл-форм данных методами POST, GET не так как есть в спецификации, а "как в ПХП"

RmzVoid 30.01.2006 00:34

I make by another way
 
class sample : citizen
{
handler:
EventHandler CREATED()
{
myself.i_ai0=0;
}

EventHandler TALK_SELECTED(talker)
{
if ( _from_choice!=0 && myself.i_ai0==1 )
{
//Do something
myself.i_ai0 = 0;
}
if ( _from_choice!=0 && myself.i_ai0==2 )
{
//Do something 2
myself.i_ai0 = 0;
}
}

EventHandler MENU_SELECTED(talker, ask ,reply)
{
if(ask == 2)
{
if ( reply == 33 )
{
AddChoice(2,"choice 0 2");
AddChoice(3,"choice 0 2");
myself.i_ai0 = 1;
ShowChoicePage(talker,1);

}
if ( reply == 34 )
{
AddChoice(6,"choice 1 6");
AddChoice(7,"choice 1 7");
myself.i_ai0 = 2;
ShowChoicePage(talker,1);
}
}
}

kvoxi 30.01.2006 03:16

EventHandler TALK_SELECTED(talker)
{
if ( _from_choice!=0 && (_code==2 || _code==3) ) {
//Do something
}
if ( _from_choice!=0 && (_code==6 || _code==7) ) {
//Do something 2
}
}

kvoxi 30.01.2006 11:31

Quote:

Originally Posted by kvoxi
Quote:

Originally Posted by kvoxi
ShowChoicePage(talker, option)
What is "option" - i dont know

Correction (not tested):
if OPTION=0, then l2npc.exe generate TALKED event with followed initialized variables:
myself; talker; _from_choice=1; _code;
if OPTION<>0, then l2npc.exe generate TALK_SELECTED event with followed initialized variables:
myself; talker; _from_choice=1; _code;

tested - worked:
[php:1:d1d73b739f]
EventHandler TALKED (talker,_from_choice,_code)
{
if (_from_choice==0) {
AddChoice(11, "Choice_11");
AddChoice(12, "Choice_12");
AddChoice(13, "Choice_13");
AddChoice(14, "Choice_14");
ShowChoicePage(talker,0);
}
if (_from_choice!=0) {
SayInt(_code);
AddChoice(21, "TALKED: Choice_21");
AddChoice(22, "TALKED: Choice_22");
AddChoice(23, "TALKED: Choice_23");
AddChoice(24, "TALKED: Choice_24");
ShowChoicePage(talker,1);
}
}

EventHandler TALK_SELECTED (talker, _from_choice, _code)
{
if (_from_choice!=0) {
SayInt(_code);
AddChoice(31, "TALK_SELECTED: Choice_31");
AddChoice(32, "TALK_SELECTED: Choice_32");
AddChoice(33, "TALK_SELECTED: Choice_33");
AddChoice(34, "TALK_SELECTED: Choice_34");
ShowChoicePage(talker,1);
}
}
[/php:1:d1d73b739f]


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