[MANUAL] AI npc Matras Hellbound

Тема в разделе "Установка и настройка (Setup and configuration)", создана пользователем root, 13 сен 2014.

  1. root

    root Administrator Команда форума Administrator Moderator Developers Team

    Регистрация:
    23 авг 2014
    Сообщения:
    254
    Симпатии:
    58
    Баллы:
    11
    127421986277.jpg
    Код:
    set_compiler_opt base_event_type(@NTYPE_NPC_EVENT)
    
    class matras : citizen
    {
    parameter:
    	int GM_ID = 130;
    handler:
    	EventHandler TALK_SELECTED(fhtml0,talker)
    	{
    		if( _from_choice == 0 )
    		{
    			if( myself.HaveMemo( talker, @mantras_curiosity ) == 0 )
    			{
    				_choiceN = ( _choiceN + 1 );
    				_code = 0;
    				myself.AddChoice( 0, "Mantras' Curiosity" );
    			}
    			if( myself.HaveMemo( talker, @mantras_curiosity ) == 1 )
    			{
    				_choiceN = ( _choiceN + 1 );
    				_code = 1;
    				myself.AddChoice( 1, "Mantras' Curiosity" );
    			}
    			
    			
    			if( myself.HaveMemo( talker, @mantras_request ) == 0 )
    			{
    				_choiceN = ( _choiceN + 1 );
    				_code = 2;
    				myself.AddChoice( 2, "Mantras' Request" );
    			}
    			if( myself.HaveMemo( talker, @mantras_request ) == 1 )
    			{
    				_choiceN = ( _choiceN + 1 );
    				_code = 3;
    				myself.AddChoice( 3, "Mantras' Request" );
    			}
    		}
    		if( _from_choice || _choiceN == 1 )
    		{
    			select( _code )
    			{
    				case 0:
    				{
    					myself.FHTML_SetFileName( fhtml0, "matras_q0132_01.htm" );
    					myself.FHTML_SetInt( fhtml0, "quest_id", 132 );
    					myself.ShowFHTML( talker, fhtml0 );
    					break;
    				}
    				case 1:
    				{
    					if (( myself.OwnItemCount( talker, @rankus_blueprint ) == 0 ) || ( myself.OwnItemCount( talker, @demon_princes_blueprint ) == 0 ))
    					{
    						myself.ShowPage( talker, "matras_q0132_04.htm" );
    					}else{
    						myself.ShowPage( talker, "matras_q0132_05.htm" );
    						myself.SetMemoState( talker, @mantras_curiosity, 2 );
    						myself.SetFlagJournal( talker, @mantras_curiosity, 2 );
    						myself.AddLog( 2, talker, 132 );
    						myself.DeleteItem1( talker, @rankus_blueprint, 1 );
    						myself.DeleteItem1( talker, @demon_princes_blueprint, 1 );
    						myself.SoundEffect( talker, "ItemSound.quest_finish" );
    					}
    					if(myself.GetMemoState( talker, @mantras_curiosity ) == 2)
    					{
    						myself.ShowPage( talker, "matras_q0132_06.htm" );
    					}
    				}
    				
    				case 2:
    				{
    					myself.ShowPage( talker, "matras_q0691_01.htm" );
    					break;
    				}
    				case 3:
    				{
    					myself.ShowPage( talker, "matras_q0691_05.htm" );
    					break;
    				}
    			}
    			return;
    		}
    		super;
    	}
    
    
    	EventHandler QUEST_ACCEPTED(quest_id,talker)
    	{
    		if(quest_id==132)
    		{
    			myself.SetCurrentQuestID( @mantras_curiosity );
    			if( myself.GetInventoryInfo( talker, 0 ) >= myself.GetInventoryInfo( talker, 1 ) * 0.800000 || myself.GetInventoryInfo( talker, 2 ) >= myself.GetInventoryInfo( talker, 3 ) * 0.800000 )
    			{
    				myself.ShowSystemMessage( talker, 1118 );
    				return;
    			}
    			else if( ( ( myself.GetCurrentTick() - talker.quest_last_reward_time ) > 1 ) && talker.level >= 78 )
    			{
    				talker.quest_last_reward_time = myself.GetCurrentTick();
    				myself.SetMemo( talker, @mantras_curiosity );
    				myself.SetMemoState( talker, @mantras_curiosity, 1 );
    				myself.AddLog( 1, talker, 14 );
    				myself.SetFlagJournal( talker, @mantras_curiosity, 1 );
    				myself.GiveItem1( talker, @rough_ore_of_fire, 1 );
    				myself.GiveItem1( talker, @rough_ore_of_water, 1 );
    				myself.GiveItem1( talker, @rough_ore_of_the_earth, 1 );
    				myself.GiveItem1( talker, @rough_ore_of_wind, 1 );
    				myself.GiveItem1( talker, @rough_ore_of_darkness, 1 );
    				myself.GiveItem1( talker, @rough_ore_of_divinity, 1 );
    				myself.SoundEffect( talker, "ItemSound.quest_accept" );
    				myself.ShowPage( talker, "matras_q0132_03.htm" );
    			}
    			if( talker.level < 78 )
    			{
    				myself.ShowPage( talker, "matras_q0132_02.htm" );				
    			}
    		}
    		if(quest_id==691)
    		{
    			myself.SetCurrentQuestID( @mantras_request );
    			if( myself.GetInventoryInfo( talker, 0 ) >= myself.GetInventoryInfo( talker, 1 ) * 0.800000 || myself.GetInventoryInfo( talker, 2 ) >= myself.GetInventoryInfo( talker, 3 ) * 0.800000 )
    			{
    				myself.ShowSystemMessage( talker, 1118 );
    				return;
    			}
    			else if( ( ( myself.GetCurrentTick() - talker.quest_last_reward_time ) > 1 ) && talker.level >= 78 )
    			{
    				talker.quest_last_reward_time = myself.GetCurrentTick();
    				myself.SetMemo( talker, @mantras_request );
    				myself.SetMemoState( talker, @mantras_request, 1 );
    				myself.AddLog( 1, talker, 14 );
    				myself.SetFlagJournal( talker, @mantras_request, 1 );
    				myself.SoundEffect( talker, "ItemSound.quest_accept" );
    				myself.ShowPage( talker, "matras_q0691_04.htm" );
    			}
    			if( talker.level < 78 )
    			{
    				myself.ShowPage( talker, "matras_q0691_03.htm" );				
    			}
    		}
    		super;
    	}
    
    
    	EventHandler MENU_SELECTED(ask,i0,i1,quest_id,reply,talker)
    	{
    		if( ask == 132 )
    		{
    			if ( reply == 1 )
    			{
    				myself.ShowPage( talker, "matras_q0132_07.htm" );
    				myself.SetMemoState( talker, @mantras_curiosity, 3 );
    				myself.AddLog( 3, talker, 132 );
    				myself.SetFlagJournal( talker, @mantras_curiosity, 3 );
    				myself.RemoveMemo( talker, @mantras_curiosity );
    				myself.SetOneTimeQuestFlag( talker, @mantras_curiosity, 1 );
    				myself.SoundEffect( talker, "ItemSound.quest_finish" );
    			}
    		}
    		if( ask == 691 )
    		{
    			if ( reply == 1 )
    			{
    				myself.ShowPage( talker, "matras_q0691_02.htm" );
    			}
    			if ( (reply == 2) && ( myself.OwnItemCount( talker, @red_stone ) >= 744 ))
    			{
    				myself.ShowPage( talker, "matras_q0691_07.htm" );
    			}
    			if ( (reply == 2) && ( myself.OwnItemCount( talker, @red_stone ) >= 1 ) && ( myself.OwnItemCount( talker, @red_stone ) < 744 ))
    			{
    				myself.ShowPage( talker, "matras_q0691_08.htm" );
    			}
    			if ( (reply == 2) && ( myself.OwnItemCount( talker, @red_stone ) == 0 ))
    			{
    				myself.ShowPage( talker, "matras_q0691_06.htm" );
    			}
    			if ( (reply == 3) && ( myself.OwnItemCount( talker, @red_stone ) >= 744 ))
    			{
    				myself.ShowPage( talker, "matras_q0691_11.htm" );
    				myself.DeleteItem1( talker, @red_stone, myself.OwnItemCount( talker, @red_stone ) );
    				myself.RemoveMemo( talker, @jude_s_request );
    				myself.AddLog( 2, talker, 691 );
    				myself.GiveItem1( talker, @dynastic_essence_ii, 1 );
    				myself.SoundEffect( talker, "ItemSound.quest_finish" );
    			}
    			if ( (reply == 3) && ( myself.OwnItemCount( talker, @red_stone ) < 744 ))
    			{
    				myself.ShowPage( talker, "matras_q0691_10.htm" );
    			}
    			if ( reply == 4 )
    			{
    				myself.ShowPage( talker, "matras_q0691_06.htm" );
    			}
    			if ( (reply == 5) && ( myself.OwnItemCount( talker, @red_stone ) >= 1 ) )
    			{
    				myself.ShowPage( talker, "matras_q0691_09.htm" );
    				myself.RemoveMemo( talker, @jude_s_request );
    				myself.AddLog( 2, talker, 691 );
    				myself.GiveItem1( talker, @adena, 200000 * myself.FloatToInt(myself.OwnItemCount( talker, @red_stone )) );
    				myself.DeleteItem1( talker, @red_stone, myself.OwnItemCount( talker, @red_stone ) );
    				myself.SoundEffect( talker, "ItemSound.quest_finish" );
    			}
    			if ( (reply == 5) && ( myself.OwnItemCount( talker, @red_stone ) < 1 ))
    			{
    				myself.ShowPage( talker, "matras_q0691_10.htm" );
    			}
    		}
    		super;
    	}
    
    
    }