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.

BraveChicken

Character's special items keeps on appearing.

Recommended Posts

BraveChicken    33

I'm a bit bothered with what I believe could be categorized as a [Gameplay] bug. (I'm playing on Steam) And the same thing happens with and without mods. (in DS, RoG)

--The issue--
All of the characters keep on receiving their "irreplaceable" items which later replace the old ones. Which in Wendy's case can be very bothersome as it also resets Abigail's flower and forces the player to wait until Abigail will be almost ready to spawn again.

--Steps to reproduce--
Leaving the character's unique item in a chest or on the ground and then entering a cave (descending to a sinkhole) will immediately spawn the left item back in the character's inventory. Later if going back to the surface with that item, the game will despawn the old item leaving only the new one which the character holds.

 

--How to fix it--
I do realize that you probably, more than anybody else, know how to script and organize this game. 
But if you'll allow me... I actually know how to easily fix this problem completely, and make the game remember if the character already has his/her specials items or not.
 

Spoiler

In my mod I also had the same exact problem with the unique/irreplaceable items that I have created for my characters. And the way that I dealt with it, is by creating a simple component which keeps track of the character's special items. (I attached that component to this post)

All that the character needs, is to have that component added to it, and then, instead of the old ways of checking for the special items
Which would be Wendy's:

    inst:DoTaskInTime(0, function() 
        local found = false
            for k,v in pairs(Ents) do
            if v.prefab == "abigail" then
                found = true
                break
            end
        end
        if not found then
            inst.components.inventory:GuaranteeItems(prefabs)
        end
    end)

--have it changed to

    inst:DoTaskInTime(0, function() --Check for items
        local found = false
        for k,v in pairs(Ents) do
            if v.prefab == "abigail_flower" or v.prefab == "abigail" then
                inst.components.statuschecker.hasitems = inst.components.statuschecker.hasitems + 1
                found = true
                break
            end
        end
        if not found and inst.components.statuschecker.hasitems == 0 then
            inst.components.statuschecker.hasitems = inst.components.statuschecker.hasitems + 1
            inst.components.inventory:GuaranteeItems(prefabs)
        end
    end)
    
    inst:DoPeriodicTask( 0.0, function(inst) --Reset item status on teleport
        if inst.is_teleporting and  inst.components.statuschecker.hasitems > 0 then
            inst.components.statuschecker:Reset()
            print("Teleport noticed")
        end
    end)

(I am guessing that all characters have something similar to Wendy's, that keeps an eye on their special items)

This will allow the players be able to leave the character's special items without worrying or feeling like they are forced to always have them in their inventory. And when teleporting out the island (like when trying to go through the adventure mode) the game still will reset the character's item status and grant them their items even if they haven't taken them along with them.
 

I'm sorry if all this came out as "annoying". I just really enjoy this game and I wanted to try and help. 
I hope that this can be at lest a little bit useful. 

statuschecker.lua

Share this post


Link to post
Share on other sites
TheOtherGuy    0

The game sees that you don't have the character specific item in your inventory, and since characters are supposed to, the game spawns them in again. I left my codex umbra on the ground and then upon entering the caves, was greeted by another. It's intended.

Share this post


Link to post
Share on other sites
Black_Mage    3
On 30/12/2018 at 5:24 PM, TheOtherGuy said:

The game sees that you don't have the character specific item in your inventory, and since characters are supposed to, the game spawns them in again. I left my codex umbra on the ground and then upon entering the caves, was greeted by another. It's intended.

Yes, but the main reason why the game gives you another special item is because it understands that you just spawned In a new world (just-generated caves/ruins, for example), and when the game checks that and you don’t have the respective character’s items, it will give you another one, just like as if you just “created another world”. This mechanic is here to prevent extreme loss whenever you use a teleportato /seaworthy/skyworthy and don’t bring your special character-specific item such as the Codex Umbra or Abigail’s flower. It has been around for too long. For now, people should be somewhat careful with Abigail’s flower, since it restarts itself.

Share this post


Link to post
Share on other sites