hotmatrixx Posted July 15, 2014 Share Posted July 15, 2014 So, I'm new to modding for DS. And I'm new to .lua - Brand new. But i used to program in Basic++ and So I am used to logic and workflows. I am reading up on .lua at the moment. I like it as a language, I love that I don't have to define variables! I'm really just jumping in, here. Both feet, and I am hoping that someone will come pull me out of this shallow end of the pool, because I can't swim! I have yet to come to grips with .lua I have got a really long way to go, and I have 12 different ideas for mods (Some easy, some adding whole tiers to the crafting menu, one idea for a new Room / Biome), so I will learn as I go, with a bit of help from you guys to point me in the right direction. So, with that out of the way... What I would like to do is create a mod that allows me to change the durability of "Classes" - for eg Hats, Clothing, Armour, Tools, Weapons. I found this one as a basis -Steam Workshop (Code is included below) --[[*************************************************** MOD BY: ***************************** Cälix ****************************************************]]---- ######################################################################-- #################### EDIT FROM HERE ##################################-- ######################################################################local multiplier_amulet = 3 -- MULTIPLIER FOR AMULETSlocal multiplier_hat = 3 -- MULTIPLIER FOR HATSlocal multiplier_armor = 3 -- MULTIPLIER FOR ARMORS-- ######################################################################-- #################### DO NOT EDIT UNDER THIS LINE #####################-- ######################################################################local seg_time = 30 local total_day_time = seg_time*16 local day_segs = 10 local dusk_segs = 4 local night_segs = 2 --default day composition. changes in winter, etc local day_time = seg_time * day_segs local dusk_time = seg_time * dusk_segs local night_time = seg_time * night_segs local wilson_attack = 34 local wilson_health = 150 local calories_per_day = 75 local wilson_attack_period = .5 ----------------------- local perish_warp = 1--/200function Durability(inst) if inst.components.finiteuses then inst:AddComponent("finiteuses") endend-----------------[[ HERE STARTS AMULETS AND STAFFS ]]------------------------- REDAMULET_USES = 20 * multiplier_amulet REDAMULET_CONVERSION = 5 BLUEAMULET_FUEL = total_day_time * 0.75 * multiplier_amulet BLUEGEM_COOLER = -20 PURPLEAMULET_FUEL = total_day_time * 0.4 * multiplier_amulet YELLOWAMULET_FUEL = total_day_time * multiplier_amulet YELLOWSTAFF_USES = 20 * multiplier_amulet ORANGEAMULET_USES = 225 * multiplier_amulet ORANGEAMULET_RANGE = 4 ORANGEAMULET_ICD = 0.33 ORANGESTAFF_USES = 20 * multiplier_amulet GREENAMULET_USES = 5 * multiplier_amulet GREENAMULET_INGREDIENTMOD = 0.5 GREENSTAFF_USES = 5 * multiplier_amulet ----------------[[ HERE STARTS HATS AND ARMORS ]] ------------------------- MINERHAT_LIGHTTIME = (night_time+dusk_time)*2.6*multiplier_hat LANTERN_LIGHTTIME = (night_time+dusk_time)*2.6*multiplier_hat SPIDERHAT_PERISHTIME = 4*seg_time*multiplier_hat ONEMANBAND_PERISHTIME = 6*seg_time*multiplier_hat UMBRELLA_PERISHTIME = total_day_time*6*multiplier_hat EARMUFF_PERISHTIME = total_day_time*5*multiplier_hat WINTERHAT_PERISHTIME = total_day_time*10*multiplier_hat BEEFALOHAT_PERISHTIME = total_day_time*10*multiplier_hat TRUNKVEST_PERISHTIME = total_day_time*15*multiplier_armor SWEATERVEST_PERISHTIME = total_day_time*10*multiplier_armor HUNGERBELT_PERISHTIME = total_day_time*8*multiplier_armor WALRUSHAT_PERISHTIME = total_day_time*25*multiplier_hat FEATHERHAT_PERISHTIME = total_day_time*8*multiplier_hat TOPHAT_PERISHTIME = total_day_time*8*multiplier_hat ARMORGRASS = wilson_health*1.5*multiplier_armor ARMORWOOD = wilson_health*3*multiplier_armor ARMORMARBLE = wilson_health*7*multiplier_armor ARMORSNURTLESHELL = wilson_health*7*multiplier_armor ARMORRUINS = wilson_health * 12*multiplier_armor ARMORSLURPER = wilson_health * 4*multiplier_armor ARMOR_FOOTBALLHAT = wilson_health*3*multiplier_hat ARMOR_RUINSHAT = wilson_health*8*multiplier_hat ARMOR_SLURTLEHAT = wilson_health*5*multiplier_hat ARMOR_BEEHAT = wilson_health*5*multiplier_hat I realise this is someone else's work. Props to them. I am using it as a template, to get a start in this business of modding. What they have done is to define the multiplier like so:local multiplier_amulet = 3 -- MULTIPLIER FOR AMULETSlocal multiplier_hat = 3 -- MULTIPLIER FOR HATSlocal multiplier_armor = 3 -- MULTIPLIER FOR ARMORSand then multiply every single prefab in the game against that. I mean ouch. No disrespect to the coder, but I was hoping that I could find a way to group these types of items and then add the multiplier. i cannot find a "classes" system for the items though, so I am wondering if this is what I am up against? the closest thing that I have found was in the prefab section, where ALL of these items are lumped undercommon/inventory/[prefab], which also includes things like foods, and the Lightning Rod. My problem is that I would like this to be compatible with other mods, so if someone adds a new item into it with default balance, this mod would then adjust said item based on it's "Class". Else I would have to add it's prefab into my mod manually each time there is a new mod out. I see someone made an infinitizer for different classes, so I am going to go and see how that works. That may give me the clues I need. Link to comment Share on other sites More sharing options...
hotmatrixx Posted July 15, 2014 Author Share Posted July 15, 2014 "update" I looked into those other mods. They seem to list everything individually, as well. hmmm. They did, however seem to create tables to call scripts. I'm not sure, but it looked like they were subroutines. This was what I looked at, if anyone was interested. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.