Jump to content

Such thing as build specific?


Recommended Posts

Almost there to push this beta character into action but I need help.

 

Is there such thing as build specific or something like it? Right now I have a character that can switch into two forms. But I want my character to only equip this certain item only when shes in her second form.

 

Just wondering if thats possible or should I go about this a different way?

 

The modmain

local function IrisFn(inst)local player = GLOBAL.ThePlayerif inst:HasTag("playerghost") then return endif inst.transformed theninst.AnimState:SetBuild("plutia")	inst.SoundEmitter:PlaySound("dontstarve/sanity/creature2/taunt")	local x, y, z = inst.Transform:GetWorldPosition()	local fx = SpawnPrefab("lightning")	fx.Transform:SetPosition(x, y, z)	SpawnPrefab("statue_transition").Transform:SetPosition(inst:GetPosition():Get())inst.components.locomotor.walkspeed = 6inst.components.locomotor.runspeed = 8.5inst.components.health.absorb = 0.10inst.components.combat.damagemultiplier = 1inst.Transform:SetScale(0.8, 0.8, 0.8)inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE)inst.components.talker:Say("Poiiiiiiiiiiiiiiii!", 2.5,true) elseinst.AnimState:SetBuild("irisheart")	inst.SoundEmitter:PlaySound("dontstarve/sanity/creature2/taunt")	local x, y, z = inst.Transform:GetWorldPosition()	local fx = SpawnPrefab("lightning")	fx.Transform:SetPosition(x, y, z)	SpawnPrefab("statue_transition_2").Transform:SetPosition(inst:GetPosition():Get())inst.components.locomotor.walkspeed = 7inst.components.locomotor.runspeed = 9.5inst.components.health.absorb = 0.80inst.components.combat.damagemultiplier = 1.5inst.Transform:SetScale(1, 1, 1)inst.components.hunger:SetRate(1)inst.components.talker:Say("I have business to attend to.", 2.5,true) end inst.transformed = not inst.transformedinst.components.health:DoDelta(-20)return true endAddModRPCHandler("Plutia", "IRIS", IrisFn)

Link to comment
Share on other sites

@rons0n,

 

Build specific? You don't need that, you can use inst.transformed.

 

Use this:

local mycharacter = "wilson"--NonEquippablesOnTransformlocal NEOT = {	beehat = true,}--We make it so we can pick them up when transformed, at leastlocal old_act = GLOBAL.ACTIONS.PICKUP.fnGLOBAL.ACTIONS.PICKUP.fn = function(act)	local ret = old_act(act)	if ret and act.doer.prefab == mycharacter then		if act.doer.transformed and NEOT[act.target.prefab] then			act.doer.components.inventory:GiveItem(act.target, nil, act.target:GetPosition())		end	end	return retend--We can't equip NEOT items when transformedAddPrefabPostInit(mycharacter, function(inst)	if GLOBAL.TheWorld.ismastersim then		local old = inst.components.inventory.Equip		inst.components.inventory.Equip = function(self, item, old_to_active)			if not item or not item.components.equippable or not item:IsValid() then				return			end			if self.inst.transformed and NEOT[item.prefab] then				return			end			return old(self, item, old_to_active)		end	endend)

You may also want to put:

for k, v in pairs(inst.components.inventory.equipslots) do	if NEOT[v.prefab] then		inst.components.inventory:DropItem(v)	endend

inside the IrisFn when it transforms, so the equipped forbidden items drop.

 

As host, this works well for all ways.

As a client, when you right click the item, transformed, nothing happens.

 

However, as client, you can click and drop the item on the equipslot it needs.

It will equip it on the inventory bar only, not in the build. It will then restore to normal in 2 seconds, as if nothing happened.

 

This can be fixed by toying with the inventory_classified prefab, but I don't believe it's worth it.

Link to comment
Share on other sites

@DarkXero, Thanks again! But I think we hit a snag on our communication. So I apologize if my last post was vague.

 

The code provided is working! When she transforms she no longer can equip that specific item, but I actually wanted the opposite effect where she can only equip it when she transforms.

 

Also the other bit of code you suggested so she drops the item on transformation had sent me this error:

 

