// This is an automatically generated chai script template // Content needs to be added by hand to make it function // In order for this script to be loaded, change its extension to .chai // and move it to the correct folder in bin/scripts/chai/quest // Quest Script: SubFst007_00031 // Quest Name: Essential Oil // Quest ID: 65567 // Start NPC: 1000705 // End NPC: 1000705 class SubFst007Def { def SubFst007Def() { // Basic quest information this.name = "Essential Oil"; this.id = 65567; // Quest vars / flags used // GetQuestUI8AL // GetQuestUI8BH // Steps in this quest ( 0 is before accepting, // 1 is first, 255 means ready for turning it in this.SEQ_0 = 0; this.SEQ_1 = 1; this.SEQ_FINISH = 255; // Quest rewards this.RewardExpFactor = 100; this.RewardItemOptional = [3530, 3531, 5823]; this.RewardItemOptionalCount = [1, 1, 3]; // Entities found in the script data of the quest this.ACTOR0 = 1000705; this.ENEMY0 = 49; this.ITEM0 = 2000098; this.SEQ_0_ACTOR0 = 0; this.SEQ_2_ACTOR0 = 1; this.SEQ_2_ACTOR0_NPCTRADENO = 99; this.SEQ_2_ACTOR0_NPCTRADEOK = 100; } ////////////////////////////////////////////////////////////////////// // Available Scenes in this quest, not necessarly all are used def Scene00000( player ) { player.eventPlay( this.id, 0, NONE, fun( player, eventId, param1, param2, param3 ) { if( param2 == 1 ) // accept quest { player.questUpdate( SubFst007.id, SubFst007.SEQ_1 ); } } ); } def Scene00001( player ) { player.eventPlay( this.id, 1, NONE, fun( player, eventId, param1, param2, param3 ) { if( param2 == 1 ) // gave back items { SubFst007.Scene00100( player ); } } ); } def Scene00099( player ) //unused { player.eventPlay( this.id, 99, NONE, fun( player, eventId, param1, param2, param3 ) {} ); } def Scene00100( player ) { player.eventPlay( this.id, 100, NONE, fun( player, eventId, param1, param2, param3 ) { if( param2 == 1 ) // finish quest { if( player.giveQuestRewards( SubFst007.id, 0 ) ) { player.questFinish( SubFst007.id ); } } } ); } ////////////////////////////////////////////////////////////////////// // Event Handlers def onTalk( eventId, player, actorId ) { var actor = mapActor( actorId ); if( !player.hasQuest( SubFst007.id ) ) { SubFst007.Scene00000( player ); } if( player.questGetSeq( SubFst007.id ) == SubFst007.SEQ_FINISH ) { SubFst007.Scene00001( player ); } } def onBnpcKill_49( player ) { var currentKC = player.getQuestUI8AL(SubFst007.id); currentKC = currentKC + 1; player.questMessage( SubFst007.id, 0, 2, currentKC, 6 ); player.tryAddItem( 2000098, 1 ); if( currentKC >= 6 ) { player.questUpdate( SubFst007.id, SubFst007.SEQ_FINISH ); player.setQuestUI8BH( SubFst007.id, currentKC ); } else { player.setQuestUI8AL( SubFst007.id, currentKC ); player.setQuestUI8BH( SubFst007.id, currentKC ); } } }; GLOBAL SubFst007 = SubFst007Def();