g_mActors = { "Player", "Nicetas", "NicetasCop1", "NicetasCop2", "NicetasCop3", "NicetasCop4", "NicetasCop5", "NicetasCop6", "NicetasCop7", "NicetasCop8", "NicetasCop9" } MissionData = { { Name = "Mission.1v10", CallBackName = "Level.Activate1V10(0)", CleanCallBackName = "", Actors = { Player = { ["PlayAll::GameServices::Placement"] = { Position = "0;-70;2.5", Rotation = "180;0;0" }, CrCharacterArmor = { ArmorName = "Heavy_Templar" , GodMode = "0" , CustomLeg="80" , CustomBody="100" , CustomHelmet="150" }, }, NicetasCop9 = { ["PlayAll::GameServices::Placement"] = { Position = "0;70;2.5", Rotation = "0;0;0" }, CrBrain = { HitDelay = "2.0" }, CrCharacterArmor = { ArmorName = "Nicetas_Heavy", GodMode = "0", MaxLife = "500", CurrentLife = "500", FinishFactor = "0.0" , CustomBody="150" , CustomHelmet="150" , CustomLeg="150"}, }, NicetasCop8 = { ["PlayAll::GameServices::Placement"] = { Position = "-20;70;2.5", Rotation = "0;0;0" }, CrBrain = { HitDelay = "3.0" }, CrCharacterArmor = { ArmorName = "Byz_Heavy", GodMode = "0", MaxLife = "200", CurrentLife = "200", FinishFactor = "0.2", CustomBody="120" , CustomHelmet="120" , CustomLeg="120"}, }, NicetasCop7 = { ["PlayAll::GameServices::Placement"] = { Position = "20;70;2.5", Rotation = "0;0;0" }, CrBrain = { HitDelay = "3.0" }, CrCharacterArmor = { ArmorName = "Byz_Heavy", GodMode = "0", MaxLife = "200", CurrentLife = "200", FinishFactor = "0.2", CustomBody="120" , CustomHelmet="120" , CustomLeg="120" }, }, NicetasCop6 = { ["PlayAll::GameServices::Placement"] = { Position = "0;50;2.5", Rotation = "0;0;0" }, CrBrain = { HitDelay = "3.0" }, CrCharacterArmor = { ArmorName = "Byz_Heavy", GodMode = "0", MaxLife = "200", CurrentLife = "200", FinishFactor = "0.2", CustomBody="120" , CustomHelmet="120" , CustomLeg="120" }, }, NicetasCop5 = { ["PlayAll::GameServices::Placement"] = { Position = "-30;50;2.5", Rotation = "0;0;0" }, CrBrain = { HitDelay = "3.0" }, CrCharacterArmor = { ArmorName = "Byz_Heavy", GodMode = "0", MaxLife = "200", CurrentLife = "200", FinishFactor = "0.2", CustomBody="120" , CustomHelmet="120" , CustomLeg="120" }, }, NicetasCop4 = { ["PlayAll::GameServices::Placement"] = { Position = "30;50;2.5", Rotation = "0;0;0" }, CrBrain = { HitDelay = "4.0" }, CrCharacterArmor = { ArmorName = "Imperial_Heavy", GodMode = "0", MaxLife = "100", CurrentLife = "100", FinishFactor = "0.5", CustomBody="100" , CustomHelmet="100" , CustomLeg="100" }, }, NicetasCop3 = { ["PlayAll::GameServices::Placement"] = { Position = "0;0;2.5", Rotation = "0;0;0" }, CrBrain = { HitDelay = "4.0" }, CrCharacterArmor = { ArmorName = "Imperial_Heavy", GodMode = "0", MaxLife = "100", CurrentLife = "100", FinishFactor = "0.5", CustomBody="100" , CustomHelmet="100" , CustomLeg="100" }, }, NicetasCop2 = { ["PlayAll::GameServices::Placement"] = { Position = "-20;30;2.5", Rotation = "0;0;0" }, CrBrain = { HitDelay = "4.0" }, CrCharacterArmor = { ArmorName = "Imperial_Heavy", GodMode = "0", MaxLife = "100", CurrentLife = "100", FinishFactor = "0.5", CustomBody="100" , CustomHelmet="100" , CustomLeg="100" }, }, NicetasCop1 = { ["PlayAll::GameServices::Placement"] = { Position = "0;30;2.5", Rotation = "0;0;0" }, CrBrain = { HitDelay = "4.0" }, CrCharacterArmor = { ArmorName = "Imperial_Heavy", GodMode = "0", MaxLife = "100", CurrentLife = "100", FinishFactor = "0.5", CustomBody="100" , CustomHelmet="100" , CustomLeg="100" }, }, Nicetas = { ["PlayAll::GameServices::Placement"] = { Position = "20;30;2.5", Rotation = "0;0;0" }, CrBrain = { HitDelay = "4.0" }, CrCharacterArmor = { ArmorName = "Imperial_Heavy", GodMode = "0", MaxLife = "100", CurrentLife = "100", FinishFactor = "0.5" }, }, }, } } g_iCurrentObjective = 0 function SetUpObjectiveWithTransition() PostProcess.Activate( "ScreenToColor", 1, 0.9, 0.0, Vector3.New( { 1.0, 1.0, 1.0 } ) ) ScriptEventManager.AddTimedEvent( 0.1, 'Level.SetUpObjective()' ) Crusaders.oPlayer:Invoke( "ForceLock", "" ) end function SetUpObjective() -- Deactivate any time factors that could have been configured before GameContext.ClearTimeFactors() -- Handling Weapons in the missions Crusaders.Drop( Crusaders.oPlayerActor , "Crossbow_1" , true) Crusaders.PickUp( Crusaders.oPlayerActor, "Crossbow_1" ) Crusaders.Drop( Crusaders.oPlayerActor , "Crusader_S_Templar", true ) Crusaders.PickUp( Crusaders.oPlayerActor, "Crusader_S_Templar" ) local mData = {} for sActorName, mActorData in pairs( MissionData[1].Actors ) do if( mData[sActorName] == nil ) then mData[sActorName] = {} end for sComponentName, mValuesMap in pairs( mActorData ) do if( mData[sActorName][sComponentName] == nil ) then mData[sActorName][sComponentName] = {} end for sValueName, oValueData in pairs( mValuesMap ) do mData[sActorName][sComponentName][sValueName] = oValueData end end end g_iLastObjective = g_iCurrentObjective g_iCurrentObjective = 1 ApplyObjectiveStartUpValue( mData, MissionData[1].Actors ) oMission:Invoke( "Reset" , MissionData[1].Name ) oMission:Invoke( "Activate", MissionData[1].Name ) end function RestartObjective() PostProcess.Activate( "ScreenToColor", 1, 0.9, 0.0, Vector3.New( { 1.0, 1.0, 1.0 } ) ) oMission:Invoke( "Reset", MissionData[ g_iCurrentObjective ].Name ) ApplyObjectiveStartUpValue( MissionData[ g_iCurrentObjective ].Actors, MissionData[ g_iCurrentObjective ].Actors ) end function ApplyObjectiveStartUpValue( mData, mObjData ) for i,sActorName in pairs( g_mActors ) do local oActor = ObjectFactory.GetActor( sActorName ) Crusaders.Freeze( oActor ) if( mData[sActorName] ) then for sComponentName, mValuesMap in pairs( mData[sActorName] ) do local oComponent = oActor:GetComponent( sComponentName ) if( oComponent == nil ) then error = sComponentName end for sValueName, oValueData in pairs( mValuesMap ) do if( type( sValueName ) == "string" ) then oComponent:SetMemberValue( sValueName, oValueData ) else oComponent:Invoke( oValueData ) end end end if mObjData[sActorName] then Crusaders.Unfreeze( oActor ) end end end end function ValidateObjective( sMissionName, fBlockInputDelay, oCallback ) oMission:Invoke( 'Validate', sMissionName ) -- block inputs after a fBlockInputDelay seconds delay ScriptEventManager.AddTimedEvent( fBlockInputDelay, [[ GameContext.BlockPlayersInput( true )]] ) if( type( oCallback ) == "string" ) then loadstring( oCallback )() end Tips.SlideAllOut() end function ManageLevel() Level.Activate1V10(0) Hud.DeactivateEntireHUD() ManageLevel = function() end end function Activate1V10( fDelay ) Gui.Clear() ScriptEventManager.AddTimedEvent( fDelay , "Level.SetUpObjectiveWithTransition(25)" ) ScriptEventManager.AddTimedEvent( fDelay + 0.2 , [[ ObjectFactory.GetComponent( 'Player', "CrArsenal" ):Invoke( "ChangeOneH" )]] ) ScriptEventManager.AddTimedEvent( fDelay + 1 , [[ObjectFactory.GetComponent( 'Player' , "CrCharacterArmor" ):Invoke( "RestoreArmor" )]] ) ScriptEventManager.AddTimedEvent( fDelay + 0.2, [[ Level.oAltWorld:SetMemberValue( "Enable", "true" )]] ) ScriptEventManager.AddTimedEvent( fDelay + 0.2 , [[ ObjectFactory.GetComponent( 'Player', "CrCharacterArmor" ):SetMemberValue( "CurrentLife" , "100" )]] ) ScriptEventManager.AddTimedEvent( fDelay + 0.2 , [[GameContext.CenterView(0)]] ) ScriptEventManager.AddTimedEvent( fDelay + 1, [[ ScriptEventManager.PopUp( "newCustom" , "HUD_TUTO_OBJ_1V1_TITLE" , "HUD_TUTO_OBJ_1V10_CONTENT" , "Level.PostActivate1V10()" , "" )]] ) --ScriptEventManager.AddTimedEvent( fDelay + 1, [[ MessageBox.PopupCustom( "SURVIVAL" , "Fight these 10 ennemies to survive" , "Level.PostActivate1V10()" , "" )]] ) ScriptEventManager.AddTimedEvent( fDelay + 1, [[ ScriptEventManager.RegisterEvent( 'Nicetas', "DIE", 'Level.Validate1V10Kill01()', "", 1 )]] ) ScriptEventManager.AddTimedEvent( fDelay + 1, [[ ScriptEventManager.RegisterEvent( 'NicetasCop1', "DIE", 'Level.Validate1V10Kill02()', "", 1 )]] ) ScriptEventManager.AddTimedEvent( fDelay + 1, [[ ScriptEventManager.RegisterEvent( 'NicetasCop2', "DIE", 'Level.Validate1V10Kill03()', "", 1 )]] ) ScriptEventManager.AddTimedEvent( fDelay + 1, [[ ScriptEventManager.RegisterEvent( 'NicetasCop3', "DIE", 'Level.Validate1V10Kill04()', "", 1 )]] ) ScriptEventManager.AddTimedEvent( fDelay + 1, [[ ScriptEventManager.RegisterEvent( 'NicetasCop4', "DIE", 'Level.Validate1V10Kill05()', "", 1 )]] ) ScriptEventManager.AddTimedEvent( fDelay + 1, [[ ScriptEventManager.RegisterEvent( 'NicetasCop5', "DIE", 'Level.Validate1V10Kill06()', "", 1 )]] ) ScriptEventManager.AddTimedEvent( fDelay + 1, [[ ScriptEventManager.RegisterEvent( 'NicetasCop6', "DIE", 'Level.Validate1V10Kill07()', "", 1 )]] ) ScriptEventManager.AddTimedEvent( fDelay + 1, [[ ScriptEventManager.RegisterEvent( 'NicetasCop7', "DIE", 'Level.Validate1V10Kill08()', "", 1 )]] ) ScriptEventManager.AddTimedEvent( fDelay + 1, [[ ScriptEventManager.RegisterEvent( 'NicetasCop8', "DIE", 'Level.Validate1V10Kill09()', "", 1 )]] ) ScriptEventManager.AddTimedEvent( fDelay + 1, [[ ScriptEventManager.RegisterEvent( 'NicetasCop9', "DIE", 'Level.Validate1V10Kill10()', "", 1 )]] ) ScriptEventManager.AddTimedEvent( fDelay + 1, [[ ScriptEventManager.RegisterEvent( 'Player', "DIE", 'Level.ActivateFail1V10()', "", 1 )]] ) ScriptEventManager.RegisterEvent( 'Player', "DAMAGED", 'Level.OnPlayerHit()', "", 1 ) Level.g_bPlayerHit = false ScriptEventManager.AddTimedEvent( fDelay + 1, [[ ObjectFactory.GetComponent( 'Player', "CrArsenal" ):Invoke( "Restore" )]] ) ScriptEventManager.AddTimedEvent( fDelay + 1, [[ ObjectFactory.GetComponent( 'Nicetas', "CrArsenal" ):Invoke( "Restore" )]] ) ScriptEventManager.AddTimedEvent( fDelay + 1, [[ ObjectFactory.GetComponent( 'NicetasCop1', "CrArsenal" ):Invoke( "Restore" )]] ) ScriptEventManager.AddTimedEvent( fDelay + 1, [[ ObjectFactory.GetComponent( 'NicetasCop2', "CrArsenal" ):Invoke( "Restore" )]] ) ScriptEventManager.AddTimedEvent( fDelay + 1, [[ ObjectFactory.GetComponent( 'NicetasCop3', "CrArsenal" ):Invoke( "Restore" )]] ) ScriptEventManager.AddTimedEvent( fDelay + 1, [[ ObjectFactory.GetComponent( 'NicetasCop4', "CrArsenal" ):Invoke( "Restore" )]] ) ScriptEventManager.AddTimedEvent( fDelay + 1, [[ ObjectFactory.GetComponent( 'NicetasCop5', "CrArsenal" ):Invoke( "Restore" )]] ) ScriptEventManager.AddTimedEvent( fDelay + 1, [[ ObjectFactory.GetComponent( 'NicetasCop6', "CrArsenal" ):Invoke( "Restore" )]] ) ScriptEventManager.AddTimedEvent( fDelay + 1, [[ ObjectFactory.GetComponent( 'NicetasCop7', "CrArsenal" ):Invoke( "Restore" )]] ) ScriptEventManager.AddTimedEvent( fDelay + 1, [[ ObjectFactory.GetComponent( 'NicetasCop8', "CrArsenal" ):Invoke( "Restore" )]] ) ScriptEventManager.AddTimedEvent( fDelay + 1, [[ ObjectFactory.GetComponent( 'NicetasCop9', "CrArsenal" ):Invoke( "Restore" )]] ) end function OnPlayerHit() Level.g_bPlayerHit = true end function ActivateFail1V10() --Tips.SlideOut() ScriptEventManager.AddTimedEvent( 3.0, [[ ScriptEventManager.PopUp( "newSurvival", "HUD_MISSION_FAILED", "GUI_MSG_CHALLENGE_RETRY", 'Level.RetryPrevious()' , 'Level.ReturnMain()')]] ) --ScriptEventManager.AddTimedEvent( 3.0 , [[ MessageBox.PopupFailSurvival( 'Level.RetryPrevious()' , 'Level.ReturnMain()' ) ]] ) Level.oAltWorld:SetMemberValue( "Enable", "false" ) Level.oAltWorld:SetMemberValue( "GaugeCurrentTime", "0" ) end function ReturnMain() GameContext.ChangeLevel( "DATA:/Levels/Lounge/Lounge.PLM" ) end function PostActivate1V10() --ScriptEventManager.AddTimedEvent( 1.0 , [[Tips.SlideIn( 'HUD_TUTO_OBJ_1V10_TIPS')]] ) Hud.FadeInEntireHUD() end function Validate1V10Kill01() oMission:Invoke( 'Validate', 'Mission.1v10.Kill.01' ) end function Validate1V10Kill02() oMission:Invoke( 'Validate', 'Mission.1v10.Kill.02' ) end function Validate1V10Kill03() oMission:Invoke( 'Validate', 'Mission.1v10.Kill.03' ) end function Validate1V10Kill04() oMission:Invoke( 'Validate', 'Mission.1v10.Kill.04' ) end function Validate1V10Kill05() oMission:Invoke( 'Validate', 'Mission.1v10.Kill.05' ) end function Validate1V10Kill06() oMission:Invoke( 'Validate', 'Mission.1v10.Kill.06' ) end function Validate1V10Kill07() oMission:Invoke( 'Validate', 'Mission.1v10.Kill.07' ) end function Validate1V10Kill08() oMission:Invoke( 'Validate', 'Mission.1v10.Kill.08' ) end function Validate1V10Kill09() oMission:Invoke( 'Validate', 'Mission.1v10.Kill.09' ) end function Validate1V10Kill10() oMission:Invoke( 'Validate', 'Mission.1v10.Kill.10' ) end function Validate1V10() GameContext.UnlockTrophy( "1v10" ) if( Level.g_bPlayerHit == false ) then GameContext.UnlockTrophy( "Super" ) end --Tips.SlideOut() ScriptEventManager.AddTimedEvent( 1, [[ ScriptEventManager.PopUp( "newSurvival", "GUI_MSG_CHALLENGE_WON", "GUI_MSG_CHALLENGE_OTHER", 'Level.RetryPrevious()' , 'Level.ReturnMain()')]] ) --ScriptEventManager.AddTimedEvent( 1.5, [[ MessageBox.PopupAchieveSurvival( 'Level.RetryPrevious()' , 'Level.ReturnMain()' )]] ) Level.oAltWorld:SetMemberValue( "Enable", "false" ) Level.oAltWorld:SetMemberValue( "GaugeCurrentTime", "0" ) end function RetryPrevious() oAltWorld:SetMemberValue( "Enable", "false" ) ScriptEventManager.ClearAllEvents() loadstring(MissionData[1].CallBackName)() end