The Driver Syndicate/Scripting/Mission Scripting/Story Missions: Difference between revisions
Jump to navigation
Jump to search
SwissCruiser (talk | contribs) |
SwissCruiser (talk | contribs) |
||
Line 169: | Line 169: | ||
gameHUD:ShowAlert("#MENU_GAME_TITLE_MISSION_SUCCESS", 2.5, HUD_ALERT_SUCCESS) | gameHUD:ShowAlert("#MENU_GAME_TITLE_MISSION_SUCCESS", 2.5, HUD_ALERT_SUCCESS) | ||
gameHUD:ShowScreenMessage("# | gameHUD:ShowScreenMessage("#JOBDONE01", 4) -- set success Text in Localization file | ||
end | end | ||
</syntaxhighlight>see [[The Driver Syndicate/Scripting/Mission Scripting/Story Missions#How to add them to the Game/Mod|here]] how to add it to the game | </syntaxhighlight> | ||
* Cops are enabled in this example | |||
* Timer is enabled in this example | |||
see [[The Driver Syndicate/Scripting/Mission Scripting/Story Missions#How to add them to the Game/Mod|here]] how to add it to the game | |||
=== Example 1b: Simple drive from A to B mission without timer === | === Example 1b: Simple drive from A to B mission without timer === | ||
The following content belongs in the .lua file for such a mission.<syntaxhighlight lang="lua"> | The following content belongs in the .lua file for such a mission.<syntaxhighlight lang="lua"> | ||
-- Basic Mission Example 1b | -- Basic Mission Example 1b without cops | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
Line 190: | Line 195: | ||
} --set mission target here | } --set mission target here | ||
MISSION.Settings.EnableCops = | MISSION.Settings.EnableCops = false --true / false = enable/disable cops | ||
local playerCar = gameses:CreateCar("toledocoupe", CAR_TYPE_NORMAL) -- set player car here | local playerCar = gameses:CreateCar("toledocoupe", CAR_TYPE_NORMAL) -- set player car here | ||
Line 212: | Line 217: | ||
gameHUD:Enable(true) | gameHUD:Enable(true) | ||
gameHUD:FadeIn(false, 2.5) | gameHUD:FadeIn(false, 2.5) | ||
gameHUD:ShowAlert("# | gameHUD:ShowAlert("#TITLE02", 7, HUD_ALERT_NORMAL) -- set Mission Title in Localization file | ||
Line 232: | Line 237: | ||
missionmanager:SetRefreshFunc( MISSION.Phase1Update ) | missionmanager:SetRefreshFunc( MISSION.Phase1Update ) | ||
gameHUD:ShowScreenMessage("# | gameHUD:ShowScreenMessage("#DESCRIPTION02", 5) -- set Mission Description in Localization file | ||
missionmanager:EnableTimeout( false, 90 ) -- enable/false, time (in seconds) | missionmanager:EnableTimeout( false, 90 ) -- enable/false, time (in seconds) | ||
Line 335: | Line 340: | ||
gameHUD:ShowAlert("#MENU_GAME_TITLE_MISSION_SUCCESS", 2.5, HUD_ALERT_SUCCESS) | gameHUD:ShowAlert("#MENU_GAME_TITLE_MISSION_SUCCESS", 2.5, HUD_ALERT_SUCCESS) | ||
gameHUD:ShowScreenMessage("# | gameHUD:ShowScreenMessage("#JOBDONE02", 4) -- set success Text in Localization file | ||
end | end | ||
</syntaxhighlight>see [[The Driver Syndicate/Scripting/Mission Scripting/Story Missions#How to add them to the Game/Mod|here]] how to add it to the game | </syntaxhighlight> | ||
* Cops are disabled in this example | |||
* Timer is disabled in this example | |||
see [[The Driver Syndicate/Scripting/Mission Scripting/Story Missions#How to add them to the Game/Mod|here]] how to add it to the game | |||
=== Example 2: Following a car to its destination === | === Example 2: Following a car to its destination === |
Revision as of 15:54, 25 January 2025
Creating Missions
Here are some examples of how to create missions.
- "#TAGS or ID" should always be chosen so that it does not create duplicates/conflicts with other mods/addons or the base game! See EqLocalizationTool
- Weather, time of day and music can be defined separately for each mission.
- Make sure that you only use environment parameters that are available for the level.
- If you use vehicles for the mission that are included in community cars, you should mention this in your readme and the mod description. (missing vehicles cause crashes)
Example 1a: Simple drive from A to B mission with timer
The following content belongs in the .lua file for such a mission.
-- Basic Mission Example 1a with cops
--------------------------------------------------------------------------------
world:SetLevelName("levelname") --set levelname here
world:SetEnvironmentName("day_clear") --set weather here
MISSION.MusicScript = "frisco_night" --set music here
MISSION.Init = function()
--SetMusicState(MUSIC_STATE_PURSUIT)
MISSION.Data = {
targetPosition = Vector3D.new(-61.93,40.71,-68.29),
} --set mission target here
MISSION.Settings.EnableCops = true --true / false = enable/disable cops
local playerCar = gameses:CreateCar("mustang", CAR_TYPE_NORMAL) -- set player car here
MISSION.playerCar = playerCar
playerCar:SetMaxDamage(12.0)
-- real
playerCar:SetOrigin( Vector3D.new(15.20,70.71,67.85) ) --set startingpoint here
playerCar:SetAngles( Vector3D.new(-180.00,90.00,-180.00) ) --set starting direction here
playerCar:Spawn()
playerCar:SetColorScheme( 4 )
-- for the load time, set player car
gameses:SetPlayerCar( playerCar )
playerCar:Lock(true)
gameHUD:Enable(true)
gameHUD:FadeIn(false, 2.5)
gameHUD:ShowAlert("#TITLE01", 7, HUD_ALERT_NORMAL) -- set Mission Title in Localization file
missionmanager:ScheduleEvent( function()
MISSION.Phase1Start()
end, 3 )
end
function MISSION.Phase1Start()
local playerCar = MISSION.playerCar
gameHUD:Enable(true)
playerCar:Lock(false)
MISSION.targetHandle = gameHUD:AddMapTargetPoint(MISSION.Data.targetPosition)
-- here we start
missionmanager:SetRefreshFunc( MISSION.Phase1Update )
gameHUD:ShowScreenMessage("#DESCRIPTION01", 5) -- set Mission Description in Localization file
missionmanager:EnableTimeout( true, 110 ) -- true/false, time (in seconds)
end
function MISSION.OnDone()
local playerCar = MISSION.playerCar
gameHUD:RemoveTrackingObject(MISSION.targetHandle)
playerCar:Lock(true)
return true
end
MISSION.UpdateAll = function(delta)
local camera = world:GetView()
local playerCar = MISSION.playerCar
--UpdateCops( playerCar, delta )
-- check player vehicle is wrecked
if CheckVehicleIsWrecked( playerCar, MISSION.Data, delta ) then
gameHUD:ShowAlert("#WRECKED_VEHICLE_MESSAGE", 3.5, HUD_ALERT_DANGER)
MISSION.OnDone()
missionmanager:SetRefreshFunc( function()
return false
end )
gameses:SignalMissionStatus( MIS_STATUS_FAILED, 4.0 )
return false
end
if missionmanager:IsTimedOut() then
gameHUD:ShowAlert("#TIME_UP_MESSAGE", 3.5, HUD_ALERT_DANGER)
MISSION.OnDone()
missionmanager:SetRefreshFunc( function()
return false
end )
gameses:SignalMissionStatus( MIS_STATUS_FAILED, 4.0 )
return false
end
return true
end
MISSION.Phase1Update = function( delta )
local playerCar = MISSION.playerCar
local distToTarget = length(playerCar:GetOrigin() - MISSION.Data.targetPosition)
local playerSpeed = playerCar:GetSpeed()
if distToTarget < 90.0 then
if playerCar:GetPursuedCount() > 0 then
gameHUD:ShowScreenMessage("#LOSE_TAIL_MESSAGE", 1.5)
elseif playerSpeed < 60 then
if distToTarget < 4.0 then
gameHUD:RemoveTrackingObject(MISSION.targetHandle)
playerCar:Lock(true)
missionmanager:EnableTimeout( false, 80 )
-- TODO: cutscene black bar curtains
missionmanager:ScheduleEvent( MISSION.OnCompleted, 0 )
missionmanager:SetRefreshFunc( function()
return false
end )
return false
end
else
gameHUD:ShowScreenMessage("#SLOW_DOWN_MESSAGE", 1.0)
end
end
return MISSION.UpdateAll(delta)
end
function MISSION.OnCompleted()
MISSION.OnDone()
missionmanager:SetRefreshFunc( function()
return false
end )
gameses:SignalMissionStatus( MIS_STATUS_SUCCESS, 4.0 )
gameHUD:ShowAlert("#MENU_GAME_TITLE_MISSION_SUCCESS", 2.5, HUD_ALERT_SUCCESS)
gameHUD:ShowScreenMessage("#JOBDONE01", 4) -- set success Text in Localization file
end
- Cops are enabled in this example
- Timer is enabled in this example
see here how to add it to the game
Example 1b: Simple drive from A to B mission without timer
The following content belongs in the .lua file for such a mission.
-- Basic Mission Example 1b without cops
--------------------------------------------------------------------------------
world:SetLevelName("levelname") --set levelname here
world:SetEnvironmentName("dusk_clear") --set weather here
MISSION.MusicScript = "frisco_day" --set music here
MISSION.Init = function()
--SetMusicState(MUSIC_STATE_PURSUIT)
MISSION.Data = {
targetPosition = Vector3D.new(-619.93,40.71,-683.29),
} --set mission target here
MISSION.Settings.EnableCops = false --true / false = enable/disable cops
local playerCar = gameses:CreateCar("toledocoupe", CAR_TYPE_NORMAL) -- set player car here
MISSION.playerCar = playerCar
playerCar:SetMaxDamage(12.0)
-- real
playerCar:SetOrigin( Vector3D.new(1598.20,70.71,677.85) ) --set startingpoint here
playerCar:SetAngles( Vector3D.new(-180.00,90.00,-180.00) ) --set starting direction here
playerCar:Spawn()
playerCar:SetColorScheme( 4 )
-- for the load time, set player car
gameses:SetPlayerCar( playerCar )
playerCar:Lock(true)
gameHUD:Enable(true)
gameHUD:FadeIn(false, 2.5)
gameHUD:ShowAlert("#TITLE02", 7, HUD_ALERT_NORMAL) -- set Mission Title in Localization file
missionmanager:ScheduleEvent( function()
MISSION.Phase1Start()
end, 3 )
end
function MISSION.Phase1Start()
local playerCar = MISSION.playerCar
gameHUD:Enable(true)
playerCar:Lock(false)
MISSION.targetHandle = gameHUD:AddMapTargetPoint(MISSION.Data.targetPosition)
-- here we start
missionmanager:SetRefreshFunc( MISSION.Phase1Update )
gameHUD:ShowScreenMessage("#DESCRIPTION02", 5) -- set Mission Description in Localization file
missionmanager:EnableTimeout( false, 90 ) -- enable/false, time (in seconds)
end
function MISSION.OnDone()
local playerCar = MISSION.playerCar
gameHUD:RemoveTrackingObject(MISSION.targetHandle)
playerCar:Lock(true)
return true
end
MISSION.UpdateAll = function(delta)
local camera = world:GetView()
local playerCar = MISSION.playerCar
--UpdateCops( playerCar, delta )
-- check player vehicle is wrecked
if CheckVehicleIsWrecked( playerCar, MISSION.Data, delta ) then
gameHUD:ShowAlert("#WRECKED_VEHICLE_MESSAGE", 3.5, HUD_ALERT_DANGER)
MISSION.OnDone()
missionmanager:SetRefreshFunc( function()
return false
end )
gameses:SignalMissionStatus( MIS_STATUS_FAILED, 4.0 )
return false
end
if missionmanager:IsTimedOut() then
gameHUD:ShowAlert("#TIME_UP_MESSAGE", 3.5, HUD_ALERT_DANGER)
MISSION.OnDone()
missionmanager:SetRefreshFunc( function()
return false
end )
gameses:SignalMissionStatus( MIS_STATUS_FAILED, 4.0 )
return false
end
return true
end
MISSION.Phase1Update = function( delta )
local playerCar = MISSION.playerCar
local distToTarget = length(playerCar:GetOrigin() - MISSION.Data.targetPosition)
local playerSpeed = playerCar:GetSpeed()
if distToTarget < 90.0 then
if playerCar:GetPursuedCount() > 0 then
gameHUD:ShowScreenMessage("#LOSE_TAIL_MESSAGE", 1.5)
elseif playerSpeed < 60 then
if distToTarget < 4.0 then
gameHUD:RemoveTrackingObject(MISSION.targetHandle)
playerCar:Lock(true)
missionmanager:EnableTimeout( false, 80 )
-- TODO: cutscene black bar curtains
missionmanager:ScheduleEvent( MISSION.OnCompleted, 0 )
missionmanager:SetRefreshFunc( function()
return false
end )
return false
end
else
gameHUD:ShowScreenMessage("#SLOW_DOWN_MESSAGE", 1.0)
end
end
return MISSION.UpdateAll(delta)
end
function MISSION.OnCompleted()
MISSION.OnDone()
missionmanager:SetRefreshFunc( function()
return false
end )
gameses:SignalMissionStatus( MIS_STATUS_SUCCESS, 4.0 )
gameHUD:ShowAlert("#MENU_GAME_TITLE_MISSION_SUCCESS", 2.5, HUD_ALERT_SUCCESS)
gameHUD:ShowScreenMessage("#JOBDONE02", 4) -- set success Text in Localization file
end
- Cops are disabled in this example
- Timer is disabled in this example
see here how to add it to the game
Example 2: Following a car to its destination
ToDo:
see here how to add it to the game
How to add them to the Game/Mod
ToDo: