![]() |
|
|
#1 |
|
Архивный участник
Join Date: Aug 2005
Posts: 428
|
HI there.
This is my basic model of sa crystal level up system. Code:
class mob_sa_quest_st_1 : default_npc
{
handler:
EventHandler SPELLED(speller, skill_name_id, i0)
{
i0=0;
if(skill_name_id == @s_soul_crystal)
{
i0=1;
}
}
EventHandler ATTACKED(attacker, damage, i0, i1)
{
i1=0;
if(damage>myself.sm.hp && i0==1)
{
i1=1;
}
i0=0;
}
EventHandler MY_DYING(i1)
{
c1 = GetLastAttacker();
if(i1==1)
{
if(OwnItemCount(c1, @red_soul_crystal_0)>1)
{
ShowSystemMessage(c1, 977);
}
if(OwnItemCount(c1, @red_soul_crystal_0)==1)
{
DeleteItem1(c1, @red_soul_crystal_0,1);
GiveItem1(c1, @red_soul_crystal_1,1);
ShowSystemMessage(c1, 974);
}
}
}
}
CAN I OPERATE WITH i0 and i1 IN SUCH CONDITION? Thanks again. |
|
|
|
|
#2 |
|
Архивный участник
Join Date: Apr 2005
Posts: 357
|
no, use myself.i_ai0
but if many players spelled at one time - last player's spell will be stored in NPC memory. And you wrong, you should store speller id , and in MY_DYING give item not to last attacker, you mast give item to stored speller. class mob_sa_quest_st_1 : default_npc { handler: EventHandler CREATED() { myself.i_ai0 = 0; myself.c_ai0 = 0; } EventHandler SPELLED(speller, skill_name_id) { if(skill_name_id == @s_soul_crystal && myself.sm.hp <= myself.sm.maxhp/2) { myself.c_ai0=speller; } } EventHandler ATTACKED(attacker, damage) { //don't need anything here //just super; } EventHandler MY_DYING() { c1 = GetLastAttacker(); if( myself.c_ai0 !=0 ) { if(OwnItemCount(myself.c_ai0, @red_soul_crystal_0)>1) { ShowSystemMessage(myself.c_ai0, 977); } if(OwnItemCount(myself.c_ai0, @red_soul_crystal_0)==1) { DeleteItem1(myself.c_ai0, @red_soul_crystal_0,1); GiveItem1(myself.c_ai0, @red_soul_crystal_1,1); ShowSystemMessage(myself.c_ai0, 974); } } } } |
|
|
|
|
#3 |
|
Архивный участник
Join Date: Apr 2005
Posts: 357
|
someone say on forum that event handler SPELLED not applies to spell from item such as Soul Crystal
|
|
|
|
|
#4 |
|
Архивный участник
Join Date: Aug 2005
Posts: 428
|
Thanks, rmzvoid, but... Why EventHandler ATTACKED is empty?
How would we know that after spell there will be final shot? |
|
|
|
|
#5 |
|
Архивный участник
Join Date: Apr 2005
Posts: 357
|
as i know NPC may dye from anyone, the main part is to spell NPC
|
|
|
|
|
#6 |
|
Архивный участник
Join Date: Apr 2005
Posts: 357
|
anyway you not need use ATTACKED.
Just in MY_DYING ... if ( myself.c_ai0 == GetLastAttacker() ) { } ... |
|
|
|
|
#7 |
|
Архивный участник
Join Date: Aug 2005
Posts: 428
|
Слушай, а стукни в асю плиз. Я тебя еще немного помучаю
![]() 203833915 Заранее спасибо
|
|
|
|
|
#8 | |
|
Архивный участник
Join Date: May 2005
Posts: 2,033
|
Quote:
theres a nice little super; in it ![]() which will load the standard attacked handler for default_npc if i remember correctly... |
|
|
|
|
|
#9 |
|
Архивный участник
Join Date: Aug 2005
Posts: 428
|
I understood, thks.
|
|
|
|
|