Bunions Posted January 29, 2017 Share Posted January 29, 2017 (edited) Hi I am new to working on modding and trying to fix a few mods on the workshop as a way to learn and improve my gameplay for personal use. I was hoping I could get some help working on 3 mods in particular in this thread. I will address them one at a time however. I am including info on the first mod in question that I have begun work / testing on. So first to describe the first mod (I was able to make a minor fix already) Here is the mod - Injured: http://steamcommunity.com/sharedfiles/filedetails/?id=746950393 Here is a copy / paste of an error that I fixed. (Copied from steam workshop page)e is a cut and past of a fix I already made (copied from mod page on Players other than host (me) coming into game & having following issues:Unable to see blood trails of injured player.Problems with build menu bar.The error people (other than the host) were having with their build menus, showed some prefabs as build-able without having the materials to build or having built a science machine of any kind. Additionally, things like sculpture table showed as pre built, & the statue tab was showing up. All happening upon entering game. Making the change from:all_clients_require_mod = false to all_clients_require_mod = truewithin the modinfo.lua file made the correction. Testing last night found this error from a group of mods being run at the time. We isolated it (the error) hosted a game with just this mod active and found the issue, made the change, and tested the mod solo, and as part of a group of mods again. Here is a new error, sorry I don't have a log this was given to me from a friend: http://images.akamai.steamusercontent.com/ugc/170410300175352932/8BF884D628C8958D7901E55C3CBB7B23B8EBED3E/ I should have asked him for a log, I didn't think to - sorry! I dont know how to reproduce the bug, but I have a theory on why it happens. Please let me know if you want to hear my idea. I don't want to corrupt thinking on it first though. Here is the section of the mod mentioned by the screenshot: function DoInjured (player) local index local x, y, z = player.Transform:GetWorldPosition() local Prefab player.components.health:DoDelta(-1,nil,"injured") index = math.random(0,6) if index > 0 and index <= 1 then Prefab = GLOBAL.SpawnPrefab("blood6") Prefab.Transform:SetPosition(x, y, z) elseif index > 1 and index <= 2 then Prefab = GLOBAL.SpawnPrefab("blood2") Prefab.Transform:SetPosition(x, y, z) elseif index > 2 and index <= 3 then Prefab = GLOBAL.SpawnPrefab("blood3") Prefab.Transform:SetPosition(x, y, z) elseif index > 3 and index <= 4 then Prefab = GLOBAL.SpawnPrefab("blood4") Prefab.Transform:SetPosition(x, y, z) elseif index > 4 and index <= 5 then Prefab = GLOBAL.SpawnPrefab("blood5") Prefab.Transform:SetPosition(x, y, z) else Prefab = GLOBAL.SpawnPrefab("blood1") Prefab.Transform:SetPosition(x, y, z) end Prefab:DoTaskInTime(120, function(inst) inst:Remove() end) if player and player:HasTag("bangbot") then injured:Cancel() player:RemoveTag("injured") end if player.components.health.currenthealth < 1 then player:RemoveTag("injured") player:RemoveTag("bangbot") injured:Cancel() end end Thanks for any help! Bunions http://steamcommunity.com/id/Bunions/ *Edit - included files in case that is helpful. workshop-746950393.7z Edited January 29, 2017 by Bunions Added files Link to comment https://forums.kleientertainment.com/forums/topic/73682-help-fixing-a-mod-giving-a-nil-value-error/ Share on other sites More sharing options...
Bunions Posted January 29, 2017 Author Share Posted January 29, 2017 Got friend to send me his log! client_log_2017-01-27-19-17-50.txt Link to comment https://forums.kleientertainment.com/forums/topic/73682-help-fixing-a-mod-giving-a-nil-value-error/#findComment-862163 Share on other sites More sharing options...
Bunions Posted January 29, 2017 Author Share Posted January 29, 2017 Addendum # 2 A conversation with a friend on Steam trying to isolate the issue: UnderwearApprentice: at a quick glance over dinner, you can fix the crash by adding if player.components.health then UnderwearApprentice: before using the health component UnderwearApprentice: however if it is actually nil then the code will do nothing instead of crash Bunions: isnt that desirable tho cause if health is nil wont you be dead? UnderwearApprentice: nah nil just means it cannot find that value Bunions: ooooh UnderwearApprentice: any variable in code acan be nil Bunions: oooh UnderwearApprentice: it means it cant find the player health component UnderwearApprentice: so it is nil casue as far as lua is concerned it doesn't exist Bunions: would lag cause that? Bunions: because it keeps checking health every few seconds? UnderwearApprentice: unlikely it would casue a crash UnderwearApprentice: especially at a few seconds interval UnderwearApprentice: when youre checking like 1000 times a second it could Bunions: the bleed takes place 1 hp every 4.8 secs UnderwearApprentice: yeah that should beno problem Bunions: wonder what caused the nil then UnderwearApprentice: this is a difficult issue with DST regarding identifying players and their components UnderwearApprentice: I have the same issue trying to add thirst to DST Bunions: the log is there (in second post) but I dont know if it explains it Bunions: OMG youre adding thirst?!?! Marry me! UnderwearApprentice: My friend made it for singleplayer UnderwearApprentice: I am trying to port it UnderwearApprentice: having issues UnderwearApprentice: though UnderwearApprentice: the log only shows where the crash occurs, you need to figure out why it is not receiving clients heaalth Bunions: sounds like a similar issue then UnderwearApprentice: yeah might be UnderwearApprentice: you don't crash as host correct UnderwearApprentice: ? Bunions: nep Bunions: nope UnderwearApprentice: then this probably has to do with replicable components which is VERY complicated (for me at least) UnderwearApprentice: this is what DST does to pass and recieve data between host and client regarding components (health, sanity, etc) Bunions: do you mind if I post this convo on the forums as an addendum to my thread? UnderwearApprentice: sure I am active there sometimes Link to comment https://forums.kleientertainment.com/forums/topic/73682-help-fixing-a-mod-giving-a-nil-value-error/#findComment-862185 Share on other sites More sharing options...
Cunning fox Posted January 29, 2017 Share Posted January 29, 2017 There's allready exists realy cool mod with blood. http://steamcommunity.com/sharedfiles/filedetails/?id=377292520&searchtext=cannibalism 1 Link to comment https://forums.kleientertainment.com/forums/topic/73682-help-fixing-a-mod-giving-a-nil-value-error/#findComment-862220 Share on other sites More sharing options...
Bunions Posted January 29, 2017 Author Share Posted January 29, 2017 Thanks for the reply. Also thanks for pointing me to cannibalism, the mod seems more fleshed out than Injured. I still would want to make personal use changes (and spoke with Star a bit about that) but at least now I am not on a bug hunt. I still think using this all as a learning experience is good for me tho. I guess I could shift gears to the personal changes aspect and not worry about the bugs with injured for now until I understand certain things more. Just to satisfy a sense of rightness or job done. Link to comment https://forums.kleientertainment.com/forums/topic/73682-help-fixing-a-mod-giving-a-nil-value-error/#findComment-862232 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