Jump to content

Recommended Posts

Hello,

 

The basic concept I am working on is a custom shovel for a character that never decays.  Can I just comment out the code linking to the "finitieuses" function?

 

Also can I force someone who is not the "character" to drop the shovel as if their inventory was full, or be unable to equip it at least?

 

If you can tell me, what names in the file will also need to be completely changed to the new name that would be amazing.  I'm trying to find good examples for comparison but I haven't found any great examples so far.

Link to comment
https://forums.kleientertainment.com/forums/topic/52704-help-custom-shovel/
Share on other sites

To remove the uses comment it out like this

 

    --inst:AddComponent("finiteuses")    --inst.components.finiteuses:SetMaxUses(TUNING.WATHGRITHR_SPEAR_USES)    --inst.components.finiteuses:SetUses(TUNING.WATHGRITHR_SPEAR_USES)    	--inst.components.finiteuses:SetOnFinished(inst.Remove)

Add something like this to prevent other from picking it up

inst.components.inventoryitem.onputininventoryfn = function(inst, player)    if player.prefab ~= "CHARACTER NAME HERE" then        inst:DoTaskInTime(0.1, function()            player.components.inventory:DropItem(inst)            player.components.talker:Say("It seems to slip right out of my hands!")        end)    endend

You can change the  text to whatever you like or remove the player.component.talker:Say entirely 

Good luck modding.

Yea I think I had finite uses figured out, thanks though!

 

@Kzisor My bad, I let the artist do some custom dialogue and forgot I hadn't compiled since than.  So he broke something, when I reverted back to a working state, I got your tutorial to work just fine thank you!

Edited by Tovath

Yea I think I had finite uses figured out, thanks though!

 

@Kzisor My bad, I let the artist do some custom dialogue and forgot I hadn't compiled since than.  So he broke something, when I reverted back to a working state, I got your tutorial to work just fine thank you!

 

I'm just going to note, that the step by step instructions are actually included in the mod itself as images. If you replicate the images in no certain order you will be able to create a perfect replica. The tutorial is also not meant to be a copy/paste thing for those wondering, I specifically made it not work with copy/pasting without additional steps being taken, after all you don't learn if all you do is copy and paste.

I've got one custom item working in game with Character Specifics only now, the shovel.lua is a bit more convoluted than one of the hat lua though; because it has a gold and normal version in the same file.  I'm attempting to get rid of the extra parts now in the shovel lua for my own custom lua.

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