Simple quest system for 1.8.5

Discussion in 'Scripting Discussions' started by Inkko, May 31, 2015.

  1. Matt L

    Matt L OpenDayZ Rockstar!

    Joined:
    May 10, 2013
    Messages:
    841
    Likes Received:
    136
    easier and there is no function calling, so it'd be way faster too. Less performance impact
     
  2. Inkko

    Inkko Valued Member!

    Joined:
    Jan 12, 2013
    Messages:
    697
    Likes Received:
    83
    I remembered the reasoning behind doing it the way I did now. It was to make sure each item was taken, and that each item was given.

    such as in what you said:

    player addMagazine ["FoodCanBeef",2];

    I need to make sure that they really got 2 cans of beef.
     
  3. Matt L

    Matt L OpenDayZ Rockstar!

    Joined:
    May 10, 2013
    Messages:
    841
    Likes Received:
    136
    Ahhh yea, inventory space is an obvious issue. I would attempt to devise a short method to check inventory space, and if they have no room, check backpack space, and if they have no room in their backpack, create a weaponholder beneath the player. Just an idea though.
     
  4. Inkko

    Inkko Valued Member!

    Joined:
    Jan 12, 2013
    Messages:
    697
    Likes Received:
    83
    I'm thinking I might do a mix between yours and mine, do the magazine check for items that need to be removed and remove them, then for adding I'd use the BIS_fnc.
     
  5. Matt L

    Matt L OpenDayZ Rockstar!

    Joined:
    May 10, 2013
    Messages:
    841
    Likes Received:
    136
    It would definitely work, but the functions will likely be laggier on lower end pc's of course it wont last long it will just be momentary, but it could still be a potential problem (assuming your server is edited to the tits like most are) if your server is relatively script empty then it shouldnt have any impact at all, but might take a second or two to run through the whole script. Its really preference, either method works, neither ones better. One has more ability, but is slower, ones barebones and fast, but has issues with inventory space. Like you said though, I think some sort of mix of the two would work perfectly.
     
  6. Inkko

    Inkko Valued Member!

    Joined:
    Jan 12, 2013
    Messages:
    697
    Likes Received:
    83
  7. FallingSheep

    FallingSheep OpenDayZ Lord!

    Joined:
    Mar 17, 2013
    Messages:
    1,980
    Likes Received:
    576
    mind if i edit it for epoch??

    perhaps add a switch to check for epoch and adjust the quests ??
     
  8. FallingSheep

    FallingSheep OpenDayZ Lord!

    Joined:
    Mar 17, 2013
    Messages:
    1,980
    Likes Received:
    576
    hers an example of how the boat quest i edited for epoch
    Code:
    private ["_vehicletype","_position","_vehicle","_dir","_result3","_result2","_queststatus","_result","_quest"];
    
    _quest = _this select 0;
    
    if (_quest == "Boat") then {
    
    _queststatus = player getVariable ["QuestBoat",0];
    
    if (isnil "_queststatus") then {
       player setVariable ["QuestBoat",0,true];
    };
    
    if (_queststatus == 1) exitwith {systemchat 'I do not need anymore parts at the moment, check back later and I may need more help.';};
    
    _result = [player,"PartEngine"] call BIS_fnc_invRemove;
    if (_result == 1) then {
    if(DZSQ_Epoch)then{
       _result2 = [player,"PartGeneric"] call BIS_fnc_invRemove;
    }else{
       _result2 = [player,"equip_hose"] call BIS_fnc_invRemove;
    };
       if (_result2 == 1) then {
       if(DZSQ_Epoch)then{
         _result3 = [player,"ItemWire"] call BIS_fnc_invRemove;
       }else{
         _result3 = [player,"equip_string"] call BIS_fnc_invRemove;
       };
         if (_result3 == 1) then {
           //reward
           _vehicletype = "PBX";
           _position = [(position player),0,40,1,2,2000,0] call BIS_fnc_findSafePos;
           if (!(_vehicletype in DayZ_SafeObjects)) then {
             DayZ_SafeObjects = DayZ_SafeObjects + [_vehicletype];
             publicVariable "DayZ_SafeObjects";
           };
           _vehicle = createVehicle [_vehicletype, _position, [], 0, "CAN_COLLIDE"];
           _dir = getdir _vehicle;
           PVDZ_obj_Publish = [0,_vehicle,[_dir,_position],[]];
           publicVariableServer "PVDZ_obj_Publish";
           systemchat 'Thank you for helping me out! I have left my PBX nearby, you can take it when you find it.';
         } else {
           if(DZSQ_Epoch)then{
             [player,"PartGeneric"] call BIS_fnc_invAdd;
             [player,"PartEngine"] call BIS_fnc_invAdd;
             systemchat 'Something went wrong and you do not have Wire in your inventory. Try again once you have all the parts.';
           }else{
             [player,"equip_hose"] call BIS_fnc_invAdd;
             [player,"PartEngine"] call BIS_fnc_invAdd;
             systemchat 'Something went wrong and you do not have a string in your inventory. Try again once you have all the parts.';
           };
         };
       } else {
         if(DZSQ_Epoch)then{
           [player,"PartEngine"] call BIS_fnc_invAdd;
           systemchat 'Something went wrong and you do not have Scrap Metal in your inventory. Try again once you have all the parts.';
         }else{
           [player,"PartEngine"] call BIS_fnc_invAdd;
           systemchat 'Something went wrong and you do not have a hose in your inventory. Try again once you have all the parts.';
         };
       };
    } else {
       systemchat 'Something went wrong and you do not have an engine in your inventory. Try again once you have all the parts.';
    };
    };
    

    and the dialog
    Code:
    if (_controltype == "Boat") then { //cheesy as shit!
    if(DZSQ_Epoch)then{
    _text = [
    "Ahoy there! I seem to have found myself in a situation that maybe you can help me with now that you are here. I drove my boat out here to checkout the island. I ran across some rocks and now the engine is fried so I need a new one. Could you go out and find me an Engine, some Scrap Metal, and some Wire ? Id do it myself but I dont know how to swim. Ill give you my boat if you help me out.",
    "Do you have a second to help me out? My boat broke down and I need a new engine, some Scrap Metal, some Wire to repair it. I can't swim so I'm unable to get it myself. Would you be able to go out and find me what I need? If you do I'll give you my boat and wait for a passerby and get off this island myself.",
    "You wouldn't happen to have an engine, some Scrap Metal, and some Wire would you? I got a boat I need to repair but I'm unable to get off this island to get the repair items I need. If you go out and bring me back the supplies I will give you my boat and you can do with it as you please."
    ] call BIS_fnc_selectrandom;
    
    }else{
    
    _text = [
    "Ahoy there! I seem to have found myself in a situation that maybe you can help me with now that you are here. I drove my boat out here to checkout the island. I ran across some rocks and now the engine is fried so I need a new one. Could you go out and find me an Engine, a hose, and some string? Id do it myself but I dont know how to swim. Ill give you my boat if you help me out.",
    "Do you have a second to help me out? My boat broke down and I need a new engine, hose, some string to repair it. I can't swim so I'm unable to get it myself. Would you be able to go out and find me what I need? If you do I'll give you my boat and wait for a passerby and get off this island myself.",
    "You wouldn't happen to have an engine, a hose, and some string would you? I got a boat I need to repair but I'm unable to get off this island to get the repair items I need. If you go out and bring me back the supplies I will give you my boat and you can do with it as you please."
    ] call BIS_fnc_selectrandom;
    };
    
    ((findDisplay 44412) displayCtrl 1103) ctrlSetText _text; 
    };
    
    and in init.sqf i add
    Code:
    DZSQ_Epoch = true;
    
     
  9. Inkko

    Inkko Valued Member!

    Joined:
    Jan 12, 2013
    Messages:
    697
    Likes Received:
    83
    Thats fine with me haha... the requirements, and rewards can all be changed around I'm just kinda trying to get it all together. Shouldn't be hard to add an epoch check in.

    I got the treasure hunt quest left to do, and then I'm gonna try and get more in depth with it all with quest chains.
     
    Last edited: Jun 6, 2015
    FallingSheep likes this.
  10. Inkko

    Inkko Valued Member!

    Joined:
    Jan 12, 2013
    Messages:
    697
    Likes Received:
    83
    I am thinking about turning the rewards portion into a function that is called and having loot arrays setup so that I can just call the function with what I want so its more easily changed and randomized. Also maybe adding a box next to the quest givers to put the gear rewards into and a heli pad near vehicle reward ones to narrow down the searching players currently have to do for vehicle rewards.

    With the function idea I was thinking of WAI and DZMS with how they fill the box.
     
    FallingSheep likes this.
  11. Matt L

    Matt L OpenDayZ Rockstar!

    Joined:
    May 10, 2013
    Messages:
    841
    Likes Received:
    136
    the box next to the quest givers is a brilliant idea, but make sure you use createVehicleLocal and execute it on every machine, that way no one can steal the others rewards.
     
  12. Inkko

    Inkko Valued Member!

    Joined:
    Jan 12, 2013
    Messages:
    697
    Likes Received:
    83
    -Update-

    Okay I got someone to help me test it and I worked out most of the bugs and it seems to be functioning properly with my big update to make it more configurable and make it work with epoch (still need to add hive write for epoch vehicles and do config for epoch).

    3 publicvariables need to be added to not be kicked:
    Code:
     !="DZSQ_RepairQ" !="DZSQ_MedsQ" !="DayZ_SafeObjects"
    
    https://www.dropbox.com/sh/wyet5ke17ba9moi/AACXoJ3OIDykspQJJ6eCWCpPa?dl=0
     
    Last edited: Aug 13, 2015
  13. Inkko

    Inkko Valued Member!

    Joined:
    Jan 12, 2013
    Messages:
    697
    Likes Received:
    83
    Updated the files some more and made it even more configurable... Just need to update the dialogs to reflect some changes.

    Config file at the moment:
    Code:
    /*
        DayZ Simple Quests (DZSQ)
        Created by Inkko
        Revision V1.0
      
        Reward tiers for quests. Vehicles and Weapons with 3 tiers in each.
      
        Format for weapons:
        DZSQ_Weapon1 = [["M1014_DZ","8Rnd_12Gauge_Slug"],["Remington870_DZ","8Rnd_12Gauge_Slug"],["Gun","Mag"]];
    
        Format for Vehicles:
        DZSQ_Vehicle1 = ["UH1H_DZ","UH1H_DZ2","Vehicle"];
    */
    private ["_medicalsupplies","_repairsupplies"];
    
    DZSQ_Epoch = false;
    
    // Attempts to create the vehicle and add it to the database using tent write. DZSQ_PermVehicle = true/false;
    DZSQ_PermVehicle = true; // only compatible with dayz 1.8.5+ and epoch
    
    // Create box to put rewards in rather then try and add to the player. (add box near quest giver in server side file to look for to add items?)
    DZSQ_RewardBox = false; // WIP doesn't function yet.
    
    
    /*-----------------------------------------------------
        Configuration for Bandit, Hero, Zed, and Race quest
        - Required timer/amount
        - Reward ["type",level]
    */
    
    // Zed kills
    DZSQ_Zed1 = 20; // 1st level
    DZSQ_Zed2 = 50; // 2nd level
    DZSQ_Zed3 = 100; //...
    DZSQ_Zed4 = 150;
    
    // Zed rewards ["Reward Type",level of reward];
    DZSQ_ZedRew1 = ["Weapon",1]; // level 1
    DZSQ_ZedRew2 = ["Weapon",2]; // level 2...
    DZSQ_ZedRew3 = ["Vehicle",1];
    DZSQ_ZedRew4 = ["Vehicle",2];
    
    // Bandit Level (Murders)
    DZSQ_Bandit1 = 20;
    DZSQ_Bandit2 = 50;
    DZSQ_Bandit3 = 100;
    DZSQ_Bandit4 = 150;
    
    // Bandit Rewards
    DZSQ_BanditRew1 = ["Weapon",1];
    DZSQ_BanditRew2 = ["Weapon",2];
    DZSQ_BanditRew3 = ["Vehicle",1];
    DZSQ_BanditRew4 = ["Vehicle",2];
    
    // Hero Levels (Bandit Kills)
    DZSQ_Hero1 = 20;
    DZSQ_Hero2 = 50;
    DZSQ_Hero3 = 100;
    DZSQ_Hero4 = 150;
    
    // Hero Rewards
    DZSQ_HeroRew1 = ["Weapon",1];
    DZSQ_HeroRew2 = ["Weapon",2];
    DZSQ_HeroRew3 = ["Vehicle",1];
    DZSQ_HeroRew4 = ["Vehicle",2];
    
    // Race times
    DZSQ_RaceTime1 = 120;
    DZSQ_RaceTime2 = 210;
    DZSQ_RaceTime3 = 300;
    DZSQ_RaceTime4 = 390;
    //DZSQ_RaceTime5 = 390; (390 seconds plus)
    
    // Race Rewards
    DZSQ_RaceRew1 = ["Vehicle",2];
    DZSQ_RaceRew2 = ["Vehicle",1];
    DZSQ_RaceRew3 = ["Vehicle",0];
    DZSQ_RaceRew4 = ["Weapon",1];
    DZSQ_RaceRew5 = ["Weapon",0];
    
    // required humanity for bandit quest
    DZSQ_RequiredBandit = -2500;
    
    // required humanity for hero quest.
    DZSQ_RequiredHero = 5000;
    
    // Race minimum time (in seconds)
    DZSQ_RaceMin = 30; // long distance so shouldn't be able to do it extremely quickly
    
    //-----------------------------------------------------
    if (DZSQ_Epoch) then {
    /*
        Epoch mod (Changes vehicle DB write to epoch one only if DZSQ_PermVehicle = true;)
    */
    //low tier
    DZSQ_Weapon1 = [["",""],["",""],["",""],["",""],["",""]];
    //mid tier
    DZSQ_Weapon2 = [["",""],["",""],["",""],["",""],["",""]];
    //high tier
    DZSQ_Weapon3 = [["",""],["",""],["",""],["",""],["",""]];
    
    //low tier
    DZSQ_Vehicle1 = ["","","",""];
    //mid tier
    DZSQ_Vehicle2 = ["","","",""];
    //high tier
    DZSQ_Vehicle3 = ["","","",""];
    
    //low tier
    DZSQ_Buildables1 = ["","","",""];
    //mid tier
    DZSQ_Buildables2 = ["","","",""];
    // high tier
    DZSQ_Buildables3 = ["","","",""];
    
    } else {
    /*
        Non Epoch mods
    */
    //low tier
    DZSQ_Weapon1 = [["M1014_DZ","8Rnd_12Gauge_Slug"],["Remington870_DZ","8Rnd_12Gauge_Slug"],["Bizon_DZ","64Rnd_9x19_Bizon"],["Bizon_SD_DZ","64Rnd_9x19_SD_Bizon"],["MP5_DZ","30Rnd_9x19_MP5"],["MP5_SD_DZ","30Rnd_9x19_MP5SD"],["AKS74U_Kobra_DZ","30Rnd_545x39_AK"],["AKS74U_Kobra_SD_DZ","30Rnd_545x39_AKSD"]];
    //mid tier
    DZSQ_Weapon2 = [["AK74_DZ","30Rnd_545x39_AK"],["G36C_DZ","30Rnd_556x45_G36"],["L85_Holo_DZ","30Rnd_556x45_Stanag"],["M16A2_DZ","30Rnd_556x45_Stanag"],["M16A4_DZ","30Rnd_556x45_Stanag"]];
    //high tier
    DZSQ_Weapon3 = [["M16A4_GL_FL_DZ","30Rnd_556x45_Stanag"],["M16A4_GL_CCO_FL_DZ","30Rnd_556x45_Stanag"],["G36C_Holo_SD_DZ","30Rnd_556x45_G36SD"],["AK74_PSO1_SD_DZ","30Rnd_545x39_AKSD"],["AK74_GL_PSO1_SD_DZ","30Rnd_545x39_AKSD"],["M249_Holo_DZ","200Rnd_556x45_M249"],["M24_Gh_DZ","5Rnd_762x51_M24"],["DMR_Gh_DZ","20Rnd_762x51_DMR"],["DMR_DZ","20Rnd_762x51_DMR"]];
    
    //low tier
    DZSQ_Vehicle1 = ["Old_bike_TK_INS_EP1","TT650_Civ","ATV_US_EP1","ATV_US_EP1"];
    //mid tier
    DZSQ_Vehicle2 = ["BAF_Offroad_D","HMMWV_DZ","SUV_DZ","Pickup_PK_INS","Offroad_DSHKM_INS"];
    //high tier
    DZSQ_Vehicle3 = ["MH6J_DZ","UH1H","Mi17_DZ","UH1H_DZ2"];
    
    /*
        Magazine tier for building reward quests.
        Need to update QuestRewardSystem to have magazine statement.
    */
    //
    DZSQ_Buildables1 = ["itemlog","ItemPadlock","itemstone"]; // ONLY Magazines
    DZSQ_Buildables2 = ["ItemStone","ItemPlank","itemlog","PartWoodPile","ItemPadlock"]; // ONLY Magazines
    DZSQ_Buildables3 = ["itemDIY_Gate","itemDIY_wood","itemDIY_Metal","itemPickaxe","itemsledgehammer"]; // ONLY put tool belt items here.
    };
    
    // Semi-randomize medical quest on startup (first player randomizes variable for everyone.)
    if (isnil "DZSQ_MedsQ") then {
    _medicalsupplies = ["ItemEpinephrine","ItemMorphine","ItemAntibiotic"] call bis_fnc_selectrandom;
    DZSQ_MedsQ = _medicalsupplies;
    publicVariable "DZSQ_MedsQ";
    };
    
    // Semi-randomize boat quest on startup (first player randomizes variable for everyone.)
    if (isnil "DZSQ_RepairQ") then {
    _repairsupplies = ["PartFueltank","PartEngine","PartGeneric"] call bis_fnc_selectrandom;
    DZSQ_RepairQ = _repairsupplies;
    publicVariable "DZSQ_RepairQ";
    };
    
    /*
    // Semi-randomize boat quest on startup (first player randomizes variable for everyone.)
    if (isnil "DZSQ_RaceQ") then {
    _races = [["City Name",[cords]],["City Name",[cords]]] call bis_fnc_selectrandom;
    DZSQ_RaceQ = _races;
    publicVariable "DZSQ_RaceQ";
    };
    */
    // Need to add these 2 variables to publicvariable.txt so they don't kick players as well as any other custom publicVariables used in this script.
    
     
    Last edited: Aug 13, 2015
  14. Inkko

    Inkko Valued Member!

    Joined:
    Jan 12, 2013
    Messages:
    697
    Likes Received:
    83
    So here is an update on where I'm at with this lil project:

    9 Quests

    - 1 bandit (murders)
    - 1 Hero (bandit killing)
    - 1 Bounty (PVP quest)
    - 1 Medical (medical supplies)
    - 1 Zed (Zed kills)
    - 1 Race (get from 1 place to another as fast as possible)
    - 1 Vehicle Parts
    - 2 Building Supply Quests

    Medical and Vehicle Part quest are slightly dynamic and are configurable (they can change slightly every server restart) *Race quest to become dynamic as well as the building supplies.

    Bounty is a random triggered event and says to server that a bounty has been placed on player X and that they are near X city. Relog will not remove a bounty but death will. Upon relog it will broadcast that player still has bounty and what city they logged in near.

    Bandit/Hero/Zed have config options to set needed kills, as well they have config options for their reward. Hero and Bandit have config option for required humanity.

    Race quest has config options for required seconds as well as rewards for each level (Reward varies on how quick you are).

    2 Building supply quests aren't configurable at the moment but will be in the future.

    Config file has options for the vehicles and weapons used for rewards. Has options for perm vehicles (only 1.8.6.1 at the moment but has a no fuel bug after restarts). Epoch mod option (not filled out yet). As well as some other customization options.

    All the dialogs are slightly dynamic as well. They won't always say the same thing upon opening them.

    Still got some work to do.. Plan on at least making all the quests slightly dynamic for what items are needed (maybe change rewards on restart for zed/hero/bandit). Need to make some of the rewards more fair (medical supplies for something less then weapons..). Fix some of the locations vehicles spawn. Add an epoch hive write which will probably be similar to trader buy. Then lastly I think maybe add a spawn items in box option. Can't think of anything else I've missed.
     
  15. Inkko

    Inkko Valued Member!

    Joined:
    Jan 12, 2013
    Messages:
    697
    Likes Received:
    83
    Here is another update on the progress of this.

    Should be pretty much completely done, kind of threw together an epoch config tho... Limitations in rewards are as follows:

    required: humanity, murders, bandit kills, nothing, 1 item, 3 items (items can be done with any of the variable required, limitations are with items, no items required, 1 item required and 3 items required)
    output: vehicle, weapon + 3 mags, other magazines (building supplies is what I'm using the magazines for)

    ---

    Added smoke grenade to spawned vehicles to make them more clear as to where the hell your vehicle spawned around you.

    5 quests change each restart meaning that they require different items just to make it a lil different.
    (race quest uses addwaypoint to help players find where to go to start race and from there to end. Uses distance/meters per second formula to calculate time variance)

    New spawn reward in box option to avoid no space in inventory or other issues with adding weapon bug. Hopefully have a working perm vehicle epoch hive write now.

    Just need to do lots of testing to make sure its all working correctly. I threw it on my server and haven't had any one complain about it so far so it must be doing fine... but then again they don't like telling me when things don't work either...
     
  16. clifdayz

    clifdayz Well-Known Member

    Joined:
    Jul 28, 2015
    Messages:
    142
    Likes Received:
    13
    Not sure how I missed this. I've been working on tweaking DZMS and you can only go so far with a one action quest. Yours sounds great, but the dropbox link is broken.
     
  17. Inkko

    Inkko Valued Member!

    Joined:
    Jan 12, 2013
    Messages:
    697
    Likes Received:
    83
    Last night I had to wipe my dropbox to put in a large file for someone but I've re-added everything and hopefully it keeps the same link. Once they upload I'll compare the links.

    On another note I had started this off as a one action quest but I've started working on this again and have a quest log now that I'm working on to make it more then a one action quest and turn it into a chain quest type thing I guess.

    Edit:

    The link is the same but here it is again.
    https://www.dropbox.com/sh/wyet5ke17ba9moi/AACXoJ3OIDykspQJJ6eCWCpPa?dl=0
     
  18. Inkko

    Inkko Valued Member!

    Joined:
    Jan 12, 2013
    Messages:
    697
    Likes Received:
    83
    I'm also still looking for anyone that'd like to help me put this together. The core of it is pretty much put together, going through some core stuff and changing it around to make it easier to modify and some other core stuff needs to be changed for the quest log and progression I'm starting to work on as well as additional quests needing to be added due to chain quests.

    Needs to be done:
    Quest Dialogs need to be updated to a Accept and Turn in format.
    More quests (includes dialogs, text, scripts)
    Quest Log dialog (filled out once all quests are made and make prettier)
     
  19. clifdayz

    clifdayz Well-Known Member

    Joined:
    Jul 28, 2015
    Messages:
    142
    Likes Received:
    13
    I just downloaded it, so let me take a look and see if I can understand the code. I was a developer for years, but only about 6 months into dayz and with no documentation, its been a bit slower to learn.

    1.8.7 is removing achievements which I think is the wrong way to go. I'd like to see some type of mission/quest/reward system to encourage more survival.
     
    Inkko likes this.
  20. Inkko

    Inkko Valued Member!

    Joined:
    Jan 12, 2013
    Messages:
    697
    Likes Received:
    83
    I would say you wouldn't need to be able to understand the whole thing, the main thing that I need help with is just more quests. Took me forever to get together the current ones.
     

Share This Page