Jump to content

DST custom character second resurrect crash

Recommended Posts

hello. im new to scripting and ive learned quite a bit this past week. so i can at least read most of the logs and fix files. but im having a major issue that i found while testing my custom character with DST. with the help of rezecib, who assisted me with most of the compatibility, i was able to make my character compatible with the standard gamemode. i was testing the character in endless on my own hosted server to test its conditions, and if he dies, he can resurrect from the portal once. if he dies again and tries to resurrect, it will crash the game without showing a silhouette of the character. im not sure what is still broken and i seek assistance. ill post both my mod files, and the log. thank you in advance.



Link to comment
Share on other sites

  • Developer

Hey @WitchDoctEr16, I took a quick look at your log file. Your death cause was nil, so I believe that inst.deathcause never get set somehow. I suspect that happened because inst._parent was nil in AddMorgueRecord. I'm not entirely sure why that would have happened though.

Looking at your prefab lua code. What's the purpose of this line? inst:ListenForEvent("respawnfromghost")


My suggestion would be to take a look at the differences between your character mod and ones that are known to work such as Ika Musume (http://steamcommunity.com/sharedfiles/filedetails/?id=350365996)


Link to comment
Share on other sites

the line inst:listenforevent("respawnfromghost") was a part i forgot to remove. crash was originally supposed to glow at night but i couldnt get it to work so i removed it. i forgot that line. thanks for the advice. ill look at that file. i was comparing to the cthulhu character. im not sure whats got it down thou. thank you for the reply.

Link to comment
Share on other sites

It might be crashing after second time respawn due to 2*40 = 80, your max health is 80, so your character would spawn with 0 health.

It's the penalty they set up for dieing multiple times with the same character...

I had this problem as well with HP lower than 100 or so, this is most likely due to this line in health.lua:

function Health:GetPenaltyPercent()    return (self.penalty*TUNING.EFFIGY_HEALTH_PENALTY)/ self.maxhealthend

It would return a percent larger than 100, thus giving you negative health.

This might be the problem you are encountering, at least this was the case for me, i fixed it by simply setting the max amount of inst.components.health.numrevives to something smaller than 2 or such.

Link to comment
Share on other sites

nope, what you should do is...

    inst:ListenForEvent("death", ondeath)

in the init, and then have another function:

local function ondeath(inst)    inst.components.health.numrevives = 0end

Set it to 0, that way it doesnt go any higher than 1 when reviving, so your hp when getting revived is 40.

Maybe the official function should check for percentages higher than 100 and just cap them at 90 or something like that... But that's not my call :p

Link to comment
Share on other sites

@WitchDoctEr16, You can also look at how I dealt with numrevives for Maxwell in More DST Characters:

local function HealthPostInit(self)	local OldRecalculatePenalty = self.RecalculatePenalty	local function RecalculatePenalty(self, forceupdatewidget)		local mult = GLOBAL.TUNING.REVIVE_HEALTH_PENALTY_AS_MULTIPLE_OF_EFFIGY		mult = mult * GLOBAL.TUNING.EFFIGY_HEALTH_PENALTY		local maxrevives = (self.maxhealth - 30)/mult		if self.numrevives > maxrevives then			self.numrevives = maxrevives		end		OldRecalculatePenalty(self, forceupdatewidget)	end	self.RecalculatePenalty = RecalculatePenaltyendAddComponentPostInit('health', HealthPostInit) 

What this approach does it makes sure that the penalty never brings you below a max of 30 health.


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

  • Create New...