Jump to content

Recommended Posts

Hello again :) , i got another few questions.
At first, I want my character to be able to eat mushrooms without any disadvantages. I tried to use code from Webber, but I just found something like "strongstomach", but this doesn't help me.

Furthermore I want to add teleportation like the teleportation of Wortox to my character. I copied some code from Wortox to my characters code, so I am able to teleport now, but there is a problem... if I drop a soul it will heal me and I dont know how to change this.
This is the code I've added to my character: 
 

local function GetPointSpecialActions(inst, pos, useitem, right)
    if right and useitem == nil and inst.replica.inventory:Has("wortox_soul", 1) then
        local rider = inst.replica.rider
        if rider == nil or not rider:IsRiding() then
            return { ACTIONS.BLINK }
        end
    end
    return {}
end

local function OnSetOwner(inst)
    if inst.components.playeractionpicker ~= nil then
        inst.components.playeractionpicker.pointspecialactionsfn = GetPointSpecialActions
    end
end

-- In master_postinit:
	inst:AddTag("soulstealer")						
	inst:ListenForEvent("setowner", OnSetOwner)		
	inst._checksoulstask = nil

I want to add a soul as non-consumable startitem, so it is a startitem right now, but if I use it, it will disappear.
Thank you for your help :) 

"strongstomach" only affects "monstermeat" as far as I can see on the code. Take a look at my new Fun With Food tutorial, specifically the part about "Removing ONLY Negative Stat Effects From Certain Foods (CHARACTER)".

I don't think I can help with the soul-dropping thing. Have you tried simply removing the line

inst:AddTag("soulstealer")	

?

18 hours ago, Ultroman said:

"strongstomach" only affects "monstermeat" as far as I can see on the code. Take a look at my new Fun With Food tutorial, specifically the part about "Removing ONLY Negative Stat Effects From Certain Foods (CHARACTER)".

I don't think I can help with the soul-dropping thing. Have you tried simply removing the line


inst:AddTag("soulstealer")	

?

The food thing worked :D Thank you.
If I remove "inst:AddTag("soulstealer")" I can still drop souls for healing me, but teleporting won't work.

On 9/12/2019 at 6:42 PM, sanok15 said:

The food thing worked :D Thank you.
If I remove "inst:AddTag("soulstealer")" I can still drop souls for healing me, but teleporting won't work.

Would you be able to share your character prefab? I am struggling to get wortox teleport to work on a custom character (the animation plays but my character doesn't actually go anywhere).

also below code can be placed in modmain and you can edit the blink action however you like (i have it check for nightmare fuel instead of souls)

local function WBlink(act)
	local act_pos = act:GetActionPoint()
    if act.invobject ~= nil then
        if act.invobject.components.blinkstaff ~= nil then
            return act.invobject.components.blinkstaff:Blink(act_pos, act.doer)
        end
    elseif act.doer ~= nil
        and act.doer.sg ~= nil
        and act.doer.sg.currentstate.name == "portal_jumpin_pre"
        and act_pos ~= nil
        and act.doer.components.inventory ~= nil
        and act.doer.components.inventory:Has("nightmarefuel", 1) then
        act.doer.sg:GoToState("portal_jumpin", act_pos)
        return true

    end
end


GLOBAL.ACTIONS.BLINK.fn = function(act)
    return WBlink(act)
end

 

Below code is from the character prefab, you can edit the soulhop cost here so no souls are consumed

local function FinishPortalHop(inst)
    if inst._freesoulhop_counter > 0 then
        if inst.components.inventory ~= nil then
            inst.components.inventory:ConsumeByName("nightmarefuel", math.max(math.ceil(inst._soulhop_cost), 0))
        end
        ClearSoulhopCounter(inst)
    end
end

 

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
×
  • Create New...