Post Pacific  

Go Back   Post Pacific > Восстановленный архив > Темы без сохранившегося раздела
FAQ Community Calendar Today's Posts Search

Notices

 
 
Thread Tools Search this Thread Display Modes
Old 02.02.2006, 06:28   #1
drzoom
Архивный участник
 
Join Date: Aug 2005
Posts: 428
Default Some question on nasc... And whole ai scripting...

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);
			}
		}
	}
}
But can a question is this:
CAN I OPERATE WITH i0 and i1 IN SUCH CONDITION?

Thanks again.
drzoom is offline  
Old 02.02.2006, 06:52   #2
RmzVoid
Архивный участник
 
Join Date: Apr 2005
Posts: 357
Default

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);
}
}
}
}
RmzVoid is offline  
Old 02.02.2006, 06:56   #3
RmzVoid
Архивный участник
 
Join Date: Apr 2005
Posts: 357
Default

someone say on forum that event handler SPELLED not applies to spell from item such as Soul Crystal
RmzVoid is offline  
Old 02.02.2006, 06:56   #4
drzoom
Архивный участник
 
Join Date: Aug 2005
Posts: 428
Default

Thanks, rmzvoid, but... Why EventHandler ATTACKED is empty?
How would we know that after spell there will be final shot?
drzoom is offline  
Old 02.02.2006, 06:57   #5
RmzVoid
Архивный участник
 
Join Date: Apr 2005
Posts: 357
Default

as i know NPC may dye from anyone, the main part is to spell NPC
RmzVoid is offline  
Old 02.02.2006, 06:59   #6
RmzVoid
Архивный участник
 
Join Date: Apr 2005
Posts: 357
Default

anyway you not need use ATTACKED.
Just in MY_DYING

...
if ( myself.c_ai0 == GetLastAttacker() )
{
}
...
RmzVoid is offline  
Old 02.02.2006, 07:01   #7
drzoom
Архивный участник
 
Join Date: Aug 2005
Posts: 428
Default

Слушай, а стукни в асю плиз. Я тебя еще немного помучаю
203833915
Заранее спасибо
drzoom is offline  
Old 02.02.2006, 18:12   #8
toolpunk
Архивный участник
 
Join Date: May 2005
Posts: 2,033
Default

Quote:
Originally Posted by drzoom
Thanks, rmzvoid, but... Why EventHandler ATTACKED is empty?
How would we know that after spell there will be final shot?
its not empty...
theres a nice little
super;
in it
which will load the standard attacked handler for default_npc if i remember correctly...
toolpunk is offline  
Old 02.02.2006, 19:03   #9
drzoom
Архивный участник
 
Join Date: Aug 2005
Posts: 428
Default

I understood, thks.
drzoom is offline  
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 19:11.