PDA

View Full Version : Help crating a simple quest


top-gear
22.12.2005, 22:42
Im trying to understand a bit of the ai code so I decided to make a small quest like the first one with keltirs and the world map. I would like to create the quest with the gremlins and the soulshots for novice as in official server. Please tell me a few tips how could I start. I suppose this is an ai-only related issue.

top-gear
22.12.2005, 22:51
Keltir AI

class keltir : warrior_passive
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 154
func_call 59 // func[HaveMemo]
shift_sp -2
push_const 1
equal
push_reg_sp
fetch_i
branch_false L9141
shift_sp 1
push_event // c1
push_const 276
add
fetch_i
push_const 1032
func_call 81 // func[OwnItemCount]
shift_sp -2
push_const 10
less
and
push_reg_sp
fetch_i
branch_false L9141
shift_sp 1
push_event // c1
push_const 276
add
fetch_i
push_const 1033
func_call 81 // func[OwnItemCount]
shift_sp -2
push_const 0
equal
and
L9141
branch_false L9143
L9142
shift_sp 1
push_const 10
func_call 55 // func[Rand]
shift_sp -1
push_const 4
less
branch_false L9145
L9144
shift_sp 1
push_event // c1
push_const 276
add
fetch_i
push_const 1032
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 1032
func_call 81 // func[OwnItemCount]
shift_sp -2
push_const 10
equal
branch_false L9147
L9146
shift_sp 1
push_event // c1
push_const 276
add
fetch_i
S1379. "ItemSound.quest_middle"
push_string S1379
func_call 173 // func[SoundEffect]
shift_sp -2
shift_sp -1
jump L9148
L9147
shift_sp 1
push_event // c1
push_const 276
add
fetch_i
S1380. "ItemSound.quest_itemget"
push_string S1380
func_call 173 // func[SoundEffect]
shift_sp -2
shift_sp -1
L9148
L9145
L9143
call_super
handler_end

class_end

I can see two item ids inside, 1032 and 1033.

The wiseman's ai is too big because it has some other quests too included i suppose

top-gear
22.12.2005, 23:00
Grand Magister Gallint AI

class gallin : citizen
handler 4 // TALK_SELECTED
variable_begin
"fhtml0"
"quest_id"
"talker"
"myself"
"_choiceN"
"_code"
"_from_choice"
variable_end

