dinhkarate Posted April 3, 2022 Share Posted April 3, 2022 (edited) swap_redlantern.zip This file isn't have the anim.bin so I can't using Krane in Ktool to convert it into .scml file to using like a template. Also, I wonder how I can make the swap_animation for my custom item. I use swap_redlantern as a template to do this because it have animation ingame like this And I also create a lantern like this. Thank for reading! Edited April 8, 2022 by dinhkarate 1 Link to comment https://forums.kleientertainment.com/forums/topic/138840-solved-help-with-krane-isnt-have-animbin/ Share on other sites More sharing options...
Monti18 Posted April 4, 2022 Share Posted April 4, 2022 This is a very good template for making your own swap_animations. The reason why swap_redlantern doesn't have an anim is because it doesn't need one. When equipping a weapon, the swap_object symbol is overwritten with the picture of the item. For this to work, only a picture is needed and not an animation file. That's why only atlas and build.bin are needed, as atlas has the texture and build.bin tells the game the folder structure of the file. You can use any other anim file to decompile it with krane so that you can still see the files and the structure of the folders. I attached the decompiled zip swap_redlantern.zip 1 Link to comment https://forums.kleientertainment.com/forums/topic/138840-solved-help-with-krane-isnt-have-animbin/#findComment-1555209 Share on other sites More sharing options...
dinhkarate Posted April 7, 2022 Author Share Posted April 7, 2022 (edited) Thank @Monti18 for replying me! Yes, I've just know this. The redlantern only overides the swap_object to swap_redlantern_stick. Yeah only a stick. But the way it have animation in game that because it uses _body which in red lantern.scml (but I'm not sure about that, can you confirm it?). And mark it to follow symbol "swap_redlantern_stick". But I want to make a custom weapon when I equip it, it gonna like the picture. I think my hope still there. I wonder what is "_light", "_body" and "_lantern" (also the other _abcxyz) meaning. Because when I tried to replace these code into my mod. It gonna say "_light" or "_body" or "_lantern" is a nil value. local function turnon(inst) if not inst.components.fueled:IsEmpty() then inst.components.fueled:StartConsuming() if inst._light == nil then inst._light = SpawnPrefab("redlanternlight") inst._light._lantern = inst inst:ListenForEvent("onremove", onremovelight, inst._light) end inst._light.entity:SetParent((inst.components.inventoryitem.owner or inst._body or inst).entity) inst.AnimState:Show("LIGHT") if inst._body ~= nil then inst._body.AnimState:Show("LIGHT") end if not (inst._body ~= nil and inst._body.entity:IsVisible()) and inst.components.equippable:IsEquipped() and inst.components.inventoryitem.owner ~= nil then inst.components.inventoryitem.owner.AnimState:Show("LANTERN_OVERLAY") end inst.components.inventoryitem:ChangeImageName("redlantern_lit") end end local function turnoff(inst) stoptrackingowner(inst) inst.components.fueled:StopConsuming() if inst._light ~= nil then inst._light:Remove() end inst.AnimState:Hide("LIGHT") if inst._body ~= nil then inst._body.AnimState:Hide("LIGHT") end if inst.components.equippable:IsEquipped() then inst.components.inventoryitem.owner.AnimState:Hide("LANTERN_OVERLAY") end inst.components.inventoryitem:ChangeImageName("redlantern") end local function OnRemove(inst) if inst._light ~= nil then inst._light:Remove() end if inst._body ~= nil then inst._body:Remove() end end Edited April 7, 2022 by dinhkarate Link to comment https://forums.kleientertainment.com/forums/topic/138840-solved-help-with-krane-isnt-have-animbin/#findComment-1555942 Share on other sites More sharing options...
Monti18 Posted April 8, 2022 Share Posted April 8, 2022 inst._light,inst._body and inst._body._lantern are just variables that were saved. You can see them defined in the onequip function of redlantern.lua. inst._body = SpawnPrefab("redlanternbody") inst._body._lantern = inst inst._light is defined in the turnon function. If you want to use this code, you will need to define them in your code like they are defined there. It's probably better for you to start from an exact copy of the file and then change the pictures to those of your item and then do some fine tuning. Link to comment https://forums.kleientertainment.com/forums/topic/138840-solved-help-with-krane-isnt-have-animbin/#findComment-1556035 Share on other sites More sharing options...
dinhkarate Posted April 8, 2022 Author Share Posted April 8, 2022 (edited) Thank you a lot! I belike *facepalm* when I notice the _abcxyz is define before. As always I only understand a variable when it have local abc = xyz end I've just thought about the past, when I have this problem with _abcxyz. Now I understand it but... the file, the dream have gone thank you a lot!!!!!! thank you a lot!!!!!! thank you a lot!!!!!! The important thing needs to repeat 3 times Edited April 8, 2022 by dinhkarate 1 Link to comment https://forums.kleientertainment.com/forums/topic/138840-solved-help-with-krane-isnt-have-animbin/#findComment-1556085 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