--****************************************************************** --[[ @brief オブジェクトのイベントスクリプトテスト @date \$Date: Thu May 18 16:52:38 UTC+0900 2006 $ @author 長谷川 (\$Author: hasem $ @version \$Revision: 0 $ ]] --****************************************************************** LoadEventStdScriptFile( CURR_DLLUA_INSTANCE ); LoadMissionConstValueAuto( "150"); ----------------------------------------------------------------------------------- -- 初期化 ----------------------------------------------------------------------------------- --****************************************************************** -- メッセージハンドラの登録 --****************************************************************** function Initial( eventOperation) LogEvent( "オブジェクトのイベントスクリプトテストの初期化"); -- ON_DECREASE_DURABILITY_MYSELF( eventOperation, 0.8, "OnDurability8"); -- ON_DECREASE_DURABILITY_MYSELF( eventOperation, 0.4, "OnDurability4"); -- ON_BRIEFING_FINISH( eventOperation, "OnStartMission"); -- -- ON_RECIEVE_USER_MESSAGE( eventOperation, 1, 2, 2, "OnRecieveMessage"); -- -- ON_PARTS_DESTROY( eventOperation, 0, "OnDestroyParts_Atama_koshi"); -- ON_PARTS_DESTROY( eventOperation, 1, "OnDestroyParts_l_ude"); -- ON_PARTS_DESTROY( eventOperation, 2, "OnDestroyParts_r_ude"); -- -- SetTimerWithHandler( eventOperation, 100, 5, "OnTimerEvent"); -- -- local ctrl = eventOperation:GetCharaEventInterface(); -- local param0 = ctrl:GetEventParam( 0); -- local param1 = ctrl:GetEventParam( 1); -- local param2 = ctrl:GetEventParam( 2); -- local param3 = ctrl:GetEventParam( 3); -- ctrl:SetEventPropertyMySelf( true, false, false); -- ctrl:SetEventPropertyMySelf( true, true, true); -- -- local gvMgr = eventOperation:GetGlobalValueManager(); -- gvMgr:AddGlobalValue( "Test_value", 987); -- gvMgr:AddGlobalValue( "Test_value12356", 987); -- local tv = gvMgr:GetGlobalValue( "Test_value"); -- tv = tv + 200; -- gvMgr:ModifyGlobalValue( "Test_value", tv); -- -- -- 可も -- ctrl:SetEnableCamouflage( true); -- ctrl:SetEnableCamouflage( false); end ----------------------------------------------------------------------------------- -- ハンドラ ----------------------------------------------------------------------------------- --****************************************************************** -- 自分がある領域に入ったか? --****************************************************************** function OnStartMission( eventOperation) -- local ctrl = eventOperation:GetCharaEventInterface(); -- ctrl:LinkEnemyAction( 0); ON_DEAD_CONSTRAINT_PARENT( eventOperation, "OnParentDead"); -- SetRadarTargetMyself( eventOperation, true); -- ObserveRegionInMySelf( eventOperation, m150_PT_DEFENSE, "OnRegionIn"); -- ObserveRegionOutMySelf( eventOperation, m150_PT_DEFENSE, "OnRegionOut"); -- -- local ctrl = eventOperation:GetCharaEventInterface(); -- ctrl:CreatePA( 100, 2); -- ctrl:SendMessageToMissionEventManager( 100, 2, WM_EVENT_USER_MSG); -- ctrl:SetImmortal( true); -- -- -- サーチライトテスト -- ctrl:SetSearchLight( ENTITY_ID__PLAYER, 100, 90); -- ctrl:SetEnableSearchLight( true); -- -- -- local gvMgr = eventOperation:GetGlobalValueManager(); -- local tv = gvMgr:GetGlobalValue( "Test_value"); end --****************************************************************** -- 親が死んだ --****************************************************************** function OnParentDead( eventOperation) LogEvent( "■親が死んだ"); end --****************************************************************** -- APが半分 --****************************************************************** function OnRegionIn( eventOperation) LogEvent( "領域内に入った。"); local ctrl = eventOperation:GetCharaEventInterface(); -- ctrl:SetEventPropertyMySelf( false, true, true); ctrl:DetachConstraint(); local gvMgr = eventOperation:GetGlobalValueManager(); local tv = gvMgr:GetGlobalValue( "Test_value"); gvMgr:ModifyGlobalValue( "Test_value", tv + 100); end --****************************************************************** -- APが半分 --****************************************************************** function OnRegionOut( eventOperation) LogEvent( "領域から出た。"); local ctrl = eventOperation:GetCharaEventInterface(); -- ctrl:SetEventPropertyMySelf( true, true, true); end --****************************************************************** -- APが半分 --****************************************************************** function OnDurability8( interface) LogEvent( "APが8割"); -- -- LogEvent( string.format( "イベントグループ(%d)の数:%d", m150_GP_INTERCEPTION1, interface:GetEventGroupNum( m150_GP_INTERCEPTION1))); -- LogEvent( string.format( "エンティティグループ(%d)の数:%d", 2, interface:GetEntityGroupNum(2))); -- -- if ( interface == nil) then -- LogEvent( "nilだから何もしない"); -- else -- LogEvent( "nilじゃないので実行"); -- interface:ForceMissionFailure(); -- end end --****************************************************************** -- APが半分 --****************************************************************** function OnDurability4( interface) LogEvent( "APが4割"); end --****************************************************************** -- メッセージ受け取り --****************************************************************** function OnRecieveMessage( eo) LogEvent( "ミッション管理からのメッセージを受け取りました。"); end --****************************************************************** -- 部位破壊(頭) --****************************************************************** function OnDestroyParts_Atama_koshi( eo) LogEvent( "部位破壊(頭)"); end --****************************************************************** -- 部位破壊(左腕) --****************************************************************** function OnDestroyParts_l_ude( eo) LogEvent( "部位破壊(左腕)"); end --****************************************************************** -- 部位破壊(右腕) --****************************************************************** function OnDestroyParts_r_ude( eo) LogEvent( "部位破壊(右腕)"); end --****************************************************************** -- --****************************************************************** function OnTimerEvent(eo) LogEvent("時間です。"); local ctrl = eo:GetCharaEventInterface(); ctrl:SetImmortal( false); end