push_event // _from_choice
push_const 332
add
fetch_i
push_const 0
equal
branch_false L13818
L13817
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 104
func_call 59 // func[HaveMemo]
shift_sp -2
push_const 0
equal
push_reg_sp
fetch_i
branch_false L13819
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 104
func_call 65 // func[GetOneTimeQuestFlag]
shift_sp -2
push_const 0
equal
and
L13819
branch_false L13821
L13820
push_event // _choiceN
push_const 328
add
push_reg_sp
fetch_i
push_event // _choiceN
push_const 328
add
fetch_i
push_const 1
add
assign
shift_sp -1
push_event // _code
push_const 324
add
push_reg_sp
fetch_i
push_const 0
assign
shift_sp -1
shift_sp 1
push_const 0
S2806. "Spirit of Mirrors"
push_string S2806
func_call 131 // func[AddChoice]
shift_sp -2
shift_sp -1
L13821
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 104
func_call 59 // func[HaveMemo]
shift_sp -2
push_const 0
equal
push_reg_sp
fetch_i
branch_false L13822
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 104
func_call 65 // func[GetOneTimeQuestFlag]
shift_sp -2
push_const 1
equal
and
L13822
branch_false L13824
L13823
push_event // _choiceN
push_const 328
add
push_reg_sp
fetch_i
push_event // _choiceN
push_const 328
add
fetch_i
push_const 1
add
assign
shift_sp -1
push_event // _code
push_const 324
add
push_reg_sp
fetch_i
push_const 1
assign
shift_sp -1
shift_sp 1
push_const 1
S2807. "Spirit of Mirrors"
push_string S2807
func_call 131 // func[AddChoice]
shift_sp -2
shift_sp -1
L13824
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 104
func_call 59 // func[HaveMemo]
shift_sp -2
push_reg_sp
fetch_i
branch_false L13825
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 748
func_call 81 // func[OwnItemCount]
shift_sp -2
push_const 1
greater_equal
and
push_reg_sp
fetch_i
branch_false L13825
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 1135
func_call 81 // func[OwnItemCount]
shift_sp -2
push_const 1
equal
push_reg_sp
fetch_i
branch_false L13826
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 1136
func_call 81 // func[OwnItemCount]
shift_sp -2
push_const 1
equal
and
push_reg_sp
fetch_i
branch_false L13826
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 1137
func_call 81 // func[OwnItemCount]
shift_sp -2
push_const 1
equal
and
L13826
push_const 0
equal
and
L13825
branch_false L13828
L13827
push_event // _choiceN
push_const 328
add
push_reg_sp
fetch_i
push_event // _choiceN
push_const 328
add
fetch_i
push_const 1
add
assign
shift_sp -1
push_event // _code
push_const 324
add
push_reg_sp
fetch_i
push_const 2
assign
shift_sp -1
shift_sp 1
push_const 2
S2808. "Spirit of Mirrors"
push_string S2808
func_call 131 // func[AddChoice]
shift_sp -2
shift_sp -1
L13828
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 104
func_call 59 // func[HaveMemo]
shift_sp -2
push_reg_sp
fetch_i
branch_false L13829
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 1135
func_call 81 // func[OwnItemCount]
shift_sp -2
push_const 1
equal
and
push_reg_sp
fetch_i
branch_false L13829
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 1136
func_call 81 // func[OwnItemCount]
shift_sp -2
push_const 1
equal
and
push_reg_sp
fetch_i
branch_false L13829
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 1137
func_call 81 // func[OwnItemCount]
shift_sp -2
push_const 1
equal
and
push_reg_sp
fetch_i
branch_false L13829
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 104
func_call 65 // func[GetOneTimeQuestFlag]
shift_sp -2
push_const 0
equal
and
L13829
branch_false L13831
L13830
push_event // _choiceN
push_const 328
add
push_reg_sp
fetch_i
push_event // _choiceN
push_const 328
add
fetch_i
push_const 1
add
assign
shift_sp -1
push_event // _code
push_const 324
add
push_reg_sp
fetch_i
push_const 3
assign
shift_sp -1
shift_sp 1
push_const 3
S2809. "Spirit of Mirrors"
push_string S2809
func_call 131 // func[AddChoice]
shift_sp -2
shift_sp -1
L13831
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 202
func_call 59 // func[HaveMemo]
shift_sp -2
branch_false L13833
L13832
push_event // _choiceN
push_const 328
add
push_reg_sp
fetch_i
push_event // _choiceN
push_const 328
add
fetch_i
push_const 1
add
assign
shift_sp -1
push_event // _code
push_const 324
add
push_reg_sp
fetch_i
push_const 4
assign
shift_sp -1
shift_sp 1
push_const 4
S2810. "Mystic's Tutorial"
push_string S2810
func_call 131 // func[AddChoice]
shift_sp -2
shift_sp -1
L13833
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 405
func_call 59 // func[HaveMemo]
shift_sp -2
push_const 1
equal
push_reg_sp
fetch_i
branch_false L13834
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 1192
func_call 81 // func[OwnItemCount]
shift_sp -2
push_const 1
equal
and
push_reg_sp
fetch_i
branch_false L13834
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 1200
func_call 81 // func[OwnItemCount]
shift_sp -2
push_const 0
equal
and
L13834
branch_false L13836
L13835
push_event // _choiceN
push_const 328
add
push_reg_sp
fetch_i
push_event // _choiceN
push_const 328
add
fetch_i
push_const 1
add
assign
shift_sp -1
push_event // _code
push_const 324
add
push_reg_sp
fetch_i
push_const 5
assign
shift_sp -1
shift_sp 1
push_const 5
S2811. "Ask about becoming a Cleric"
push_string S2811
func_call 131 // func[AddChoice]
shift_sp -2
shift_sp -1
L13836
push_event // _choiceN
push_const 328
add
fetch_i
push_const 1
greater
branch_false L13838
L13837
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 1
func_call 132 // func[ShowChoicePage]
shift_sp -2
shift_sp -1
exit_handler
L13838
L13818
push_event // _from_choice
push_const 332
add
fetch_i
push_reg_sp
fetch_i
branch_true L13839
push_event // _choiceN
push_const 328
add
fetch_i
push_const 1
equal
or
L13839
branch_false L13841
L13840
push_event // _code
push_const 324
add
fetch_i
push_reg_sp
fetch_i
push_const 0
equal
branch_false L13844
L13843
push_event // _from_choice
push_const 332
add
fetch_i
push_const 0
equal
push_reg_sp
fetch_i
branch_true L13845
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 104
func_call 59 // func[HaveMemo]
shift_sp -2
push_const 0
equal
push_reg_sp
fetch_i
branch_false L13846
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 104
func_call 65 // func[GetOneTimeQuestFlag]
shift_sp -2
push_const 0
equal
and
L13846
or
L13845
branch_false L13848
L13847
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
func_call 58 // func[GetMemoCount]
shift_sp -1
push_const 16
less
branch_false L13850
L13849
push_event // talker
push_const 32
add
fetch_i // race
push_const 148
add
fetch_i
push_const 0
not_equal
branch_false L13852
L13851
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
S2812. "gallin_q0104_00.htm"
push_string S2812
func_call 43 // func[ShowPage]
shift_sp -2
shift_sp -1
jump L13853
L13852
push_event // talker
push_const 32
add
fetch_i // level
push_const 888
add
fetch_i
push_const 10
greater_equal
branch_false L13855
L13854
shift_sp 1
push_event // fhtml0
push_const 316
add
fetch_i
S2813. "gallin_q0104_02.htm"
push_string S2813
func_call 84 // func[FHTML_SetFileName]
shift_sp -2
shift_sp -1
shift_sp 1
push_event // fhtml0
push_const 316
add
fetch_i
S2814. "quest_id"
push_string S2814
push_const 104
func_call 85 // func[FHTML_SetInt]
shift_sp -3
shift_sp -1
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_event // fhtml0
push_const 316
add
fetch_i
func_call 88 // func[ShowFHTML]
shift_sp -2
shift_sp -1
jump L13856
L13855
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
S2815. "gallin_q0104_06.htm"
push_string S2815
func_call 43 // func[ShowPage]
shift_sp -2
shift_sp -1
L13856
L13853
jump L13857
L13850
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
S2816. "fullquest.htm"
push_string S2816
func_call 43 // func[ShowPage]
shift_sp -2
shift_sp -1
L13857
L13848
jump L13842
jump L13858
L13844
push_reg_sp
fetch_i
push_const 1
equal
branch_false L13859
L13858
push_event // _from_choice
push_const 332
add
fetch_i
push_const 0
equal
push_reg_sp
fetch_i
branch_true L13860
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 104
func_call 59 // func[HaveMemo]
shift_sp -2
push_const 0
equal
push_reg_sp
fetch_i
branch_false L13861
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 104
func_call 65 // func[GetOneTimeQuestFlag]
shift_sp -2
push_const 1
equal
and
L13861
or
L13860
branch_false L13863
L13862
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
S2817. "finishedquest.htm"
push_string S2817
func_call 43 // func[ShowPage]
shift_sp -2
shift_sp -1
L13863
jump L13842
jump L13864
L13859
push_reg_sp
fetch_i
push_const 2
equal
branch_false L13865
L13864
push_event // _from_choice
push_const 332
add
fetch_i
push_const 0
equal
push_reg_sp
fetch_i
branch_true L13866
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 104
func_call 59 // func[HaveMemo]
shift_sp -2
push_reg_sp
fetch_i
branch_false L13867
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 748
func_call 81 // func[OwnItemCount]
shift_sp -2
push_const 1
greater_equal
and
push_reg_sp
fetch_i
branch_false L13867
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 1135
func_call 81 // func[OwnItemCount]
shift_sp -2
push_const 1
equal
push_reg_sp
fetch_i
branch_false L13868
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 1136
func_call 81 // func[OwnItemCount]
shift_sp -2
push_const 1
equal
and
push_reg_sp
fetch_i
branch_false L13868
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 1137
func_call 81 // func[OwnItemCount]
shift_sp -2
push_const 1
equal
and
L13868
push_const 0
equal
and
L13867
or
L13866
branch_false L13870
L13869
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
S2818. "gallin_q0104_04.htm"
push_string S2818
func_call 43 // func[ShowPage]
shift_sp -2
shift_sp -1
L13870
jump L13842
jump L13871
L13865
push_reg_sp
fetch_i
push_const 3
equal
branch_false L13872
L13871
push_event // _from_choice
push_const 332
add
fetch_i
push_const 0
equal
push_reg_sp
fetch_i
branch_true L13873
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 104
func_call 59 // func[HaveMemo]
shift_sp -2
push_reg_sp
fetch_i
branch_false L13874
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 1135
func_call 81 // func[OwnItemCount]
shift_sp -2
push_const 1
equal
and
push_reg_sp
fetch_i
branch_false L13874
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 1136
func_call 81 // func[OwnItemCount]
shift_sp -2
push_const 1
equal
and
push_reg_sp
fetch_i
branch_false L13874
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 1137
func_call 81 // func[OwnItemCount]
shift_sp -2
push_const 1
equal
and
push_reg_sp
fetch_i
branch_false L13874
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 104
func_call 65 // func[GetOneTimeQuestFlag]
shift_sp -2
push_const 0
equal
and
L13874
or
L13873
branch_false L13876
L13875
shift_sp 1
func_call 23 // func[GetCurrentTick]
push_event // talker
push_const 32
add
fetch_i // quest_last_reward_time
push_const 644
add
fetch_i
sub
push_const 1
greater
branch_false L13878
L13877
push_event // talker
push_const 32
add
fetch_i // quest_last_reward_time
push_const 644
add
push_reg_sp
fetch_i
shift_sp 1
func_call 23 // func[GetCurrentTick]
assign
shift_sp -1
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 1135
push_const 1
func_call 80 // func[DeleteItem1]
shift_sp -3
shift_sp -1
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 1136
push_const 1
func_call 80 // func[DeleteItem1]
shift_sp -3
shift_sp -1
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 1137
push_const 1
func_call 80 // func[DeleteItem1]
shift_sp -3
shift_sp -1
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 747
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
S2819. "gallin_q0104_05.htm"
push_string S2819
func_call 43 // func[ShowPage]
shift_sp -2
shift_sp -1
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 104
func_call 63 // func[RemoveMemo]
shift_sp -2
shift_sp -1
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
S2820. "ItemSound.quest_finish"
push_string S2820
func_call 173 // func[SoundEffect]
shift_sp -2
shift_sp -1
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 104
push_const 1
func_call 66 // func[SetOneTimeQuestFlag]
shift_sp -3
shift_sp -1
L13878
L13876
jump L13842
jump L13879
L13872
push_reg_sp
fetch_i
push_const 4
equal
branch_false L13880
L13879
push_event // _from_choice
push_const 332
add
fetch_i
push_const 0
equal
push_reg_sp
fetch_i
branch_true L13881
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 202
func_call 59 // func[HaveMemo]
shift_sp -2
or
L13881
branch_false L13883
L13882
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 1068
func_call 81 // func[OwnItemCount]
shift_sp -2
push_reg_sp
fetch_i
branch_false L13884
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 202
func_call 65 // func[GetOneTimeQuestFlag]
shift_sp -2
push_const 0
equal
and
L13884
branch_false L13886
L13885
shift_sp 1
func_call 23 // func[GetCurrentTick]
push_event // talker
push_const 32
add
fetch_i // quest_last_reward_time
push_const 644
add
fetch_i
sub
push_const 1
greater
branch_false L13888
L13887
push_event // talker
push_const 32
add
fetch_i // quest_last_reward_time
push_const 644
add
push_reg_sp
fetch_i
shift_sp 1
func_call 23 // func[GetCurrentTick]
assign
shift_sp -1
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 91035
negate
push_const 248049
push_const 3559
negate
func_call 195 // func[DeleteRadar]
shift_sp -4
shift_sp -1
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
S2821. "gallin_q0202_01.htm"
push_string S2821
func_call 43 // func[ShowPage]
shift_sp -2
shift_sp -1
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 1
push_const 50
func_call 171 // func[IncrementParam]
shift_sp -3
shift_sp -1
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 1068
push_const 1
func_call 80 // func[DeleteItem1]
shift_sp -3
shift_sp -1
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 202
func_call 63 // func[RemoveMemo]
shift_sp -2
shift_sp -1
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
S2822. "ItemSound.quest_finish"
push_string S2822
func_call 173 // func[SoundEffect]
shift_sp -2
shift_sp -1
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 7
func_call 190 // func[ShowQuestionMark]
shift_sp -2
shift_sp -1
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 84081
negate
push_const 243277
push_const 3723
negate
func_call 194 // func[ShowRadar]
shift_sp -4
shift_sp -1
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 202
push_const 1
func_call 66 // func[SetOneTimeQuestFlag]
shift_sp -3
shift_sp -1
L13888
jump L13889
L13886
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
S2823. "gallin001.htm"
push_string S2823
func_call 43 // func[ShowPage]
shift_sp -2
shift_sp -1
L13889
L13883
jump L13842
jump L13890
L13880
push_reg_sp
fetch_i
push_const 5
equal
branch_false L13891
L13890
push_event // _from_choice
push_const 332
add
fetch_i
push_const 0
equal
push_reg_sp
fetch_i
branch_true L13892
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 405
func_call 59 // func[HaveMemo]
shift_sp -2
push_const 1
equal
push_reg_sp
fetch_i
branch_false L13893
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 1192
func_call 81 // func[OwnItemCount]
shift_sp -2
push_const 1
equal
and
push_reg_sp
fetch_i
branch_false L13893
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 1200
func_call 81 // func[OwnItemCount]
shift_sp -2
push_const 0
equal
and
L13893
or
L13892
branch_false L13895
L13894
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 1193
func_call 81 // func[OwnItemCount]
shift_sp -2
push_const 1
equal
push_reg_sp
fetch_i
branch_false L13896
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 1197
func_call 81 // func[OwnItemCount]
shift_sp -2
push_const 0
equal
and
L13896
branch_false L13898
L13897
shift_sp 1
func_call 23 // func[GetCurrentTick]
push_event // talker
push_const 32
add
fetch_i // quest_last_reward_time
push_const 644
add
fetch_i
sub
push_const 1
greater
branch_false L13900
L13899
push_event // talker
push_const 32
add
fetch_i // quest_last_reward_time
push_const 644
add
push_reg_sp
fetch_i
shift_sp 1
func_call 23 // func[GetCurrentTick]
assign
shift_sp -1
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
S2824. "gallin_q0405_01.htm"
push_string S2824
func_call 43 // func[ShowPage]
shift_sp -2
shift_sp -1
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 1193
push_const 1
func_call 80 // func[DeleteItem1]
shift_sp -3
shift_sp -1
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 1197
push_const 1
func_call 77 // func[GiveItem1]
shift_sp -3
shift_sp -1
L13900
jump L13901
L13898
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 1193
func_call 81 // func[OwnItemCount]
shift_sp -2
push_const 0
equal
push_reg_sp
fetch_i
branch_false L13902
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 1197
func_call 81 // func[OwnItemCount]
shift_sp -2
push_const 1
equal
and
L13902
branch_false L13904
L13903
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
S2825. "gallin_q0405_02.htm"
push_string S2825
func_call 43 // func[ShowPage]
shift_sp -2
shift_sp -1
L13904
L13901
L13895
jump L13842
jump L13905
L13891
L13905
L13842
shift_sp -1
exit_handler
L13841
call_super
handler_end

