rons0n Posted June 10, 2015 Share Posted June 10, 2015 (edited) So right now I'm working on making my own custom thermal stone, except not really. Well I guess I am? I'm using the thermal stone spriter files to make it look different visually. Other than that, I want it to function differently. How I want it to function is that it turns blacker and blacker depending on how many creatures she kills and the only way to bring back to a light pink is by feeding this thermal stone nightmare fuel. If it does turn full black than this characters HP and Sanity drops like a rock in water. Fast. I honestly don't know how to approach this because thermals work based off temperature, I don't know how to approach this based off kills. I just need a good lead to get me started, thanks! Edited June 10, 2015 by rons0n Link to comment Share on other sites More sharing options...
DarkXero Posted June 11, 2015 Share Posted June 11, 2015 @rons0n, have fun.Stone.zip Link to comment Share on other sites More sharing options...
rons0n Posted June 11, 2015 Author Share Posted June 11, 2015 (edited) @DarkXero, Thanks yet again for giving me an answer but I'm a little confused. Can you explain how inventoryimages work if they have multiple forms? (e.g. Thermals changing colors in your inventory). I'm asking this because it's asking for an inventoryimage but I have no idea how to do it if the item itself changes into 5 different forms. Also a crash log just incase I missed anything. [00:03:07]: [Fixed] SPAWNING PLAYER AT: (-202.00, 0.00, 530.00) [00:03:07]: Serializing user session to session/09C00003CF8BE841/KU_3rVqOlH8_/0000000002[00:03:07]: WARNING! Could not find region 'FROMNUM' from atlas 'images/inventoryimages.xml'. Is the region specified in the atlas?[00:03:07]: Looking for default texture '(null)' from atlas 'images/inventoryimages.xml'.[00:03:07]: 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(187,1) in function 'Rebuild' scripts/widgets/inventorybar.lua(289,1) in function 'OnUpdate' scripts/frontend.lua(594,1) in function 'Update' scripts/update.lua(93,1)[00:03:07]: 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(187,1) in function 'Rebuild' scripts/widgets/inventorybar.lua(289,1) in function 'OnUpdate' scripts/frontend.lua(594,1) in function 'Update' scripts/update.lua(93,1)[00:03:07]: SCRIPT ERROR! Showing error screen [00:03:07]: stack traceback: scripts/widgets/widget.lua:276 in (method) SetPosition (Lua) <271-280> scripts/widgets/inventorybar.lua:245 in (method) Rebuild (Lua) <126-269> scripts/widgets/inventorybar.lua:289 in (method) OnUpdate (Lua) <271-352> scripts/frontend.lua:594 in (method) Update (Lua) <460-609> scripts/update.lua:93 in () ? (Lua) <39-123> [00:03:07]: stack traceback: scripts/widgets/widget.lua:276 in (method) SetPosition (Lua) <271-280> scripts/widgets/inventorybar.lua:246 in (method) Rebuild (Lua) <126-269> scripts/widgets/inventorybar.lua:289 in (method) OnUpdate (Lua) <271-352> scripts/frontend.lua:594 in (method) Update (Lua) <460-609> scripts/update.lua:93 in () ? (Lua) <39-123> [00:03:07]: stack traceback: scripts/widgets/widget.lua:276 in (method) SetPosition (Lua) <271-280> scripts/widgets/inventorybar.lua:247 in (method) Rebuild (Lua) <126-269> scripts/widgets/inventorybar.lua:289 in (method) OnUpdate (Lua) <271-352> scripts/frontend.lua:594 in (method) Update (Lua) <460-609> scripts/update.lua:93 in () ? (Lua) <39-123> [00:03:07]: stack traceback: scripts/widgets/widget.lua:276 in (method) SetPosition (Lua) <271-280> scripts/widgets/inventorybar.lua:253 in (method) Rebuild (Lua) <126-269> scripts/widgets/inventorybar.lua:289 in (method) OnUpdate (Lua) <271-352> scripts/frontend.lua:594 in (method) Update (Lua) <460-609> scripts/update.lua:93 in () ? (Lua) <39-123> [00:03:08]: QueryServerComplete no callback[00:03:08]: QueryServerComplete no callback[00:03:51]: Shutdown: shutting up talker [00:03:51]: Could not unload undefined prefab 0x4058bc0 (OUTOFSPACE)[00:03:51]: Could not unload undefined prefab 0xc86f3d60 (OUTOFSPACE)[00:03:51]: Could not unload undefined prefab 0x1bd1b038 (OUTOFSPACE)[00:03:51]: Could not unload undefined prefab 0xa5da3273 (OUTOFSPACE)[00:03:51]: unloading prefabs for mod MOD_workshop-451559807 [00:03:51]: unloading prefabs for mod MOD_workshop-418604101 [00:03:51]: unloading prefabs for mod MOD_workshop-434383046 [00:03:51]: unloading prefabs for mod MOD_workshop-376333686 [00:03:51]: unloading prefabs for mod MOD_workshop-431000624 [00:03:51]: unloading prefabs for mod MOD_workshop-395160719 [00:03:51]: unloading prefabs for mod MOD_workshop-409753995 [00:03:51]: unloading prefabs for mod MOD_workshop-422744946 [00:03:51]: unloading prefabs for mod MOD_workshop-421029894 [00:03:51]: unloading prefabs for mod MOD_workshop-420284239 [00:03:51]: unloading prefabs for mod MOD_workshop-412291722 [00:03:51]: unloading prefabs for mod MOD_workshop-424150128 [00:03:51]: unloading prefabs for mod MOD_Illya-ROG [00:03:51]: unloading prefabs for mod MOD_workshop-409184357 [00:03:51]: unloading prefabs for mod MOD_workshop-446033941 [00:03:51]: unloading prefabs for mod MOD_workshop-451779457 [00:03:51]: unloading prefabs for mod MOD_workshop-426769055 [00:03:51]: unloading prefabs for mod MOD_workshop-444235588 [00:03:51]: unloading prefabs for mod MOD_workshop-435988740 [00:03:51]: unloading prefabs for mod MOD_workshop-437521942 [00:03:51]: unloading prefabs for mod MOD_workshop-434859111 [00:03:51]: unloading prefabs for mod MOD_workshop-453114504 [00:03:51]: unloading prefabs for mod MOD_workshop-407705132 [00:03:51]: unloading prefabs for mod MOD_workshop-454781545 [00:03:51]: unloading prefabs for mod MOD_workshop-365632677 [00:03:51]: unloading prefabs for mod MOD_workshop-376244443 [00:03:51]: unloading prefabs for mod MOD_workshop-399803164 [00:03:51]: unloading prefabs for mod MOD_workshop-356930882 [00:03:51]: unloading prefabs for mod MOD_Madoka Wip 2.0 [00:03:51]: unloading prefabs for mod MOD_workshop-343762271 [00:03:51]: unloading prefabs for mod MOD_workshop-384048428 [00:03:51]: unloading prefabs for mod MOD_workshop-381295942 [00:03:51]: unloading prefabs for mod MOD_workshop-391470860 [00:03:51]: unloading prefabs for mod MOD_workshop-388109833 [00:03:51]: unloading prefabs for mod MOD_workshop-398858801 [00:03:51]: unloading prefabs for mod MOD_workshop-394470072 [00:03:51]: unloading prefabs for mod MOD_workshop-386087632 [00:03:51]: unloading prefabs for mod MOD_workshop-424743335 [00:03:51]: unloading prefabs for mod MOD_workshop-410614768 [00:03:51]: unloading prefabs for mod MOD_workshop-382177939 [00:03:51]: unloading prefabs for mod MOD_workshop-399799824 [00:03:51]: unloading prefabs for mod MOD_workshop-380079744 [00:03:51]: unloading prefabs for mod MOD_workshop-360823660 [00:03:51]: unloading prefabs for mod MOD_workshop-378160973 [00:03:51]: Left room 109775242102377329[00:03:51]: FMOD Error: Can't play event dontstarve/common/dropGeneric: The requested event, event group, event category or event property could not be found. [00:03:51]: Collecting garbage...[00:03:51]: lua_gc took 0.12 seconds[00:03:52]: ~NetworkLuaProxy()[00:03:52]: ~SimLuaProxy()[00:03:52]: lua_close took 0.36 seconds[00:03:53]: HttpClient::ClientThread::Main() complete[00:03:53]: HttpClient::ClientThread::Main() complete[00:03:53]: saved ping_cache[00:03:53]: HttpClient::ClientThread::Main() complete[00:03:53]: Manager - ORPHANED UNKNOWN RESOURCES:[00:03:53]: anim/tears.zip - 2[00:03:53]: anim/player_one_man_band.zip - 4[00:03:53]: anim/player_idles_groggy.zip - 2[00:03:53]: anim/player_actions_pickaxe.zip - 4[00:03:53]: anim/player_attacks.zip - 4[00:03:53]: anim/player_actions_bugnet.zip - 4[00:03:53]: anim/player_actions_axe.zip - 4[00:03:53]: anim/beard.zip - 2[00:03:53]: anim/player_slurtle_armor.zip - 2[00:03:53]: anim/player_basic.zip - 4[00:03:53]: anim/player_rebirth.zip - 4[00:03:53]: anim/player_actions_item.zip - 4[00:03:53]: anim/wilson_fx.zip - 4[00:03:53]: anim/shock_fx.zip - 2[00:03:53]: anim/fish01.zip - 2[00:03:53]: anim/player_amulet_resurrect.zip - 4[00:03:53]: anim/player_emotesxl.zip - 2[00:03:53]: anim/player_bush_hat.zip - 4[00:03:53]: anim/goo.zip - 2[00:03:53]: anim/player_jump.zip - 4[00:03:53]: anim/player_knockedout.zip - 2[00:03:53]: anim/player_revive_ghosthat.zip - 2[00:03:53]: anim/player_actions_eat.zip - 4[00:03:53]: anim/player_revive_to_character.zip - 2[00:03:53]: ../mods/workshop-409184357/anim/zoro.zip - 2[00:03:53]: anim/player_tornado.zip - 2[00:03:53]: anim/eel01.zip - 2[00:03:53]: anim/puff_spawning.zip - 2[00:03:53]: anim/player_groggy.zip - 2[00:03:53]: ../mods/workshop-409184357/anim/ghost_zoro_build.zip - 2[00:03:53]: anim/player_actions_uniqueitem.zip - 4[00:03:53]: anim/player_ghost_withhat.zip - 2[00:03:53]: anim/player_teleport.zip - 4[00:03:53]: anim/player_frozen.zip - 2[00:03:53]: anim/player_actions.zip - 4[00:03:53]: anim/player_actions_fishing.zip - 4[00:03:53]: anim/emote_fx.zip - 2[00:03:53]: anim/player_idles_shiver.zip - 4[00:03:53]: anim/player_staff.zip - 2[00:03:53]: anim/player_actions_shovel.zip - 4[00:03:53]: anim/player_actions_boomerang.zip - 4[00:03:53]: anim/player_actions_blowdart.zip - 4[00:03:53]: anim/tentacle.zip - 1[00:03:53]: anim/shadow_hands.zip - 4[00:03:53]: anim/player_cave_enter.zip - 2[00:03:53]: anim/player_idles.zip - 4[00:03:53]: anim/player_shock.zip - 2[00:03:53]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:03:53]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:03:53]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:03:53]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:03:53]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:03:53]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:03:53]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:03:53]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:03:53]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:03:53]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:03:53]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:03:53]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:03:53]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:03:53]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:03:53]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:03:53]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:03:53]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:03:53]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:03:53]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:03:53]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:03:53]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:03:53]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:03:53]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:03:53]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. [00:03:53]: Manager - ORPHANED UNKNOWN RESOURCES:[00:03:53]: anim/tears.zip:tears--atlas-0.tex - 1[00:03:53]: anim/player_rebirth.zip:player_rebirth--atlas-0.tex - 1[00:03:53]: ../mods/workshop-409184357/anim/zoro.zip:zoro--atlas-1.tex - 1[00:03:53]: anim/wilson_fx.zip:wilson_fx--atlas-0.tex - 1[00:03:53]: anim/puff_s Edited June 11, 2015 by rons0n Link to comment Share on other sites More sharing options...
Kzisor Posted June 11, 2015 Share Posted June 11, 2015 rons0n, Atlas and Texture files explained: http://forums.kleientertainment.com/topic/51402-guide-modding-practices-introdution-to-atlas-and-tex-files/ Link to comment Share on other sites More sharing options...
DarkXero Posted June 11, 2015 Share Posted June 11, 2015 @rons0n, image changes work via thisinst.components.inventoryitem:ChangeImageName("heat_rock"..tostring(stage))There are heat_rock1.tex, heat_rock2.tex, ... heat_rock5.tex. The good thing this function has is that it propagates the image change to the replica, and therefore, the client. Now there are two ways to get all these tex done, as explained in Kzisor's post:1) You put all images into a tex, and you specify regions with the xml atlas, like inventoryimages.xml does.2) You make one tex and one xml per image. Remember to load the assets, or specify the atlas (if atlas parameter is required) so the game does not go looking for the image in the inventoryimages atlas. Also, for inventoryitem, the game looks for the image with name identical to the prefab name, in the inventoryimages atlas, so you have to cast the ChangeImageName on mod items. Link to comment Share on other sites More sharing options...
rons0n Posted June 11, 2015 Author Share Posted June 11, 2015 Much appreciated you guys, I think I understand where I'm going with both of your information. So far I went with the the individual tex and xml per image method as I'm more accustomed with it. But looks like I hit a snag understanding what to do now. For some reason when my character enters the server, the rock is full black rather than the intended light pink. Also, after I kill a few spiders I encounter this error: [00:02:22]: Reconstructing topology [00:02:22]: ...Sorting points [00:02:22]: ...Sorting edges [00:02:22]: ...Connecting nodes [00:02:22]: ...Validating connections [00:02:23]: ...Housekeeping [00:02:23]: ...Done! [00:02:23]: 1 uploads added to server. From server_temp[00:02:23]: Telling Client our new session identifier: 067000064F994DFB[00:02:23]: QueryServerComplete no callback[00:02:23]: Creating Steam Room[00:02:24]: Console_CreateRoom: roomName Testing 2-man test created for id 109775242102946982[00:02:24]: Attempting to send resume request[00:02:24]: ReceiveResumeRequest[00:02:24]: Received request to resume from: session/067000064F994DFB/KU_3rVqOlH8_[00:02:24]: OnResumeRequestLoadComplete - UserID KU_3rVqOlH8[00:02:24]: ReceiveResumeNotification[00:02:24]: Deleting user session from session/067000064F994DFB/KU_3rVqOlH8_/0000000002[00:02:41]: Received request to spawn as esctemplate from Arcade[Host][00:02:41]: Could not find anim build OUTOFSPACE[00:02:41]: Could not find anim bank [OUTOFSPACE][00:02:41]: Could not find anim build OUTOFSPACE[00:02:41]: Could not find anim bank [OUTOFSPACE][00:02:41]: Initialization of UI Clock. [00:02:41]: [Fixed] SPAWNING PLAYER AT: (-214.00, 0.00, 38.00) [00:02:41]: Serializing user session to session/067000064F994DFB/KU_3rVqOlH8_/0000000002[00:02:41]: Loading minimap from session/067000064F994DFB/KU_3rVqOlH8_/minimap[00:02:41]: Clearing minimap[00:02:41]: Could not find anim [OUTOFSPACE] in bank [OUTOFSPACE][00:03:42]: God mode: true [00:03:46]: giving 111880 - spear [00:03:54]: Could not find anim [OUTOFSPACE] in bank [OUTOFSPACE][00:04:01]: WARNING! Could not find region 'FROMNUM' from atlas 'FROMNUM'. Is the region specified in the atlas?[00:04:01]: Looking for default texture '(null)' from atlas 'FROMNUM'.[00:04:01]: 195224757LUA ERROR stack traceback: scripts/widgets/image.lua(30,1) in function 'SetTexture' scripts/widgets/itemtile.lua(58,1) in function 'fn' scripts/entityscript.lua(938,1) in function 'PushEvent' scripts/components/inventoryitem.lua(266,1) in function 'ChangeImageName' ../mods/Character WIP/scripts/prefabs/nightmarerock.lua(34,1) in function 'UpdateRock' ../mods/Character WIP/modmain.lua(78,1) in function 'fn' scripts/entityscript.lua(938,1) in function 'PushEvent' ../mods/workshop-451559807/scripts/components/combat.lua(397,1) in function 'GetAttacked' ../mods/workshop-451559807/scripts/components/combat.lua(737,1) in function 'DoAttack' scripts/actions.lua(546,1) in function 'fn' scripts/bufferedaction.lua(23,1) in function 'Do' scripts/entityscript.lua(1200,1) in function 'PerformBufferedAction' scripts/stategraphs/SGwilson.lua(2516,1) in function 'fn' scripts/stategraph.lua(562,1) in function 'UpdateState' scripts/stategraph.lua(601,1) in function 'Update' scripts/stategraph.lua(123,1) in function 'Update' scripts/update.lua(205,1)[00:04:01]: 195224757LUA ERROR stack traceback: scripts/widgets/image.lua(30,1) in function 'SetTexture' scripts/widgets/itemtile.lua(58,1) in function 'fn' scripts/entityscript.lua(938,1) in function 'PushEvent' scripts/components/inventoryitem.lua(266,1) in function 'ChangeImageName' ../mods/Character WIP/scripts/prefabs/nightmarerock.lua(34,1) in function 'UpdateRock' ../mods/Character WIP/modmain.lua(78,1) in function 'fn' scripts/entityscript.lua(938,1) in function 'PushEvent' ../mods/workshop-451559807/scripts/components/combat.lua(397,1) in function 'GetAttacked' ../mods/workshop-451559807/scripts/components/combat.lua(737,1) in function 'DoAttack' scripts/actions.lua(546,1) in function 'fn' scripts/bufferedaction.lua(23,1) in function 'Do' scripts/entityscript.lua(1200,1) in function 'PerformBufferedAction' scripts/stategraphs/SGwilson.lua(2516,1) in function 'fn' scripts/stategraph.lua(562,1) in function 'UpdateState' scripts/stategraph.lua(601,1) in function 'Update' scripts/stategraph.lua(123,1) in function 'Update' scripts/update.lua(205,1)[00:04:01]: SCRIPT ERROR! Showing error screen [00:04:02]: QueryServerComplete no callback[00:04:02]: QueryServerComplete no callback Or maybe I just don't understand at all and I'm just derping really hard. Maybe someone can spot what I'm doing wrong? File below. WIP.zip Link to comment Share on other sites More sharing options...
DarkXero Posted June 11, 2015 Share Posted June 11, 2015 @rons0n:TheWIP.zip Link to comment Share on other sites More sharing options...
rons0n Posted June 12, 2015 Author Share Posted June 12, 2015 Thanks! We wont do the actual project until tomorrow so testing this out will be later. If we do hit any snags i'll make a post here. As usual, a huge token of gratefulness for getting me out of messes! Link to comment Share on other sites More sharing options...
rons0n Posted June 12, 2015 Author Share Posted June 12, 2015 @DarkXero, Our character is coming along nicely! Whoopee!I did encounter a crash and I fixed it, but now I'm encountering other problems. First, the Client does not receive the nightmarerock at all whatsoever. The second one I'm not sure if this is related to Clients/Host or another issue altogether. The second problem is that when the Host has her nightmarerock fully black and receives the HP/Sanity drain, the client(who is the same character) also receives the HP/Sanity penalty. I only added if inst.components.inventory == nil then return endto my modmain like so: PrefabFiles = { "madoka", "nightmarerock", "rosebow", "madoka_projectile",}Assets = { Asset( "IMAGE", "images/saveslot_portraits/madoka.tex" ), Asset( "ATLAS", "images/saveslot_portraits/madoka.xml" ), Asset( "IMAGE", "images/selectscreen_portraits/madoka.tex" ), Asset( "ATLAS", "images/selectscreen_portraits/madoka.xml" ), Asset( "IMAGE", "images/selectscreen_portraits/madoka_silho.tex" ), Asset( "ATLAS", "images/selectscreen_portraits/madoka_silho.xml" ), Asset( "IMAGE", "bigportraits/madoka.tex" ), Asset( "ATLAS", "bigportraits/madoka.xml" ), Asset( "IMAGE", "images/map_icons/madoka.tex" ), Asset( "ATLAS", "images/map_icons/madoka.xml" ), Asset( "IMAGE", "images/avatars/avatar_madoka.tex" ), Asset( "ATLAS", "images/avatars/avatar_madoka.xml" ), Asset( "IMAGE", "images/avatars/avatar_ghost_madoka.tex" ), Asset( "ATLAS", "images/avatars/avatar_ghost_madoka.xml" ),}local require = GLOBAL.requirelocal STRINGS = GLOBAL.STRINGSSTRINGS.NAMES.NIGHTMAREROCK = "Nightmare Rock"STRINGS.CHARACTERS.GENERIC.DESCRIBE.NIGHTMAREROCK = { VOID = "Looking at it makes me sick.", WEAK = "It feels cold.", NORM = "It keeps still.", GRAY = "It lost some energy.", FULL = "It's pulsating."}local TUNING = GLOBAL.TUNINGlocal SpawnPrefab = GLOBAL.SpawnPrefablocal function OnSave(inst, data) data.SoulStage = inst.SoulStone.SoulStageendlocal function OnLoad(inst, data) if data and data.SoulStage then inst.SoulStone:UpdateRock(data.SoulStage) endendlocal function OnDespawn(inst) if not inst.SoulStone:HasTag("INLIMBO") then SpawnPrefab("collapse_small").Transform:SetPosition(inst.SoulStone.Transform:GetWorldPosition()) end inst.SoulStone:Remove()endlocal function OnKilledOther(inst, data) if inst.SoulBorn == 4 then inst.SoulBorn = 0 local stage = inst.SoulStone.SoulStage if stage > 1 then inst.SoulStone:UpdateRock(inst.SoulStone.SoulStage - 1) end else inst.SoulBorn = inst.SoulBorn + 1 endendlocal function RockReaction(inst, stage) if inst.components.health.regen then inst.components.health:StopRegen() end inst.components.sanity.custom_rate_fn = nil if stage == 1 then inst.components.health:StartRegen(-2, 2) inst.components.sanity.custom_rate_fn = function(inst) return (-2) * TUNING.DAPPERNESS_HUGE end elseif stage == 2 then elseif stage == 3 then elseif stage == 4 then elseif stage == 5 then endendAddPrefabPostInit("madoka", function(inst) if inst.components.inventory == nil then return end local SoulStone = SpawnPrefab("nightmarerock") SoulStone.SoulMaster = inst inst.SoulStone = SoulStone inst.components.inventory:GiveItem(inst.SoulStone) if inst.OnSave then local old1 = inst.OnSave inst.OnSave = function(inst, data) old1(inst, data) OnSave(inst, data) end else inst.OnSave = OnSave end if inst.OnLoad then local old2 = inst.OnLoad inst.OnLoad = function(inst, data) old2(inst, data) OnLoad(inst, data) end else inst.OnLoad = OnLoad end if inst.OnDespawn then local old3 = inst.OnDespawn inst.OnDespawn = function(inst) old3(inst) OnDespawn(inst) end else inst.OnDespawn = OnDespawn end inst.SoulBorn = 0 inst:ListenForEvent("killed", OnKilledOther) inst:ListenForEvent("soulchange", RockReaction)end)-- The character select screen linesSTRINGS.CHARACTER_TITLES.madoka = "Madoka"STRINGS.CHARACTER_NAMES.madoka = "Esc"STRINGS.CHARACTER_DESCRIPTIONS.madoka = "*Perk 1\n*Perk 2\n*Perk 3"STRINGS.CHARACTER_QUOTES.madoka = "\"Quote\""-- Custom speech stringsSTRINGS.CHARACTERS.MADOKA = require "speech_madoka"-- The character's name as appears in-game STRINGS.NAMES.MADOKA = "Esc"-- The default responses of examining the characterSTRINGS.CHARACTERS.GENERIC.DESCRIBE.MADOKA = { GENERIC = "It's Madoka!", ATTACKER = "That Madoka looks shifty...", MURDERER = "Murderer!", REVIVER = "Madoka, friend of ghosts.", GHOST = "Madoka could use a heart.",}AddMinimapAtlas("images/map_icons/madoka.xml")-- Add mod character to mod character list. Also specify a gender. Possible genders are MALE, FEMALE, ROBOT, NEUTRAL, and PLURAL.AddModCharacter("madoka", "FEMALE") I'm not sure if you also need the prefab but here it is, also provided.local assets = { Asset("ANIM", "anim/nightmarerock.zip"),}for i = 1, 5, 1 do table.insert(assets, Asset( "IMAGE", "images/inventoryimages/nightmarerock"..tostring(i)..".tex" )) table.insert(assets, Asset( "ATLAS", "images/inventoryimages/nightmarerock"..tostring(i)..".xml" ))endlocal function GetStatus(inst) if inst.SoulStage == 1 then return "VOID" elseif inst.SoulStage == 2 then return "WEAK" elseif inst.SoulStage == 3 then return "NORM" elseif inst.SoulStage == 4 then return "GRAY" elseif inst.SoulStage == 5 then return "FULL" endendlocal function UpdateRock(inst, stage) inst.SoulStage = stage inst.AnimState:PlayAnimation(tostring(stage), true) inst.components.inventoryitem.atlasname = "images/inventoryimages/nightmarerock"..tostring(stage)..".xml" inst.components.inventoryitem:ChangeImageName("nightmarerock"..tostring(stage)) if stage < 4 then inst.components.trader:Enable() else inst.components.trader:Disable() end if inst.SoulMaster then inst.SoulMaster:PushEvent("soulchange", stage) endendlocal function FuelTest(inst, item, giver) if item.prefab == "nightmarefuel" and giver == inst.SoulMaster then return true endendlocal function FuelAccept(inst, giver, item) inst:UpdateRock(inst.SoulStage + 2)endlocal function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddSoundEmitter() inst.entity:AddNetwork() MakeInventoryPhysics(inst) inst.AnimState:SetBank("nightmarerock") inst.AnimState:SetBuild("nightmarerock") inst:AddTag("irreplaceable") inst.entity:SetPristine() if not TheWorld.ismastersim then return inst end inst:AddComponent("inspectable") inst.components.inspectable.getstatus = GetStatus inst:AddComponent("inventoryitem") inst:AddComponent("trader") inst.components.trader.acceptnontradable = true inst.components.trader.test = FuelTest inst.components.trader.onaccept = FuelAccept inst.UpdateRock = UpdateRock inst.SoulMaster = nil inst:UpdateRock(5) return instendreturn Prefab("common/inventory/nightmarerock", fn, assets) Much is appreciated! Link to comment Share on other sites More sharing options...
DarkXero Posted June 12, 2015 Share Posted June 12, 2015 @rons0n, try using this:modmain.lua Link to comment Share on other sites More sharing options...
rons0n Posted June 13, 2015 Author Share Posted June 13, 2015 Yup, this seems to have done the trick! Any snags will be reported back here once again. Yet again, I am grateful! Link to comment Share on other sites More sharing options...
rons0n Posted June 16, 2015 Author Share Posted June 16, 2015 (edited) @DarkXero, I hit a little snag that I can't seem to understand. Basically a bunch of griefers decided to raid my server and attempt to destroy it. Obviously I could rollback and I did. But now whenever I try to bring it back up I encounter this error:[00:00:38]: [string "../mods/workshop-461627386/modmain.lua"]:71: attempt to index field 'SoulStone' (a nil value)LUA ERROR stack traceback:../mods/workshop-461627386/modmain.lua:71 in (upvalue) OnDespawn (Lua) <70-75> inst = 114904 - madoka (valid:true)../mods/workshop-461627386/modmain.lua:135 in (method) OnDespawn (Lua) <133-136> inst = 114904 - madoka (valid:true)scripts/gamelogic.lua:676 in (upvalue) DoInitGame (Lua) <524-734> savedata = table: 0BB483C0 profile = table: 07C0D510 was_file_load = false players_to_restore = table: 111148A8 players_restored = table: 253EB998 k = KU_3rVqOlH8 v = 114904 - madoka (valid:true)scripts/gamelogic.lua:766 in (upvalue) cb (Lua) <761-767> savedata = table: 0BB483C0scripts/saveindex.lua:120 in () ? (Lua) <102-121> load_success = true str = return {world_network={persistdata={clock={moonphase="quarter",cycles=42,phase="dawn",remainingtimeinphase=92.97868347168,totaltimeinphase=120,segs={dawn=4,night=3,day=5,dusk=4}},seasons={elapseddaysinseason=7,premode=false,remainingdaysinseason=13,lengths={summer=15,autumn=20,spring=20,winter=15},totaldaysinseason=20,mode="cycle",season="spring",segs={summer={dawn=1,night=4,day=10,dusk=1},autumn={dawn=3,night=2,day=8,dusk=3},spring={dawn=4,night=3,day=5,dusk=4},winter={dawn=2,night=7,day=5,dusk=2}}},holidayed={name="Halloween",phase={state="completed",ending="dawn",start="dusk"}},weather={seasontemperature=22.5,preciptype="none",moistureceil=3638.3288574219,peakprecipitationrate=0.89617604017258,season="spring",moisturerateval=3.081745423094,lightningmode="rain",moistureceilmultiplier=5.5,moisture=2684.4924316406,stopsnowthreshold=0,snowlevel=0,moisturefloormultiplier=0.25,moisturerateoffset=0,noisetime=20130.15234375,moisturerate=3.0817453861237,wetness=2.7879686355591,nextlightningtime=0.1474546879987,star [**truncated**] success = true savedata = table: 0BB483C0=[C]:-1 in (method) GetPersistentString (C) <-1--1>scripts/saveindex.lua:102 in (method) GetSaveDataFile (Lua) <101-122> self = data = table: 07C0D830 current_slot = 5 file = session/0C90000077D27C07/0000000048 cb = function - scripts/gamelogic.lua:761scripts/saveindex.lua:128 in (method) GetSaveData (Lua) <124-132> self = data = table: 07C0D830 current_slot = 5 slot = 5 cb = function - scripts/gamelogic.lua:761 file = session/0C90000077D27C07/0000000048scripts/gamelogic.lua:768 in (upvalue) DoLoadWorld (Lua) <760-769> saveslot = 5 onload = function - scripts/gamelogic.lua:761scripts/gamelogic.lua:813 in (upvalue) LoadSlot (Lua) <808-819> slot = 5scripts/gamelogic.lua:868 in (upvalue) DoResetAction (Lua) <823-908>scripts/gamelogic.lua:919 in (local) complete_callback (Lua) <911-920>[00:00:38]: SCRIPT ERROR! Showing error screen [00:00:38]: ModIndex: Load sequence finished successfully. [00:00:38]: Reset() returningKinda sucks that the griefers have officially won, but atleast I found a error. So it's a bitter sweet king of thing lol. How do I fix this? This was on a dedicated server Edited June 16, 2015 by rons0n Link to comment Share on other sites More sharing options...
DarkXero Posted June 16, 2015 Share Posted June 16, 2015 @rons0n: local function OnDespawn(inst) if inst.SoulStone then if not inst.SoulStone:HasTag("INLIMBO") then SpawnPrefab("collapse_small").Transform:SetPosition(inst.SoulStone.Transform:GetWorldPosition()) end inst.SoulStone:Remove() end end Link to comment Share on other sites More sharing options...
rons0n Posted June 16, 2015 Author Share Posted June 16, 2015 Thanks! Next time I can rollback without errors and ban them properly next time. All is appreciated! Link to comment Share on other sites More sharing options...
rons0n Posted June 22, 2015 Author Share Posted June 22, 2015 (edited) @DarkXero, I hit another crash and it doesn't tell me why, but I do know how to recreate it to crash! This is a client-sided crash. Basically if you leave the Soulgem(nightmarerock) inside chester and decide to log out and log back in, then decide to reopen the chester with the soulgem, the game crashes. I think what I'd want the soulgem to do is not enter other containers other than her inventory only. If thats not possible I'd appreciate any other alternatives. Edited June 22, 2015 by rons0n Link to comment Share on other sites More sharing options...
DarkXero Posted June 22, 2015 Share Posted June 22, 2015 @rons0n, I tried to replicate the issue but I couldn't.It worked as intended, rock banished from chester when I returned to him. But you can use this: inst:AddComponent("inventoryitem") -- put the code below inventoryitem local old = inst.components.inventoryitem.SetOwner inst.components.inventoryitem.SetOwner = function(self, owner) old(self, owner) if owner then owner:DoTaskInTime(0, function() if owner.components.container then owner.components.container:DropItem(inst) end end) end endin nightmarerock to get what you want. Link to comment Share on other sites More sharing options...
rons0n Posted June 22, 2015 Author Share Posted June 22, 2015 @DarkXero, Thats so odd..You're correct the Soulgem no longer stays within Chester but goes back in your inventory after you relogin. But just 1 hour ago it did stay in chester and it did cause the client to crash. Did the devs do something the past hour? Allwell, with the code you provided above I don't have to worry if it does magically decide to stay within chester. Much is appreciated! Link to comment 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