FAForever Forums
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Login
    The current pre-release of the client ("pioneer" in the version) is only compatible to itself. So you can only play with other testers. Please be aware!

    Let me tell you how to fix RK-s-Explosions Mod on the latest FAF game

    Scheduled Pinned Locked Moved Modding & Tools
    17 Posts 7 Posters 1.0k Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Z Offline
      ZBC
      last edited by ZBC

      As we all know, RK-s-Explosions Mod is the coolest explosion effects mod for FA, but it doesn't work on the latest version of faf now. Since I can't contact with the author (I'm a Chinese player so I can't use any common social programs like x, telegram or gmail).
      Without the author's permission, I won't post the moded files, but I will tell you how to make it work on the latest 3812 version of the game by simply modifying a lua file.

      1 Reply Last reply Reply Quote 5
      • Z Offline
        ZBC
        last edited by ZBC

        First, you should get the newest mod from github(Not FAF, the newest version hasn't be uploaded) : https://github.com/RK4000/RK-s-Explosions/releases
        And then, you must rename the mod folder name from ''RK-s-Explosions-13'' to ''rks_explosions'', to make most of effects work.(Because the path of most effects in lua is still "rks_explosions", not "RK-s-Explosions-13")

        1 Reply Last reply Reply Quote 1
        • Z Offline
          ZBC
          last edited by

          Then, let's go to the FAF github repository to find a key file:
          https://github.com/FAForever/fa/blob/develop/lua/defaultexplosions.lua
          Download it and compare it to rks_explosions\hook\lua\defaultexplosions.lua;
          We can see that the contents of the function “CreateScalableUnitExplosion” have changed considerably. That is why the mod doesn't work properly.
          A simple solution is to overwrite the defaultexplosions.lua file in the mod with the same file in FAF, and then using your text editor, modify"function CreateScalableUnitExplosion "to the following form:
          function CreateScalableUnitExplosion(unit, debrisMultiplier, circularDebris)

          debrisMultiplier = debrisMultiplier or 1
          circularDebris = circularDebris or false
          
          if unit and (not IsDestroyed(unit)) then
              if IsUnit(unit) then
          
                  -- cache blueprint values
                  local blueprint = EntityGetBlueprint(unit)
                  local sx = blueprint.SizeX or 1 
                  local sy = blueprint.SizeY or 1 
                  local sz = blueprint.SizeZ or 1 
          
                  -- cache stats 
                  local army = unit.Army
                  local boundingXZRadius = 0.25 * (sx + sz)
                  local boundingXYZRadius = 0.166 * (sx + sy + sz)
                  local volume = sx * sy * sz
                  local layer = unit.Layer
          
                  -- data for emitters / shaking
                  local baseEffects = false
                  local environmentEffects = false 
                  local shakeTimeModifier = 0
                  local shakeMaxMul = 1
          
                  if layer == 'Land' then
                      -- determine land effects
                      if boundingXZRadius < 1.1 then
                          baseEffects =  NEffectTemplate.ExplosionSmallest
                      elseif boundingXZRadius > 3.75 then
                          -- large units cause camera to shake
                          baseEffects = NEffectTemplate.ExplosionSmall
                          ShakeTimeModifier = 1.0
                          ShakeMaxMul = 0.25
                      else
                          baseEffects = NEffectTemplate.ExplosionSmaller
                      end
          
                      -- environment effects (splat / decal creation)
                      local position = EntityGetPosition(unit)
                      local scorchRotation = 6.28 * Random()
                      local scorchDuration = 200 + 150 * Random()
                      local scorchLOD = 300 + 300 * Random()
                      if boundingXZRadius > 1.2 then
                          CreateDecal(
                              position, 
                              scorchRotation, 
                              UpvaluedScorchDecalTextures[Random(1, ScorchDecalTexturesN)], 
                              '', 
                              'Albedo', 
                              boundingXZRadius, 
                              boundingXZRadius, 
                              scorchLOD, 
                              scorchDuration, 
                              army
                          )
                      else
                          CreateSplat(
                              position, 
                              scorchRotation, 
                              UpvaluedScorchSplatTextures[Random(1, ScorchSplatTexturesN)], 
                              boundingXZRadius, 
                              boundingXZRadius, 
                              scorchLOD,
                              scorchDuration, 
                              army
                          )
                      end
          
                  elseif layer == 'Air' then
                      -- determine air effects
                      if boundingXZRadius < 1.1 then
                          baseEffects = ExplosionSmallAir
                      elseif boundingXZRadius > 7 then
                          -- large units cause camera to shake
                          baseEffects = ExplosionLarge
                          ShakeTimeModifier = 1.0
                          ShakeMaxMul = 0.25
                      else
                          baseEffects = ExplosionMedium
                      end
                  elseif layer == 'Water' then
                      -- determine water effects
                      if boundingXZRadius < 2 then
                          baseEffects = ExplosionSmallWater
                      elseif boundingXZRadius > 3.6 then
                          -- large units cause camera to shake
                          baseEffects = ExplosionMediumWater
                          ShakeTimeModifier = 1.0
                          ShakeMaxMul = 0.25
                      else
                          baseEffects = ExplosionMediumWater
                      end
          
                      -- environment effects
                      if boundingXZRadius < 1.0 then
                          environmentEffects = Splashy
                      end
                  end
          
                  -- create the emitters  
                  if baseEffects then 
                      CreateEffectsOpti(unit, army, baseEffects)
                  end
          
                  if environmentEffects then 
                      CreateEffectsOpti(unit, army, environmentEffects)       
                  end    
          
                  -- create the flash
                  CreateLightParticle(
                      unit, 
                      -1, 
                      army, 
                      boundingXZRadius * (2 + 1 * Random()),  -- (2, 3)
                      10.5 + 4 * Random(), -- (10.5, 14.5)
                      'glow_03', 
                      'ramp_flare_02'
                  )
          
                  -- determine debris amount
                  local amount = debrisMultiplier * MathMin(Random(1 + (boundingXYZRadius * 6), (boundingXYZRadius * 15)) , 100)
          
                  -- determine debris velocity range
                  local velocity = 2 * boundingXYZRadius
                  local hVelocity = 0.5 * velocity
          
                  -- determine heading adjustments for debris origin
                  local heading = -1 * unit:GetHeading() -- inverse heading because Supreme Commander :)
                  local mch = MathCos(heading)
                  local msh = MathSin(heading)
          
                  -- make it slightly smaller so that debris originates from mesh and not from the air
                  sx = 0.8 * sx 
                  sy = 0.8 * sy 
                  sz = 0.8 * sz
          
                  -- create debris
                  for i = 1, amount do
          
                      -- get some random numbers
                      local r1, r2, r3 = Random(), Random(), Random() 
          
                      -- position somewhere in the size of the unit
                      local xpos = r1 * sx - (sx * 0.5)
                      local ypos = 0.1 * sy + 0.5 * r2 * sy
                      local zpos = r3 * sz - (sz * 0.5)
          
                      -- launch them into space
                      local xdir, ydir, zdir 
                      if circularDebris then 
                          xdir = velocity * r1 - (hVelocity)
                          ydir = velocity * r2 - (hVelocity)
                          zdir = velocity * r3 - (hVelocity)
                      else 
                          xdir = velocity * r1 - (hVelocity)
                          ydir = boundingXYZRadius + velocity * r2
                          zdir = velocity * r3 - (hVelocity)
                      end
          
                      -- choose a random blueprint
                      local bp = ProjectileDebrisBps[MathMin(ProjectileDebrisBpsN, Random(1, i))]
          
                      EntityCreateProjectile(
                          unit, 
                          bp, 
                          xpos * mch - zpos * msh, -- adjust for orientation of unit
                          ypos, 
                          xpos * msh + zpos * mch, -- adjust for orientation of unit
                          xdir * mch - zdir * msh, -- adjust for orientation of unit 
                          ydir, 
                          xdir * msh + zdir * mch  -- adjust for orientation of unit
                      )
                  end
          
                  -- do camera shake
                  EntityShakeCamera(unit, 30 * boundingXZRadius, boundingXZRadius * shakeMaxMul, 0, 0.5 + shakeTimeModifier)
              end
          end
          

          end

          1 Reply Last reply Reply Quote 1
          • Z Offline
            ZBC
            last edited by

            And, you need to add the following definition to the beginning of the moded defaultexplosions.lua file:
            "local SDEffectTemplate = import('/mods/rks_explosions/lua/SDEffectTemplates.lua')
            local NEffectTemplate = import('/mods/rks_explosions/lua/NEffectTemplates.lua')"
            Then you'll see that the mod will almost work (but there are still some units with incorrect fire effects, such as the Experimental Bomber, which will require some more detailed modifications, which I'm still working on)

            1 Reply Last reply Reply Quote 1
            • BlackrobeB Offline
              Blackrobe
              last edited by

              Nice!

              1 Reply Last reply Reply Quote 0
              • DoompantsD Offline
                Doompants
                last edited by

                I always thought Aeon planes exploding in green fire was a bit much, but it was a small price to pay to get the oil slicks after a massive naval battle... god those added so much to ocean combat. ❤

                1 Reply Last reply Reply Quote 0
                • J Offline
                  JamCrumpet
                  last edited by

                  Can I get some help with this
                  Ive followed to the best of my understanding the instructions above, but it still seems to cause massive issues

                  For one, none of the campaign missions are playable, they dont load objectives, scenes or dialogue at all, using the mod also changes all the units that spawn in, as well as your buildable units and tech levels seemingly randomly
                  There is no effects, such as no build effects, animations on factories etc

                  Im assuming I did something wrong? I replaced the mod lua with the one linked above, then edited it and replaced the entire block below Createscalableunitexplosion as stated with the provided one, confirmed it lined up with the end argument too
                  Finally I added the last two lines to the very top of the lua, right where the other "local" lines are.
                  Does anyone just have a working modded LUA or text dump of one?

                  1 Reply Last reply Reply Quote 0
                  • J Offline
                    JamCrumpet
                    last edited by

                    I've actually managed to fix it, annoyingly easily. I'll post my findings here in case any other person is searching around like I was, and couldnt get it to work.
                    For me it was very, very simple: Make sure you have no prior version just in case, the FAF client mod version is only V12, not V13, so make sure its not in the mods folder at all just to be safe
                    Download the V13 mod as linked above
                    Rename the mod folder, as instructed above, to 'rks_explosions'
                    Youre done, thats it, it works out of the box for me. It was modifying the lua file that was breaking it just like V12 is broken, causing weird changes in spawning, animations, enemies, campaigns, and even skirmish maps.

                    Im not sure why I had this issue where ZBC wasnt having it, though, maybe we have different versions of FAF launcher? I downloaded mine just last week from the main website, considering the mod on the FAF launcher is outdated despite being published in 2020 yet updated between then and now, im willing to bet there is just a general lack of maintenance causing issues with versions that makes V13 work for me but not ZBC.

                    Personally I find it shocking I didnt see the V13 version anywhere despite dozens of minutes of googling, the FAF client is several years out of date with the mod, which is tragic since thats how most people will find and install the mod - and it wont work. Not only is it hard to figure out its that specific mod causing issues, I mean "its just a graphics mod, why would that mod stop the commander spawning or place a T3 cybran destroyer in my base at spawn?" but its such a good mod that id consider it one of the top 10 essential mods, just with how good it makes the game look.

                    The mod listed on the FAF website under its own page is only V12 simply stating V13 is "coming", since that was 2020 any normal person would assume it was abandoned. and then assume its just forever broken.
                    The mod on modDB is also only V12.

                    Its by pure luck and chance I just happened to google the right combination of keywords to find this thread and my answer and a link to the V13 mod, despite literally searching RK Explosions, if I hadnt found this thread id never assume V13 existed. Itd be nice for all the relevant pages to be updated with up to date mods or links, especially the launcher.

                    Anyway I want to thank ZBC, not only for trying to help, but also instructing me about changing the mods folder name, even though for me the V13 mod worked without editing, I would never have known to check that one specific lua, nor to identify I needed to rename the mod, for it to work.

                    Z 1 Reply Last reply Reply Quote 0
                    • Z Offline
                      ZBC @JamCrumpet
                      last edited by

                      @JamCrumpet I'm sorry that I didn't solve your problem, but I still need to explain it further.
                      As I mentioned at the beginning of my post, the latest v13 version of the RK-s-Explosions Mod needs to be downloaded from the author's github, not moddb, and not faforever. my solution is also for the problem that exists with v13, not v12.

                      1 Reply Last reply Reply Quote 0
                      • H Offline
                        Hazard
                        last edited by

                        I don't mean to Necro an old thread, but I was wondering if RK's explosion mod was broken for anybody else? I'm getting the same problems in v12 as v13 now. What's weird is it worked fine a month ago. Anyone have any ideas on how to fix it? For me the ACUs aren't spawning at the beginning of the match.

                        K 1 Reply Last reply Reply Quote 1
                        • K Offline
                          kettenferry @Hazard
                          last edited by

                          @Hazard said in Let me tell you how to fix RK-s-Explosions Mod on the latest FAF game:

                          I don't mean to Necro an old thread, but I was wondering if RK's explosion mod was broken for anybody else? I'm getting the same problems in v12 as v13 now. What's weird is it worked fine a month ago. Anyone have any ideas on how to fix it? For me the ACUs aren't spawning at the beginning of the match.

                          Same for me, i can narrow it to the last 4-6 days. Until than, it was working with the "easy"-fix (just renaming in the lua-file) and now, out of the sudden, no ACU spawning anymore! 😞

                          please, anybody, HELP - this game is my mental cure after every shit workday in office and only wth these nice "boom"-effects it is soooo much satisfying...

                          SaverS 1 Reply Last reply Reply Quote 0
                          • SaverS Offline
                            Saver @kettenferry
                            last edited by

                            @kettenferry
                            Hi, it's not the same mod, but it's also decent and makes the battle more impressive.

                            4408b43e-34c5-43f6-8025-082dfe390ff2-image.png

                            auch mal fünf gerade sein lassen

                            K 1 Reply Last reply Reply Quote 1
                            • K Offline
                              kettenferry @Saver
                              last edited by

                              @Saver Thanks a lot - i was finding that yesterday evening also and yes, it is absolute better than nothing (in some details it may even be better, e.g. dirt / splash particles flying around when buildings explode). The biggest thing i miss from RK´s are the ship fights with the oil-leakage from sinking ships... that just looks awesome!
                              Anyway, i hope that somebody might find out what wrong with it and may fix it - i would pay him / her a drink (or several lol) for fixing this! 🍻 ✌

                              1 Reply Last reply Reply Quote 1
                              • SaverS Offline
                                Saver
                                last edited by

                                Correct me if I'm wrong, but is the mod still available on FAF? I couldn't find RK-s-Explosions in the vault.

                                auch mal fünf gerade sein lassen

                                K 1 Reply Last reply Reply Quote 0
                                • K Offline
                                  kettenferry @Saver
                                  last edited by

                                  @Saver Yes, it is not available on FAF, but there was a last update uploaded to github, like our chinese friend (@zbc Thank you VERY MUCH for sharing this in 2024!!) writes here in this thread at the very beginning
                                  https://github.com/RK4000/RK-s-Explosions/releases

                                  After getting this you would have to do basically 1-2 steps to make it running ( i am just copying from zbs´s instructions you can see at the top of this thread:

                                  1. You have to ename the mod folder name from ''RK-s-Explosions-13'' to ''rks_explosions'', to make most of effects work. (Because the path of most effects in lua is still "rks_explosions", not "RK-s-Explosions-13")

                                  (That was already enough for me to make it running with FAF half a year ago...!)

                                  2
                                  @ZBC said in Let me tell you how to fix RK-s-Explosions Mod on the latest FAF game:

                                  Then, let's go to the FAF github repository to find a key file:
                                  https://github.com/FAForever/fa/blob/develop/lua/defaultexplosions.lua
                                  Download it and compare it to rks_explosions\hook\lua\defaultexplosions.lua;
                                  We can see that the contents of the function “CreateScalableUnitExplosion” have changed considerably. That is why the mod doesn't work properly.
                                  A simple solution is to overwrite the defaultexplosions.lua file in the mod with the same file in FAF, and then using your text editor, modify"function CreateScalableUnitExplosion "to the following form:
                                  function CreateScalableUnitExplosion(unit, debrisMultiplier, circularDebris)

                                  @ZBC said in Let me tell you how to fix RK-s-Explosions Mod on the latest FAF game:

                                  And, you need to add the following definition to the beginning of the moded defaultexplosions.lua file:
                                  "local SDEffectTemplate = import('/mods/rks_explosions/lua/SDEffectTemplates.lua')
                                  local NEffectTemplate = import('/mods/rks_explosions/lua/NEffectTemplates.lua')"
                                  Then you'll see that the mod will almost work (but there are still some units with incorrect fire effects, such as the Experimental Bomber, which will require some more detailed modifications, which I'm still working on)

                                  As i did not tried yet if THIS missing second step will make it running again, i will probably test this tonight and report back here!

                                  Cheers

                                  1 Reply Last reply Reply Quote 1
                                  • K Offline
                                    kettenferry
                                    last edited by

                                    So i tried as best (with near nothing in coding-experiences) to adapt all modifiactions to the lua file - wich ended in game crashing when i was trying it...
                                    😞

                                    K 1 Reply Last reply Reply Quote 0
                                    • K Offline
                                      kettenferry @kettenferry
                                      last edited by

                                      @saver By the way: really like your Unit Pack!! Your Fatboy kicks ass! 😉 👍

                                      1 Reply Last reply Reply Quote 1

                                      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                      With your input, this post could be even better 💗

                                      Register Login
                                      • First post
                                        Last post