KirblesOcto Posted September 10, 2021 Share Posted September 10, 2021 I am trying to make a weapon mod that doesn't damage other players but does damage mobs, is there a base mod I could work off of or where should I look? Link to comment https://forums.kleientertainment.com/forums/topic/133529-hello-i-am-needing-help-trying-to-make-a-weapon-mod/ Share on other sites More sharing options...
Monti18 Posted September 10, 2021 Share Posted September 10, 2021 This will make your weapon only damage mobs: --item prefab local function OnlyDamageMobs(inst,attacker,target) if target:HasTag("player") then return 0 else return 34 --replace with whatever damage you want end end --item fn() inst.components.weapon:SetDamage(OnlyDamageMobs) If you want to see another example of damage calculation, have a look at the trident.lua prefab from the base game, as this one also has a different damage depending on if you are on land or not. 2 Link to comment https://forums.kleientertainment.com/forums/topic/133529-hello-i-am-needing-help-trying-to-make-a-weapon-mod/#findComment-1493677 Share on other sites More sharing options...
KirblesOcto Posted September 10, 2021 Author Share Posted September 10, 2021 24 minutes ago, Monti18 said: This will make your weapon only damage mobs: --item prefab local function OnlyDamageMobs(inst,attacker,target) if target:HasTag("player") then return 0 else return 34 --replace with whatever damage you want end end --item fn() inst.components.weapon:SetDamage(OnlyDamageMobs) If you want to see another example of damage calculation, have a look at the trident.lua prefab from the base game, as this one also has a different damage depending on if you are on land or not. Thank you! Link to comment https://forums.kleientertainment.com/forums/topic/133529-hello-i-am-needing-help-trying-to-make-a-weapon-mod/#findComment-1493683 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