Jump to content

Trying to make a specific character NOT cause moisture in the world when using a Telelocator


Recommended Posts

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! :D

Link to comment
Share on other sites

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 by CarlZalph
Mention.
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...