Screamingspider Posted June 5, 2018 Share Posted June 5, 2018 I'm quite new to coding and I was wondering if anyone can help me, I want my mod to work the same way as how a frog works. When in battle with another player they drop the items similar to what a frog does, if anyone can help me with this, it'll be very much appreciated. Thank you! Link to comment Share on other sites More sharing options...
Wolf_EX Posted June 6, 2018 Share Posted June 6, 2018 (edited) if you go to data/databundles unzip script.zip and you can view all the prefabs to see how they work. quick glance at frog.lua shows inst:AddComponent("thief") inst.components.combat.onhitotherfn = OnHitOther local function OnHitOther(inst, other, damage) inst.components.thief:StealItem(other) end I never done it before but I would imagine you add that to player_common.lua if you want a weapon that does it you would probably use inst:AddComponent("thief") inst.components.weapon:SetOnAttack(OnAttack) local function OnAttack(inst, owner, target) inst.components.thief:StealItem(target) end Edited June 6, 2018 by Wolf_EX Link to comment Share on other sites More sharing options...
Screamingspider Posted June 7, 2018 Author Share Posted June 7, 2018 On 06/06/2018 at 5:49 AM, Wolf_EX said: if you go to data/databundles unzip script.zip and you can view all the prefabs to see how they work. quick glance at frog.lua shows inst:AddComponent("thief") inst.components.combat.onhitotherfn = OnHitOther local function OnHitOther(inst, other, damage) inst.components.thief:StealItem(other) end I never done it before but I would imagine you add that to player_common.lua if you want a weapon that does it you would probably use inst:AddComponent("thief") inst.components.weapon:SetOnAttack(OnAttack) local function OnAttack(inst, owner, target) inst.components.thief:StealItem(target) end Hello, it didn't work unfortunately 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