handler 31 // QUEST_ACCEPTED
variable_begin
"quest_id"
"talker"
"myself"
"_choiceN"
"_code"
"_from_choice"
variable_end

push_event // quest_id
push_const 96
add
fetch_i
push_const 104
equal
branch_false L13907
L13906
shift_sp 1
func_call 23 // func[GetCurrentTick]
push_event // talker
push_const 32
add
fetch_i // quest_last_reward_time
push_const 644
add
fetch_i
sub
push_const 1
greater
branch_false L13909
L13908
push_event // talker
push_const 32
add
fetch_i // quest_last_reward_time
push_const 644
add
push_reg_sp
fetch_i
shift_sp 1
func_call 23 // func[GetCurrentTick]
assign
shift_sp -1
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_event // quest_id
push_const 96
add
fetch_i
func_call 60 // func[SetMemo]
shift_sp -2
shift_sp -1
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
S2826. "ItemSound.quest_accept"
push_string S2826
func_call 173 // func[SoundEffect]
shift_sp -2
shift_sp -1
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
push_const 748
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 748
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 748
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
S2827. "gallin_q0104_03.htm"
push_string S2827
func_call 43 // func[ShowPage]
shift_sp -2
shift_sp -1
L13909
exit_handler
L13907
call_super
handler_end

