icantevenname Posted August 22, 2019 Share Posted August 22, 2019 Is it possible to have a character to throw birds that are in their inventory as a perk? Link to comment Share on other sites More sharing options...
Thomas Die Posted August 23, 2019 Share Posted August 23, 2019 (edited) Yeah you must alter the code to change into a weapon on pickup and change when dropped tho inst.components.inventoryitem:SetOnDroppedFn(dropped) inst.components.inventoryitem:SetOnPickupFn(get) inst.components.inventoryitem:SetOnPutInInventoryFn(get) local function get(inst) --------------------------- this gives the item the equipable if inst.components.equippable == nil then inst:AddComponent("equippable") inst.components.equippable:SetOnEquip(onequip) inst.components.equippable:SetOnUnequip(onunequip) end end local function lost(inst) ------------------------- this removes the equipable if inst.components.equippable ~= nil then inst:RemoveComponent("equippable") end end local function get(inst, owner) -------------------------makes / recognises if tt should be equipable or not if owner ~= nil then if owner.prefab == "character" then get(inst) else inst:DoTaskInTime(0, lost) end end end local function dropped(inst) ----------------------------this removes the equipable when dropped so it's character specific inst:DoTaskInTime(0, lost) end this is some basic bare bones code for it Edited August 25, 2019 by thomas4845 Link to comment Share on other sites More sharing options...
icantevenname Posted August 25, 2019 Author Share Posted August 25, 2019 (edited) Good thing the birds all share the same file. Though I want it to be a character-specific thing. Isn't there a "if player is character" thing to go under local function get, next to if inst.components.equippable == nil? Unless I interpreted the info wrong and have to put it in the character's LUA instead of the birds'? Edited August 25, 2019 by icantevenname Had a thought. Link to comment Share on other sites More sharing options...
Thomas Die Posted August 25, 2019 Share Posted August 25, 2019 if owner.prefab == "character" then this bit of code makes it so that it only become equitable if the character picks it up the only problems that should be recognized is that you need to change the anim to suit the bird when you equip the item if you need any more help i'll try my best Link to comment Share on other sites More sharing options...
icantevenname Posted September 6, 2019 Author Share Posted September 6, 2019 (edited) Haven't had the chance to work on this mod, but I've had some thoughts. Would it be better for the birds to die when hitting the target, or have them stunned? And how about they have elemental effects? (Crow = Just damage, Robin = Fire + Less Damage, Winter Robin = Ice + Less Damage, Canary = Electric + Less Damage, Puffin = Water + Less Damage) Would that be too much? Edited September 6, 2019 by icantevenname Had another thought. Link to comment Share on other sites More sharing options...
icantevenname Posted September 6, 2019 Author Share Posted September 6, 2019 It doesn't seem to work, am I doing something wrong? Or is it because I'm getting the birds from traps? Link to comment Share on other sites More sharing options...
Thomas Die Posted September 6, 2019 Share Posted September 6, 2019 it might be because the option to murder overrides the option to use maybe remove the option to murder or try to move the bird maually to equip slot Link to comment Share on other sites More sharing options...
icantevenname Posted September 7, 2019 Author Share Posted September 7, 2019 Manual equipping ain't working. Might as well try to remove the Murder option. Link to comment Share on other sites More sharing options...
Thomas Die Posted September 7, 2019 Share Posted September 7, 2019 i know this is random but i'm taking a break from the forums to play banjo kazzoie for a while any replies i'll try to help but i'mm mainly be off Link to comment Share on other sites More sharing options...
icantevenname Posted September 9, 2019 Author Share Posted September 9, 2019 I've been using Wilbur's poop file from SW as a reference. I've given Sky the ability to throw (currently invisible) birds. But there's two problems I can't figure out. The birds fly to the NW if the target isn't close enough or in the way. Also, if I load a game with birds in Sky's inventory, I get this error: [string "../mods/Sky/scripts/prefabs/birds.lua"]:449: attempt to index a nil value LUA ERROR stack traceback: ../mods/Sky/scripts/prefabs/birds.lua:449 in (field) fn (Lua) <285-454> scripts/mainfunctions.lua:258 in () ? (Lua) <247-289> =[C]:-1 in (method) SpawnPrefab (C) <-1--1> scripts/mainfunctions.lua:306 in () ? (Lua) <300-308> =(tail call):-1 in () (tail) <-1--1> scripts/mainfunctions.lua:312 in (global) SpawnSaveRecord (Lua) <310-352> scripts/gamelogic.lua:553 in (upvalue) PopulateWorld (Lua) <325-587> scripts/gamelogic.lua:803 in (upvalue) DoInitGame (Lua) <686-882> scripts/gamelogic.lua:916 in (local) cb (Lua) <910-917> scripts/saveindex.lua:312 in (upvalue) OnLoadSaveDataFile (Lua) <294-313> scripts/saveindex.lua:327 in () ? (Lua) <326-328> =[C]:-1 in (method) GetPersistentStringInClusterSlot (C) <-1--1> Link to comment 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