Quests

Creates quests for players to go on to earn rewards, complete with a GUI menu

Total Downloads: 9,371 - First Release: May 31, 2015 - Last Update: Jun 11, 2018

5/5, 53 likes
  1. (faulty code, plz ignore)
     
    Last edited by a moderator: Jan 24, 2017
  2. (faulty code, plz ignore)
     
    Last edited by a moderator: Jan 24, 2017
  3. BUG! Players with macros can dupe rewards many times. Pease fix this. It`s based on lag GUI menu.
     
  4. Oops, my code is faulty, it takes both names from the same source ultimately. So now, when you kill someone, it will always trigger the suicide warning...
     
  5. This tested out allright:
    Code:
    try
    {
        if (info.Initiator.ToPlayer().userID==entity.ToPlayer().userID) return; // suicide check
    }
    catch (Exception ex)
    {
    }

    Code:
            void OnEntityDeath(BaseCombatEntity entity, HitInfo info)
            {
                try
                {
                    if (entity != null)
                    {
                        BasePlayer player = null;                    if (info?.Initiator is BasePlayer)
                            player = info?.Initiator?.ToPlayer();
                        else if (entity.GetComponent<BaseHelicopter>() != null)
                            player = BasePlayer.FindByID(GetLastAttacker(entity.net.ID));
                      
                        if (player != null)
                        {
                            if (isPlaying(player)) return;
                            try
                            {
                                if (info.Initiator.ToPlayer().userID==entity.ToPlayer().userID) return; // suicide check
                            }
                            catch (Exception ex)
                            {
                            }
                            if (hasQuests(player.userID) && isQuestItem(player.userID, entity?.ShortPrefabName, QuestType.Kill))
                                ProcessProgress(player, QuestType.Kill, entity?.ShortPrefabName);
                        }
                    }
                }
                catch (Exception ex)
                {
                }
            }
    
    Perhaps it could be optimized for speed, the ToPlayer() and try/catch might be a bit heavy. But it works all right. Suicides now no longer count as player kills, while killing other people works just fine.
     
  6. This seems to be a better way to do it, but I did not have a chance to really test it:
    (update: tested out just fine)
    Code:
    if ((entity is BasePlayer) && (player.userID==entity.ToPlayer().userID)) return;
    Code:
            void OnEntityDeath(BaseCombatEntity entity, HitInfo info)
            {
                try
                {
                    if (entity != null)
                    {
                        BasePlayer player = null;                    if (info?.Initiator is BasePlayer)
                        {
                            player = info?.Initiator?.ToPlayer();
                            if ((entity is BasePlayer) && (player.userID==entity.ToPlayer().userID)) return;//suicide check
                        }
                        else if (entity.GetComponent<BaseHelicopter>() != null)
                            player = BasePlayer.FindByID(GetLastAttacker(entity.net.ID));
                   
                        if (player != null)
                        {
                            if (isPlaying(player)) return;
                            if (hasQuests(player.userID) && isQuestItem(player.userID, entity?.ShortPrefabName, QuestType.Kill))
                                ProcessProgress(player, QuestType.Kill, entity?.ShortPrefabName);
                        }
                    }
                }
                catch (Exception ex)
                {
                }
    
     
    Last edited by a moderator: Jan 26, 2017
  7. BUG! Players with macros can dupe rewards many times. Pease fix this. It`s based on lag GUI menu.
     
  8. I am proposing to use .Sort() here and there to make selecting items from lists a bit less tedious:

    Code:
            private void GetAllItems()
            {
                foreach (var item in ItemManager.itemList)
                    AllObjectives[QuestType.Loot].Add(item.shortname);
                AllObjectives[QuestType.Loot].Sort();
            }
            private void GetAllCraftables()
            {
                AllObjectives[QuestType.Craft].Sort();
                foreach (var bp in ItemManager.bpList)
                    if (bp.userCraftable)
                        AllObjectives[QuestType.Craft].Add(bp.targetItem.shortname);
                AllObjectives[QuestType.Craft].Sort();
            }
            private void GetAllResources()
            {
                AllObjectives[QuestType.Gather].Add("bearmeat");
                AllObjectives[QuestType.Gather].Add("bone.fragments");
                AllObjectives[QuestType.Gather].Add("chicken.raw");
                AllObjectives[QuestType.Gather].Add("cloth");
                AllObjectives[QuestType.Gather].Add("crude.oil");
                AllObjectives[QuestType.Gather].Add("fat.animal");
                AllObjectives[QuestType.Gather].Add("hq.metal.ore");
                AllObjectives[QuestType.Gather].Add("humanmeat.raw");
                AllObjectives[QuestType.Gather].Add("leather");
                AllObjectives[QuestType.Gather].Add("meat.boar");
                AllObjectives[QuestType.Gather].Add("metal.ore");
                AllObjectives[QuestType.Gather].Add("mushroom");
                AllObjectives[QuestType.Gather].Add("skull.human");
                AllObjectives[QuestType.Gather].Add("skull.wolf");
                AllObjectives[QuestType.Gather].Add("stones");
                AllObjectives[QuestType.Gather].Add("sulfur.ore");
                AllObjectives[QuestType.Gather].Add("wolfmeat.raw");
                AllObjectives[QuestType.Gather].Add("wood");
            }
            private void GetAllKillables()
            {
                AllObjectives[QuestType.Kill] = new List<string>
                {
                    "autoturret_deployed",
                    "bear",
                    "boar",
                    "chicken",
                    "horse",
                    "patrolhelicopter",
                    "player",
                    "stag",
                    "wolf"               
                };
                DisplayNames.Add("autoturret_deployed", "Auto-Turret");
                DisplayNames.Add("bear", "Bear");
                DisplayNames.Add("boar", "Boar");
                DisplayNames.Add("chicken", "Chicken");
                DisplayNames.Add("horse", "Horse");
                DisplayNames.Add("patrolhelicopter", "Helicopter");
                DisplayNames.Add("player", "Player");
                DisplayNames.Add("stag", "Stag");
                DisplayNames.Add("wolf", "Wolf");
            } 
     
  9. bro Players with macros can dupe rewards many times. Pease fix this. It`s based on lag GUI menu. Anybody Hear me!
     
  10. Can you stop spam this please?
     
  11. Is it possible to make a quest without using the chat?
     
  12. you can always change
    server\IDENTITY\oxide\data\Quests\quests_data.json
    then in server console type
    reload Quests

    Example of a quest_data.json with some kill & craft quests:
    Code:
    {
      "Quest": {
        "Craft": {
          "CertifiedBombMaker": {
            "QuestName": "CertifiedBombMaker",
            "Description": "Wow, you made 3 c4 without blowing yourself up? Here, have a certificate... and go.. go away!",
            "Objective": "explosive.timed",
            "ObjectiveName": "Timed Explosive Charge",
            "AmountRequired": 3,
            "Cooldown": 1,
            "ItemDeduction": false,
            "Rewards": [
              {
                "isRP": false,
                "isCoins": true,
                "isHuntXP": false,
                "DisplayName": "Coins",
                "ShortName": null,
                "ID": 0,
                "Amount": 3.0,
                "BP": false,
                "Skin": 0
              }
            ]
          },
          "TurretBuilder": {
            "QuestName": "TurretBuilder",
            "Description": "W...what?! You can build a Turret? Ehm... Ok! Lets be friends!",
            "Objective": "autoturret",
            "ObjectiveName": "Auto Turret",
            "AmountRequired": 1,
            "Cooldown": 1,
            "ItemDeduction": false,
            "Rewards": [
              {
                "isRP": false,
                "isCoins": true,
                "isHuntXP": false,
                "DisplayName": "Coins",
                "ShortName": null,
                "ID": 0,
                "Amount": 8.0,
                "BP": false,
                "Skin": 0
              },
              {
                "isRP": false,
                "isCoins": false,
                "isHuntXP": false,
                "DisplayName": "5.56 Rifle Ammo",
                "ShortName": "ammo.rifle",
                "ID": 815896488,
                "Amount": 100.0,
                "BP": false,
                "Skin": 0
              }
            ]
          },
          "OilBaron": {
            "QuestName": "OilBaron",
            "Description": "Melting your own oil down. Makes you a rich man.",
            "Objective": "small.oil.refinery",
            "ObjectiveName": "Small Oil Refinery",
            "AmountRequired": 1,
            "Cooldown": 60,
            "ItemDeduction": false,
            "Rewards": [
              {
                "isRP": false,
                "isCoins": true,
                "isHuntXP": false,
                "DisplayName": "Coins",
                "ShortName": null,
                "ID": 0,
                "Amount": 5.0,
                "BP": false,
                "Skin": 0
              },
              {
                "isRP": false,
                "isCoins": false,
                "isHuntXP": false,
                "DisplayName": "Crude Oil",
                "ShortName": "crude.oil",
                "ID": 1983936587,
                "Amount": 50.0,
                "BP": false,
                "Skin": 0
              }
            ]
          },
          "BigBurner": {
            "QuestName": "BigBurner",
            "Description": "Ah.. burning big amounts now eh? Good. Good!",
            "Objective": "furnace.large",
            "ObjectiveName": "Large Furnace",
            "AmountRequired": 1,
            "Cooldown": 1,
            "ItemDeduction": false,
            "Rewards": [
              {
                "isRP": false,
                "isCoins": true,
                "isHuntXP": false,
                "DisplayName": "Coins",
                "ShortName": null,
                "ID": 0,
                "Amount": 3.0,
                "BP": false,
                "Skin": 0
              },
              {
                "isRP": false,
                "isCoins": false,
                "isHuntXP": false,
                "DisplayName": "Wood",
                "ShortName": "wood",
                "ID": 3655341,
                "Amount": 1000.0,
                "BP": false,
                "Skin": 0
              },
              {
                "isRP": false,
                "isCoins": false,
                "isHuntXP": false,
                "DisplayName": "Camp Fire",
                "ShortName": "campfire",
                "ID": -139769801,
                "Amount": 1.0,
                "BP": false,
                "Skin": 0
              }
            ]
          },
          "DiggingItBig": {
            "QuestName": "DiggingItBig",
            "Description": "So, you are one of the Big Mining Companies now eh? Thats great!",
            "Objective": "mining.quarry",
            "ObjectiveName": "Mining Quarry",
            "AmountRequired": 1,
            "Cooldown": 1,
            "ItemDeduction": false,
            "Rewards": [
              {
                "isRP": false,
                "isCoins": true,
                "isHuntXP": false,
                "DisplayName": "Coins",
                "ShortName": null,
                "ID": 0,
                "Amount": 10.0,
                "BP": false,
                "Skin": 0
              },
              {
                "isRP": false,
                "isCoins": false,
                "isHuntXP": false,
                "DisplayName": "Low Grade Fuel",
                "ShortName": "lowgradefuel",
                "ID": 28178745,
                "Amount": 500.0,
                "BP": false,
                "Skin": 0
              },
              {
                "isRP": false,
                "isCoins": false,
                "isHuntXP": false,
                "DisplayName": "Stones",
                "ShortName": "stones",
                "ID": -892070738,
                "Amount": 1000.0,
                "BP": false,
                "Skin": 0
              },
              {
                "isRP": false,
                "isCoins": false,
                "isHuntXP": false,
                "DisplayName": "Sulfur Ore",
                "ShortName": "sulfur.ore",
                "ID": 889398893,
                "Amount": 1000.0,
                "BP": false,
                "Skin": 0
              },
              {
                "isRP": false,
                "isCoins": false,
                "isHuntXP": false,
                "DisplayName": "Metal Ore",
                "ShortName": "metal.ore",
                "ID": -1059362949,
                "Amount": 1000.0,
                "BP": false,
                "Skin": 0
              },
              {
                "isRP": false,
                "isCoins": false,
                "isHuntXP": false,
                "DisplayName": "High Quality Metal Ore",
                "ShortName": "hq.metal.ore",
                "ID": 2133577942,
                "Amount": 1000.0,
                "BP": false,
                "Skin": 0
              }
            ]
          }
        },
        "Delivery": {},
        "Gather": {},
        "Kill": {
          "KillPlayer": {
            "QuestName": "KillPlayer",
            "Description": "You know what I hate? Humans. Kill them! KILL THEM ALL!",
            "Objective": "player",
            "ObjectiveName": "Player",
            "AmountRequired": 1,
            "Cooldown": 1,
            "ItemDeduction": false,
            "Rewards": [
              {
                "isRP": false,
                "isCoins": true,
                "isHuntXP": false,
                "DisplayName": "Coins",
                "ShortName": null,
                "ID": 0,
                "Amount": 5.0,
                "BP": false,
                "Skin": 0
              }
            ]
          },
          "Chopper": {
            "QuestName": "Chopper",
            "Description": "Chopper.... Someone... Has to.. Kill! .... impossible..... ?",
            "Objective": "patrolhelicopter",
            "ObjectiveName": "Helicopter",
            "AmountRequired": 1,
            "Cooldown": 1,
            "ItemDeduction": false,
            "Rewards": [
              {
                "isRP": false,
                "isCoins": true,
                "isHuntXP": false,
                "DisplayName": "Coins",
                "ShortName": null,
                "ID": 0,
                "Amount": 1000.0,
                "BP": false,
                "Skin": 0
              }
            ]
          },
          "ChickenBoneArrows": {
            "QuestName": "ChickenBoneArrows",
            "Description": "Did you know you can make 2 arrows from one chicken? You can! Really!",
            "Objective": "chicken",
            "ObjectiveName": "Chicken",
            "AmountRequired": 1,
            "Cooldown": 1,
            "ItemDeduction": false,
            "Rewards": [
              {
                "isRP": false,
                "isCoins": false,
                "isHuntXP": false,
                "DisplayName": "Wooden Arrow",
                "ShortName": "arrow.wooden",
                "ID": -420273765,
                "Amount": 2.0,
                "BP": false,
                "Skin": 0
              }
            ]
          },
          "KillTheSwines": {
            "QuestName": "KillTheSwines",
            "Description": "You can make a crappy pants and a crappy knife from 10 swines. Just saying.",
            "Objective": "boar",
            "ObjectiveName": "Boar",
            "AmountRequired": 10,
            "Cooldown": 1,
            "ItemDeduction": false,
            "Rewards": [
              {
                "isRP": false,
                "isCoins": false,
                "isHuntXP": false,
                "DisplayName": "Bone Knife",
                "ShortName": "knife.bone",
                "ID": 776005741,
                "Amount": 1.0,
                "BP": false,
                "Skin": 0
              },
              {
                "isRP": false,
                "isCoins": false,
                "isHuntXP": false,
                "DisplayName": "Burlap Trousers",
                "ShortName": "burlap.trousers",
                "ID": 1767561705,
                "Amount": 1.0,
                "BP": false,
                "Skin": 0
              }
            ]
          },
          "HorseKiller": {
            "QuestName": "HorseKiller",
            "Description": "You can slaughter half a dozen horses, and use their hair for a sewing kit and rope.",
            "Objective": "horse",
            "ObjectiveName": "Horse",
            "AmountRequired": 6,
            "Cooldown": 1,
            "ItemDeduction": false,
            "Rewards": [
              {
                "isRP": false,
                "isCoins": false,
                "isHuntXP": false,
                "DisplayName": "Rope",
                "ShortName": "rope",
                "ID": 3506418,
                "Amount": 1.0,
                "BP": false,
                "Skin": 0
              },
              {
                "isRP": false,
                "isCoins": false,
                "isHuntXP": false,
                "DisplayName": "Sewing Kit",
                "ShortName": "sewingkit",
                "ID": -419069863,
                "Amount": 1.0,
                "BP": false,
                "Skin": 0
              }
            ]
          },
          "DeerHunter": {
            "QuestName": "DeerHunter",
            "Description": "Sometimes, you can get lucky with those deer, and you can make a Bow, 3 bandages, and an apple. Cewl",
            "Objective": "stag",
            "ObjectiveName": "Stag",
            "AmountRequired": 2,
            "Cooldown": 30,
            "ItemDeduction": false,
            "Rewards": [
              {
                "isRP": false,
                "isCoins": false,
                "isHuntXP": false,
                "DisplayName": "Hunting Bow",
                "ShortName": "bow.hunting",
                "ID": -853695669,
                "Amount": 1.0,
                "BP": false,
                "Skin": 0
              },
              {
                "isRP": false,
                "isCoins": false,
                "isHuntXP": false,
                "DisplayName": "Bandage",
                "ShortName": "bandage",
                "ID": -337261910,
                "Amount": 3.0,
                "BP": false,
                "Skin": 0
              },
              {
                "isRP": false,
                "isCoins": false,
                "isHuntXP": false,
                "DisplayName": "Apple",
                "ShortName": "apple",
                "ID": 93029210,
                "Amount": 1.0,
                "BP": false,
                "Skin": 0
              }
            ]
          },
          "HowlingWolfs": {
            "QuestName": "HowlingWolfs",
            "Description": "Some wolfs have guns in them. Dont ask how they got in there. They have strange hobbies.",
            "Objective": "wolf",
            "ObjectiveName": "Wolf",
            "AmountRequired": 3,
            "Cooldown": 45,
            "ItemDeduction": false,
            "Rewards": [
              {
                "isRP": false,
                "isCoins": false,
                "isHuntXP": false,
                "DisplayName": "Revolver",
                "ShortName": "pistol.revolver",
                "ID": -930579334,
                "Amount": 1.0,
                "BP": false,
                "Skin": 0
              },
              {
                "isRP": false,
                "isCoins": false,
                "isHuntXP": false,
                "DisplayName": "Pistol Bullet",
                "ShortName": "ammo.pistol",
                "ID": -533875561,
                "Amount": 8.0,
                "BP": false,
                "Skin": 0
              },
              {
                "isRP": false,
                "isCoins": true,
                "isHuntXP": false,
                "DisplayName": "Coins",
                "ShortName": null,
                "ID": 0,
                "Amount": 1.0,
                "BP": false,
                "Skin": 0
              }
            ]
          },
          "Bears": {
            "QuestName": "Bears",
            "Description": "Bears. They are so usefull. Kill some, and you can find fish in them. Make cloths. Even a Pooky Bear",
            "Objective": "bear",
            "ObjectiveName": "Bear",
            "AmountRequired": 4,
            "Cooldown": 1,
            "ItemDeduction": false,
            "Rewards": [
              {
                "isRP": false,
                "isCoins": false,
                "isHuntXP": false,
                "DisplayName": "Pookie Bear",
                "ShortName": "pookie.bear",
                "ID": 640562379,
                "Amount": 1.0,
                "BP": false,
                "Skin": 0
              },
              {
                "isRP": false,
                "isCoins": false,
                "isHuntXP": false,
                "DisplayName": "Raw Fish",
                "ShortName": "fish.raw",
                "ID": -533484654,
                "Amount": 10.0,
                "BP": false,
                "Skin": 0
              },
              {
                "isRP": false,
                "isCoins": false,
                "isHuntXP": false,
                "DisplayName": "Pants",
                "ShortName": "pants",
                "ID": 106433500,
                "Amount": 1.0,
                "BP": false,
                "Skin": 0
              },
              {
                "isRP": false,
                "isCoins": false,
                "isHuntXP": false,
                "DisplayName": "Hide Poncho",
                "ShortName": "attire.hide.poncho",
                "ID": 102672084,
                "Amount": 1.0,
                "BP": false,
                "Skin": 0
              },
              {
                "isRP": false,
                "isCoins": true,
                "isHuntXP": false,
                "DisplayName": "Coins",
                "ShortName": null,
                "ID": 0,
                "Amount": 1.0,
                "BP": false,
                "Skin": 0
              }
            ]
          }
        },
        "Loot": {}
      }
    }
     
    Last edited by a moderator: Jan 26, 2017
  13. lol? Plugin have a problem and nobody not listen me
     
  14. k1lly0u updated Quests with a new update entry:

    2.1.78

     
  15. Possible solution for macro abusing noobs - if this doesn't work then you are shit out of luck
    Try to check - still have a problem, player can get reward many times based on microlag GUI menu + mouse macros
     
  16. Code:
    Image loading fail! Error: Couldn't open file D:\servers\service3752\home\games\rust\server\verygames\oxide\data\LustyMap\custom\vendoricon
    Image loading fail! Error: Couldn't open file D:\servers\service3752\home\games\rust\server\verygames\oxide\data\LustyMap\custom\vendoricon
     

    Attached Files:

  17. k1lly0u updated Quests with a new update entry:

    2.1.79

     
  18. I can Claim reward twice I think it is a problem. Cant u add a cooldown between rewards for stop macro users?
     
    Last edited by a moderator: Jan 27, 2017
  19. we can get reward twice if we click on claim fastly. can you add timer to fix it ?
     
  20. Check - Still can get rewards a lot of time. Maybe send to you video how its work?