Jump to content

Recommended Posts

After almost a dozen days, I finished a character to near completion (with the exception of the speaking script)

I added

  inst:RemoveTag("scarytoprey") + sanity and damage taken for killing rabbits and various other prey

Now I've realized that I can drop a trap ontop of a rabbit, take him out, and murder him, with no penalty. (the eating part is penalized though)

I've searched around to find a post made by @IronHunter which involved a sanity penalty for crafting anything in general. I'd rather specify which items crafted penalize this character. Specifically traps, but other things later down the line.

If reasonable, penalties for placing a trap would be swell!

Current code is

Screen Shot 2017-05-30 at 7.24.29 AM.png

Edited by Luroshard
SOLVED

Instead of listening for "consumeingredients" which is called for all recipes you could listen for "builditem" which uses data (item = prod, recipe = recipe, skin = skin)

I don't really have access to all my modding tools, but it should be a simple enough to edit from here.

Spoiler

    inst:ListenForEvent("builditem", function(inst, data)
        if data.item.prefab == "trap" then
            inst.components.sanity:DoDelta(-15)
        end
    end)

 

Depending on how many items you want to make have this penalty you could do a array to store their values so you don't have to make as many if statements.

Spoiler

	inst:ListenForEvent("builditem", function(inst, data)
		local traps = {trap = true, birdtrap = true, beemine = true, trap_teeth = true}
		if traps[data.item.prefab] then
			inst.components.sanity:DoDelta(-15)
		end
	end)

 

Cheers

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