skittles sour Posted January 11, 2022 Share Posted January 11, 2022 I'm trying to make giant vegetables throwable, and I copied several functions from the waterbaloon prefab to test it out, however, when I equip one, the "toss" option doesn't appear. I think it has to do with the giant vege being a heavy item, but I checked the component actions for complexprojectiles and it seems that it shouldn't matter and that all the checks should go through... Does anyone have any clue why? AddPrefabPostInitAny(function(inst) if not inst:HasTag"oversized_veggie" or not inst:HasTag"waxable" then return end inst:AddComponent"reticule" inst.components.reticule.targetfn = ReticuleTargetFn inst.components.reticule.ease = true if not GLOBAL.TheWorld.ismastersim then return end inst:AddComponent"complexprojectile" inst.components.complexprojectile:SetHorizontalSpeed(15) inst.components.complexprojectile:SetGravity(-35) inst.components.complexprojectile:SetLaunchOffset(GLOBAL.Vector3(.25, 1, 0)) -- inst.components.complexprojectile:SetOnLaunch(onthrown) inst.components.complexprojectile:SetOnHit(OnHitWater) end) Link to comment Share on other sites More sharing options...
Wonderlarr Posted January 11, 2022 Share Posted January 11, 2022 I believe it has to do with it not using the hand slot as it's equip slot, it equips into the body slot, and throwables should always be in the hand slot. Link to comment Share on other sites More sharing options...
Leonidas IV Posted January 11, 2022 Share Posted January 11, 2022 The throw action maybe be related to the hand slot? Try taking a look at the actions. Although I believe you have already done so Link to comment Share on other sites More sharing options...
Monti18 Posted January 12, 2022 Share Posted January 12, 2022 @TheSkylarr is correct, EQUIPPED component actions are only called from the hand slot. Spoiler function PlayerActionPicker:GetLeftClickActions(position, target) ---- local equipitem = self.inst.replica.inventory:GetEquippedItem(EQUIPSLOTS.HANDS) ---- elseif equipitem ~= nil and equipitem:IsValid() then actions = self:GetEquippedItemActions(target, equipitem) end As you can see, it checks for the equipped item in the handslot. You can either set the equipslot of the veggies to the handslot or you hook the PlayerActionPicker:GetLeftClickActions function and add the case of an equipped veggy. 2 Link to comment Share on other sites More sharing options...
Leonidas IV Posted January 13, 2022 Share Posted January 13, 2022 On 1/12/2022 at 4:26 AM, Monti18 said: @TheSkylarr is correct, EQUIPPED component actions are only called from the hand slot. I'm impressed with your effort to help 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