Jump to content

[help] modding chester


Recommended Posts

Hey all;

 

I'm trying to mod chester in 3 ways. 1) I'm going to reskin him 2) I want to make his inventory inaccessible by everyone (including owner because of the next alteration) and 3) I want him to drop 2 meat ONLY when he dies. I'm trying to find the lua that has all of this information but cannot find it for the life of me. I downloaded the personal chester mod but cannot seem to locate files (other than the re-skin). Any advice would be greatly appreciated.

Link to comment
Share on other sites

@Ramrodiger:

It's all in chester.lua.

 

 

 

I want to make his inventory inaccessible by everyone

 

Remove the container component.

 

 

 

I want him to drop 2 meat ONLY when he dies.
local loot = { "meat", "meat" }inst:AddComponent("lootdropper")inst.components.lootdropper:SetLoot(loot)
Edited by DarkXero
Link to comment
Share on other sites

@rons0n, because of stategraph differences.

 

Monsters usually use the death commonstate for their stategraphs (stategraphs/commonstates.lua).

Players have a different death state.

 

In only one of them this is called

inst.components.lootdropper:DropLoot(inst:GetPosition())

What I do is:

1) Make a lootbag prefab.

local function fn()	local inst = CreateEntity()	inst.entity:AddTransform()	-- Non-networked entity	inst:AddComponent("lootdropper")	return instendreturn Prefab("lootbag", fn)

2) Have a listener on players

inst:ListenForEvent("death", OnDeath)

3) Generate a lootbag, customize it, drop the loot, and remove it.

local function OnDeath(inst)	local lootbag = SpawnPrefab("lootbag")	local loot = { "meat", "meat" }	lootbag.components.lootdropper:SetLoot(loot)	lootbag.components.lootdropper:DropLoot(inst:GetPosition())	lootbag:Remove()end
Link to comment
Share on other sites

chester.lua or SGchester.lua?

 

To your copy of chester.lua.

 

SGchester.lua relates the animations of chester, with its actions and events that happen to him.

If Wilson opens Chester, the stategraph handles it to display Chester with mouth open, panting.

Edited by DarkXero
Link to comment
Share on other sites

Hey again;

 

So I spent a couple hours trying to tinker with it and get it to work and I even went to your "Moar Loot" post and tried to take elements from your Lootbag.zip file there and use them to no avail. I just can't seem to get chester to spawn 2 meat when he dies. Further, when I try to remove the container elements I get this error here:

 

http://i.imgur.com/bBHLsFO.png

 

I attached what I have for the chester.lua in hopes that you might once again help a frustrated noob out. 

personal_chester.lua

Link to comment
Share on other sites

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
 Share

×
  • Create New...