Jump to content

Recommended Posts

I'd like to make it so that, when you see berrybushes with lots of berries it gives you three berries and the rest of the time it gives one as usual, any idea how?

 

I'm not good at modding at all, but i saw this, and my guess is it's for the animation only, but there must be a way to change the number of berries it gives?

 

p.s.- can someone tell me how to hide long text like the following?

local function pickanim(inst)
    if inst.components.pickable then
        if inst.components.pickable:CanBePicked() then
            local percent = 0
            if inst.components.pickable then
                percent = inst.components.pickable.cycles_left / inst.components.pickable.max_cycles
            end
            if percent >= .9 then
                return "berriesmost"
            elseif percent >= .33 then
                return "berriesmore"
            else
                return "berries"
            end
        else
            if inst.components.pickable:IsBarren() then
                return "idle_dead"
            else
                return "idle"
            end
        end
    end

    return "idle"
end

Put this in modmain.lua:

local function MakeBerryBushGiveMoreBerries(inst)    inst.components.pickable.numtoharvest = 3endAddPrefabPostInit("berrybush", MakeBerryBushGiveMoreBerries)AddPrefabPostInit("berrybush2", MakeBerryBushGiveMoreBerries)
Edited by squeek

Put this in modmain.lua:

 

local function MakeBerryBushGiveMoreBerries(inst)    inst.components.pickable.numtoharvest = 3endAddPrefabPostInit("berrybush", MakeBerryBushGiveMoreBerries)AddPrefabPostInit("berrybush2", MakeBerryBushGiveMoreBerries)

Thank you kind sir XD

 

edit: should i just create a new ''modmain.lua'' in the mods folder? because there is no ''modmain.lua'' in the main folder, but i have a different ''modmain.lua'' for all mods

 

edit2: i tried creating a modmain.lua in the mods folder and it does not work, i'm such a newb at modding lol

Edited by julz1981

i'm only tweaking files in scripts, i don't have any clue how to make a mod lol

You shouldn't tweak game scripts, as any changes have a high likelihood of being overwritten/lost whenever the game updates. My post that you just quoted is literally all you need to do to make a mod (create a folder in mods called anything, create a modmain.lua inside that folder). Edited by squeek

You shouldn't tweak game scripts, as any changes have a high likelihood of being overwritten/lost whenever the game updates. My post that you just quoted is literally all you need to do to make a mod (create a folder in mods called anything, create a modmain.lua inside that folder).

I just did that,

 

I created a folder named more berries, and put a txt file that i renamed modmain.lua with the text you sent me, then i activated the mod and it didn't do a thing. ''it said mod out of date'' do i need to add something else? ''i play with RoG''

 

I did tweak some scripts 3 months ago and it didn't change as of yet. thanks for letting me know, i'll make backup of those, in case.

Edited by julz1981

Interesting, I have been working on a similar change to the berry bush, as my first attempt at mod creation.

I'm not 100% sure, but you also need a modinfo.lua in the folder along with the modmain.lua. you can look at another mods modinfo to see what fields to change. One of the fields is version.

Interesting, I have been working on a similar change to the berry bush, as my first attempt at mod creation.

I'm not 100% sure, but you also need a modinfo.lua in the folder along with the modmain.lua. you can look at another mods modinfo to see what fields to change. One of the fields is version.

Thanks for the reply, but i really don't have a clue how to mod so i guess i will just forget about it.

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