class_end

Phantom2005
23.12.2005, 12:04
Could you make yourself a bit more clear....
for example:
if player has 10 keltir fangs and then talks to Gallint then they will get 1000 soulshots for novice or whatever....

toolpunk
23.12.2005, 12:42
hmm
most things are understandable for me...
but could anyone please explain what the functions
call_super
and GetCurrentTick
do?

top-gear
23.12.2005, 12:49
I want to create a small quest for begginers. They will firstly talk to gallint to take the quest, then collect the keltir fangs (quest item), and after that they will talk to him again to get the prize and complete the quest. The basic reason to do this is to learn how to make a simple quest :D

andreagighi
23.12.2005, 13:14
I want to create a small quest for begginers. They will firstly talk to gallint to take the quest, then collect the keltir fangs (quest item), and after that they will talk to him again to get the prize and complete the quest. The basic reason to do this is to learn how to make a simple quest :D

...in handler:


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_const 100
func_call 55 // func[Rand] Probability Drop QuestItem
shift_sp -1
push_const 20 // Prob. 20%
less
branch_false L90225 //

shift_sp 1
push_event // c1
push_const 276
add
fetch_i
push_const x1x1 // Own QuestMark ? x1x1 is QuestMark Item ID
func_call 81 // func[OwnItemCount]
shift_sp -2
push_const 1
equal
branch_false L90225

