Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.85 KB | None | 0 0
  1. // Quest script by Nautical
  2.  
  3. local quest = {
  4.  
  5.   // Quest/Mission information
  6.   id = "ancientskull",
  7.   name = "The Ancient Skull",
  8.   description = "My buddy Brent has lost\nhis prized skulls. These things\ndate all the way back\nto around 200 BCE.\nHe is going absolutely\nnuts without the thing.\nPlease find and return\nit.",
  9.   objectives = "Retrieve 3 Ancient Skulls",
  10.   rewards = "A pat on the back\n$200 cash",
  11.   setupInstructions = "Place skull spawns around\nthe map. You can place as many\nas you like! So try to make it a\nchallenge to find the watermelons.",
  12.   pvp = false,
  13.   daily = false, // makes this quest a non-daily quest
  14.  
  15.   // Quest/Mission data
  16.   spawnModel = "models/Gibs/HGIBS.mdl",
  17.   spawnClass = "missionmod_collectable",
  18.   credit = 0, // how much credit do we have for completing objectives?
  19.   toCleanup = {},
  20. };
  21.  
  22. // Called when a player starts this quest
  23. function quest:OnStart(ply)
  24.  
  25.   for i = 1,3 do
  26.     local spawns = hook.Call("missionmod_GetQuestSpawns", nil, self.id);
  27.     local wm = ents.Create(self.spawnClass);
  28.      wm:MissionMod_SetQuest(self.id);
  29.     wm:Spawn();
  30.      wm:MissionMod_ChangeModel(self.spawnModel);
  31.      hook.Call("missionmod_SpawnAt", nil, wm, spawns, self.spawnClass);
  32.     table.insert(self.toCleanup, wm);
  33.   end
  34. end
  35.  
  36. // Called when we want to cleanup
  37. function quest:Cleanup()
  38.   for k,v in next, self.toCleanup do
  39.     if (IsValid(v)) then
  40.       v:Remove();
  41.     end
  42.   end
  43. end
  44.  
  45. // Checks to see if our quest is ready to be turned in
  46. function quest:CheckGoals()
  47.   if (self.credit > 2) then
  48.     return true;
  49.   end
  50.   return false;
  51. end
  52.  
  53. // Gets called when a player completes the quest and is to receive rewards
  54. function quest:OnGiveRewards(ply)
  55.   if (ply.addMoney) then
  56.     ply:addMoney(200);
  57.   end
  58. end
  59.  
  60. // Register the quest with mission mod
  61. hook.Call("missionmod_RegisterQuest", nil, quest);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement