DocterRedstone

  • Content Count

    20
  • Joined

  • Last visited

Community Reputation

2 Neutral

About DocterRedstone

  • Rank
    Junior Member
...

Recent Profile Visitors

211 profile views
  1. How exactly would I, for example, throw an item at wherever the cursor is inside a function? I'm trying to set up a way to throw an explosive I've modded, but only when wearing a specific hat, and pressing a key to throw it, since the hand slot takes up the normal throw key.
  2. I'm trying to make a hat that allows you to throw explosives with a keybind, since the mouse buttons are reserved for the hand slot. I currently have the code for an item that is a simple explosive you throw, but since it's a hand slot item it uses the normal mouse buttons. How can I make it throw projectiles with a keybind, like the R button? local kidpotion_assets = { Asset("ANIM", "anim/kidpotion.zip"), Asset("ANIM", "anim/swap_kidpotion.zip"), Asset("ATLAS", "images/inventoryimages/kidpotion.xml"), Asset("IMAGE", "images/inventoryimages/kidpotion.tex"), } local kidpotion_prefabs = { "explode_small", } local function DoExplode(self) print("DoExplode") local explosiverange = 5 local stacksize = self.inst.components.stackable ~= nil and self.inst.components.stackable:StackSize() or 1 local totaldamage = self.explosivedamage * stacksize local x, y, z = self.inst.Transform:GetWorldPosition() -- Players are off limits now local ents = TheSim:FindEntities(x, y, z, explosiverange, nil, { "INLIMBO", "player" }) for i, v in ipairs(ents) do if v ~= self.inst and v:IsValid() and not v:IsInLimbo() then if v.components.workable ~= nil and v.components.workable:CanBeWorked() then v.components.workable:WorkedBy(self.inst, self.buildingdamage) end --Find a way to get rid of this stuff, it's freaking useless since the potion doesn't set stuff on fire if v:IsValid() and not v:IsInLimbo() then if self.lightonexplode and v.components.fueled == nil and v.components.burnable ~= nil and not v.components.burnable:IsBurning() and not v:HasTag("burnt") then --v.components.burnable:Ignite() end if v.components.combat ~= nil then v.components.combat:GetAttacked(self.inst, totaldamage, nil) end v:PushEvent("explosion", { explosive = self.inst }) end end end end local function OnExplodeFn(inst) print("OnExplode") SpawnPrefab("explode_small").Transform:SetPosition(inst.Transform:GetWorldPosition()) DoExplode(inst.components.explosive) end local function OnHitWater(inst, attacker, target) print("OnHitWater") inst.components.explosive:OnBurnt() end local function common_fn(bank, build, anim, tag, isinventoryitem) print("common_fn") local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddSoundEmitter() inst.entity:AddNetwork() if isinventoryitem then MakeInventoryPhysics(inst) else inst.entity:AddPhysics() inst.Physics:SetMass(1) inst.Physics:SetCapsule(0.2, 0.2) inst.Physics:SetFriction(0) inst.Physics:SetDamping(0) inst.Physics:SetCollisionGroup(COLLISION.CHARACTERS) inst.Physics:ClearCollisionMask() inst.Physics:CollidesWith(COLLISION.WORLD) end if tag ~= nil then inst:AddTag(tag) end inst.AnimState:SetBank(bank) inst.AnimState:SetBuild(build) inst.AnimState:PlayAnimation(anim, true) inst.entity:SetPristine() if not TheWorld.ismastersim then return inst end inst:AddComponent("locomotor") inst:AddComponent("complexprojectile") return inst end local function onequip(inst, owner) print("OnEquip") owner.AnimState:OverrideSymbol("swap_object", "swap_kidpotion", "swap_kidpotion") owner.AnimState:Show("ARM_carry") owner.AnimState:Hide("ARM_normal") end local function onunequip(inst, owner) print("OnUnequip") owner.AnimState:Hide("ARM_carry") owner.AnimState:Show("ARM_normal") end local function onthrown(inst) print("OnThrown") inst:AddTag("NOCLICK") inst.persists = false inst.AnimState:PlayAnimation("spin_loop", true) inst.Physics:SetMass(1) inst.Physics:SetCapsule(0.2, 0.2) inst.Physics:SetFriction(0) inst.Physics:SetDamping(0) inst.Physics:SetCollisionGroup(COLLISION.CHARACTERS) inst.Physics:ClearCollisionMask() inst.Physics:CollidesWith(COLLISION.WORLD) inst.Physics:CollidesWith(COLLISION.OBSTACLES) inst.Physics:CollidesWith(COLLISION.ITEMS) end local function ReticuleTargetFn() print("ReticuleTargetFn") local player = ThePlayer local ground = TheWorld.Map local x, y, z --Attack range is 8, leave room for error --Min range was chosen to not hit yourself (2 is the hit range) for r = 6.5, 3.5, -.25 do x, y, z = player.entity:LocalToWorldSpace(r, 0, 0) if ground:IsPassableAtPoint(x, y, z) then return Vector3(x, y, z) end end return Vector3(x, y, z) end local function kidpotion_fn() print("kidpotion_fn") local inst = common_fn("kidpotion", "kidpotion", "idle", "projectile", true) inst:AddComponent("reticule") inst.components.reticule.targetfn = ReticuleTargetFn inst.components.reticule.ease = true if not TheWorld.ismastersim then return inst end inst:AddComponent("explosive") inst.components.explosive:SetOnExplodeFn(OnExplodeFn) inst.components.explosive.explosivedamage = 100 -- So explosion doesn't affect anything, including players inst.components.explosive.explosiverange = 0 inst.components.complexprojectile:SetHorizontalSpeed(15) inst.components.complexprojectile:SetGravity(-40) inst.components.complexprojectile:SetLaunchOffset(Vector3(.25, 1, 0)) inst.components.complexprojectile:SetOnLaunch(onthrown) inst.components.complexprojectile:SetOnHit(OnHitWater) inst:AddComponent("weapon") inst.components.weapon:SetDamage(0) inst.components.weapon:SetRange(8, 10) inst:AddComponent("inspectable") inst:AddComponent("inventoryitem") inst.components.inventoryitem.imagename = "kidpotion" inst.components.inventoryitem.atlasname = "images/inventoryimages/kidpotion.xml" inst:AddComponent("stackable") inst:AddComponent("equippable") inst.components.equippable:SetOnEquip(onequip) inst.components.equippable:SetOnUnequip(onunequip) inst.components.equippable.equipstack = true return inst end local testkey = "r" TheInput:AddKeyUpHandler( testkey:lower():byte(), function() print("R Button Test") end) STRINGS.NAMES.KIDPOTION = "Kid's Potion" STRINGS.CHARACTERS.GENERIC.DESCRIBE.KIDPOTION = "It might explode!" return Prefab("kidpotion", kidpotion_fn, kidpotion_assets, kidpotion_prefabs)
  3. Oh my god! Finally it works! You're a freaking lifesaver dude. What was the error out of curiosity?
  4. Here you go, individually and with the full mod. hatbrella2.lua swap_hatbrella2.zip hatbrella2.zip Full Mod.zip
  5. That's how it is normally, without the swap_ part in the build name, I just added it in case it worked. I've been trying to get this to work for days, JUST ONE TEXTURE.
  6. 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)
  7. 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.
  8. This is my current LUA file for my entity, I have no idea whats going wrong here, log isn't saying anything is missing and the only debug info I have is, like I said in my other post, INLIMBO. local assets = { Asset("ANIM", "anim/swap_hatbrella2.zip"), Asset("ANIM", "anim/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_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.HATBRELLA2_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)
  9. I tried that, no effect. I'm beginning to think something is wrong with the texture itself. I tried replacing it with a different texture and got it to load correctly.
  10. 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
  11. Thanks! This did simplify a different part of my workload but it seems my problem isn't with the animations, since my handheld items are still invisible.
  12. 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?
  13. How would I do that? I have no experience doing any work with mods, I changed the build in build.bin, but am I supposed to do something in anim.bin? If I am how would I do that?
  14. 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