halfrose Posted September 9, 2015 Share Posted September 9, 2015 While looking through the whole 'starting items' thing in the prefabs, and it raised a question; If one were to make a character with a starting item, and you wanted to, in case the character resurrects from any resurrection item (amulet, effigy, touchstone) to have the items back by re-spawning the items into the inventory without console commands. How possible and how difficult would it be to make that? Link to comment https://forums.kleientertainment.com/forums/topic/57748-make-the-character-resurrect-with-their-custom-items/ Share on other sites More sharing options...
UnionGaming Posted September 9, 2015 Share Posted September 9, 2015 Well, Lucy the axe teleports into your hands without an issue, it's not hard to do I guess. Link to comment https://forums.kleientertainment.com/forums/topic/57748-make-the-character-resurrect-with-their-custom-items/#findComment-671051 Share on other sites More sharing options...
halfrose Posted September 9, 2015 Author Share Posted September 9, 2015 Well, Lucy the axe teleports into your hands without an issue, it's not hard to do I guess. ...Ok, now I really need to test this, because I never happened to die and revive through an effigy or anything with Woodie, infact, I never died as Woodie at all, so I had no idea the ax respawns in the hands of the player....Time to go open Woodie and Lucy's lua file then! Link to comment https://forums.kleientertainment.com/forums/topic/57748-make-the-character-resurrect-with-their-custom-items/#findComment-671060 Share on other sites More sharing options...
NecroAnbu Posted September 9, 2015 Share Posted September 9, 2015 I had the same Idea to have a weapon the respawn your self when you died. The thing that you can't have the item stay in the inventory because it won't drop when you die. but if your respawning any way there is no need. so here is the code I use. MakeHauntableLaunch(inst) inst:AddComponent("hauntable") inst.components.hauntable:SetHauntValue(TUNING.HAUNT_INSTANT_REZ) Link to comment https://forums.kleientertainment.com/forums/topic/57748-make-the-character-resurrect-with-their-custom-items/#findComment-671067 Share on other sites More sharing options...
halfrose Posted September 10, 2015 Author Share Posted September 10, 2015 I had the same Idea to have a weapon the respawn your self when you died. The thing that you can't have the item stay in the inventory because it won't drop when you die. but if your respawning any way there is no need. so here is the code I use. MakeHauntableLaunch(inst) inst:AddComponent("hauntable") inst.components.hauntable:SetHauntValue(TUNING.HAUNT_INSTANT_REZ) This code would go for the character prefab or the object prefab?(I am assuming it is the character prefab or the modmain.lua) Link to comment https://forums.kleientertainment.com/forums/topic/57748-make-the-character-resurrect-with-their-custom-items/#findComment-671075 Share on other sites More sharing options...
NecroAnbu Posted September 10, 2015 Share Posted September 10, 2015 Its for an object prefab. I used it on my custom sword and it works fine. Link to comment https://forums.kleientertainment.com/forums/topic/57748-make-the-character-resurrect-with-their-custom-items/#findComment-671079 Share on other sites More sharing options...
halfrose Posted September 10, 2015 Author Share Posted September 10, 2015 Its for an object prefab. I used it on my custom sword and it works fine. I actually just attempted to use this to see if it works, it is just leading me to crashes with the game telling me the MakeHauntableLaunch(inst)is not being speficiedare you sure you just added that and nothing else like the ' local function' or Postinit or the definition of the inst in it? Link to comment https://forums.kleientertainment.com/forums/topic/57748-make-the-character-resurrect-with-their-custom-items/#findComment-671089 Share on other sites More sharing options...
NecroAnbu Posted September 10, 2015 Share Posted September 10, 2015 Here is the prefab for my sword. I am not very good at scripting but I put it together from the "Law" character mod. local assets={ Asset("ANIM", "anim/necroanbusword.zip"), Asset("ANIM", "anim/swap_necroanbusword.zip"), Asset("ATLAS", "images/inventoryimages/necroanbusword.xml"), Asset("IMAGE", "images/inventoryimages/necroanbusword.tex"),}local prefabs ={}local function fn(colour) local function OnEquip(inst, owner) --owner.AnimState:OverrideSymbol("swap_object", "swap_necroanbuswords", "purplestaff") owner.AnimState:OverrideSymbol("swap_object", "swap_necroanbusword", "necroanbusword") 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 inst = CreateEntity() local trans = inst.entity:AddTransform() local anim = inst.entity:AddAnimState() MakeInventoryPhysics(inst) anim:SetBank("necroanbusword") anim:SetBuild("necroanbusword") anim:PlayAnimation("idle") inst:AddComponent("inventoryitem") inst.components.inventoryitem.imagename = "necroanbusword" inst.components.inventoryitem.atlasname = "images/inventoryimages/necroanbusword.xml" inst:AddComponent("equippable") inst.components.equippable:SetOnEquip( OnEquip ) inst.components.equippable:SetOnUnequip( OnUnequip ) inst:AddComponent("weapon") inst.components.weapon:SetDamage(50) inst:AddComponent("tool") inst.components.tool:SetAction(ACTIONS.CHOP, 15) inst.components.tool:SetAction(ACTIONS.MINE, 15) MakeHauntableLaunch(inst) inst:AddComponent("hauntable") inst.components.hauntable:SetHauntValue(TUNING.HAUNT_INSTANT_REZ) return instendreturn Prefab("common/inventory/necroanbusword", fn, assets, prefabs) Link to comment https://forums.kleientertainment.com/forums/topic/57748-make-the-character-resurrect-with-their-custom-items/#findComment-671094 Share on other sites More sharing options...
NecroAnbu Posted September 10, 2015 Share Posted September 10, 2015 Also don't know if it makes a difference but I tested it with DST and it work fine. So i am not sure if it works with DS Link to comment https://forums.kleientertainment.com/forums/topic/57748-make-the-character-resurrect-with-their-custom-items/#findComment-671095 Share on other sites More sharing options...
halfrose Posted September 10, 2015 Author Share Posted September 10, 2015 Also don't know if it makes a difference but I tested it with DST and it work fine. So i am not sure if it works with DS Yeah I guess it is indeed just a DST thing, seeing that I placed just exactly as you did, and it made me crash on DS. but it was at least worth the try, I actually found a mod from another user that actually has a coding that seems to do what I questioned, now I just need to make it work with a few changes. Link to comment https://forums.kleientertainment.com/forums/topic/57748-make-the-character-resurrect-with-their-custom-items/#findComment-671138 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