NPCMaxwell Posted December 6, 2024 Share Posted December 6, 2024 (edited) To be exact it happens in he following three situations from my Maxwell mod's modmain: (and RECENTLY it happens a LOT, which is kind of painful when you actually need to make use of the situation, but the item bug won't let you interact with it.) -- spawn Charlie near Maxwell (here bug seldomly happens, Charlie will not be "examinable", sometimes un-examinable Charlie will stick around although she should despawn) local function SpawnCharlieNearMaxwell(inst) if math.random() < 0.03 then local x, y, z = inst.Transform:GetWorldPosition() local entities = GLOBAL.TheSim:FindEntities(x, y, z, 10) for i, entity in ipairs(entities) do if entity.prefab == "charlie_npc" then return end end -- random position local dx = math.random() * 2 - 1 -- Random number between -1 and 1 local dz = math.random() * 2 - 1 -- Random number between -1 and 1 local charlie = GLOBAL.SpawnPrefab("charlie_npc") charlie.Transform:SetPosition(x + 3 * dx, y, z + 3 * dz) inst:DoTaskInTime(25, function() if charlie and charlie:IsValid() then charlie:Remove() end end) -- Charlie gifts a flower (flower will sometimes be "prop" flower because of the bug and will stick around without Maxwell being able to interact with it) local flower = math.random() < 0.50 and "flower_rose" or "flower_evil" local flower_entity = GLOBAL.SpawnPrefab(flower) flower_entity.Transform:SetPosition(x + 3.5 * dx, y, z + 3.5 * dz) if inst.components.sanity then inst.components.sanity:DoDelta(30) end if not inst:HasTag("playerghost") then inst.components.talker:Say("Ah, my dearest Shadow Queen!") inst:DoTaskInTime(5, function() inst.AnimState:PlayAnimation("tall_emote_swoon", false) inst:DoTaskInTime(5, function() inst.AnimState:PlayAnimation("tall_emoteXL_kiss", false) end) end) end end inst:DoTaskInTime(GLOBAL.TUNING.TOTAL_DAY_TIME / 16, SpawnCharlieNearMaxwell) end AddPrefabPostInit("maxwellnpc", function(inst) inst:DoTaskInTime(120, SpawnCharlieNearMaxwell) end) AddPrefabPostInit("monstermaxwellnpc", function(inst) inst:DoTaskInTime(120, SpawnCharlieNearMaxwell) end) AddPrefabPostInit("sadmaxwellnpc", function(inst) inst:DoTaskInTime(120, SpawnCharlieNearMaxwell) end) -- reviver as random additional gift (bug almost ALWAYS since the halloween update results in a "prop" reviver being spawned that uselessly lingers on the floor without being able to examine or pick it up! It's starting to drive me insane because I feal needlessly teased by Charlie ^^) local function SpawnReviverNearCharlie(inst) local function SpawnReviver() local x, y, z = inst.Transform:GetWorldPosition() local entities = GLOBAL.TheSim:FindEntities(x, y, z, 10) for i, entity in ipairs(entities) do if entity.prefab == "reviver" then return end end for i, entity in ipairs(entities) do if entity.prefab == "charlie_npc" and math.random() < 0.50 then local dx = math.random() * 2 - 1 local dz = math.random() * 2 - 1 local reviver = GLOBAL.SpawnPrefab("reviver") reviver.Transform:SetPosition(x + 3 * dx, y, z + 3 * dz) return end end end inst:DoTaskInTime(5, SpawnReviver) end AddPrefabPostInit("charlie_npc", function(inst) inst:DoTaskInTime(0, SpawnReviverNearCharlie) end) The bug also happens here recently a lot: -- spawn evil Simon near Maxwell (thanks to the bug evil Simon happens to sometimes be a non-moving "prop" Simon that usually normally despawns, but sometimes evil Simon keeps sitting around forever and can't be examined or interact with) local function SpawnRabbitKingNearMaxwell(inst) local x, y, z = inst.Transform:GetWorldPosition() local entities = GLOBAL.TheSim:FindEntities(x, y, z, 10) for i, entity in ipairs(entities) do if entity.prefab == "rabbitking_aggressive" then return end end local rabbitking = GLOBAL.SpawnPrefab("rabbitking_aggressive") rabbitking.Transform:SetPosition(x, y, z) inst:DoTaskInTime(5, function() if rabbitking and rabbitking:IsValid() then rabbitking:Remove() end end) if inst.components.sanity then inst.components.sanity:DoDelta(-100) end inst:DoTaskInTime(0, function() if not inst:HasTag("playerghost") then inst.components.talker:Say("Curse you, Simon!") end end) end local function CheckSpawnRabbitKing(inst) if math.random() < 0.01 then SpawnRabbitKingNearMaxwell(inst) end inst:DoTaskInTime(GLOBAL.TUNING.TOTAL_DAY_TIME / 16, CheckSpawnRabbitKing) end AddPrefabPostInit("maxwellnpc", function(inst) inst:DoTaskInTime(120, CheckSpawnRabbitKing) end) AddPrefabPostInit("monstermaxwellnpc", function(inst) inst:DoTaskInTime(120, CheckSpawnRabbitKing) end) AddPrefabPostInit("sadmaxwellnpc", function(inst) inst:DoTaskInTime(120, CheckSpawnRabbitKing) end) And here: -- spawn babyghost (custom cosmetical ghost based on pipspook doing idle animation) Thanks to the bug babyghost will sometimes float around without being examinable and will sometimes stick around as prop, sometimes not even triggering Maxwell's "insanity-punishment" reaction. The appearance dialogue also seems to get triggered for "prop" babyghost.) local function HandleSanity(inst, babyghost) if not inst.components.sanity or inst:HasTag("playerghost") or not babyghost:IsValid() then if inst.sanityTask then inst.sanityTask:Cancel() end return end local x, y, z = inst.Transform:GetWorldPosition() local bx, by, bz = babyghost.Transform:GetWorldPosition() local distance = math.sqrt((x - bx) ^ 2 + (z - bz) ^2) if distance > 4 then inst.components.talker:Say("I guess this is my punishment for not being there for you...") inst.components.sanity:DoDelta(-500) if inst.sanityTask then inst.sanityTask:Cancel() end return end end local function HandleDialogues(inst, babyghost) if inst:HasTag("playerghost") or not babyghost:IsValid() then return end local x, y, z = inst.Transform:GetWorldPosition() local bx, by, bz = babyghost.Transform:GetWorldPosition() local distance = math.sqrt((x - bx) ^ 2 + (z - bz) ^ 2) if distance <= 4 then inst.components.talker:Say("Shhh... It's alright, little one...") inst:DoTaskInTime(5, function() if babyghost:IsValid() then inst.components.talker:Say("I'm here now...") if inst.components.sanity then inst.components.sanity:DoDelta(5) end end end) end end local function SpawnBaby(inst) if inst:HasTag("playerghost") then return end local babyghost = GLOBAL.SpawnPrefab("babyghost") local x, y, z = inst.Transform:GetWorldPosition() babyghost.Transform:SetPosition(x + 2, y, z + 2) if inst.components.sanity then inst.components.sanity:DoDelta(-1) end inst.components.talker:Say("Are you looking for your mommy?") inst:DoTaskInTime(3, function() inst.components.talker:Say("Please, don't play with my heart like this...") inst:DoTaskInTime(3, function() inst.components.talker:Say("I suppose it's my job to comfort you now...") inst.sanityTask = inst:DoPeriodicTask(1, function() HandleSanity(inst, babyghost) end) inst.dialogueTask = inst:DoPeriodicTask(7, function() HandleDialogues(inst, babyghost) end) end) end) babyghost:DoTaskInTime(90, function() if babyghost:IsValid() then babyghost:Remove() if not inst:HasTag("playerghost") then inst:DoTaskInTime(5, function() inst.components.talker:Say("We could have had a family...") end) end if inst.sanityTask then inst.sanityTask:Cancel() end end end) end local function CheckSpawnBaby(inst) if math.random() < 0.01 then SpawnBaby(inst) end inst:DoTaskInTime(GLOBAL.TUNING.TOTAL_DAY_TIME / 16, CheckSpawnBaby) end AddPrefabPostInit("maxwellnpc", function(inst) inst:DoTaskInTime(120, CheckSpawnBaby) end) AddPrefabPostInit("monstermaxwellnpc", function(inst) inst:DoTaskInTime(120, CheckSpawnBaby) end) AddPrefabPostInit("sadmaxwellnpc", function(inst) inst:DoTaskInTime(120, CheckSpawnBaby) end) Edited December 6, 2024 by NPCMaxwell Link to comment https://forums.kleientertainment.com/forums/topic/161904-mod-bug-tends-to-spawn-prop-items-problem-occured-after-halloween-update-cant-interact-with-spawned-item-but-item-appears-on-the-ground-frozen-in-place/ 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