Author Topic: Editing this Death flash thing...  (Read 1140 times)

0 Members and 1 Guest are viewing this topic.

Editing this Death flash thing...
So, this time with a question. I've got a new, IMO really cool looking effect for this death flash script. My problem is, however, that the size of the effect varies around the value in the config file. Under normal circumstances this is probably good, but for this new effect it's a problem. For while it looks good most of the time (about 50%), it looks rather tiny sometimes (that's sub-obtimum) and from time to time it becomes annoying bright so that it would be considered a bug. I tried to find out why this happens and found following in the MVP script:

Code: [Select]
   function do_death_flash(name, number)

      -- death flash explosion
      arr_FS_List[name] = 2
      local v_F_pos = arr_FS_Pos[name]
      arr_FS_Pos[name] = nil
      local str_F_class = arr_FS_Class[name]
      arr_FS_Class[name] = nil
      local l_f_model_r = tb.ShipClasses[str_F_class].Model.Radius

      if (arr_SF_eff[str_F_class] > 0) and boolflashanifileOK then
        local n_F_rad = 1.5 * (math.random() + 0.5) * l_f_model_r * arr_SF_rad[str_F_class]        ----This line was edited
        local l_anim_flash = arr_D_eff[arr_SF_eff[str_F_class]]
        if l_anim_flash:isValid() then
          ts.createParticle(v_F_pos,v_null,f_F_time,n_F_rad,PARTICLE_BITMAP,-1,false,l_anim_flash)
        end
      end

I have actually 0 idea about LUA, but out of desperation I attempted it and removed the rest of the script until only following remained, what I put into the Explosions-sct.tbm of my mod folder (with the MVPs as secondary mod):

Code: [Select]
#Conditional Hooks

$Application: FS2_Open

$On Mission Start:

[
if not mediavps.explosionsOverride then
function do_death_flash(name, number)

   -- death flash explosion
   arr_FS_List[name] = 2
   local v_F_pos = arr_FS_Pos[name]
   arr_FS_Pos[name] = nil
   local str_F_class = arr_FS_Class[name]
   arr_FS_Class[name] = nil
   local l_f_model_r = tb.ShipClasses[str_F_class].Model.Radius

   if (arr_SF_eff[str_F_class] > 0) and boolflashanifileOK then
  local n_F_rad = 1.4 * l_f_model_r * arr_SF_rad[str_F_class]     ---- Edited line
  local l_anim_flash = arr_D_eff[arr_SF_eff[str_F_class]]
  if l_anim_flash:isValid() then
ts.createParticle(v_F_pos,v_null,f_F_time,n_F_rad,PARTICLE_BITMAP,-1,false,l_anim_flash)
  end
   end
end

end
]
#End

Surprisingly, it SEEMS to work now as I wanted, the annoying overbright glow disappeared on regular builts as far as I tested it. However, on the debug builts the effect did not show up at all. Could anybody who knows how LUA works, explain me what a "proper" working version would look like? My intention is to remove the "(math.random() + 0.5)", so that the brightness of the effect is only defined by "Flash Radius Multiplier:" in the mv_shp_exp_flashes.cfg.