4here4 Posted July 17, 2020 Share Posted July 17, 2020 Hello, I have a custom character I'm making for myself and a few friends to mess around with. The only problem I'm running into is I want him to be able to teleport himself/others with a telelocator staff without causing it to rain. I'm afraid I don't know if this is something that would even be possible to code, so please don't feel obligated to find a solution. Any help would be greatly appreciated. Thanks in advance! Link to comment Share on other sites More sharing options...
CarlZalph Posted July 17, 2020 Share Posted July 17, 2020 (edited) AddPrefabPostInit( "purplestaff", function(inst) if not GLOBAL.TheWorld.ismastersim then return end local spellcaster = inst.components.spellcaster if spellcaster then local spell_old = spellcaster.spell if spell_old then spellcaster.spell = function(staff, target, pos, ...) local TELESTAFF_MOISTURE_old = GLOBAL.TUNING.TELESTAFF_MOISTURE local caster = staff.components.inventoryitem and staff.components.inventoryitem.owner if caster and caster.prefab == "yourprefabnamehere" then GLOBAL.TUNING.TELESTAFF_MOISTURE = 0 end local rets = {spell_old(staff, target, pos, ...)} GLOBAL.TUNING.TELESTAFF_MOISTURE = TELESTAFF_MOISTURE_old return GLOBAL.unpack(rets) end end end end ) Untested but should be snaps. Replace yourprefabnamehere with your character's prefab name. @4here4 Edited July 17, 2020 by CarlZalph Mention. Link to comment Share on other sites More sharing options...
4here4 Posted July 18, 2020 Author Share Posted July 18, 2020 Hmm... doesn't seem to be working. I might have placed it in the wrong spot, or perhaps some other bit of code is conflicting? Attached is my modmain.lua Any ideas? modmain.lua 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