shift_sp 1
push_event // c1
push_const 276
add
fetch_i
push_const x2x2 // If Own 15 QuesItem id x2x2 (keltir fang) jump
func_call 81 // func[OwnItemCount]
shift_sp -2
push_const 15
equal
branch_false L90225

shift_sp 1
push_event // c1
push_const 276
add
fetch_i
push_const x2x2 // Get QuestItem (keltir Fang)
push_const 1
func_call 77 // func[GiveItem1]
shift_sp -3
shift_sp -1

L90225
call_super
handler_end


Then u need 2 item id (questmark that u take from magister and questitem dropped).

This is only one of many method to make a simple quest (i obmited quest sound for simplify the code)

Bye and good... xmas...

top-gear
23.12.2005, 23:48
youre my man :D thanks a lot! I owe you! If you have some time, give me some info about grand master's ai. How can he give the quest, so that the quest appears in Accepted Quests list, and how can I make a quest non repeatable? thanks again

Kenster
24.12.2005, 10:01
Great guide, Can you exsplain this tho :

L90225
call_super

Thanks, I am trying to learn AI too.

toolpunk
24.12.2005, 20:52
the L90225 is just a branch...
you need em if you want to jump in the code ;)
the call_super...
not sure on it :?

filrip
25.12.2005, 00:30
call_super

