Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- The first argument of the function below is the ID of a mission type, it must be unique!
- local obj = MISSIONS.NewMissionType("example")
- -- Disable the mission type
- -- As the addon is most likely loaded after all other addons,
- -- you can check for specific a specific condition.
- -- (Example: Does my global addon table exist?)
- obj:SetDisabled(true)
- -- Set the Imgur ID of the image which will be downloaded by clients and be used.
- --At the moment, other image platforms are not supported.
- -- Images are loaded using a proxy so even players from Turkey should be able to see them.
- obj:SetImgurIconID("nJU8Mrd")
- -- This is the string that will be displayed.
- -- ":value:" will be replaced with the current (formatted!) progress.
- obj:SetDescription("This is an example mission which requires :value: amount of something")
- -- obj:AddTier(progressRequired, rewardOverride)
- -- Those must be kept in order!
- obj:AddTier(10, 1000)
- obj:AddTier(20, 5000)
- obj:AddTier(30, 10000)
- -- Save the progress instantly after it changes?
- obj:SetSaveOnChange(true)
- -- Instantly network progress changes to the player?
- obj:SetNetworkOnChange(true)
- -- This function allows to modify the displayed value of a mission type.
- obj:SetFormatFunction(function(value)
- return value .. " points"
- end)
- -- This function allows you to check if a player is eligible to get this specific mission assigned.
- -- Return false to exclude it from a player's possible mission pool.
- obj:SetEligibleFunction(function(p)
- return false
- end)
- -- obj:AddHook(hookName, function(self, ...))
- -- "self" is the mission object, it will always be added as first argument
- obj:AddHook("EntityTakeDamage", function(self, target, damageInfo)
- -- example code
- local mission = target:Missions():Get(self)
- if (mission) then
- mission:AddProgress(1)
- end
- end)
- -- obj:AddTimer(timerID, delay, repetitions) Check out https://wiki.facepunch.com/gmod/timer.Create
- -- The first function argument will be the mission object
- obj:AddTimer("SomeTimerID", 1, 0, function(self)
- -- your code here
- end)
- -- Don't forget to register the mission at the end.
- obj:Register()
Add Comment
Please, Sign In to add comment