![]() |
|
|
|
|
#1 |
|
Архивный участник
Join Date: Sep 2005
Posts: 1,014
|
In the past we use AI to implement some skills like "Summon Arrows" or unpack soulshots ... or "Scroll of Escape for towns"...
Thats is because with C1 skilldata was imposible to get an item through an skill so... with AI, summoning a pet who give an item to master and later despawn... in the case of the SOE towns is a similar idea, pet teleport master to the required location and later despawn... some examples... C1 NASC... my own code... Decompressing packs... Code:
class default_npc { }
class summon_item : default_npc {
parameter:
int item = 1;
int cantidad = 1;
handler:
EventHandler CREATED() {
GiveItem1(myself.master, item, cantidad);
AddTimerEx(30001, 100);
}
EventHandler TIMER_FIRED_EX(timer_id) {
if (timer_id == 30001) Despawn();
}
}
// Soulshot
class soulshot_decompressor_n : summon_item {
parameter:
int item = 1835;
int cantidad = 300;
}
Code:
class default_npc { }
class summon_item_random : default_npc {
parameter:
int item = 1;
int cantidad_fija = 1;
int cantidad_random = 1;
handler:
EventHandler CREATED() {
GiveItem1(myself.master, item, cantidad_fija+Rand(cantidad_random));
AddTimerEx(30001, 100);
}
EventHandler TIMER_FIRED_EX(timer_id) {
if (timer_id == 30001) Despawn();
}
}
class summon_mithril_arrow : summon_item_random {
parameter:
int item = 1344; // @mithril_arrow
int cantidad_fija = 450;
int cantidad_random = 1350;
}
Code:
class default_npc { }
class scroll_of_escape_town : default_npc {
parameter:
int x = 0;
int y = 0;
int z = 0;
int castle = 0;
string fnYouAreChaotic = "tcm.htm";
handler:
EventHandler CREATED() {
if (myself.master.karma > 0) {
ShowPage(myself.master, fnYouAreChaotic);
Despawn();
}
else if (castle > 0) && (Castle_IsUnderSiege2(castle))
{
ShowSystemMessage(myself.master, 707); // No puedes teletransportarte a un pueblo que este en asedio
Despawn();
}
else {
AddTimerEx(50000, 100);
InstantTeleport(myself.master, x, y, z);
}
}
EventHandler TIMER_FIRED_EX(timer_id) {
if (timer_id == 50000) Despawn();
}
}
class summon_soe_talking : scroll_of_escape_town {
parameter:
int x = -83900;
int y = 242700;
int z = -3700;
int castle = 0;
}
|
|
|
|
|
#2 |
|
Архивный участник
Join Date: Jul 2006
Posts: 46
|
Thanks to fidows post i am able begin my first attempt to add skills that buff stats, i'm able to add a kind of validation to whether players buff stack on this by retaining the summon until a certain period using TIMER_FIRED, which when it will die and negate the stats, but a major problem arise because players can select the summon and unsummoning it manually, this causing the AI not able to negate the stats before the timer runs out.
i tried a few methods but to no avail........... 1) negate the stats upon MY_DYING problem: MY_DYING doesn't work when players unsummon them manually s 2) negate the stats upon TALKED and TALK_SELECTED problem: doesn't work either so here's my question 1) what are the parameter that is passed in to MENU_SELECTED when players click unsummon? (maybe this method works?) 2) is there any other way around this? any help appreciated... really.... i'm stucked for days... thanks in advance Code:
class stat_inc_skills : default_npc
{
parameter:
int Stat = 0;
int Amount = 0;
handler:
EventHandler CREATED()
{
myself->AddTimerEx(3000,1000);
}
EventHandler TIMER_FIRED_EX(timer_id,i0,i1)
{
if( timer_id == 3000 )
{
i0 = Stat;
i1 = Amount;
myself->IncrementParam(myself.master,i0,i1);
despawn();
}
}
}
Code:
class 1 stat_inc_skills : default_npc parameter_define_begin int Stat 0 int Amount 0 parameter_define_end handler 13 17 // CREATED variable_begin "myself" "_choiceN" "_code" "_from_choice" variable_end push_event // myself push_const 704 add fetch_i push_const 3000 push_const 1000 func_call 184680487 // func[AddTimerEx] shift_sp -2 shift_sp -1 handler_end handler 12 540 // TIMER_FIRED_EX variable_begin "timer_id" "i0" "i1" "myself" "_choiceN" "_code" "_from_choice" variable_end push_event // timer_id push_const 236 add fetch_i4 push_const 3000 equal branch_false L12899 L12898 push_event // i0 push_const 260 add push_reg_sp fetch_i push_parameter Stat assign4 shift_sp -1 L12900 push_event // i1 push_const 264 add push_reg_sp fetch_i push_parameter Amount assign4 shift_sp -1 L12901 push_event // myself push_const 704 add fetch_i push_event // myself push_const 704 add fetch_i // master push_const 552 add fetch_i push_event // i0 push_const 260 add fetch_i4 push_event // i1 push_const 264 add fetch_i4 func_call 184746219 // func[IncrementParam] shift_sp -3 shift_sp -1 L12902 push_event // myself push_const 704 add fetch_i func_call 184549616 // func[Despawn] shift_sp -1 L12899 handler_end class_end |
|
|
| Thread Tools | Search this Thread |
| Display Modes | |
|
|