[00:02:41]: [string "../mods/plutia/modmain.lua"]:102: attempt to index global 'NEOT' (a nil value)LUA ERROR stack traceback:    ../mods/plutia/modmain.lua:102 in (field) Fn (Lua) <64-113>    ../mods/plutia/scripts/components/keyhandler.lua:34 in (local) fn (Lua) <29-35>    scripts/entityscript.lua:938 in (method) PushEvent (Lua) <932-955>    ../mods/plutia/scripts/components/keyhandler.lua:20 in (local) fn (Lua) <16-26>    scripts/entityscript.lua:938 in (method) PushEvent (Lua) <932-955>    ../mods/plutia/scripts/components/keyhandler.lua:9 in (method) OnRawKey (Lua) <6-13>    ../mods/plutia/scripts/components/keyhandler.lua:3 in (field) fn (Lua) <3-3>    scripts/events.lua:46 in (method) HandleEvent (Lua) <42-49>    scripts/input.lua:182 in (method) OnRawKey (Lua) <181-189>    scripts/input.lua:374 in () ? (Lua) <373-375>	[00:02:41]: SCRIPT ERROR! Showing error screen	[00:07:02]: Shutdown: shutting up talker	[00:07:02]: Could not unload undefined prefab 0x4058bc0 (molehat)[00:07:02]: unloading prefabs for mod MOD_plutia	[00:07:02]: Left room 109775242159148623[00:07:02]: Collecting garbage...[00:07:02]: lua_gc took 0.08 seconds[00:07:02]: ~NetworkLuaProxy()[00:07:02]: ~SimLuaProxy()[00:07:02]: lua_close took 0.18 seconds[00:07:03]: HttpClient::ClientThread::Main() complete[00:07:03]: HttpClient::ClientThread::Main() complete[00:07:03]: saved ping_cache[00:07:03]: HttpClient::ClientThread::Main() complete[00:07:03]: HttpClient::ClientThread::Main() complete[00:07:03]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:07:03]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:07:03]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:07:03]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:07:03]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:07:03]: HttpClient::ClientThread::Main() complete[00:07:03]: Shutting down

 

But theres always that chance I derped it and just placed it in the wrong area. Again.

 

Anyway I'll provide the modmain, but its a tad big:

 

