15.12.2006, 04:28
|
#16
|
|
Архивный участник
Join Date: Oct 2006
Posts: 40
|
Quote:
Originally Posted by FidoW
I shared before a similar code for C1moded... ok, lest go with a newer version for C4
NASC CODE
Code:
class buffer_npc : default_npc {
parameter:
string fnHi = "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 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 == -201) && (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,fnHi);
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;
}
}
COMPILED CODE
Code:
class 1 buffer_npc : default_npc
parameter_define_begin
string fnHi "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 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 201
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 ItemBuff
func_call 184680579 // func[OwnItemCount]
shift_sp -2
push_parameter Amount
greater_equal
and
L4
branch_false L5
L6
push_event // myself
push_const 704
add
fetch_i // i_ai0
push_const 308
add
fetch_i4
push_const 0
equal
branch_false L8
L7
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 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 L9
L8
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
L9
jump L10
L5
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
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 L12
L11
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
L12
handler_end
class_end
NPCDATA
Code:
npc_begin citizen 14003 [buffer_npc] level=70 acquire_exp_rate=0 acquire_sp=0 unsowing=1 clan={} ignore_clan_list={} clan_help_range=300 slot_chest=[] slot_rhand=[] slot_lhand=[] shield_defense_rate=0 shield_defense=0 skill_list={@s_race_undead;@s_npc_weakness_holy3;@s_evil_attack;@s_npc_weakness_fire1} npc_ai={[buffer_npc];{[fnHi]=[buffer_npc001.htm]}} category={} race=human sex=female undying=1 can_be_attacked=0 corpse_time=1 no_sleep_mode=0 agro_range=0 ground_high={120;0;0} ground_low={50;0;0} exp=429634528 org_hp=2444.5 org_hp_regen=7.5 org_mp=10000 org_mp_regen=200 collision_radius={8;8} collision_height={24;24} str=60 int=90 dex=50 wit=90 con=60 men=40 base_attack_type=sword base_attack_range=40 base_damage_range={0;0;80;120} base_rand_dam=30 base_physical_attack=6xx.xx373 base_critical=4 physical_hit_modify=4.75 base_attack_speed=253 base_reuse_delay=0 base_magic_attack=470.4 base_defend=2xx.xx base_magic_defend=2xx.xx physical_avoid_modify=0 soulshot_count=0 spiritshot_count=0 hit_time_factor=0.6 item_make_list={} corpse_make_list={} additional_make_list={} additional_make_multi_list={} hp_increase=0 mp_increase=0 safe_height=100 npc_end
NPC_PCH
Code:
[buffer_npc] = 1014003
buffer_npc001.html
Code:
<html><body>
Buffer NPC:<br>
Por solo <font color="LEVEL">1000 adenas</font> te podemos dar auras! Elije aquellas que prefieras!<br>
<table><tr><td width=80>
<a action="bypass -h menu_select?ask=-201&reply=273411">[Might]</a><br>
<a action="bypass -h menu_select?ask=-201&reply=266243">[Shield]</a><br>
<a action="bypass -h menu_select?ask=-201&reply=275715">[Focus]</a><br>
<a action="bypass -h menu_select?ask=-201&reply=308226">[Windwalk]</a><br>
<a action="bypass -h menu_select?ask=-201&reply=317443">[Guidance]</a><br>
<a action="bypass -h menu_select?ask=-201&reply=278275">[Agility]</a><br>
<a action="bypass -h menu_select?ask=-201&reply=265218">[Magic Barrier]</a>
</td><td width=100>
<a action="bypass -h menu_select?ask=-201&reply=277763">[Acumen]</a><br>
<a action="bypass -h menu_select?ask=-201&reply=271107">[Empower]</a><br>
<a action="bypass -h menu_select?ask=-201&reply=268294">[Bless the Soul]</a><br>
<a action="bypass -h menu_select?ask=-201&reply=271874">[Berserker Spirit]</a><br>
<a action="bypass -h menu_select?ask=-201&reply=267009">[Holy Weapon]</a><br>
<a action="bypass -h menu_select?ask=-201&reply=264964">[Mental Shield]</a><br>
<a action="bypass -h menu_select?ask=-201&reply=275974">[Concrentrarion]</a>
</td><td width=100>
<a action="bypass -h menu_select?ask=-201&reply=267267">[Regeneration]</a><br>
<a action="bypass -h menu_select?ask=-201&reply=316931">[Freezing Skin]</a><br>
<a action="bypass -h menu_select?ask=-201&reply=267526">[Bless the Body]</a><br>
<a action="bypass -h menu_select?ask=-201&reply=318214">[Bless the Shield]</a><br>
<a action="bypass -h menu_select?ask=-201&reply=278018">[Haste]</a><br>
<a action="bypass -h menu_select?ask=-201&reply=317955">[Death Wisper]</a><br>
<a action="bypass -h menu_select?ask=-201&reply=274690">[Kiss Of Eva]</a>
</td></tr></table>
<br><br><br>
<font color="FF0000">Buffer NPC by FidoW</font>
</body></html>
You need to do other html files... isnt too hard...
If someone have a C4 compiler will be interesting because i spend like 1 hour compiling that -.- maybe the next time it will be faster, but is the first time I try to code a enterly AI code from NASC.
Tip: SauDecompiler can help you to code you own AI, i do that, thanks to Sauron.
|
WARNING!, IF YOU USE THIS NPC YOU CAN USE THE HTML EXPLOIT TO HAVE FREE BUFFS.
PELIGRO!, si usas este metodo de BUFF NPC, a travez del HTML EXPLOIT podes tener BUFF CUANDO QUIERAS.
|
|
|