Jump to content

porting updated Wendy to DS


Recommended Posts

I've been working on getting solo Wendy her DST update, and I'm unsure about my project setup. So far, I've been using AddPrefabPostInit to alter wendy, abigail, and abigail_flower as opposed to creating entirely new prefabs - my reasoning being that it seems easier to build on top of what's already there. Is there any reason for me to use custom prefabs instead?

What's also really tripping me up right now is figuring out how to save/load the game, in part because I'm having trouble figuring out the order in which objects are added/removed. At the moment, I am working mostly with the ghostlybond component, which handles Wendy's interactions with Abgail. In-game behavior is working as expected, but loading the game is not. Abigail appears where she was when I closed the game before playing her death animation and disappearing. Abigail then respawns as she would when the game initializes, and can then be summoned without issue. Unfortunately I haven't been getting useful error messages, because these things aren't breaking the game.

This seems to be happening because, when the game loads, ghostlybond can't find Abigail and so spawns a new one instead (GhostlyBond:SpawnGhost runs every time the game loads and I'm not fully sure why). Below is OnSave from the original DST game file – when I tried to use in my ghostlybond component, apparently it couldn't find Abigail – she seems to already have been removed by then, so self.ghost always gets set to nil.

 

function GhostlyBond:OnSave()
	local time_remaining = self.bondleveltask ~= nil and GetTaskRemaining(self.bondleveltask) or nil

	return {
		bondlevel = self.bondlevel,
		elapsedtime = self.bondleveltimer,

		ghost = self.ghost ~= nil and self.ghost:GetSaveRecord() or nil,
		ghostinlimbo = self.ghost ~= nil and self.ghost.inlimbo or nil,
	}
end

Is there a way for me to ensure that ghostlybond is able to save before Abigail is removed? I think I should be able to load it properly once saved, but I'm having trouble moving forward until I resolve this. Thank you so much!

modmain.lua ghostlybond.lua mod_ghostlybond.lua

Link to comment
Share on other sites

#1: I would think custom prefabs are better in this case. It would minimize your chance of conflict with the original prefab, and gives you a fresh slate.

#2: OnSave and OnLoad are called automatically by the game.

#3: I'm assuming that when the game saves the data, the ghost index is nil. This could be caused by self.ghost being nil, or :GetSaveRecord() returning nil.

I notice in your mod_ghostlybond, there is no OnSave. Perhaps you aren't saving anything at all?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...