-- Import the lib use.modimport("libs/use.lua")-- Import the mod environment as our environment.env = use "libs/mod_env"use "data/widgets/controls"use "data/screens/chatinputscreen"use "data/screens/consolescreen"PrefabFiles = {	"plutia", 	"personal_dogoo_eyebone",	"personal_dogoo",	"galientsword",	"wilsondoll",	"willowdoll",	"wendydoll",	"wxdoll",	"wickerdoll",	"wolfgangdoll"}Assets = {    Asset( "IMAGE", "images/saveslot_portraits/plutia.tex" ),    Asset( "ATLAS", "images/saveslot_portraits/plutia.xml" ),    Asset( "IMAGE", "images/selectscreen_portraits/plutia.tex" ),    Asset( "ATLAS", "images/selectscreen_portraits/plutia.xml" ),	    Asset( "IMAGE", "images/selectscreen_portraits/plutia_silho.tex" ),    Asset( "ATLAS", "images/selectscreen_portraits/plutia_silho.xml" ),    Asset( "IMAGE", "bigportraits/plutia.tex" ),    Asset( "ATLAS", "bigportraits/plutia.xml" ),		Asset( "IMAGE", "images/map_icons/plutia.tex" ),	Asset( "ATLAS", "images/map_icons/plutia.xml" ),		Asset( "IMAGE", "images/avatars/avatar_plutia.tex" ),    Asset( "ATLAS", "images/avatars/avatar_plutia.xml" ),		Asset( "IMAGE", "images/avatars/avatar_ghost_plutia.tex" ),    Asset( "ATLAS", "images/avatars/avatar_ghost_plutia.xml" ),		Asset( "ATLAS", "images/hud/plutiatab.xml" ),}local require = GLOBAL.requirelocal STRINGS = GLOBAL.STRINGSlocal resolvefilepath = GLOBAL.resolvefilepathlocal Ingredient = GLOBAL.Ingredientlocal RECIPETABS = GLOBAL.RECIPETABSlocal Recipe = GLOBAL.Recipelocal TECH = GLOBAL.TECHGLOBAL.TUNING.PLUTIA = {}GLOBAL.TUNING.PLUTIA.KEYTHREE = GetModConfigData("key3") or 122--Transformationlocal function IrisFn(inst)local player = GLOBAL.ThePlayerif inst:HasTag("playerghost") then return endif inst.transformed theninst.AnimState:SetBuild("plutia")	inst.SoundEmitter:PlaySound("dontstarve/sanity/creature2/taunt")	local x, y, z = inst.Transform:GetWorldPosition()	local fx = SpawnPrefab("lightning")	fx.Transform:SetPosition(x, y, z)	SpawnPrefab("statue_transition").Transform:SetPosition(inst:GetPosition():Get())inst.components.locomotor.walkspeed = 6inst.components.locomotor.runspeed = 8.5inst.components.health.absorb = 0.10inst.components.combat.damagemultiplier = 1inst.Transform:SetScale(0.8, 0.8, 0.8)inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE)inst.components.talker:Say("Poiiiiiiiiiiiiiiii!", 2.5,true) elseinst.AnimState:SetBuild("irisheart")	inst.SoundEmitter:PlaySound("dontstarve/sanity/creature2/taunt")	local x, y, z = inst.Transform:GetWorldPosition()	local fx = SpawnPrefab("lightning")	fx.Transform:SetPosition(x, y, z)	SpawnPrefab("statue_transition_2").Transform:SetPosition(inst:GetPosition():Get())inst.components.locomotor.walkspeed = 7inst.components.locomotor.runspeed = 9.5inst.components.health.absorb = 0.80inst.components.combat.damagemultiplier = 1.5inst.Transform:SetScale(1, 1, 1)inst.components.hunger:SetRate(1)inst.components.talker:Say("I have business to attend to.", 2.5,true) for k, v in pairs(inst.components.inventory.equipslots) do    if NEOT[v.prefab] then        inst.components.inventory:DropItem(v)    endendend inst.transformed = not inst.transformedinst.components.health:DoDelta(-20)return true end AddModRPCHandler("Plutia", "IRIS", IrisFn)local mycharacter = "plutia" --NonEquippablesOnTransformlocal NEOT = {    galientsword = true,} --We make it so we can pick them up when transformed, at leastlocal old_act = GLOBAL.ACTIONS.PICKUP.fnGLOBAL.ACTIONS.PICKUP.fn = function(act)    local ret = old_act(act)    if ret and act.doer.prefab == mycharacter then        if act.doer.transformed and NEOT[act.target.prefab] then            act.doer.components.inventory:GiveItem(act.target, nil, act.target:GetPosition())        end    end    return retend --We can't equip NEOT items when transformedAddPrefabPostInit(mycharacter, function(inst)    if GLOBAL.TheWorld.ismastersim then        local old = inst.components.inventory.Equip        inst.components.inventory.Equip = function(self, item, old_to_active)            if not item or not item.components.equippable or not item:IsValid() then                return            end            if self.inst.transformed and NEOT[item.prefab] then                return            end            return old(self, item, old_to_active)        end    endend)--Max Health Penaltylocal 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 - 40)/mult		if self.numrevives > maxrevives then			self.numrevives = maxrevives		end		OldRecalculatePenalty(self, forceupdatewidget)	end	self.RecalculatePenalty = RecalculatePenaltyendAddComponentPostInit('health', HealthPostInit) -- Custom itemsSTRINGS.NAMES.PERSONAL_DOGOO = "Personal Dogoo"STRINGS.NAMES.PERSONAL_DOGOO_EYEBONE = "Personal Dogoo Bone"GLOBAL.STRINGS.NAMES.GALIENTSWORD = "Galient Sword" GLOBAL.STRINGS.CHARACTERS.GENERIC.DESCRIBE.GALIENTSWORD = "A dangerous weapon of a sadist!"-- Custom Items dollsSTRINGS.RECIPE_DESC.WILSONDOLL = "A doll of a Scientist!" STRINGS.RECIPE_DESC.WXDOLL = "A robot-like doll!"STRINGS.RECIPE_DESC.WILLOWDOLL = "A firey cute doll!" STRINGS.RECIPE_DESC.WENDYDOLL = "A pessimistic doll!"STRINGS.RECIPE_DESC.WICKERDOLL = "An insomniac doll!"STRINGS.RECIPE_DESC.WOLFGANGDOLL = "A mighty stuffed doll!"GLOBAL.STRINGS.NAMES.WILSONDOLL = "Wilson Doll"GLOBAL.STRINGS.NAMES.WXDOLL = "WX-78 Doll"GLOBAL.STRINGS.NAMES.WILLOWDOLL = "Willow Doll"GLOBAL.STRINGS.NAMES.WENDYDOLL = "Wendy Doll"GLOBAL.STRINGS.NAMES.WICKERDOLL = "Wickerbottom Doll"GLOBAL.STRINGS.NAMES.WOLFGANGDOLL = "Wolfgang Doll"GLOBAL.STRINGS.CHARACTERS.GENERIC.DESCRIBE.WILSONDOLL = "A cute snuggly scientist!"GLOBAL.STRINGS.CHARACTERS.GENERIC.DESCRIBE.WXDOLL = "Cold yet loving robot!"GLOBAL.STRINGS.CHARACTERS.GENERIC.DESCRIBE.WILLOWDOLL = "I feel warm just looking at it!"GLOBAL.STRINGS.CHARACTERS.GENERIC.DESCRIBE.WENDYDOLL = "Gloomy yet loving lolita!"GLOBAL.STRINGS.CHARACTERS.GENERIC.DESCRIBE.WICKERDOLL = "Can't sleep with this one..."GLOBAL.STRINGS.CHARACTERS.GENERIC.DESCRIBE.WOLFGANGDOLL = "It's stuffed with meat!"-- An eyebone is given every time player is spawned/loaded. It's not savedlocal function GiveEyebone(inst)	local eyebone = GLOBAL.SpawnPrefab("personal_dogoo_eyebone")	if eyebone then		eyebone.owner = inst		inst.eyebone = eyebone		inst.components.inventory.ignoresound = true		inst.components.inventory:GiveItem(eyebone)		inst.components.inventory.ignoresound = false		eyebone.components.named:SetName(inst.name.."'s Dogoo Bone")	return eyebone	endendlocal function GetSpawnPoint(pt)	local theta = math.random() * 2 * GLOBAL.PI	local radius = 4	local offset = GLOBAL.FindWalkableOffset(pt, theta, radius, 12, true)	return offset ~= nil and (pt + offset) or nilendlocal function PersonalDogoo(inst)	if not inst:HasTag("specialdogooowner") then		return	end	local OnDespawn_prev = inst.OnDespawn	local OnDespawn_new = function(inst)		-- Remove dogoo		if inst.dogoo then			-- Don't allow dogoo to despawn with irreplaceable items			inst.dogoo.components.container:DropEverythingWithTag("irreplaceable")						-- We need time to save before despawning.			inst.dogoo:DoTaskInTime(0.1, function(inst)				if inst and inst:IsValid() then					inst:Remove()				end			end)					end				if inst.eyebone then			-- Eyebone drops from whatever its in			local owner = inst.eyebone.components.inventoryitem.owner			if owner then				if owner.components.container then					owner.components.container:DropItem(inst.eyebone)				elseif owner.components.inventory then					owner.components.inventory:DropItem(inst.eyebone)				end			end			-- Remove eyebone			inst.eyebone:DoTaskInTime(0.1, function(inst)				if inst and inst:IsValid() then					inst:Remove()				end			end)		else			print("Error: Player has no linked eyebone!")		end		if OnDespawn_prev then			return OnDespawn_prev(inst)		end	end	inst.OnDespawn = OnDespawn_new		local OnSave_prev = inst.OnSave	local OnSave_new = function(inst, data)		local references = OnSave_prev and OnSave_prev(inst, data)		if inst.dogoo then			-- Save dogoo			local refs = {}			if not references then				references = {}			end			data.dogoo, refs = inst.dogoo:GetSaveRecord()			if refs then				for k,v in pairs(refs) do					table.insert(references, v)				end 			end						end		if inst.eyebone then			-- Save eyebone			local refs = {}			if not references then				references = {}			end			data.eyebone, refs = inst.eyebone:GetSaveRecord()			if refs then				for k,v in pairs(refs) do					table.insert(references, v)				end 			end			end		return references	end    inst.OnSave = OnSave_new		local OnLoad_prev = inst.OnLoad	local OnLoad_new = function(inst, data, newents)		if data.dogoo ~= nil then			-- Load dogoo			inst.dogoo = GLOBAL.SpawnSaveRecord(data.dogoo, newents)		else			--print("Warning: No dogoo was loaded from save file!")		end				if data.eyebone ~= nil then			-- Load dogoo			inst.eyebone = GLOBAL.SpawnSaveRecord(data.eyebone, newents)						-- Look for eyebone at spawn point and re-equip			inst:DoTaskInTime(0, function(inst)				if inst.eyebone and inst:IsNear(inst.eyebone,4) then					inst.components.inventory:GiveItem(inst.eyebone)				end			end)		else			print("Warning: No eyebone was loaded from save file!")		end				-- Create new eyebone if none loaded		if not inst.eyebone then			GiveEyebone(inst)		end				inst.eyebone.owner = inst						if OnLoad_prev then			return OnLoad_prev(inst, data, newents)		end	end    inst.OnLoad = OnLoad_new		local OnNewSpawn_prev = inst.OnNewSpawn	local OnNewSpawn_new = function(inst)		-- Give new eyebone. Let dogoo spawn naturally.		GiveEyebone(inst)		if OnNewSpawn_prev then			return OnNewSpawn_prev(inst)		end	end    inst.OnNewSpawn = OnNewSpawn_new		if GLOBAL.TheNet:GetServerGameMode() == "wilderness" then		local function ondeath(inst, data)			-- Kill player's dogoo in wilderness mode 			if inst.dogoo then				inst.dogoo.components.health:Kill()			end			if inst.eyebone then				inst.eyebone:Remove()			end		end		inst:ListenForEvent("death", ondeath)	end		-- Debug function to return eyebone	inst.ReturnEyebone = function()		if inst.eyebone and inst.eyebone:IsValid() then			if inst.eyebone.components.inventoryitem.owner ~= inst then				inst.components.inventory:GiveItem(inst.eyebone)			end		else			GiveEyebone(inst)		end		if inst.dogoo and not inst:IsNear(inst.dogoo, 20) then			local pt = inst:GetPosition()			local spawn_pt = GetSpawnPoint(pt)			if spawn_pt ~= nil then				inst.dogoo.Physics:Teleport(spawn_pt:Get())				inst.dogoo:FacePoint(pt:Get())			end		end	endendGLOBAL.c_returneyebone = function(inst)	if not inst then		inst = GLOBAL.ThePlayer or GLOBAL.AllPlayers[1]	end	if not inst or not inst.ReturnEyebone then 		print("Error: Cannot return eyebone")		return 	end	inst:ReturnEyebone()endAddPlayerPostInit(PersonalDogoo)--No One Enters Chester cept the one with the dogoo bone!local old_RUMMAGE = GLOBAL.ACTIONS.RUMMAGE.fn GLOBAL.ACTIONS.RUMMAGE.fn = function(act)    if act.target.prefab == "personal_dogoo" then         print("GLOBAL.ACTIONS.RUMMAGE--"..tostring(act.doer.components.inventory))        result = act.doer.components.inventory:FindItem(function(item)            if item.prefab == "personal_dogoo_eyebone" then                print("GLOBAL.ACTIONS.RUMMAGE--"..tostring(item).."--ok--")                return true            end        end)        if result then             return old_RUMMAGE(act)        else            print("GLOBAL.ACTIONS.RUMMAGE--"..tostring(item).."--fail--")             act.doer:DoTaskInTime(1, function ()                act.doer.components.talker:Say("No Can Do!")            end)            return false        end    else        return old_RUMMAGE(act)    endend--Plutia Tabplutiastab = AddRecipeTab("Plutia", 998, "images/hud/plutiatab.xml", "plutiatab.tex", "plutiabuilder")--Plutia Recipeslocal wilsondoll_recipe = AddRecipe("wilsondoll",{GLOBAL.Ingredient("beefalowool", 4), GLOBAL.Ingredient("silk", 4)},plutiastab, TECH.NONE,nil, nil, nil, nil, nil,"images/inventoryimages/wilsondoll.xml", "wilsondoll.tex")wilsondoll_recipe.tagneeded = falsewilsondoll_recipe.builder_tag = "plutiabuilder"local willowdoll_recipe = AddRecipe("willowdoll",{GLOBAL.Ingredient("beefalowool", 4), GLOBAL.Ingredient("silk", 4), GLOBAL.Ingredient("charcoal", 1)},plutiastab, TECH.NONE,nil, nil, nil, nil, nil,"images/inventoryimages/willowdoll.xml", "willowdoll.tex")willowdoll_recipe.tagneeded = falsewillowdoll_recipe.builder_tag = "plutiabuilder"local wendydoll_recipe = AddRecipe("wendydoll",{GLOBAL.Ingredient("beefalowool", 4), GLOBAL.Ingredient("silk", 4), GLOBAL.Ingredient("petals", 3)},plutiastab, TECH.NONE,nil, nil, nil, nil, nil,"images/inventoryimages/wendydoll.xml", "wendydoll.tex")wendydoll_recipe.tagneeded = falsewendydoll_recipe.builder_tag = "plutiabuilder"local wxdoll_recipe = AddRecipe("wxdoll",{GLOBAL.Ingredient("beefalowool", 4), GLOBAL.Ingredient("silk", 4), GLOBAL.Ingredient("goldnugget", 1)},plutiastab, TECH.NONE,nil, nil, nil, nil, nil,"images/inventoryimages/wxdoll.xml", "wxdoll.tex")wxdoll_recipe.tagneeded = falsewxdoll_recipe.builder_tag = "plutiabuilder"local wickerdoll_recipe = AddRecipe("wickerdoll",{GLOBAL.Ingredient("beefalowool", 4), GLOBAL.Ingredient("silk", 4), GLOBAL.Ingredient("papyrus", 1)},plutiastab, TECH.NONE,nil, nil, nil, nil, nil,"images/inventoryimages/wickerdoll.xml", "wickerdoll.tex")wickerdoll_recipe.tagneeded = falsewickerdoll_recipe.builder_tag = "plutiabuilder"local wolfgangdoll_recipe = AddRecipe("wolfgangdoll",{GLOBAL.Ingredient("beefalowool", 4), GLOBAL.Ingredient("silk", 4), GLOBAL.Ingredient("meat", 1)},plutiastab, TECH.NONE,nil, nil, nil, nil, nil,"images/inventoryimages/wolfgangdoll.xml", "wolfgangdoll.tex")wolfgangdoll_recipe.tagneeded = falsewolfgangdoll_recipe.builder_tag = "plutiabuilder"-- The character select screen linesSTRINGS.CHARACTER_TITLES.plutia = "Planeptune CPU of 1980s!"STRINGS.CHARACTER_NAMES.plutia = "Plutia"STRINGS.CHARACTER_DESCRIPTIONS.plutia = "*Naps!\n*Values Friends!\n*Sadist(transformation)"STRINGS.CHARACTER_QUOTES.plutia = "\"Aww, I wanted to stay longer and play a while longer...\""-- Custom speech stringsSTRINGS.CHARACTERS.PLUTIA = require "speech_plutia"-- The character's name as appears in-game STRINGS.NAMES.PLUTIA = "Plutia"-- The default responses of examining the characterSTRINGS.CHARACTERS.GENERIC.DESCRIBE.PLUTIA = {	GENERIC = "It's Plutia!",	ATTACKER = "That Plutia looks shifty...",	MURDERER = "Murderer!",	REVIVER = "Plutia, friend of ghosts.",	GHOST = "Plutia could use a heart.",}AddMinimapAtlas("images/map_icons/plutia.xml")-- Add mod character to mod character list. Also specify a gender. Possible genders are MALE, FEMALE, ROBOT, NEUTRAL, and PLURAL.AddModCharacter("plutia", "FEMALE")

 

