• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Login
FAForever Forums
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Login

Effects / Emiters cleanup question

Scheduled Pinned Locked Moved Modding & Tools
14 Posts 3 Posters 783 Views
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.
  • S
    speed2
    last edited by 1 Jun 2024, 11:38

    Calling Destroy method on it will destroy it, but it wont remove it from a table you've added it to. Its gonna be there, just destroyed.

    R 1 Reply Last reply 1 Jun 2024, 12:28 Reply Quote 0
    • R
      Resin_Smoker @speed2
      last edited by 1 Jun 2024, 12:28

      @speed2 Awesome, thank you !

      Kykhu Oss https://youtu.be/JUgyGTgeZb8
      Unit Thrower https://youtu.be/iV8YBXVxxeI
      Beam Tentacle https://youtu.be/le5SNwHvC4c
      Blackhole https://www.youtube.com/watch?v=D9NGQC5rr0c
      Resurection https://www.youtube.com/watch?v=WdbIQ4vHkMs

      1 Reply Last reply Reply Quote 0
      • J
        Jip
        last edited by 1 Jun 2024, 18:02

        If ThrasherFXBag is of type TrashBag then the reference is, eventually, also removed from the table by the garbage collector.

        A work of art is never finished, merely abandoned

        1 Reply Last reply Reply Quote 0
        • J
          Jip @Resin_Smoker
          last edited by 1 Jun 2024, 18:04

          @resin_smoker said in Effects / Emiters cleanup question:

          Side note: I've also notice that not all emitters are capable of be scaled. No idea why this is or what criteria determine this. By chance anyone know?

          All emitters can be scaled, do you have a concrete snippet that can not scale according to you?

          A work of art is never finished, merely abandoned

          R 1 Reply Last reply 2 Jun 2024, 09:02 Reply Quote 0
          • R
            Resin_Smoker
            last edited by Resin_Smoker 6 Jan 2024, 18:32 1 Jun 2024, 18:17

            Was attempting to scale simple beam emitter. I believe it was with CreateAttachedBeamEmitter(). Meanwhile, I could alter the beamFX lifetime and a few other things, just couldn't not use SetScale().

            Edit: Will post a code snippet next time I'm using the computer.

            Kykhu Oss https://youtu.be/JUgyGTgeZb8
            Unit Thrower https://youtu.be/iV8YBXVxxeI
            Beam Tentacle https://youtu.be/le5SNwHvC4c
            Blackhole https://www.youtube.com/watch?v=D9NGQC5rr0c
            Resurection https://www.youtube.com/watch?v=WdbIQ4vHkMs

            1 Reply Last reply Reply Quote 0
            • R
              Resin_Smoker @Jip
              last edited by Resin_Smoker 6 Feb 2024, 09:43 2 Jun 2024, 09:02

              uea0206_Script.zip @jip

              table.insert(self.ThrasherFXBag, CreateBeamEmitterOnEntity( self, 'afterburner', self:GetArmy(), '/mods/4DFAF/effects/emitters/uea0202_afterburner_fire_beam_01/uea0202_afterburner_fire_beam_01_emit.bp'):SetEmitterParam('Lifetime', burnTime))
              

              Above is what I'm currently using, which works, minus being able to re-scale it. However, please note that I'm currently using a custom file so i can manually change the scale.

              Using :SetScale(Value) doesn't appear to change anything. Neither does :SetEmitterParam('Thickness', value) or :SetEmitterParam('length', value), which "Thickness" and "Length" are BeamBluePrint values that can be seen via a repr() of the emitter file.

              (Effect file shown below, length and thicknesses are half the original files values)

              -----------------------------------------------------------------------------
              --	File		: /4DFAF/effects/emitters/uea0202_afterburner_fire_beam_01/uea0202_afterburner_fire_beam_01_emit.bp
              --
              --	Author(s)	: EbolaSoup, Resin Smoker, Optimus Prime, Vissroid
              --
              --	Summary		: Special FX for use with Thrasher multirole fighter
              --
              --	Note		: This file is needed as the default GPG beam effect can not be rescaled via :ScaleEmitter()	
              --
              --	Copyright © 2024 4DFAF, All rights reserved.
              -----------------------------------------------------------------------------
              
              BeamBlueprint {
              	Lifetime = 3.0,
              	TextureName = '/textures/particles/missile_exhaust_fire_01.dds',
              	Thickness = 0.05,
              	StartColor = {x=1,y=1,z=1,w=0.2}, -- R,G,B,A
              	EndColor = {x=0.0,y=0.0,z=0,w=0}, -- R,G,B,A
              	Length = -1.4,
              	UShift = 0.0,
              	VShift = -0.65,
              }
              

              If your iterested or need to see the units complete .lua for context, Ive included it below. The script does run as intended, which is pretty good for a guy who hasn't scripted in 10 years.

              uea0206_Script.zip

              Kykhu Oss https://youtu.be/JUgyGTgeZb8
              Unit Thrower https://youtu.be/iV8YBXVxxeI
              Beam Tentacle https://youtu.be/le5SNwHvC4c
              Blackhole https://www.youtube.com/watch?v=D9NGQC5rr0c
              Resurection https://www.youtube.com/watch?v=WdbIQ4vHkMs

              1 Reply Last reply Reply Quote 0
              • J
                Jip
                last edited by 2 Jun 2024, 11:59

                Ah, I understand now. Not all emitters are alike, in Supreme Commander we have:

                • (1) Actual emitters
                • (2) Trails
                • (3) Beams

                You can scale (1) just fine. But (2) and (3) have a similar class, but not everything works on that class. It never did, that's not something we changed. For more information, see also:

                • https://github.com/FAForever/fa/blob/develop/engine/Sim/IEffect.lua

                And specifically SetBeamParam for beams. I'm not sure how to adjust trails in Lua.

                A work of art is never finished, merely abandoned

                R 1 Reply Last reply 2 Jun 2024, 12:41 Reply Quote 0
                • R
                  Resin_Smoker @Jip
                  last edited by Resin_Smoker 6 Feb 2024, 12:55 2 Jun 2024, 12:41

                  @jip ahh that Github helps clarity things... What I noticed right off is that I used "Length" where the Github has "LENGTH" with all capitals. Will attempt this later and post back the results.

                  Which, looking (again) at the emitter blueprint, it doesn't say specifically which type of emitter it is. (It's name does but not within the BP) Thus, its likely being defaulted by the effects Lua some where down the pipe. Figuring out which type is it, will help provide a solution or a possible path to one.

                  Side note: Would be helpful to be able to update the Lua Wiki to reflect this. As is the reference has a few holes.

                  Kykhu Oss https://youtu.be/JUgyGTgeZb8
                  Unit Thrower https://youtu.be/iV8YBXVxxeI
                  Beam Tentacle https://youtu.be/le5SNwHvC4c
                  Blackhole https://www.youtube.com/watch?v=D9NGQC5rr0c
                  Resurection https://www.youtube.com/watch?v=WdbIQ4vHkMs

                  J 1 Reply Last reply 2 Jun 2024, 13:13 Reply Quote 0
                  • R
                    Resin_Smoker
                    last edited by 2 Jun 2024, 12:58

                    I'm wondering is changing from "CreateBeamEmitterOnEntity()" to "CreateEmitterOnEntity()" would work using the same file. (Or is it CreateAttachedEmitter ? )

                    Kykhu Oss https://youtu.be/JUgyGTgeZb8
                    Unit Thrower https://youtu.be/iV8YBXVxxeI
                    Beam Tentacle https://youtu.be/le5SNwHvC4c
                    Blackhole https://www.youtube.com/watch?v=D9NGQC5rr0c
                    Resurection https://www.youtube.com/watch?v=WdbIQ4vHkMs

                    1 Reply Last reply Reply Quote 0
                    • J
                      Jip @Resin_Smoker
                      last edited by 2 Jun 2024, 13:13

                      @resin_smoker said in Effects / Emiters cleanup question:

                      Side note: Would be helpful to be able to update the Lua Wiki to reflect this. As is the reference has a few holes.

                      What Lua Wiki?

                      It's best to use the references and documentation in the repository directly, the annotations have been in the works for the past two to three years and is still being improved occasionally 🙂

                      A work of art is never finished, merely abandoned

                      R 1 Reply Last reply 2 Jun 2024, 13:51 Reply Quote 0
                      • R
                        Resin_Smoker @Jip
                        last edited by 2 Jun 2024, 13:51

                        @jip

                        https://wiki.faforever.com/en/Development/Modding/LUADOC

                        https://wiki.faforever.com/en/Development/Modding/LUAGLOBALS

                        Kykhu Oss https://youtu.be/JUgyGTgeZb8
                        Unit Thrower https://youtu.be/iV8YBXVxxeI
                        Beam Tentacle https://youtu.be/le5SNwHvC4c
                        Blackhole https://www.youtube.com/watch?v=D9NGQC5rr0c
                        Resurection https://www.youtube.com/watch?v=WdbIQ4vHkMs

                        1 Reply Last reply Reply Quote 0
                        • R
                          Resin_Smoker
                          last edited by 2 Jun 2024, 14:08

                          "LENGTH" results in... "WARNING: Error running lua script: Invalid Effect Parameter LENGTH"

                          "Length" results in... "WARNING: Error running lua script: Invalid Effect Parameter Length"

                          Using "CreateAttachedEmitter" with the Beam blueprint results in... "WARNING: Failed to create emitter as you passed in an invalid blueprint name /effects/emitters/missile_exhaust_fire_beam_01_emit.bp."

                          Kinda figured that would happen, but was worth trying it just to know for sure.

                          -Resin

                          Kykhu Oss https://youtu.be/JUgyGTgeZb8
                          Unit Thrower https://youtu.be/iV8YBXVxxeI
                          Beam Tentacle https://youtu.be/le5SNwHvC4c
                          Blackhole https://www.youtube.com/watch?v=D9NGQC5rr0c
                          Resurection https://www.youtube.com/watch?v=WdbIQ4vHkMs

                          1 Reply Last reply Reply Quote 1
                          • J
                            Jip
                            last edited by 2 Jun 2024, 19:46

                            @Resin_Smoker better to review this folder:

                            • https://github.com/FAForever/fa/blob/develop/engine

                            It has all the information on the wiki and more 🙂 . We should probably link the Wiki to that

                            A work of art is never finished, merely abandoned

                            1 Reply Last reply Reply Quote 0
                            11 out of 14
                            • First post
                              11/14
                              Last post