Post Pacific  

Go Back   Post Pacific > Восстановленный архив > Темы без сохранившегося раздела

Notices

 
 
Thread Tools Search this Thread Display Modes
Old 22.02.2006, 04:59   #1
Truffe
Архивный участник
 
Join Date: May 2005
Posts: 944
Default Little issues with AI

I'm trying to create a npc who trades a few items for another one, (don't say "use multisell" :shock: ) so I wrote this :

Code:
class blehblehbleh : default_npc
{
parameter:
	string fnNoItem = "";

handler:				
	EventHandler MENU_SELECTED(talker, ask ,reply)			
	{			
		if(ask == -6)		
		{		
			if(OwnItemCount(talker, @small_sword) >= 1 && OwnItemCount(talker, @long_sword) >= 3 && OwnItemCount(talker, @broad_sword) >= 3)
			{	
				DeleteItem1(talker, @long_sword, 3);
				DeleteItem1(talker, @broad_sword, 3);
				GiveItem1(talker, @club, 1);
			}	
			else	
			{	
				ShowPage(talker, fnNoItem);
			}
		}	
	}		
}
It compiles fine,
But it gives an "Invalid Class[0]" error
Once I managed to get rid of that error, but this NPC's AI still wasn't working :?

So...Any ideas on what's wrong with it ? :?
Truffe is offline  
Old 22.02.2006, 05:22   #2
Kirikups
Архивный участник
 
Join Date: Oct 2005
Posts: 175
Default

Try this:

Code:
class default_npc
{}
 
class blehblehbleh : default_npc
{ 
parameter: 
   string fnNoItem = ""; 

handler:             
   EventHandler MENU_SELECTED(talker, ask ,reply)          
   {          
      if(ask == -6)       
      {       
         if(OwnItemCount(talker, @small_sword) >= 1 && OwnItemCount(talker, @long_sword) >= 3 && OwnItemCount(talker, @broad_sword) >= 3) 
         {    
            DeleteItem1(talker, @long_sword, 3); 
            DeleteItem1(talker, @broad_sword, 3); 
            GiveItem1(talker, @club, 1); 
         }    
         else    
         {    
            ShowPage(talker, fnNoItem); 
         } 
      }    
   }       
}
or this

Code:
class blehblehbleh
{ 
parameter: 
   string fnNoItem = ""; 

handler:             
   EventHandler MENU_SELECTED(talker, ask ,reply)          
   {          
      if(ask == -6)       
      {       
         if(OwnItemCount(talker, @small_sword) >= 1 && OwnItemCount(talker, @long_sword) >= 3 && OwnItemCount(talker, @broad_sword) >= 3) 
         {    
            DeleteItem1(talker, @long_sword, 3); 
            DeleteItem1(talker, @broad_sword, 3); 
            GiveItem1(talker, @club, 1); 
         }    
         else    
         {    
            ShowPage(talker, fnNoItem); 
         } 
      }    
   }       
}
Kirikups is offline  
Old 22.02.2006, 11:57   #3
RumanticK
Архивный участник
 
Join Date: Feb 2006
Posts: 66
Default

i suppose, you've missed parent class in your source-code.
RumanticK is offline  
Old 22.02.2006, 13:12   #4
Truffe
Архивный участник
 
Join Date: May 2005
Posts: 944
Default

No, I've got the same issue even with the parent class in the source, NASC doesn't give any errors.

Thanks Kirikups, but I already tried such things :?
Truffe is offline  
Old 22.02.2006, 15:27   #5
Truffe
Архивный участник
 
Join Date: May 2005
Posts: 944
Default

Nvm, I solved my problem
Truffe is offline  
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 18:19.