โ๏ธScript Exports
exports.abp_missions:StartRemoteMission(missionId, gameVariables, playerInitiator)
The RemoteStartMission function is an export function that allows you to start a mission remotely from another resource or client. It provides an interface to start a specific mission and handle the corresponding responses and actions.
Important: Setting the game variables WILL REPLACE the ones set within the mission file.
Parameters:
missionId
: The unique identifier of the mission you want to start.gameVariables
: (nil for optional) An object that contains the game variables needed for the mission.playerInitiator
: The playerServerId of the player who initiated the quest start request.
Example
exports.abp_missions:StartRemoteMission("test_mission", {
position = vector3(120.0, 20.0, 75.0),
distanceCheck = 5,
secondsRemaining = 20
}, GetPlayerServerId(PlayerId()))
When use custom game variables?
Let's imagine that you want to create a shoplifting system, because each store is different, so you could configure the name, if it is for liquors or chocolates. Then you will make a list of temporary game variables that depending on the player's location will call one another.
Another example is, you want to make a variable mission where an objective is not always in the same place, so you make a table of variables and when you start the mission to play, it automatically selects the alternatives.
Example
local gameVariables = {
{
enemyPosition = vector3(0, 0, 0),
enemyName = "Batman"
},
{
enemyPosition = vector3(1, 1, 1),
enemyName = "Superman"
},
{
enemyPosition = vector3(2, 3, 3),
enemyName = "Spiderman"
}
}
local gameVariableToUse = gameVariables[math.random(1, #gameVariables)]
exports.abp_missions:StartRemoteMission("test_hero_mission", gameVariableToUse, GetPlayerServerId(PlayerId()))
Why require playerInitiator?
The playerInitiator is required to prevent malicious players from initiating missions for other players while away. (It's a small filter, although we are working on alternatives)
Last updated
Was this helpful?