Petrenko Posted February 12, 2013 Share Posted February 12, 2013 Heyho, i decompiled the .lua files and played a bit with them. I deleted the traits, making tools a finite tool and also added a new drop to the grass. (It's just a proof on concept so please don't critizise what i'm doing) local dig_up = function(inst, chopper) if inst.components.pickable and inst.components.pickable:CanBePicked() then inst.components.lootdropper:SpawnLootPrefab("cutgrass") and inst.components.lootdropper:SpawnLootPrefab("seeds") end inst:Remove() After this i get the following crashlog at booting of the game LOADING LUA SUCCESS...e_Make_Steam_Package\workspace\data\scripts\main.lua:152: Prefab file doesn't return a callable chunk data/scripts/prefabs/grass.luaLUA ERROR stack traceback: =[C] in function 'assert' I did not recompile, since it did not work for me, also they told on the forum, you don't have to. Thanks in advance for any usefull hints etc. Erast P. Link to comment Share on other sites More sharing options...
Developer Kevin Posted February 12, 2013 Developer Share Posted February 12, 2013 The clause within the then/end block isn't valid, syntactically.Replace it with:inst.components.lootdropper:SpawnLootPrefab("cutgrass")inst.components.lootdropper:SpawnLootPrefab("seeds") Link to comment Share on other sites More sharing options...
Petrenko Posted February 12, 2013 Author Share Posted February 12, 2013 (edited) You mean like this? if inst.components.pickable and inst.components.pickable:CanBePicked() theninst.components.lootdropper:SpawnLootPrefab("cutgrass") inst.components.lootdropper:SpawnLootPrefab("seeds") end inst:Remove() This did not work. Edited February 12, 2013 by Petrenko Link to comment Share on other sites More sharing options...
Yello Posted February 12, 2013 Share Posted February 12, 2013 You mean like this?if inst.components.pickable and inst.components.pickable:CanBePicked() theninst.components.lootdropper:SpawnLootPrefab("cutgrass") inst.components.lootdropper:SpawnLootPrefab("seeds") end inst:Remove()This did not work.Are those item scripts? If so where are they? Link to comment Share on other sites More sharing options...
Starvation Posted February 12, 2013 Share Posted February 12, 2013 (edited) local prefabs = {"cutgrass", "dug_grass"}it's about the fifth line from the top (in the actual file) U must define the prefabs first. Don't forget to add a comma after each word. I figured this out by modding the rocks.lua to drop spears and bee-mines and random stuff, as a mod (based on a story that pigmen hide your stuff under rocks when you die)--------So....local prefabs = {"cutgrass", "dug_grass, [The prefab goes here]"}then....inst.components.lootdropper:SpawnLootPrefab("cutgrass")inst.components.lootdropper:SpawnLootPrefab("[The prefab goes here]")[][][]So if were to make the grass give butter muffins.i would type 'butterflymuffin' where [The prefab goes here] is, as that is it's prefab name.----Hoped that helped Edited February 12, 2013 by Starvation Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now