![]() |
|
|
#1 |
|
Архивный участник
Join Date: Oct 2006
Posts: 32
|
Just can someonr pls explain how to add some ai code to one already existing npc? Or just give me some links fo guides where i can learn htis...becaurse i really can not find nothing regarding this...
|
|
|
|
|
#2 |
|
Архивный участник
Join Date: Dec 2006
Posts: 205
|
Ai deconpiler?
|
|
|
|
|
#3 |
|
Архивный участник
Join Date: Oct 2006
Posts: 32
|
hm...for example... ive tried to ask here to explain how to wrok with not decompiled ai.... but if someone could share with me decompiler for c4 it would be great.... then i could understand everything myself...
|
|
|
|
|
#4 |
|
Архивный участник
Join Date: Nov 2006
Posts: 204
|
use the search.. there's a ai to nasc compiler on the forums i believe..
use that to see what ai codes do what in nasc..will help you alot there are not step by step tutorials for this stuff.. you just gotta take it step by step yourself and the ai to nasc tool will help with that greatly unfortunatly there is no nasc to ai compiler for C4 yet ( no idea if its ever gonna be there ) but once you understand what nasc gives what ai code you can write it in nasc yourself and translate it by hand |
|
|
|
|
#5 |
|
Архивный участник
Join Date: Oct 2006
Posts: 32
|
i really can write it in nasc.... already readed alot of this staff...but with translation ive got a problem( i just can not understand how it translates to ai...
|
|
|
|
|
#6 |
|
Архивный участник
Join Date: Nov 2006
Posts: 204
|
well thats where the ai to nasc tool comes in .. just translate some from ai to nasc and see what ai command gives what in nasc.. takes time but basic functions are easy understandable..
also if you got something you want to do..look for an npc that has it in his/hers AI and compile pieces till you get what you need .. thats how its the easiest for me i guess also check the stickes for ai handlers and stuff like that |
|
|
|
|
#7 |
|
Архивный участник
Join Date: Feb 2006
Posts: 136
|
|
|
|
|
|
#8 |
|
Архивный участник
Join Date: Oct 2006
Posts: 32
|
thank you very much....but i still can not fully understand how to compile it by hands...
Im trying to compile this code Code:
class buffer_npc : default_npc {
parameter:
string fnBuff = "buffer_npc001.htm";
string fnYouAreChaotic = "buffer_npc002.htm";
string fnNotEnoughAdena = "buffer_npc003.htm";
string fnWait = "buffer_npc004.htm";
int ItemBuff = 57;
int ItemBuff1 = 57;
int Amount = 1000;
int Amount1 = 100;
int Delay = 500;
handler:
EventHandler CREATED() {
myself.i_ai0 = 0;
}
EventHandler TALKED(talker) {
if (talker.karma > 0) myself->ShowPage(talker,fnYouAreChaotic);
else myself->ShowPage(talker,fnHi);
}
EventHandler MENU_SELECTED(talker,ask,reply) {
if ( (ask == -1002) {
myself->ShowPage(talker,fnBuff);
}
else if ( (ask == -1001) && (myself->OwnItemCount(talker,ItemBuff1) >= Amount1) ) {
if( myself.i_ai0 == 0 ) {
myself.i_ai0 = 1;
myself->DeleteItem1(talker,ItemBuff1,Amount1);
myself->AddUseSkillDesire(talker,reply,1,1,1000000);
myself->ShowPage(talker,fnHi);
myself->AddTimerEx(1,Delay);
} else myself->ShowPage(talker,fnWait);
} else if ( (ask == -1000) && (myself->OwnItemCount(talker,ItemBuff) >= Amount) ) {
if( myself.i_ai0 == 0 ) {
myself.i_ai0 = 1;
myself->DeleteItem1(talker,ItemBuff,Amount);
myself->AddUseSkillDesire(talker,reply,1,1,1000000);
myself->ShowPage(talker,fnBuff);
myself->AddTimerEx(1,Delay);
} else myself->ShowPage(talker,fnWait);
} else myself->ShowPage(talker,fnNotEnoughAdena);
}
EventHandler TIMER_FIRED_EX(timer_id) {
if( timer_id == 1 ) myself.i_ai0 = 0;
}
}
Code:
class buffer_npc : default_npc
parameter_define_begin
string fnBuff = "buffer_npc001.htm";
string fnYouAreChaotic = "buffer_npc002.htm";
string fnNotEnoughAdena = "buffer_npc003.htm";
string fnWait = "buffer_npc004.htm";
int ItemBuff = 57;
int ItemBuff1 = 57;
int Amount = 1000;
int Amount1 = 100;
int Delay = 500;
parameter_define_end
handler 13 11 // CREATED
variable_begin
"myself"
"_choiceN"
"_code"
"_from_choice"
variable_end
push_event // myself
push_const 704
add
fetch_i // i_ai0
push_const 308
add
push_reg_sp
fetch_i
push_const 0
assign4
shift_sp -1
handler_end
handler 3 38 // TALKED
variable_begin
"talker"
"myself"
"_choiceN"
"_code"
"_from_choice"
variable_end
push_event // talker
push_const 40
add
fetch_i // karma
push_const 468
add
fetch_i4
push_const 0
greater
branch_false L2
L1
push_event // myself
push_const 704
add
fetch_i
push_event // talker
push_const 40
add
fetch_i
push_parameter fnYouAreChaotic
func_call 184680516 // func[ShowPage]
shift_sp -2
shift_sp -1
jump L3
L2
push_event // myself
push_const 704
add
fetch_i
push_event // talker
push_const 40
add
fetch_i
push_parameter fnHi
func_call 184680516 // func[ShowPage]
shift_sp -2
shift_sp -1
L3
handler_end
handler 32 134 // MENU_SELECTED
variable_begin
"talker"
"ask"
"reply"
"myself"
"_choiceN"
"_code"
"_from_choice"
variable_end
push_event // ask
push_const 160
add
fetch_i4
push_const 1002
negate
equal
push_reg_sp
fetch_i
branch_false L4
shift_sp 1
push_event // myself
push_const 704
add
fetch_i
push_event // talker
push_const 40
add
fetch_i
push_parameter fnBuff
func_call 184680516 // func[ShowPage]
shift_sp -2
shift_sp -1
L100
jump L101
L4
push_event // ask
push_const 160
add
fetch_i4
push_const 1001
negate
equal
push_reg_sp
fetch_i
branch_false L5
shift_sp 1
push_event // myself
push_const 704
add
fetch_i
push_event // talker
push_const 40
add
fetch_i
push_parameter ItemBuff1
func_call 184680579 // func[OwnItemCount]
shift_sp -2
push_parameter Amount1
greater_equal
and
L6
branch_false L102
L7
push_event // myself
push_const 704
add
fetch_i // i_ai0
push_const 308
add
fetch_i4
push_const 0
equal
branch_false L103
L8
push_event // myself
push_const 704
add
fetch_i // i_ai0
push_const 308
add
push_reg_sp
fetch_i
push_const 1
assign4
shift_sp -1
push_event // myself
push_const 704
add
fetch_i
push_event // talker
push_const 40
add
fetch_i
push_parameter ItemBuff1
push_parameter Amount1
func_call 184746114 // func[DeleteItem1]
shift_sp -3
shift_sp -1
push_event // myself
push_const 704
add
fetch_i
push_event // talker
push_const 40
add
fetch_i
push_event // reply
push_const 164
add
fetch_i
push_const 1
push_const 1
push_const 1000000
func_call 184877074 // func[AddUseSkillDesire]
shift_sp -5
shift_sp -1
push_event // myself
push_const 704
add
fetch_i
push_event // talker
push_const 40
add
fetch_i
push_parameter fnHi
func_call 184680516 // func[ShowPage]
shift_sp -2
shift_sp -1
push_event // myself
push_const 704
add
fetch_i
push_const 1
push_parameter Delay
func_call 184680487 // func[AddTimerEx]
shift_sp -2
shift_sp -1
jump L101
L5
push_event // ask
push_const 160
add
fetch_i4
push_const 1000
negate
equal
push_reg_sp
fetch_i
branch_false L11
shift_sp 1
push_event // myself
push_const 704
add
fetch_i
push_event // talker
push_const 40
add
fetch_i
push_parameter ItemBuff
func_call 184680579 // func[OwnItemCount]
shift_sp -2
push_parameter Amount
greater_equal
and
L11
branch_false L102
L12
push_event // myself
push_const 704
add
fetch_i // i_ai0
push_const 308
add
fetch_i4
push_const 0
equal
branch_false L103
L13
push_event // myself
push_const 704
add
fetch_i // i_ai0
push_const 308
add
push_reg_sp
fetch_i
push_const 1
assign4
shift_sp -1
push_event // myself
push_const 704
add
fetch_i
push_event // talker
push_const 40
add
fetch_i
push_parameter ItemBuff
push_parameter Amount
func_call 184746114 // func[DeleteItem1]
shift_sp -3
shift_sp -1
push_event // myself
push_const 704
add
fetch_i
push_event // talker
push_const 40
add
fetch_i
push_event // reply
push_const 164
add
fetch_i
push_const 1
push_const 1
push_const 1000000
func_call 184877074 // func[AddUseSkillDesire]
shift_sp -5
shift_sp -1
push_event // myself
push_const 704
add
fetch_i
push_event // talker
push_const 40
add
fetch_i
push_parameter fnBuff
func_call 184680516 // func[ShowPage]
shift_sp -2
shift_sp -1
push_event // myself
push_const 704
add
fetch_i
push_const 1
push_parameter Delay
func_call 184680487 // func[AddTimerEx]
shift_sp -2
shift_sp -1
jump L101
L103
shift_sp 1
push_event // myself
push_const 704
add
fetch_i
push_event // talker
push_const 40
add
fetch_i
push_parameter fnWait
func_call 184680516 // func[ShowPage]
shift_sp -2
shift_sp -1
L102
shift_sp 1
push_event // myself
push_const 704
add
fetch_i
push_event // talker
push_const 40
add
fetch_i
push_parameter fnNotEnoughAdena
func_call 184680516 // func[ShowPage]
shift_sp -2
shift_sp -1
L101
handler_end
handler 12 20 // TIMER_FIRED_EX
variable_begin
"timer_id"
"myself"
"_choiceN"
"_code"
"_from_choice"
variable_end
push_event // timer_id
push_const 236
add
fetch_i4
push_const 1
equal
branch_false L10112
L111
push_event // myself
push_const 704
add
fetch_i // i_ai0
push_const 308
add
push_reg_sp
fetch_i
push_const 0
assign4
shift_sp -1
L10112
handler_end
class_end
|
|
|
|
|
#9 |
|
Архивный участник
Join Date: Oct 2006
Posts: 32
|
and more one variant of this nasc
Code:
class 1 buffer_npc : default_npc
parameter_define_begin
string fnBuff "buffer_npc001.htm"
string fnYouAreChaotic "buffer_npc002.htm"
string fnNotEnoughAdena "buffer_npc003.htm"
string fnWait "buffer_npc004.htm"
int ItemBuff 57
int Amount 1000
int ItemBuff2 57
int Amount2 1000
int Delay 500
parameter_define_end
handler 13 11 // CREATED
variable_begin
"myself"
"_choiceN"
"_code"
"_from_choice"
variable_end
push_event // myself
push_const 704
add
fetch_i // i_ai0
push_const 308
add
push_reg_sp
fetch_i
push_const 0
assign4
shift_sp -1
handler_end
handler 3 38 // TALKED
variable_begin
"talker"
"myself"
"_choiceN"
"_code"
"_from_choice"
variable_end
push_event // talker
push_const 40
add
fetch_i // karma
push_const 468
add
fetch_i4
push_const 0
greater
branch_false L2
L1
push_event // myself
push_const 704
add
fetch_i
push_event // talker
push_const 40
add
fetch_i
push_parameter fnYouAreChaotic
func_call 184680516 // func[ShowPage]
shift_sp -2
shift_sp -1
jump L3
L2
push_event // myself
push_const 704
add
fetch_i
push_event // talker
push_const 40
add
fetch_i
push_parameter fnHi
func_call 184680516 // func[ShowPage]
shift_sp -2
shift_sp -1
L3
handler_end
handler 32 134 // MENU_SELECTED
variable_begin
"talker"
"ask"
"reply"
"myself"
"_choiceN"
"_code"
"_from_choice"
variable_end
push_event // ask
push_const 160
add
fetch_i4
push_const 1002
negate
equal
push_reg_sp
fetch_i
branch_true L4
shift_sp 1
push_event // ask
push_const 160
add
fetch_i4
push_const 1001
negate
equal
push_reg_sp
fetch_i
branch_true L7
shift_sp 1
push_event // ask
push_const 160
add
fetch_i4
push_const 1000
negate
equal
push_reg_sp
fetch_i
branch_false L5
shift_sp 1
push_event // myself
push_const 704
add
fetch_i
push_event // talker
push_const 40
add
fetch_i
push_parameter ItemBuff
func_call 184680579 // func[OwnItemCount]
shift_sp -2
push_parameter Amount
greater_equal
and
L5
branch_false L9
L15
push_event // myself
push_const 704
add
fetch_i // i_ai0
push_const 308
add
fetch_i4
push_const 0
equal
branch_false L12
L16
push_event // myself
push_const 704
add
fetch_i // i_ai0
push_const 308
add
push_reg_sp
fetch_i
push_const 1
assign4
shift_sp -1
push_event // myself
push_const 704
add
fetch_i
push_event // talker
push_const 40
add
fetch_i
push_parameter ItemBuff
push_parameter Amount
func_call 184746114 // func[DeleteItem1]
shift_sp -3
shift_sp -1
push_event // myself
push_const 704
add
fetch_i
push_event // talker
push_const 40
add
fetch_i
push_event // reply
push_const 164
add
fetch_i
push_const 1
push_const 1
push_const 1000000
func_call 184877074 // func[AddUseSkillDesire]
shift_sp -5
shift_sp -1
push_event // myself
push_const 704
add
fetch_i
push_event // talker
push_const 40
add
fetch_i
push_parameter fnBuff
func_call 184680516 // func[ShowPage]
shift_sp -2
shift_sp -1
push_event // myself
push_const 704
add
fetch_i
push_const 1
push_parameter Delay
func_call 184680487 // func[AddTimerEx]
shift_sp -2
shift_sp -1
jump L10
L7
shift_sp 1
push_event // myself
push_const 704
add
fetch_i
push_event // talker
push_const 40
add
fetch_i
push_parameter ItemBuff2
func_call 184680579 // func[OwnItemCount]
shift_sp -2
push_parameter Amount2
greater_equal
and
L8
branch_false L9
L11
push_event // myself
push_const 704
add
fetch_i // i_ai0
push_const 308
add
fetch_i4
push_const 0
equal
branch_false L12
L14
push_event // myself
push_const 704
add
fetch_i // i_ai0
push_const 308
add
push_reg_sp
fetch_i
push_const 1
assign4
shift_sp -1
push_event // myself
push_const 704
add
fetch_i
push_event // talker
push_const 40
add
fetch_i
push_parameter ItemBuff2
push_parameter Amount2
func_call 184746114 // func[DeleteItem1]
shift_sp -3
shift_sp -1
push_event // myself
push_const 704
add
fetch_i
push_event // talker
push_const 40
add
fetch_i
push_event // reply
push_const 164
add
fetch_i
push_const 1
push_const 1
push_const 1000000
func_call 184877074 // func[AddUseSkillDesire]
shift_sp -5
shift_sp -1
push_event // myself
push_const 704
add
fetch_i
push_event // talker
push_const 40
add
fetch_i
push_parameter fnHi
func_call 184680516 // func[ShowPage]
shift_sp -2
shift_sp -1
push_event // myself
push_const 704
add
fetch_i
push_const 1
push_parameter Delay
func_call 184680487 // func[AddTimerEx]
shift_sp -2
shift_sp -1
jump L10
L9
shift_sp 1
push_event // myself
push_const 704
add
fetch_i
push_event // talker
push_const 40
add
fetch_i
push_parameter fnNotEnoughAdena
func_call 184680516 // func[ShowPage]
shift_sp -2
shift_sp -1
L10
jump L6
L12
shift_sp 1
push_event // myself
push_const 704
add
fetch_i
push_event // talker
push_const 40
add
fetch_i
push_parameter fnWait
func_call 184680516 // func[ShowPage]
shift_sp -2
shift_sp -1
L13
jump L6
L4
shift_sp 1
push_event // myself
push_const 704
add
fetch_i
push_event // talker
push_const 40
add
fetch_i
push_parameter fnBuff
func_call 184680516 // func[ShowPage]
shift_sp -2
shift_sp -1
L6
handler_end
handler 12 20 // TIMER_FIRED_EX
variable_begin
"timer_id"
"myself"
"_choiceN"
"_code"
"_from_choice"
variable_end
push_event // timer_id
push_const 236
add
fetch_i4
push_const 1
equal
branch_false L18
L17
push_event // myself
push_const 704
add
fetch_i // i_ai0
push_const 308
add
push_reg_sp
fetch_i
push_const 0
assign4
shift_sp -1
L18
handler_end
class_end
|
|
|
| Thread Tools | Search this Thread |
| Display Modes | |
|
|