call (launch) the child part of the EventHandler

like :


class FirstOne : citizen
handler 0 // NO_DESIRE
<Walk>
handler_end
class_end

class SecondOne : FirstOne
handler 0 // NO_DESIRE
<Hum...Then Search a target>
<if NoTarget then>
call_super
handler_end
class_end


This is just an example, without clean AI code of course

So imagine you have a gremlin, with AI = SecondOne

When it do nothing... it search a target first (SecondOne class). if not found, it call the older handler, so if no target, ... it will walk (FirstOne class) because "SecondOne" AI inherit of "FirstOne" class

I hope im clean. if you dont understand, i will post a real example

Kenster
25.12.2005, 00:43
I understand, basic consept of programming to save code, have all mobs inherit a few lines of code so that you can call the super and not have to copy and paste the same lines a few thousand times.

top-gear
25.12.2005, 09:58
very useful information! I'm starting to understand AI code much more ^^

Sephiroth
21.01.2006, 00:42
Excuse me. I can't find keltir fangs in items and in loot of keltirs. What number doest it have?

toolpunk
21.01.2006, 11:25
its not in the loot...
check keltirs ai class...
you will find a my_dying handler and in this you will find the quest items it may drop ;)

Sire
09.04.2006, 20:21
For making a quest a one time quest. You use the SetOneTimeQuest function in the ai, set to 0 for not completed, 1 for completed. You then use GetOneTimeQuest func to find out if they have completed it.

