Knightlore 0 Posted October 31, 2024 (edited) Hi, I am fairly new to modding, just a coup,le of bog standard override to my name, however this time i am venturing into the actual coding override, I am trying to write an override to reduce skinning time when using a certain knife, However I am struggling to get it to reduce the skinning time, the knife works and i can spawn it so i know the CPP is being read however I cant seem to get the skinning time down, I was originally trying to pull a duration speed from the config.cpp but going down a simpler route, just cant get theover ride to work on the code, Any help apprieciated. so I have a config set up with class CfgPatches { class WLD_Kitchen_Knife { units[]={}; weapons[]={}; requiredVersion=0.1; requiredAddons[]={"DZ_Data","DZ_Scripts"}; }; }; class CfgMods { class WLD_Kitchen_Knife { dir="WLD_Kitchen_Knife"; hideName=1; hidePicture=1; name="WLD_Kitchen_Knife"; credits="Knightlore"; author="Knightlore"; authorID="0"; version="1.0"; extra=0; type="mod"; dependencies[]={"World"}; class defs { class worldScriptModule { value=""; files[]={"WLD_Kitchen_Knife/4_world"}; }; }; }; }; Pointing to scripts folder - WLD_Kitchen_Knife\Addons\4_world\Classes\UserActionsComponent\Actions\Continuous\ActionSkinningCB.c This has modded class ActionSkinningCB : ActionContinuousBaseCB { override void CreateActionComponent() { float time_spent; time_spent = UATimeSpent.SKIN; time_spent = time_spent / 4; m_ActionData.m_ActionComponent = new CAContinuousTime(time_spent); } }; This should reduce UATimeSpent.Skin by a factor of 4 (I think). UTimeSpent.Skin is set as a constant 10 in the dayz main config As a reference the first part of the actual dayz file is class ActionSkinningCB : ActionContinuousBaseCB { override void CreateActionComponent() { m_ActionData.m_ActionComponent = new CAContinuousTime(UATimeSpent.SKIN); } } Anyone see why this doesnt work, TIA Edited October 31, 2024 by Knightlore spelling Share this post Link to post Share on other sites
Sid Debian 149 Posted October 31, 2024 On 10/31/2024 at 4:18 PM, Knightlore said: Hi, I am fairly new to modding, just a coup,le of bog standard override to my name, however this time i am venturing into the actual coding override, I am trying to write an override to reduce skinning time when using a certain knife, However I am struggling to get it to reduce the skinning time, the knife works and i can spawn it so i know the CPP is being read however I cant seem to get the skinning time down, I was originally trying to pull a duration speed from the config.cpp but going down a simpler route, just cant get theover ride to work on the code, Any help apprieciated. so I have a config set up with class CfgPatches { class WLD_Kitchen_Knife { units[]={}; weapons[]={}; requiredVersion=0.1; requiredAddons[]={"DZ_Data","DZ_Scripts"}; }; }; class CfgMods { class WLD_Kitchen_Knife { dir="WLD_Kitchen_Knife"; hideName=1; hidePicture=1; name="WLD_Kitchen_Knife"; credits="Knightlore"; author="Knightlore"; authorID="0"; version="1.0"; extra=0; type="mod"; dependencies[]={"World"}; class defs { class worldScriptModule { value=""; files[]={"WLD_Kitchen_Knife/4_world"}; }; }; }; }; Pointing to scripts folder - WLD_Kitchen_Knife\Addons\4_world\Classes\UserActionsComponent\Actions\Continuous\ActionSkinningCB.c This has modded class ActionSkinningCB : ActionContinuousBaseCB { override void CreateActionComponent() { float time_spent; time_spent = UATimeSpent.SKIN; time_spent = time_spent / 4; m_ActionData.m_ActionComponent = new CAContinuousTime(time_spent); } }; This should reduce UATimeSpent.Skin by a factor of 4 (I think). UTimeSpent.Skin is set as a constant 10 in the dayz main config As a reference the first part of the actual dayz file is class ActionSkinningCB : ActionContinuousBaseCB { override void CreateActionComponent() { m_ActionData.m_ActionComponent = new CAContinuousTime(UATimeSpent.SKIN); } } Anyone see why this doesnt work, TIA So instead of blah-blah-blah what's your problem? No need to write a poem how you wanted your summer, just the question, facts and code it's not so hard. Share this post Link to post Share on other sites
Sid Debian 149 Posted October 31, 2024 Reveal hidden contents On 10/31/2024 at 4:18 PM, Knightlore said: Hi, I am fairly new to modding, just a coup,le of bog standard override to my name, however this time i am venturing into the actual coding override, I am trying to write an override to reduce skinning time when using a certain knife, However I am struggling to get it to reduce the skinning time, the knife works and i can spawn it so i know the CPP is being read however I cant seem to get the skinning time down, I was originally trying to pull a duration speed from the config.cpp but going down a simpler route, just cant get theover ride to work on the code, Any help apprieciated. so I have a config set up with class CfgPatches { class WLD_Kitchen_Knife { units[]={}; weapons[]={}; requiredVersion=0.1; requiredAddons[]={"DZ_Data","DZ_Scripts"}; }; }; class CfgMods { class WLD_Kitchen_Knife { dir="WLD_Kitchen_Knife"; hideName=1; hidePicture=1; name="WLD_Kitchen_Knife"; credits="Knightlore"; author="Knightlore"; authorID="0"; version="1.0"; extra=0; type="mod"; dependencies[]={"World"}; class defs { class worldScriptModule { value=""; files[]={"WLD_Kitchen_Knife/4_world"}; }; }; }; }; Pointing to scripts folder - WLD_Kitchen_Knife\Addons\4_world\Classes\UserActionsComponent\Actions\Continuous\ActionSkinningCB.c This has modded class ActionSkinningCB : ActionContinuousBaseCB { override void CreateActionComponent() { float time_spent; time_spent = UATimeSpent.SKIN; time_spent = time_spent / 4; m_ActionData.m_ActionComponent = new CAContinuousTime(time_spent); } }; This should reduce UATimeSpent.Skin by a factor of 4 (I think). UTimeSpent.Skin is set as a constant 10 in the dayz main config As a reference the first part of the actual dayz file is class ActionSkinningCB : ActionContinuousBaseCB { override void CreateActionComponent() { m_ActionData.m_ActionComponent = new CAContinuousTime(UATimeSpent.SKIN); } } Anyone see why this doesnt work, TIA I was able to reduce amount of your blah-blah blah to get the idea of the question. Here the solution: 1. If you wish make something faster - no need create clocks, need to redefine timeouts! So for that case you have 2 way for resolving: Case 1: Global reduce time by modify the Constant: DayZ\dta\scripts\4_World\Classes\UserActionsComponent\Actions\ActionConstants.c /**@class Constants for Time spent while doing action*/ modded class UATimeSpent { /* Another constants that's I don't cares, but you better safe them for something */ const float SKIN = 10; // <- in 1.26 default value is 10, set 4 or idk how many you prefer and IT DEFINED AS CONST, so you can't redefine it in runtime by assign. } Case 2: If you don't want to create duplicate of class - redefine the timeout on action (your code is almost right, but wrong overriding, try this way): modded class ActionSkinningCB { // You're only modifing the existing callback class, when you define parent - you're redefiend the class and that can mess up the game override void CreateActionComponent() { float time_spent = UATimeSpent.SKIN; time_spent = time_spent / 4; m_ActionData.m_ActionComponent = new CAContinuousTime(time_spent); } }; Let me know about results 🙂 Share this post Link to post Share on other sites
Knightlore 0 Posted November 1, 2024 (edited) Thanks for the help. But no joy, still not working, 🙁 I used case 2 Edited November 1, 2024 by Knightlore Share this post Link to post Share on other sites
Brennie Boi 1 Posted February 4 (edited) modded class ActionSkinningCB : ActionContinuousBaseCB { override void CreateActionComponent() { m_ActionData.m_ActionComponent = new CAContinuousTime( GetDefaultTime() ); } float GetDefaultTime() { string item_type = m_ActionData.m_MainItem.GetType(); switch(item_type) { case "CombatKnife": //Refers to whichever item you're using, I think most knives in the vanilla scripts extend toolbase so each one will have a spot in this script if you want to cut down the time. I.E., BoneKnife, KitchenKnife, Cleaver, CrudeMachete, FangeKnife, FireFighterAxe, etc. Here's a couple of examples return 5.0; // In seconds break; case "HuntingKnife": return 5.0; break; case "KitchenKnife": return 5.0; break; default: return UATimeSpent.SKIN; break } return -1; } } Note: Will not work if other mods are using the same script, for they will conflict. Using ToolBase as a case will also brick the script and cause infinite cutting times because there is no item_type for ToolBase. If anybody is familiar with overriding the original script I would be very thankful if you could share it so I could implement it on my server. I've tried a few ways but I'm not super familiar with coding. Edited February 4 by Brennie Boi Added referencing 1 Share this post Link to post Share on other sites