Commodore Posted October 1, 2015 Share Posted October 1, 2015 (this is really my first time using a forum for help, but we're at the point where neither of us know how to code well enough to implement something like this) does anyone know if there's a possible way to reduce the amount of damage from crafting a telltale for a mod character? if so, it would be really appreciated if you helped us with the code, thanks! Link to comment Share on other sites More sharing options...
Toros Posted October 1, 2015 Share Posted October 1, 2015 I know it's possible in a clean way and can be done through modmain essentially by modifying the part of the function that deals the damage.I'd add a custom tag to the custom character and alter the telltale heart function to check if there is a tag and then do less damage, else normal damage. Link to comment Share on other sites More sharing options...
Arkathorn Posted October 1, 2015 Share Posted October 1, 2015 The health deducted from crafting a Telltale Heart is shown (and set) in the recipe. This is done using a pretty cool system for using player stats as crafting ingredients, that is only found in DST. Find the recipe for the Telltale Heart, and figure out a way to overwrite the recipe to have a different value for health cost. (This is from memory, I don't have time to fetch the examples or further explore the solution) Link to comment Share on other sites More sharing options...
DarkXero Posted October 1, 2015 Share Posted October 1, 2015 GLOBAL.AllRecipes["reviver"].character_ingredients[1].amount = 10Or whatever number you want. Link to comment Share on other sites More sharing options...
Commodore Posted October 4, 2015 Author Share Posted October 4, 2015 GLOBAL.AllRecipes["reviver"].character_ingredients[1].amount = 10Or whatever number you want. sorry to ask, but we're not too sure where to put this (as i said before, we're both really new to coding stuff, sorry!) Link to comment Share on other sites More sharing options...
Valkyrie19k Posted October 4, 2015 Share Posted October 4, 2015 @Commodore, Try putting it first in YourCharacter.lua and see if it works, then if it doesn't, go for modmain.lua. Those are the only 2 lua you need to edit anyways. I feel as though if you put it in modmain, it might conflict with other mods. DarkXero will answer that because I don't know haha. Link to comment Share on other sites More sharing options...
DarkXero Posted October 4, 2015 Share Posted October 4, 2015 where to put this (as i said before, we're both really new to coding stuff, sorry!) You can either putGLOBAL.AllRecipes["reviver"].character_ingredients[1].amount = 10in modmain.lua (AllRecipes is in the GLOBAL environment). Or putAllRecipes["reviver"].character_ingredients[1].amount = 10in your mod character's prefab file. As long as it loads, it edits the value.However, now that I read this properly, you want to edit the health value only for the mod character, correct?You want it to be 10 for your character, and 40 for, say, Wilson. Link to comment Share on other sites More sharing options...
Commodore Posted October 4, 2015 Author Share Posted October 4, 2015 ok so, with Valkyrie19k's method, i got these errors with each one this one in modmain and this one in the character lua we tried with DarkXeros suggestions too, but pretty much the same errors popped up upon loading worlds. yes, we'd like it to be specifically for the mod character, sorry if this is too much trouble ! ;; Link to comment Share on other sites More sharing options...
DarkXero Posted October 4, 2015 Share Posted October 4, 2015 @Commodore, in modmain, it works, you screwed up copy pasting.In the character file it doesn't have GLOBAL. I will look to make it specifically for a character. Link to comment Share on other sites More sharing options...
DarkXero Posted October 4, 2015 Share Posted October 4, 2015 @Commodore, alright, copy accordingly:local MakePlayerCharacter = require("prefabs/player_common")local assets = { Asset("ANIM", "anim/wilson.zip"), Asset("ANIM", "anim/ghost_wilson_build.zip"),}local prefabs = {}-- You need this functionlocal function removeReviver(inst) local _learn = inst.replica.builder.CanLearn inst.replica.builder.CanLearn = function(self, recipename) if recipename == "reviver" then return false end return _learn(self, recipename) endendlocal function common_postinit(inst)-- And this tag inst:AddTag("easyreviver")-- And this function inst:DoTaskInTime(0.314, removeReviver)endlocal function master_postinit(inst)end-- And all these definitionsRecipe("commodorereviver", {Ingredient("cutgrass", 3), Ingredient("spidergland", 1), Ingredient(CHARACTER_INGREDIENT.HEALTH, 10)},RECIPETABS.SURVIVAL, TECH.NONE, nil, nil, nil, nil, "easyreviver", "images/inventoryimages.xml", "reviver.tex")AllRecipes["commodorereviver"].sortkey = AllRecipes["reviver"].sortkeySTRINGS.NAMES.COMMODOREREVIVER = STRINGS.NAMES.REVIVERSTRINGS.CHARACTERS.GENERIC.DESCRIBE.COMMODOREREVIVER = STRINGS.CHARACTERS.GENERIC.DESCRIBE.REVIVERSTRINGS.RECIPE_DESC.COMMODOREREVIVER = STRINGS.RECIPE_DESC.REVIVERreturn MakePlayerCharacter("wilson", prefabs, assets, common_postinit, master_postinit)In modmain, add "commodorereviver" to your PrefabFiles (don't copy and paste another PrefabFiles, ADD OTHER ITEM TO YOUR LIST):PrefabFiles = { "commodorereviver",}Create a prefab and put it in scripts/prefabs, next to your character.commodorereviver.lua:local function fn() local inst = SpawnPrefab("reviver") return instendreturn Prefab("common/commodorereviver", fn) Link to comment Share on other sites More sharing options...
Commodore Posted October 4, 2015 Author Share Posted October 4, 2015 alright, so we got the first method working (a bit of a mistake on our end cause we forgot something kinda silly) and now i've done my best to follow what you've made here, and i get this Link to comment Share on other sites More sharing options...
DarkXero Posted October 4, 2015 Share Posted October 4, 2015 @Commodore, put the mod in a zip and upload it here. Link to comment Share on other sites More sharing options...
Commodore Posted October 4, 2015 Author Share Posted October 4, 2015 this is our first mod, so things are probably really messy, sorry..naph.zip Link to comment Share on other sites More sharing options...
Wispyknight Posted October 4, 2015 Share Posted October 4, 2015 Might as well pop in and say thanks for all the help you guys have given us. (I'm the one who does most of the scripting) We would have fucked so much up without help. Thanks. Link to comment Share on other sites More sharing options...
DarkXero Posted October 5, 2015 Share Posted October 5, 2015 @Commodore, here:naph.zip Link to comment Share on other sites More sharing options...
Commodore Posted October 5, 2015 Author Share Posted October 5, 2015 thank you so much!! if you'd like, we can credit you once we update the mod, this helps out so much Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now