spawn wood chest with items

maughanorama

Member
Member
Nov 27, 2014
181
10
18
43
Hi i was wondering if someone could give me a point in the right direction...
id like to write my own plugin to spawn Large Wood Storage with items in (for arena). but instead of writing it for me could someone help me write my own.
im not 100 % on where to start i can obviously create the script but im not sure what to call or how to call or how to even decompile the dll ... also is decompile possible on linux?

thanks
 

Jakkee

Plugin Developer
Plugin Developer
Contributor
Jul 28, 2014
1,466
326
83
Australia
Hi i was wondering if someone could give me a point in the right direction...
id like to write my own plugin to spawn Large Wood Storage with items in (for arena). but instead of writing it for me could someone help me write my own.
im not 100 % on where to start i can obviously create the script but im not sure what to call or how to call or how to even decompile the dll ... also is decompile possible on linux?

thanks
http://www.jetbrains.com/decompiler/download/
Not sure if it works with linux.

I believe the object is an Entity so I don't think World.Spawn would work.
But adding the items shouldn't be too hard, Entity.Inventory.AddItem("P250", 3)

So somthing like:
ent = World.Spawn("Large Wooden Chest", x, y, z)
ent.Inventory.AddItem("P250", 3)
 

Jakkee

Plugin Developer
Plugin Developer
Contributor
Jul 28, 2014
1,466
326
83
Australia
Does that work ?
Pretty sure you can.
I remember looking at magmafires and the code adds wood into the campfire by using Entitiy.Inventory.AddItem()
I'd have to see if it'll work for chests.
 

Snake

Moderator
Moderator
Jul 13, 2014
288
103
28
Pretty sure you can.
I remember looking at magmafires and the code adds wood into the campfire by using Entitiy.Inventory.AddItem()
I'd have to see if it'll work for chests.
Yeah, that can be done. But spawning a Large Wood Chest with World.Spawn() ?
 

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
3,979
1,363
113
At your house.
github.com
http://www.jetbrains.com/decompiler/download/
Not sure if it works with linux.

I believe the object is an Entity so I don't think World.Spawn would work.
But adding the items shouldn't be too hard, Entity.Inventory.AddItem("P250", 3)

So somthing like:
ent = World.Spawn("Large Wooden Chest", x, y, z)
ent.Inventory.AddItem("P250", 3)
Does the ent variable get any value?
 

Snake

Moderator
Moderator
Jul 13, 2014
288
103
28
Does the ent variable get any value?
That's what I've asked. World.Spawn() takes as first argument the prefab as a string.

If there's a prefab named Large Wood Storage then perfect but I haven't tried that.
 

Hor

New Member
Member
Jul 16, 2018
2
0
0
21
ent = Entity(World.Spawn(';deploy_wood_storage_large, location.x, location.y, location.z, spawnRot))