Mod help please

Everything about mods can be found here.

Moderator: Morax

Mod help please

Postby rockoe10 » 18 Sep 2013, 13:36

I am attempting to design a mod that will reduce the reclaim of unit wreckage and cannot seem to get the changes to take affect. I have a file located in the hook folder running a 'do' loop and can't seem to get it to work. Any help would be much appreciated.
do

local oldModBlueprints = ModBlueprints
function ModBlueprints(all_bps)
oldModBlueprints(all_bps)

for id, bp in all_bps.Unit do

local cats = {}
for k, cat in bp.Categories do
cats[cat] = true
end

LOG('*BM: ' .. repr(cats))
-- LOG('*BM: ' .. cats.RECLAIMABLE)


if bp.Wreckage and cats.RECLAIMABLE then
for ik, rec in bp.Wreckage do
if rec.MassMult >= 0 then
rec.EnergyMult = 0
rec.MassMult = 0.4
rec.HealthMult = 1
rec.ReclaimTimeMultiplier = 1

LOG('*BM: ' .. bp.BlueprintId .. ', ' .. bp.Description)

end

end

end

end -- all_bps.Unit loop

end -- ModBlueprints

end
ZeP: doesn't matter if it's an avatar, a trophy or a collection of dead cats
ZeP: it's the same code
User avatar
rockoe10
Avatar-of-War
 
Posts: 299
Joined: 05 Jan 2013, 05:09
Has liked: 36 times
Been liked: 17 times
FAF User Name: Rockoe10

Re: Mod help please

Postby Krapougnak » 19 Sep 2013, 07:52

There is already a mod doing that. This is what it does :

hook/lua/system/bluprints

Code: Select all
--#****************************************************************************
--#**
--#** Hooked To:  /lua/system/blueprints.lua
--#**
--#** Modded By:  FuryoftheStars
--#**   
--#*********************************************************************

local WreckageReduction = function(all_bps)
   for _, bp in all_bps do
      if bp.Wreckage then
         --if bp.Wreckage.EnergyMult then
         --   bp.Wreckage.EnergyMult = bp.Wreckage.EnergyMult / 1.5
         --end
         if bp.Wreckage.HealthMult then
            bp.Wreckage.HealthMult = bp.Wreckage.HealthMult * (0.4/0.9)
         end
         if bp.Wreckage.MassMult then
            bp.Wreckage.MassMult = bp.Wreckage.MassMult * (1/0.9)
         end
      end
   end
end

local OldModBlueprints = ModBlueprints
function ModBlueprints(all_blueprints)

   OldModBlueprints(all_blueprints)

   WreckageReduction(all_blueprints.Unit)
end

--]]
User avatar
Krapougnak
Contributor
 
Posts: 340
Joined: 12 Jul 2012, 11:03
Has liked: 193 times
Been liked: 24 times
FAF User Name: Krapougnak

Re: Mod help please

Postby rockoe10 » 21 Sep 2013, 15:21

Amazing! thanks a ton. I looked everywhere for a mod like this before trying to make my own (No need to re-invent the wheel ;P). SO thanks a ton!

EDIT:
What was the mod name? And, the multipliers achieve what kind of outcome? That is, why does it multiply by (.4/.9)? Seems like more work than needed?
ZeP: doesn't matter if it's an avatar, a trophy or a collection of dead cats
ZeP: it's the same code
User avatar
rockoe10
Avatar-of-War
 
Posts: 299
Joined: 05 Jan 2013, 05:09
Has liked: 36 times
Been liked: 17 times
FAF User Name: Rockoe10

Re: Mod help please

Postby rockoe10 » 24 Sep 2013, 03:50

I figured it out lol. Took me a minute but I got it (longer to make this post). I uploaded my revised and perfected version to the vault. Easily modified if you wish to change the percent of reclaim. Just be sure everyone in your game has the same number
ZeP: doesn't matter if it's an avatar, a trophy or a collection of dead cats
ZeP: it's the same code
User avatar
rockoe10
Avatar-of-War
 
Posts: 299
Joined: 05 Jan 2013, 05:09
Has liked: 36 times
Been liked: 17 times
FAF User Name: Rockoe10


Return to Mods & Tools

Who is online

Users browsing this forum: No registered users and 1 guest