Also in order to do the quests the right way, you will have to add them into quest_pch and quest_pch2.

quest_pch is simple just like item_pch
[quest_name]<tab>quest_id

quest_pch2 is just for items used in the quest.
quest_id<space>number_of_items_used<space>then each item id.
example:

262 1 707
262 is the quest id for fungus sac quest.
707 is the item id for the fungus sacs you collect.
since 707 is the only item, 1 is the second number.
If there was another item with id 708 it would look like this:
262 2 707 708

The item ids listed in quest_pch2 are the ones that get removed when you abort the quest.

To make the quest display clientside you will have to add the quest to the questname-e.dat file in your system folder.
In that file the quest_id is the id of the quest you used in quest_pch and quest_pch2. Then level is what step the specific entry is for. If theres 4 steps in your quest, questname-e.dat should have 4 different entries with the same quest ID. Each entry would have a level from 1 to 4. This is also where you add the description, and the item lists in quest accepted box. You can have it display a count for any item you want, even if they aren't included in quest_pch2. But only the ones in quest_pch2 will be deleted if you abort the quest.

In the AI you will use the SetMemo and SetMemoState functions to start the quest, and to progress through the steps in the quest.

None of this is proven, but it's what I have put together from playing with quests a bit. I'm currently working on writing a custom quest of my own, when I'm finished I can post more detailed instructions.

Sire
09.04.2006, 22:11
Sorry for double post. Merge if you want.

Anyways, as promised heres a few snippets of sample AI and quest_pch stuff.
This is for my new subclass quest and AI that I'm working on currently.

quest_pch
[path_to_subclass] 700

quest_pch2
700 2 19001 19006

I'm not posting clientside stuff, just look in your existing client files and follow the format. Easy enough.

