Jump to content

Telltale heart damage reduction?


Recommended Posts

(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

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

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

@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

where to put this (as i said before, we're both really new to coding stuff, sorry!)

 

You can either put

GLOBAL.AllRecipes["reviver"].character_ingredients[1].amount = 10

in modmain.lua (AllRecipes is in the GLOBAL environment).

 

 

Or put

AllRecipes["reviver"].character_ingredients[1].amount = 10

in 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

ok so, with Valkyrie19k's method, i got these errors with each one

 

this one in modmain

 

fNGvTgq.png

 

and this one in the character lua

 

g7Fx0BA.jpg

 

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

@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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...