1. Hello all, as many of you know the development of HuntRPG stopped and I managed to fix up a few small things with it that I have been running on my own server (Typos, balance changes, fix so that the new large furnaces work with blacksmithing) but all of these things are pretty simple edits.

    What I would like to ask you guys is where did you start to begin modding with Oxide? How do I find out the entity values of objects/items in the game, my main goals are to create a skill called Gathering which increases the items picked up by gathering rocks/wood/ore/cloth from the plants and dropped items around the map.

    My main goal right now is to create a skill that increases the speed of Quarries but no matter what I try to do it does not seem to work.

    For example:
    Code:
            public void OnDeployQuarry(Deployer deployer, BaseEntity baseEntity, MiningQuarry quarry)
            {
                var player = deployer.ownerPlayer;
                var item = deployer.GetItem();
                var itemDef = item.info;
                var type = baseEntity.GetType();
                if (type != typeof (MiningQuarry) || !itemDef.displayName.translated.ToLower().Equals("mining quarry")) return;
                var MiningQuarry = (MiningQuarry)baseEntity;
                var instanceId = RPGHelper.QuarryId(quarry);
                if (PlayersFurnaces.ContainsKey(instanceId))
                {
                    ChatMessage(player, "Contact the developer, wrong ID usage for Quarry.");
                    return;
                }
                PlayersFurnaces.Add(instanceId, RPGHelper.SteamId(player));
            }
    Code:
            public static string QuarryId(MiningQuarry quarry)
            {
                var position = quarry.transform.position;
                return String.Format("X{0}Y{1}Z{2}", position.x, position.y, position.z);
            }
    Is what I tried to do to save deployed quarries to the same table that furnaces are saved to (PlayersFurnaces) but I get no error messages and no saved position data for quarries
     
    Last edited by a moderator: Jul 24, 2015
  2. Wulf

    Wulf Community Admin

    See oxidemod.org/threads/getting-started-in-plugin-development.8775/.
     
  3. Thank you very much for that it helped me get to grips with what I need to do in order to get started, if you do not mind Wulf can you please look at the following if you have some spare time and perhaps give me some indication as to what I am doing wrong though as I do not understand the problem at all:

    From the top -
    Code:
            [HookMethod("OnItemDeployed")]
            void OnItemDeployed(Deployer deployer, BaseEntity baseEntity, MiningQuarry quarry)
            {
                HuntRPGInstance.OnDeployFurnace(deployer, baseEntity);
                HuntRPGInstance.OnDeployLargeFurnace(deployer, baseEntity);
                HuntRPGInstance.OnDeployQuarry(deployer, baseEntity, quarry);
            }
    The above section is linked into these 3:
    Furnace and LargeFurnace both work fine with the blacksmithing skill but for the life of me I can't get quarries to save to the same table as Furnaces
    Code:
            public void OnDeployFurnace(Deployer deployer, BaseEntity baseEntity)
            {
                var player = deployer.ownerPlayer;
                var item = deployer.GetItem();
                var itemDef = item.info;
                var type = baseEntity.GetType();
                if (type != typeof (BaseOven) || !itemDef.displayName.translated.ToLower().Equals("furnace")) return;
                var baseOven = (BaseOven)baseEntity;
                var instanceId = RPGHelper.OvenId(baseOven);
                if (PlayersFurnaces.ContainsKey(instanceId))
                {
                    ChatMessage(player, "Contact the developer, wrong ID usage for furnace.");
                    return;
                }
                PlayersFurnaces.Add(instanceId, RPGHelper.SteamId(player));
            }        public void OnDeployLargeFurnace(Deployer deployer, BaseEntity baseEntity)
            {
                var player = deployer.ownerPlayer;
                var item = deployer.GetItem();
                var itemDef = item.info;
                var type = baseEntity.GetType();
                if (type != typeof (BaseOven) || !itemDef.displayName.translated.ToLower().Equals("large furnace")) return;
                var baseOven = (BaseOven)baseEntity;
                var instanceId = RPGHelper.OvenId(baseOven);
                if (PlayersFurnaces.ContainsKey(instanceId))
                {
                    ChatMessage(player, "Contact the developer, wrong ID usage for large furnace.");
                    return;
                }
                PlayersFurnaces.Add(instanceId, RPGHelper.SteamId(player));
            }        public void OnDeployQuarry(Deployer deployer, BaseEntity baseEntity, MiningQuarry quarry)
            {
                var player = deployer.ownerPlayer;
                var item = deployer.GetItem();
                var itemDef = item.info;
                var type = baseEntity.GetType();
                if (type != typeof (MiningQuarry) || !itemDef.displayName.translated.ToLower().Equals("mining quarry")) return;
                var MiningQuarry = (MiningQuarry)baseEntity;
                var instanceId = RPGHelper.QuarryId(quarry);
                if (PlayersFurnaces.ContainsKey(instanceId))
                {
                    ChatMessage(player, "Contact the developer, wrong ID usage for Quarry.");
                    return;
                }
                PlayersFurnaces.Add(instanceId, RPGHelper.SteamId(player));
            }
    This part is what saves the co-ords of the objects
    Code:
            public static string OvenId(BaseOven oven)
            {
                var position = oven.transform.position;
                return String.Format("X{0}Y{1}Z{2}", position.x, position.y, position.z);
            }        public static string QuarryId(MiningQuarry quarry)
            {
                var position = quarry.transform.position;
                return String.Format("X{0}Y{1}Z{2}", position.x, position.y, position.z);
            }

    Should I replace the section above with the below ?


    Code:
            public static string QuarryId(BaseEntity baseEntity)
            {
                var position = baseEntity.transform.position;
                return String.Format("X{0}Y{1}Z{2}", position.x, position.y, position.z);
            }
    
     
    Last edited by a moderator: Jul 24, 2015
  4. Wulf

    Wulf Community Admin

    That's a bit beyond my scope, but I'm sure someone will help you with it once they're around. :)
     
  5. Alright thank you anyway for your time, perhaps this may be a bit easier of a question ~

    How do I find out an items type, for example Furnace's seem to all refer to BaseOven, is there a way I can find out if large furnaces and quarries do the same?

    By type I don't mean ammo, construction, food etc just to note.
     
  6. Wulf

    Wulf Community Admin

    Digging into the Assembly-CSharp.dll would be the best way.