I don't have alot of AI to show, but you were asking how to make them show up in the accepted quests screen, here is how:

shift_sp 1
push_event // talker
push_const 32
add
fetch_i // quest_last_reward_time
push_const 644
add
push_reg_sp
fetch_i
shift_sp 1
func_call 23 // func[GetCurrentTick]
assign
push_event // talker
push_const 32
add
fetch_i
push_const 700 //THIS IS THE QUEST ID.
func_call 60 // func[SetMemo]
shift_sp -2
push_event // talker
push_const 32
add
fetch_i
S90600. "ItemSound.quest_accept"
push_string S90600
func_call 173 // func[SoundEffect]
shift_sp -3

Place this in your quest_accepted handler and call it from an htm with <a action="bypass -h quest_accept?quest_id=700">Start Quest</a>

You will still have to add in checks for if they have already started quest and such. And the progress of the quest with SetMemoState.

Sorry it's not fully working, but I'm just starting to learn this stuff as well. Just posting what I get working to help others out if they are stuck at the same spots as I was.

Eanae
10.04.2006, 02:46
Nasc is alot easier to code quests in. Especially with questdata. o.o

Sire
10.04.2006, 03:56
Well, I don't know anything about NASC. I never got it to run properly so I gave up and just learned how to do things by hand. He asked for help so I offered what I knew.

OnlyOne
10.04.2006, 09:52
class novice_helper : default_npc
{
parameter:
string fnHi = "chi.htm";

handler:
EventHandler TALKED(talker)
{
ShowPage(talker, fnHi);
}
EventHandler MENU_SELECTED(talker)
{
{
else if (GetOneTimeQuestFlag(talker, @hfighter_tutorial) == 1 )
{
ShowPage(talker, fnHi);
}
else if ( OwnItemCount(talker, @blue_gemstone) >= 1 && IsInCategory(@mage_group, talker.occupation ) )
{
GiveItem1(talker, @spiritshot_none_for_rookie, 100);
GiveItem1(talker, @recommendation_01, 1);
DeleteItem1(talker, @blue_gemstone, OwnItemCount(talker, @blue_gemstone));
SetOneTimeQuestFlag(talker, @hfighter_tutorial, 1);
ShowPage(talker, "novice_helper_q2.htm");
}
else if ( OwnItemCount(talker, @blue_gemstone) >= 1 && IsInCategory(@fighter_group, talker.occupation ) )
{
GiveItem1(talker, @soulshot_none_for_rookie, 200);
GiveItem1(talker, @recommendation_01, 1);
DeleteItem1(talker, @blue_gemstone, OwnItemCount(talker, @blue_gemstone));
SetOneTimeQuestFlag(talker, @hfighter_tutorial, 1);
ShowPage(talker, "novice_helper_q2a.htm");
}
else if (OwnItemCount(talker, @recommendation_01))
{
ShowPage(talker, "novice_helper_q3.htm");
}
else if (OwnItemCount(talker, @blue_gemstone) == 0)
{
ShowPage(talker, "novice_helper_q4.htm");
}
return;
}
super;
}
}

Thats my try with quest but i think it didnt work. any suggestions? btw i tried to to this like on off you kill gremlin,get blue gemstone (no need to take quest), take it to npc it gives you nss/nsps and so on and i added GetOneTimeQuestFlag(talker, @hfighter_tutorial) to prevent from getting lots of ss/sps but i didnt know if i added it right way :?

Sire
10.04.2006, 14:38
You have Else If's without any normal If, not sure if NASC has a problem with this but it might.

Eanae
10.04.2006, 18:14
He's using the wrong handler for one. Menu_selected isn't what you want. You want talk_select... Second, yes that else if without a normal if is wrong too.

Sire
11.04.2006, 01:30
Well, I was going to mention the menu_selected thing instead of talk_selected, except it's not really "wrong."

It's doesn't follow how it's usually done, but quests can work just fine in menu_selected. I've coded them using ask reply sets before.