Jump to content

Recommended Posts

I finally made my first trap mod. Phew that was hard.

 

Link: http://steamcommunity.com/sharedfiles/filedetails/?id=392879002

 

Spear Trap works just like tooth trap except:

-more, hard to get ingredients

-why? because the trap lasts forever

 

Trap does same damage and still needs to be reset.

Craft it at the "Fight" (war) recipe tab.

Requires science machine to prototype.

 

Ingredients: spear (duh), log, rope and gear
Quantity depends on config setting.

 

Now a question for those who know, how do I make this config differently, example:

"Easy" = spear(1), log(1)

"Normal" = spear(4), log(4), rope(4), gears(2)

"Hard" = spear(4), log(8), rope(8), gears(4)

"VHard" = spear(4), gears(4), purplegem(1), nightmarefuel(20)

 

I tried and failed many times.

Current code in modmain (that works):

local recipes = 
{
  Recipe("speartrap"
    ,{Ingredient("spear",GetModConfigData("SpearTrap_SpearCount"))
    ,Ingredient("log",GetModConfigData("SpearTrap_LogCount"))
    ,Ingredient("gears",GetModConfigData("SpearTrap_GearsCount"))
    ,Ingredient("rope",GetModConfigData("SpearTrap_RopeCount"))
    }
    ,RECIPETABS.WAR
    ,{SCIENCE=1}
  )
}
 
for k,v in pairs(recipes) do
v.tagneeded = false
v.atlas = "images/inventoryimages/" .. v.name .. ".xml"
end
 
I tried using if ... then, like this:
local recipes_easy = { Recipe(... 
recipes_easy.tagneeded = false
recipes_easy.atlas = "images/inventoryimages/speartrap.xml"
 
local recipes_normal = { Recipe(... 
recipes_normal.tagneeded = false
recipes_normal.atlas = "images/inventoryimages/speartrap.xml"
 

But it crashes on texture being nil.

Any help is appreciated.

 

 

 

 

BTW: Yes, that is Groot in the preview/screenshot

http://steamcommunity.com/sharedfiles/filedetails/?id=391743403

 

post-543199-0-31945200-1423988361.png

post-543199-0-90194600-1423988366_thumb.

Edited by SenL
Link to comment
https://forums.kleientertainment.com/forums/topic/50994-mod-release-spear-trap/
Share on other sites

I feel like you should raise the damage at least a little. Gears aren't renewable, and between fridges and upgrading a wx character they're a lot more valuable than a neverending trap that you'd still have to reset anyways. Tooth traps last quite a while, and the materials are fairly easy to get since you could kill hounds with a set of tooth traps to get more teeth to make more tooth traps. It just doesn't seem worth it to make, especially on Vhard since you'd have to dig up a ton of graves to refine a purple gem, which while technically renewable you'd have to kill a lot of fire and ice hounds to do so. And by that point you'd have hound teeth out the butt anyways. As for your issue with how to set up the config, here's a snippet from one of mine that could help:

local easy = (GetModConfigData("generatorrecipe")=="easy")        if easy thenlocal ec_generator = GLOBAL.Recipe("ec_generator",{         Ingredient("cutstone", 3),        Ingredient("rope", 2),        Ingredient("gears", 1),        Ingredient("rabbit", 1)},        RECIPETABS.SCIENCE, TECH.SCIENCE_TWO, "ec_generator_placer")        ec_generator.atlas = "images/inventoryimages/ec_generator.xml"        else local ec_generator = GLOBAL.Recipe("ec_generator",{         Ingredient("cutstone", 4),        Ingredient("rope", 2),        Ingredient("rabbit", 1),        Ingredient("gears", 2),        Ingredient("redgem", 1)},        RECIPETABS.SCIENCE, TECH.SCIENCE_TWO, "ec_generator_placer")        ec_generator.atlas = "images/inventoryimages/ec_generator.xml"        end

The top one goes in modmain.lua, bottom in modinfo.lua. And of course you could add more options by using a chain of 'else if's.

configuration_options ={	{		name = "generatorrecipe",		label = "Advanced Generator Recipe",		options =	{		{description = "Easy", data = "easy"},		{description = "Hard", data = "hard"},	},		default = "easy",	},}	

e/ Instead of increasing the damage you could have the traps auto reset each day or something along that line. That would at least justify the use of gears, seeing as it'd have a mechanical aspect to it.

Edited by polygone

No problem, but lasting forever isn't that great of a trait considering you still have to reset the trap manually. Kill two or three hound waves and you have enough teeth to make a nice array of tooth traps. Use those traps to kill the next hound wave and then you have five more traps, next wave you have five more and so on. The tooth traps may wear out, but they have plenty of uses to make up for the fact/can help you farm materials to get more and so on. Just having this last forever means you get more teeth building up. I guess you could make sewing kits and dapper vests with it but why would you need that many?

Actually I was planning on figuring out what the most useless items in the game are (hi bee stingers) and turn them into things that are actually useful like weapons and buildings. Then again leaving a ton of 'useless' items around on the ground to distract Krampus is always a valid strategy. xD

 

Found the trap in the workshop, sounds well worth it now for the gears. Auto resetting deathtraps yay. Also neat idea with wooden flooring instead of logs. Makes sense.

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