Augustusc Posted June 15, 2017 Share Posted June 15, 2017 Im looking for help in making a few instruments. All of these are based off the code of an already existing item (which will be stated in the instruments in question) A battle horn (based on beefalo horn) that gives any player that hears it a +50% attack bonus for 30 seconds An improved battle horn (based on the beefalo horn) that gives the player +100% attack bonus AND a health regen for 30 seconds A grasswhistle (based on the pan flute) that gives any player that hear it 5 sanity, and the user 5 sanity for every creature that heard it Thanks in advance! Link to comment Share on other sites More sharing options...
Lumina Posted June 15, 2017 Share Posted June 15, 2017 You could probably take a look to the jellybean for an example for a regen function. Good luck. Link to comment Share on other sites More sharing options...
Augustusc Posted June 16, 2017 Author Share Posted June 16, 2017 bump? Link to comment Share on other sites More sharing options...
alainmcd Posted June 16, 2017 Share Posted June 16, 2017 (edited) On 6/15/2017 at 2:12 PM, Augustusc said: A battle horn (based on beefalo horn) that gives any player that hears it a +50% attack bonus for 30 seconds TUNING.BATTLEHORN_BUFF_DURATION = 30 TUNING.BATTLEHORN_BUFF_MULT = 5 local function HearBattleHorn(inst, musician, instrument) if inst:HasTag("player") and not inst:HasTag("playerghost") then if inst.debuffbattlehorntask ~= nil then inst.debuffbattlehorntask:Cancel() inst.debuffbattlehorntask = nil else local mult = inst.components.combat.damagemultiplier or 1 inst.components.combat.damagemultiplier = mult * TUNING.BATTLEHORN_BUFF_MULT end inst.debuffbattlehorntask = inst:DoTaskInTime(TUNING.BATTLEHORN_BUFF_DURATION, function(inst) inst.debuffbattlehorntask = nil inst.components.combat.damagemultiplier = inst.components.combat.damagemultiplier / TUNING.BATTLEHORN_BUFF_MULT end) end end On 6/15/2017 at 2:12 PM, Augustusc said: A grasswhistle (based on the pan flute) that gives any player that hear it 5 sanity, and the user 5 sanity for every creature that heard it local function HearGrassWhistle(inst, musician, instrument) if inst ~= musician then if inst:HasTag("player") and not inst:HasTag("playerghost") then inst.components.sanity:DoDelta(TUNING.SANITY_TINY) elseif inst:HasTag("creature") then musician.components.sanity:DoDelta(TUNING.SANITY_TINY) end end end Untested. The other instrument should be fairly similar. Edited June 16, 2017 by alainmcd inst.debuffbattlehorntask:Cancel() Link to comment Share on other sites More sharing options...
Lumina Posted June 16, 2017 Share Posted June 16, 2017 Another thanks to you, because sometimes i wonder how many mods wouldn't exist without you. 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