Search the Community
Showing results for tags 'answered'.
-
Edit: Special thanks to krylincy and Monti18 for their help. I've been trying to mod the guts the black swordsman mod (https://steamcommunity.com/sharedfiles/filedetails/?id=2285521612) and I wanted to make it so that when it's nighttime he gets attacked by monsters. I've been trying different pieces of code but none have worked, here's my latest try. What am I doing wrong? GLOBAL.require master_postinit = function(inst:WatchWorldState("isnight", SetInducedInsanity)) local function brandattraction(inst) if Theworld.state.isnight then inst.components.sanity:SetInducedInsanity(inst, true) end end end
-
In my mod I require the ability for players to create and link wormholes. I've got it working fine, but players can also destroy wormholes that were player-built. The problem is, a player can link a wormhole that's been destroyed to an existing one. If someone jumps in, it crashes the game because the wormhole no longer exists. However, when I check that the prefab is not equal to nil, it always comes back true even if it has been deleted. I tried getting the prefab of an object that's already been deleted, and it returns the correct prefab. How can I check if something exists? I'd have thought its values in memory would be manually deleted by the game engine, but it seems they're left for garbage collection, which won't remove them since I still have references to that object in my mod that aren't components of the prefab and therefore don't get automatically deleted when the wormhole does. Is there a method that returns whether a prefab exists or not?
-
I have a mod with a command that takes alphanumeric arguments. The command does different things depending on whether it was given a number or a letter string. What I'd like to know is how to convert (or try to convert) a string to a number so I can do this. I'd really like to not have two separate commands, but when i tried tonumber (a supposed Lua standard function) it crashed saying tonumber is a nil value. which I found extremely odd. Any help is much appreciated.
-
I tried using the following code: inst.components.inventory:GiveItem("boards",3) But it tells me that components is a nil value, even though I know inst is a reference to a player. The same syntax is used in the consolecommands.lua file to give the player an item with the c_give command. Anybody know what I'm doing wrong?
-
I want to use the following code to get entities near each player: AddPlayerPostInit(function(inst) inst:DoPeriodicTask(1.0, function(inst) local pp = inst.Transform:GetWorldPosition() local ents = GLOBAL.TheSim:FindEntities(pp.x, pp.y, pp.z, 100) end) end) However it crashes my game with the following error: [string *../mods/MyMod/modmain.lua"]:25: attempt to index local 'pp' (a number value) LUA ERROR stack traceback: ../mods/MyMod/modmain.lua:25 in (field) fn (Lua) <23-26> scripts/scheduler.lua:177 in (method) OnTick (Lua) <155-207> scripts/scheduler.lua:371 in (global) RunScheduler (Lua) <369-377> scripts/update.lua:185 in () ? (Lua) <164-243> Any idea what I'm doing wrong? I'm brand new to modding DST so I don't know if I have a syntax error or what.
-
answered Item tutorial suggestions?
TheSkylarr posted a topic in [Don't Starve Together] Mods and Tools
I've been stumped over the same texture issue for a while now, so I figured I should start from the beginning and redo the whole item. Since I've only been copy pasting code I would like a suggestion on where the best item tutorial is, so I can start from scratch and do it well. -
TL;DR at bottom Hello all, I've recently gotten into modding DST and have hit a little bit of a roadblock today. I downloaded a mod from the Steam Workshop, and after playing with it thought it was a bit overpowered, so I took to Notepad++ and began changing some damage, durability, etc. values around, and since I wanted to play with friends I uploaded my own version to the Workshop. Changing damage values is all good and fun, but from there I wanted to start adding some items, and through trial and error was able to add a second version of an item into the mod that used the same texture as a different item, but had different stats and materials needed to craft it. Now that I had this new item, I wanted to give it a unique texture, so I made one and did my best to put it where I thought was appropriate, using TEXtool and TEXcreator where needed, but this is where I hit the roadblock I mentioned earlier. I was able to get the item to show up in my inventory correctly, but when handheld and dropped on the ground it went invisible. After hours of big brain activity in my head I've decided to make a post on here, asking the best way to approach this situation. From what I can tell from a different post, the problem is part of the animation of the item. TL;DR: Downloaded a mod from the workshop, script kiddie edited it to death till I got problems, animation issues are blocking me from continuing. I have no access to the original project files, I was barely able to even get permission to take the original mod and edit it, and based on the grumpy response from the original mod's OP, I really don't know if I'll be talking to him again. Download my Broken Mod in the download link on the right side 2.0.2.zip To be clear, I'm trying to fix in the invisible item problems, specifical with hatbrella2 and hatbrella3
-
I've been trying to create a custom item based on the umbrella from the game A Hat in Time for days now, but I've been hitting the same problem every time I try to work on it. The texture of the item, no matter if I use a texture from the game itself, or a custom texture I supply, is invisible, I'm assuming this a script problem, but I have no idea what could be causing it. Here's my script. local assets = { Asset("ANIM", "anim/hatbrella2.zip"), Asset("ANIM", "anim/swap_hatbrella2.zip"), Asset("ATLAS", "images/inventoryimages/hatbrella2.xml"), Asset("IMAGE", "images/inventoryimages/hatbrella2.tex"), } local function OnEquip(inst, owner) --owner.AnimState:OverrideSymbol("swap_object", "swap_wands", "purplestaff") owner.AnimState:OverrideSymbol("swap_object", "swap_hatbrella2", "swap_hatbrella2") owner.AnimState:Show("ARM_carry") owner.AnimState:Hide("ARM_normal") end local function OnUnequip(inst, owner) owner.AnimState:Hide("ARM_carry") owner.AnimState:Show("ARM_normal") end local function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddNetwork() inst.entity:AddMiniMapEntity() MakeInventoryPhysics(inst) inst.AnimState:SetBank("hatbrella2") inst.AnimState:SetBuild("swap_hatbrella2") inst.AnimState:PlayAnimation("idle") inst:AddTag("sharp") inst:AddTag("waterproofer") inst:AddComponent("waterproofer") inst.components.waterproofer:SetEffectiveness(TUNING.WATERPROOFNESS_HUGE) inst:AddComponent("insulator") inst.components.insulator:SetSummer() inst.components.insulator:SetInsulation(TUNING.INSULATION_MED) if not TheWorld.ismastersim then return inst end inst.entity:SetPristine() inst:AddComponent("weapon") inst.components.weapon:SetDamage(TUNING.HATBRELLA_DAMAGE) inst:AddComponent("inspectable") inst:AddComponent("inventoryitem") inst.components.inventoryitem.imagename = "hatbrella2" inst.components.inventoryitem.atlasname = "images/inventoryimages/hatbrella2.xml" inst:AddComponent("equippable") inst.components.equippable:SetOnEquip( OnEquip ) inst.components.equippable:SetOnUnequip( OnUnequip ) MakeHauntableLaunch(inst) return inst end return Prefab("common/inventory/hatbrella2", fn, assets)
-
Add( resource )I'm new to the modding scene here, and I have so many questions. One of my most burning questions right now is weather or not I can use the animations on one item for another item? For example, we have an item called hatbrella that has animations done already, and we have another item called hatbrella2 that doesn't have animations specifically for it, could I use the animations from hatbrella on hatbrella2 if hatbrella2 is just a recolor of hatbrella?
-
I've been posting on here for the past 2 days trying to figure out what my problem is and I still can't, but I think I may have an idea. After following the Extended Sample Character Template tutorial, I got far making my character, until I wanted to add my own custom item, which is just an upgraded Tentacle Spike. I started off just using the texture of a tentacle spike and I got the item fully functional, but as soon as I switched to a custom texture I couldn't get it to show up at all in my hand. It looked like this. The red umbrella item is the problem item, and I have NO IDEA where to even try to find out what's wrong. The debug menu shows something weird, that the item is tagged as INLIMBO, which I can tell you I didn't set in the script. Any help here would be appreciated. Full mod download link, and problem texture link is below. The problem item is hatbrella2. Full Mod.zip swap_hatbrella2.zip
-
I've been modding for about 3 days now, I'm not great but I have successfully done number changes and made items using textures that are already in the game as a test, but as soon as I try to use my own custom textures everything seems to break. I've confirmed my models work properly in the game, I just don't know how to use them. Right now, this script makes the item show up in my inventory, but it's invisible when held in my hands. local assets = { Asset("ANIM", "anim/hatbrella2.zip"), Asset("ANIM", "anim/swap_hatbrella2.zip"), Asset("ATLAS", "images/inventoryimages/hatbrella2.xml"), Asset("IMAGE", "images/inventoryimages/hatbrella2.tex"), } local function OnEquip(inst, owner) --owner.AnimState:OverrideSymbol("swap_object", "swap_wands", "purplestaff") owner.AnimState:OverrideSymbol("swap_object", "swap_hatbrella2", "hatbrella2") owner.AnimState:Show("ARM_carry") owner.AnimState:Hide("ARM_normal") end local function OnUnequip(inst, owner) owner.AnimState:Hide("ARM_carry") owner.AnimState:Show("ARM_normal") end local function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddNetwork() inst.entity:AddMiniMapEntity() MakeInventoryPhysics(inst) inst.AnimState:SetBank("hatbrella2") inst.AnimState:SetBuild("hatbrella2") inst.AnimState:PlayAnimation("idle") inst:AddTag("sharp") inst:AddTag("waterproofer") inst:AddComponent("waterproofer") inst.components.waterproofer:SetEffectiveness(TUNING.WATERPROOFNESS_HUGE) inst:AddComponent("insulator") inst.components.insulator:SetSummer() inst.components.insulator:SetInsulation(TUNING.INSULATION_MED) if not TheWorld.ismastersim then return inst end inst.entity:SetPristine() inst:AddComponent("weapon") inst.components.weapon:SetDamage(TUNING.HATBRELLA_DAMAGE) inst:AddComponent("inspectable") inst:AddComponent("inventoryitem") inst.components.inventoryitem.imagename = "hatbrella2" inst.components.inventoryitem.atlasname = "images/inventoryimages/hatbrella2.xml" inst:AddComponent("equippable") inst.components.equippable:SetOnEquip( OnEquip ) inst.components.equippable:SetOnUnequip( OnUnequip ) MakeHauntableLaunch(inst) return inst end return Prefab("common/inventory/hatbrella2", fn, assets)