Regardless I appreciate everything!

Link to comment
Share on other sites

@rons0n, correct.

Should look like this then:

--Transformation--NonEquippablesOnTransformlocal NEOT = {    galientsword = true,} local function IrisFn(inst)	 	local player = GLOBAL.ThePlayer	 	if inst:HasTag("playerghost") then return end		if inst.transformed then		inst.AnimState:SetBuild("plutia")			inst.SoundEmitter:PlaySound("dontstarve/sanity/creature2/taunt")			local x, y, z = inst.Transform:GetWorldPosition()			local fx = SpawnPrefab("lightning")			fx.Transform:SetPosition(x, y, z)			SpawnPrefab("statue_transition").Transform:SetPosition(inst:GetPosition():Get())		inst.components.locomotor.walkspeed = 6		inst.components.locomotor.runspeed = 8.5		inst.components.health.absorb = 0.10		inst.components.combat.damagemultiplier = 1		inst.Transform:SetScale(0.8, 0.8, 0.8)		inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE)		 		inst.components.talker:Say("Poiiiiiiiiiiiiiiii!", 2.5,true) 	else		inst.AnimState:SetBuild("irisheart")			inst.SoundEmitter:PlaySound("dontstarve/sanity/creature2/taunt")			local x, y, z = inst.Transform:GetWorldPosition()			local fx = SpawnPrefab("lightning")			fx.Transform:SetPosition(x, y, z)			SpawnPrefab("statue_transition_2").Transform:SetPosition(inst:GetPosition():Get())		inst.components.locomotor.walkspeed = 7		inst.components.locomotor.runspeed = 9.5		inst.components.health.absorb = 0.80		inst.components.combat.damagemultiplier = 1.5		inst.Transform:SetScale(1, 1, 1)		inst.components.hunger:SetRate(1)		 		inst.components.talker:Say("I have business to attend to.", 2.5,true) 		 		for k, v in pairs(inst.components.inventory.equipslots) do			if NEOT[v.prefab] then				inst.components.inventory:DropItem(v)			end		end	end	  	inst.transformed = not inst.transformed	 	inst.components.health:DoDelta(-20)	return trueend  AddModRPCHandler("Plutia", "IRIS", IrisFn) local mycharacter = "plutia"--We make it so we can pick them up when not transformed, at leastlocal old_act = GLOBAL.ACTIONS.PICKUP.fnGLOBAL.ACTIONS.PICKUP.fn = function(act)    local ret = old_act(act)    if ret and act.doer.prefab == mycharacter then        if not act.doer.transformed and NEOT[act.target.prefab] then            act.doer.components.inventory:GiveItem(act.target, nil, act.target:GetPosition())        end    end    return retend  --We can't equip NEOT items when not transformedAddPrefabPostInit(mycharacter, function(inst)    if GLOBAL.TheWorld.ismastersim then        local old = inst.components.inventory.Equip        inst.components.inventory.Equip = function(self, item, old_to_active)            if not item or not item.components.equippable or not item:IsValid() then                return            end            if not self.inst.transformed and NEOT[item.prefab] then                return            end            return old(self, item, old_to_active)        end    endend)

 

