Code:
--=================================
-- 002100
--=================================
x002100_g_ScriptId = 002100
x002100_g_RadioItemBonus={{id=30103040 ,num=2345},{id=30103039,num=2345},{id=30103038,num=2345}}
--===========================================
-- On Default Event
--===========================================
function x002100_OnDefaultEvent( sceneId, selfId, targetId )
BeginEvent(sceneId)
AddText(sceneId," Các hÕ mu¯n có mµt dßþc ph¦m quý hiªm phäi không, · ch± ta có mµt ít ðây. ")
AddNumText( sceneId, x002100_g_ScriptId, "бi dßþc ph¦m th¥n kÏ", 6, 1 )
AddNumText( sceneId, x002100_g_ScriptId, "R¶i ði..", 0, 0 )
EndEvent(sceneId)
DispatchEventList(sceneId,selfId,targetId)
end
function x002100_OnEventRequest( sceneId, selfId, targetId, eventId )
local nNumText = GetNumText()
if nNumText == 0 then
BeginUICommand(sceneId)
EndUICommand(sceneId)
DispatchUICommand(sceneId,selfId, 1000)
return
end
if nNumText == 1 then
BeginEvent(sceneId)
AddText(sceneId, " Dßþc ph¦m này không th¬ cho không ðßþc.")
local szStr = " Mu¯n nh§n ðßþc dßþc ph¦m này, ngß½i c¥n phäi ðßa mang cho ta.";
AddText(sceneId, szStr)
for i, item in x002100_g_RadioItemBonus do
if item.num == 2345 then
AddRadioItemBonus( sceneId, item.id, 4 )
end
end
EndEvent(sceneId)
DispatchMissionContinueInfo(sceneId,selfId,targetId, x002100_g_ScriptId, 0)
end
end
function x002100_OnMissionSubmit( sceneId, selfId, targetId, missionScriptId, selectRadioId )
--Kiem tra item can thiet co du so luong hay khong va xuat ra thong bao
if selectRadioId == 30103040 then
if GetItemCount(sceneId, selfId, 30001004) >= 50 and GetItemCount(sceneId, selfId, 30002004) >= 50 then
-- du item, bat dau xoa thu
if LuaFnDelAvailableItem(sceneId,selfId, 30001004, 50) == 1 and LuaFnDelAvailableItem(sceneId,selfId, 30002004, 50) == 1 then
-- them item
TryRecieveItem( sceneId, selfId, 30103040, 1 );
LuaFnSendSpecificImpactToUnit(sceneId,selfId,selfId,selfId,18,0)
else
x002100_MsgBox( sceneId, selfId, targetId, "#{JPZB_0610_12}" )
return
end
else
x002100_MsgBox( sceneId, selfId, targetId, "#WC¥n #R50 #WPh¥n #YThái Thß½ng Hoàn #Wvà #R50 #WPh¥n #YLµc Nhung Ðan" )
return
end
end
if selectRadioId == 30103039 then
if GetItemCount(sceneId, selfId, 30002003) >= 50 then
-- du item, bat dau xoa thu
if LuaFnDelAvailableItem(sceneId,selfId, 30002003, 50) == 1 then
-- them item
TryRecieveItem( sceneId, selfId, 30103039, 4 );
LuaFnSendSpecificImpactToUnit(sceneId,selfId,selfId,selfId,18,0)
else
x002100_MsgBox( sceneId, selfId, targetId, "#{JPZB_0610_12}" )
return
end
else
x002100_MsgBox( sceneId, selfId, targetId, "#WC¥n #R50 #WPh¥n #YQuy Linh Hoàn" )
return
end
end
if selectRadioId == 30103038 then
if GetItemCount(sceneId, selfId, 30001003) >= 50 then
-- du item, bat dau xoa thu
if LuaFnDelAvailableItem(sceneId,selfId, 30001003, 50) == 1 then
-- them item
TryRecieveItem( sceneId, selfId, 30103038, 4 );
LuaFnSendSpecificImpactToUnit(sceneId,selfId,selfId,selfId,18,0)
else
x002100_MsgBox( sceneId, selfId, targetId, "#{JPZB_0610_12}" )
return
end
else
x002100_MsgBox( sceneId, selfId, targetId, "#WC¥n #R50 #WPh¥n #YKim Sáng Dßþc" )
return
end
end
end
--===========================================
-- Show A Message Box
--===========================================
function x002100_MsgBox( sceneId, selfId, targetId, Tip )
BeginEvent( sceneId )
AddText( sceneId, Tip )
EndEvent( sceneId )
DispatchEventList( sceneId, selfId, targetId )
end