FlawlessHair Posted March 9, 2016 Share Posted March 9, 2016 (edited) Hey. (I have created a few question-topics today. I hope that's ok). I'm working on making the blowdart into just the tube, which requires ammo to be used. I imagine it is going to be like this: - On attack > If has ammo > do attack else do nothing Problem is that I've been looking through the blowdart.lua file for a while now and I haven't been able to find the thing that removes it on use. Do you know what makes it finite use, and how I could change it into infinite uses? EDIT: Making progress. Removing all references to the "projectile" component makes it so the blowdart is not destroyed on use. So now I know where to look. Next question is: How do I check the player, holding the blowdart,'s inventory for an item? EDIT2: I have created the following script local function pipeattack(inst, attacker, target) if not target:IsValid() then --target killed or removed in combat damage phase return end if GetPlayer().components.inventory:Has("stinger", 1) then if target.components.combat then inst.components.weapon:SetDamage(TUNING.PIPE_DART_DAMAGE) target.components.combat:SuggestTarget(attacker) GetPlayer().components.inventory:RemoveItem("stinger", false) end else inst.components.weapon:SetDamage(0) print("No ammo") end end However, the console says I shouldn't use GetPlayer(). Instead I should use ThePlayer. When I use ThePlayer it doesn't let me attack any creature at all. When I use GetPlayer() it crashes, saying something went wrong in inventory.lua The error it gives me is: "848: attempt to index field 'components' (a nil value)". I'm not sure what it means but it seems like it found an item that isn't nil and wants to do something with it. Not sure what I can do to prevent this crash. I am probably doing something wrong with the RemoveItem function. EDIT3: I have solved the whole thing. I am using fueled.lua to give the blowdart stingers as ammo. Edited March 9, 2016 by FlawlessHair Link to comment https://forums.kleientertainment.com/forums/topic/65250-solved-custom-blowdart-weapon-infinite-uses/ Share on other sites More sharing options...
Soto8969 Posted March 9, 2016 Share Posted March 9, 2016 i dont really know about modding, but i thing the speargun from Shipwreck is a good model for your idea. Link to comment https://forums.kleientertainment.com/forums/topic/65250-solved-custom-blowdart-weapon-infinite-uses/#findComment-731510 Share on other sites More sharing options...
FlawlessHair Posted March 9, 2016 Author Share Posted March 9, 2016 3 minutes ago, Soto8969 said: i dont really know about modding, but i thing the speargun from Shipwreck is a good model for your idea. Ah, I don't have that DLC :/ However, I'm mostly interested in knowing what makes the blowdart prefab a finite-use prefab. Link to comment https://forums.kleientertainment.com/forums/topic/65250-solved-custom-blowdart-weapon-infinite-uses/#findComment-731515 Share on other sites More sharing options...
Soto8969 Posted March 9, 2016 Share Posted March 9, 2016 It doesn't have infinite uses, you just load the gun with a spear and then shot, lowering the spear's durability and the speargun. Link to comment https://forums.kleientertainment.com/forums/topic/65250-solved-custom-blowdart-weapon-infinite-uses/#findComment-731542 Share on other sites More sharing options...
FlawlessHair Posted March 9, 2016 Author Share Posted March 9, 2016 19 minutes ago, Soto8969 said: It doesn't have infinite uses, you just load the gun with a spear and then shot, lowering the spear's durability and the speargun. Interesting! Yet, not quite what I'm going for. Still interesting. Link to comment https://forums.kleientertainment.com/forums/topic/65250-solved-custom-blowdart-weapon-infinite-uses/#findComment-731557 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