Jump to content

Recommended Posts

I'm trying to get this function here:

 

     local function OnCreate(inst, player)        return FindEntity(player, 50, function(guy)        if guy:HasTag("spiderchan") then            return not (guy:HasTag("spiderbone_follower"))                    endend)    end    local player = GetPlayer()    spider =     OnCreate(inst, player)        if spider ~= nil then    print(spider)    spider:AddTag("spiderbone_follower")    inst.name = "Spiderbone ("..spider.name..")"    spider.components.follower:SetLeader(inst)    end

 

to return one of the followers and set its leader while adding a tag to prevent it from being set again.

Right now it works perfectly if you only have one follower, but with several it just resets their leaderships or doesn't work at all.

 

What should I do? x:

Thank you for reading!

Link to comment
https://forums.kleientertainment.com/forums/topic/48906-returning-one-at-random/
Share on other sites

@SophieTheDog, not enough information to accurately determine the problem. Please provide the full code.

Though, I think it might have something to do with the inst variable passed into the SetLeader function.

 

It's alright, stayed up all night to fix it.

rip sleep but it works now

 

I think the problem was me trying to set things from within the item prefab, so I basically I just made a function inside the prefab it was trying to change leadership for instead.

 

Pretty sure my mod is almost finished now! n w n

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...