NEOT on top of transformation; now using not transformed, so you get the effect you want.

Link to comment
Share on other sites

@DarkXero, Yes all the effects I want are currently working fine over here! Woo!

 

I haven't tested this Client sided yet but my Client-tester is currently alseep. If anything goes wrong I'll make sure to post in this thread tomarrow.

 

As usual, my thankfulness being one of the many people who pull me out of messes.

 

 

 

 

Link to comment
Share on other sites

@DarkXero,  Looks like I've tripped somewhere. It seems like the code provided works well on Host but on the Client it's a whole 'nother story. For the time being I did a quick rollback to my Character before the changes on the workshop.

 

First Issue I had was that I rejoined my server where I was already plutia but, with the updated code, joining the server makes me invisible. Not only was she invisible but she could also no longer move.

 

So I decided to try a new world and the game still crashes.

Heres how I replicated it:

 

-Joined newly generated world

-Open Dogoo

-Game disconnects

 

Edit: Turns out one of the causes was the rummage code I had on my character. I had to temporarily remove it. I'm just confused why the console log.txt refused to show it but in the console it does.

 

Edit Edit: Turns out it wasn't the rummage code but the Code that gives you the personal dogoo code...But it worked perfectly yesterday...did they update something? I don't want to remove those Dogoos...Hysteria imminent :indecisiveness:

 

TSOpJgs.png

Edited by rons0n
Link to comment
Share on other sites

@DarkXero,

 

You're completely right, the crashes are not consistent and seem to happen completely at random times for no reason stated on the crash logs. Completely frustrating.

5 Minutes Ago(Dedicated Server):

-Log In newly generated world

-Do Equippable Galient Sword on Transformation Test

(Works 100% as Intended)

-Do Jelly Slime Test(Opening It hoping it won't crash the Server)

(Works 100% as Intended)

-Log Out

-Game Crashes on loading screen for some reason?

-Log Back In

-Suddenly I have two galientswords in my inventory

-Try to pick up one

-It Crashes saying I'm missing InventoryImages of it

 

Now(With No Changes to the Code Whatsoever)(Dedicated Server)

-Log back In same world

-I'm back to just one single Galient Sword

-Equip it(It works as intended)

-Open Slime Seal(It works as Intended)

-I log out and log back in(No longer crashing at Loading Screen)

-Log back in with no problems and no second Galient Sword

-Game goes on as normal

With no changes to the code my character is miraculously fixed. I did nothing to the code, I did not tinker any numbers or change any symbols. I don't seem to understand whats happening. I'll be disabling mods on my dedicated server to see if they may have some conflict with another. I just kinda wished there was something on the crash log indicating something ya know?

 

Regardless your help is undying. I'll be updating my character with the code as I think it's more mod incompatibility than this mod itself. Thank you for your time!

 

Update: I finally got the crash log

 

[00:49:35]: WARNING! Could not find region 'OUTOFSPACE' from atlas 'images/inventoryimages.xml'. Is the region specified in the atlas?[00:49:35]: Looking for default texture '(null)' from atlas 'images/inventoryimages.xml'.[00:49:35]: images/inventoryimages.xmlLUA ERROR stack traceback:        scripts/widgets/image.lua(30,1) in function 'SetTexture'        scripts/widgets/image.lua(11,1) in function '_ctor'        scripts/class.lua(181,1) in function 'Image'        scripts/widgets/itemtile.lua(45,1) in function '_ctor'        scripts/class.lua(181,1) in function 'ItemTile'        scripts/widgets/inventorybar.lua(979,1) in function 'OnItemGet'        scripts/widgets/inventorybar.lua(79,1) in function 'fn'        scripts/entityscript.lua(938,1) in function 'PushEvent'        scripts/prefabs/inventory_classified.lua(279,1) in function 'fn'        scripts/scheduler.lua(187,1) in function 'OnTick'        scripts/scheduler.lua(398,1) in function 'RunScheduler'        scripts/update.lua(162,1)[00:49:35]: images/inventoryimages.xmlLUA ERROR stack traceback:        scripts/widgets/image.lua(30,1) in function 'SetTexture'        scripts/widgets/image.lua(11,1) in function '_ctor'        scripts/class.lua(181,1) in function 'Image'        scripts/widgets/itemtile.lua(45,1) in function '_ctor'        scripts/class.lua(181,1) in function 'ItemTile'        scripts/widgets/inventorybar.lua(979,1) in function 'OnItemGet'        scripts/widgets/inventorybar.lua(79,1) in function 'fn'        scripts/entityscript.lua(938,1) in function 'PushEvent'        scripts/prefabs/inventory_classified.lua(279,1) in function 'fn'        scripts/scheduler.lua(187,1) in function 'OnTick'        scripts/scheduler.lua(398,1) in function 'RunScheduler'        scripts/update.lua(162,1)[00:49:35]: images/inventoryimages.xmlLUA ERROR stack traceback:        scripts/widgets/image.lua(30,1) in function 'SetTexture'        scripts/widgets/image.lua(11,1) in function '_ctor'        scripts/class.lua(181,1) in function 'Image'        scripts/widgets/itemtile.lua(45,1) in function '_ctor'        scripts/class.lua(181,1) in function 'ItemTile'        scripts/widgets/inventorybar.lua(979,1) in function 'OnItemGet'        scripts/widgets/inventorybar.lua(79,1) in function 'fn'        scripts/entityscript.lua(938,1) in function 'PushEvent'        scripts/prefabs/inventory_classified.lua(279,1) in function 'fn'        scripts/scheduler.lua(187,1) in function 'OnTick'        scripts/scheduler.lua(398,1) in function 'RunScheduler'        scripts/update.lua(162,1)	[00:49:35]: SCRIPT ERROR! Showing error screen	[00:50:27]: Stale Component Reference: GUID 100539, scripts/widgets/savingindicator.lua:33[00:50:27]: Stale Component Reference: GUID 100539, scripts/widgets/savingindicator.lua:35[00:50:27]: Serializing user minimap to session/07800000311D7472/KU_3rVqOlH8_/minimap[00:50:27]: Serializing user session to session/07800000311D7472/KU_3rVqOlH8_/0000000001[00:50:30]: Stale Component Reference: GUID 100507, scripts/widgets/text.lua:55[00:50:30]: Stale Component Reference: GUID 100507, scripts/widgets/text.lua:23[00:50:30]: Stale Component Reference: GUID 100507, scripts/widgets/text.lua:55[00:50:30]: Stale Component Reference: GUID 100507, scripts/widgets/text.lua:23[00:50:30]: Stale Component Reference: GUID 100508, scripts/widgets/text.lua:55[00:50:30]: Stale Component Reference: GUID 100508, scripts/widgets/text.lua:23[00:50:30]: Stale Component Reference: GUID 100509, scripts/widgets/text.lua:55[00:50:30]: Stale Component Reference: GUID 100509, scripts/widgets/text.lua:23[00:50:30]: Stale Component Reference: GUID 100510, scripts/widgets/text.lua:55[00:50:30]: Stale Component Reference: GUID 100510, scripts/widgets/text.lua:23[00:50:30]: Stale Component Reference: GUID 100511, scripts/widgets/text.lua:55[00:50:30]: Stale Component Reference: GUID 100511, scripts/widgets/text.lua:23[00:50:30]: Stale Component Reference: GUID 100512, scripts/widgets/text.lua:55[00:50:30]: Stale Component Reference: GUID 100512, scripts/widgets/text.lua:23[00:50:30]: Stale Component Reference: GUID 100513, scripts/widgets/text.lua:55[00:50:30]: Stale Component Reference: GUID 100513, scripts/widgets/text.lua:23[00:50:30]: Stale Component Reference: GUID 100514, scripts/widgets/text.lua:55[00:50:30]: Stale Component Reference: GUID 100514, scripts/widgets/text.lua:23[00:50:30]: Stale Component Reference: GUID 100515, scripts/widgets/text.lua:55[00:50:30]: Stale Component Reference: GUID 100515, scripts/widgets/text.lua:23[00:50:30]: Stale Component Reference: GUID 100516, scripts/widgets/text.lua:55[00:50:30]: Stale Component Reference: GUID 100516, scripts/widgets/text.lua:23[00:50:30]: Stale Component Reference: GUID 100507, scripts/widgets/text.lua:55[00:50:30]: Stale Component Reference: GUID 100507, scripts/widgets/text.lua:23[00:50:30]: PushNetworkDisconnectEvent With Reason: "ID_DISCONNECTION_NOTIFICATION", reset: true[00:50:30]: Serializing user minimap to session/07800000311D7472/KU_3rVqOlH8_/minimap[00:50:30]: Serializing user session to session/07800000311D7472/KU_3rVqOlH8_/0000000001[00:50:30]: SteamWorkshop::CancelDownloads clearing all existing data[00:50:34]: Force aborting...

Edited by rons0n
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...