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

    4DFAF Uploaded

    Scheduled Pinned Locked Moved Modding & Tools
    44 Posts 7 Posters 2.4k Views 1 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.
    • R Offline
      Resin_Smoker @foxy_pj
      last edited by Resin_Smoker

      @foxy_pj Me confused... Edit NM, just saw the PM.

      Your welcome.

      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

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

        @resin_smoker No worries Resin. I was gunna say that stealth and cloak for all but omni is good. If you have a look at the BrewLAN Mod, he has T1/T2/T3 mines that can go on land and submerse in water; and they are cloaked and stealthed to all but omni as well. If you see what he's done, It should help so you can adapt your mines the same so you see them as cloaked in FAF.

        R 1 Reply Last reply Reply Quote 0
        • R Offline
          Resin_Smoker @Blackrobe
          last edited by Resin_Smoker

          @blackrobe I just used the standard in game cloak / stealth, as It's simple and works. Though I'll give the Mod you've suggested a deep look.

          One thing to consider... The way that intel is setup "Structures" once seen, can not be un-seen, even after Intel is removed. Thus, I've setup the mines as either Land or Naval units, which allows them to once again be un-seen once the Omni source has been removed. (They just can't move) This should make them a bit more viable / functional in longer games as a result.

          Side note: I really hate that Intel perma-detects structures in this way, and would advise the FAF Dev's to address this issue. Far as I'm concerned, Intel is too powerful, too cheap, and has too great of an area of effect (especially on smaller maps).

          -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 0
          • R Offline
            Resin_Smoker
            last edited by Resin_Smoker

            Just took a look at the BrewLan mines, specifically unit SEB2220. Looks like he's also using the standard intel system for stealth, along with the "Suicide" weapon trigger event.

            --Snippet from the units blueprint
            Intel = {
                    Cloak = true,
                    RadarStealth = true,
                    SonarStealth = true,
                    VisionRadius = 0,
                    OmniRadius = 1,
                },
            
            SEB2220 = Class(MineStructureUnit) {
                Weapons = {
                    Suicide = Class(MineStructureUnit.Weapons.Suicide) {
               			FxDeathLand = EffectTemplate.TSmallYieldNuclearBombHit01,
                    },
                },
            }
            TypeClass = SEB2220
            

            Only significant change here is that the mines are using there own Omni Intel rather than other types. Thus the mines can see thru stealthed units. But notice that the mines are all labeled as Structures. This means once they've been discovered via Omni that they will always remain so, even after Omni has been removed.

            In comparison from 4DFAF unit UEB2102 (yes the identifier shows it as a structure but its not. This is deliberate)

            --Snippet from the unit blueprint
            	Intel = {
            		Cloak = true,
            		RadarStealth = true,
            		VisionRadius = 2,
            	},
            
            -----------------------------------------------------------------------------
            --	File	 : /units/ueb2102/ueb2102_script.lua
            --
            --	Author(s): EbolaSoup, Resin Smoker, Optimus Prime, Vissroid, Domino
            --
            --	Summary  : UEF Basic Land Mine Script
            --
            --	Copyright © 2024 4DFAF, All rights reserved.
            -----------------------------------------------------------------------------
            
            local bombWeap = import('/lua/sim/DefaultWeapons.lua').KamikazeWeapon
            local emtBpPath = ('/effects/emitters/')
            local TLandUnit = import('/lua/terranunits.lua').TLandUnit
            local util = import('/lua/utilities.lua')
            
            --Mine custom FX Tables
            local mineFX = {
            	emtBpPath .. 'destruction_explosion_concussion_ring_01_emit.bp',
            	emtBpPath .. 'tti_dirt02_large01_01_emit.bp',
            	emtBpPath .. 'tti_dirt02_large01_02_emit.bp',
            }
            
            ueb2102 = Class(TLandUnit) {
            
            	Weapons = {
            
            		Suicide = Class(bombWeap) {
            			OnFire = function(self)
            				--Check to see if mine has already fired once
            				if not self.unit.Detonated then
            
            					--Set flag true
            					self.unit.Detonated = true
            
            					--Trigger FX
            					self.unit:DetonateFX()
            
            					--Callback to KamikazeWeapon to perform damage
            					bombWeap.OnFire(self)
            				end
            			end,
            		},
            	},
            
            	OnCreate = function(self,builder,layer)
            		TLandUnit.OnCreate(self)
            		 --Set hitbox
            		self:SetCollisionShape('Sphere', 0, 0, 0, 0.5)
            
            		--Make the mine uncapturable
            		self:SetCapturable(false)
            
            		--Enable stealth
            		self:EnableIntel('Cloak')
            		self:EnableIntel('RadarStealth')
            
            		--Set flag to prevent multiple firings
            		self.Detonated = false
            	end,
            
            	OnDamage = function(self, instigator, amount, vector, damagetype)
            		--Trigger mine detonation if the mine is damaged
            		if self and not self:IsDead() and not self.Detonated then
            			self:GetWeaponByLabel('Suicide'):FireWeapon()
            		end
            
            		--Null the damage amount so the unit attacking the mine doesnt earn a kill counter, as it just triggered the detonation instead
            		amount = 0
            		TLandUnit.OnDamage(self, instigator, amount, vector, damagetype)
            	end,
            
            	DetonateFX = function(self)
            		--Sound FX
            		self:PlayUnitSound('Detonate')
            
            		--Do local calls
            		local army = self:GetArmy()
            		local pos = self:GetPosition()
            		local bp = self:GetBlueprint()
            		local ran = util.GetRandomFloat(0.75, 1.0)
            		local myWeapon = self:GetWeaponByLabel('Suicide')
            
            		--Disable the weapon to prevent them triggering more than once
            		self:SetWeaponEnabledByLabel('Suicide', false)
            
            		--Make FX and decals
            		for k, v in mineFX do
            			local mineEmitter01 = CreateEmitterAtBone(self,-2,army,v):ScaleEmitter(0.5)
            			self.Trash:Add(mineEmitter01)
            		end
            		CreateDecal( pos, util.GetRandomFloat(0,2*math.pi), 'nuke_scorch_001_normals', '', 'Alpha Normals', 1 + ran, 1 + ran, 150, 60, army )
            		CreateDecal( pos, util.GetRandomFloat(0,2*math.pi), 'nuke_scorch_002_albedo', '', 'Albedo', 2 + ran, 2 + ran, 150, 60, army )
            
            		--Shake camera
            		self:ShakeCamera(myWeapon:GetBlueprint().DamageRadius, 0.5, 0.25, 1)
            	end,
            
            }
            TypeClass = ueb2102
            

            Biggest difference here is that the 4DC mines have more destruction effects, impact shake and leave craters.

            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 Offline
              Resin_Smoker
              last edited by

              Uploaded V2 with bug corrections.

              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 Offline
                J_W_W
                last edited by

                Very cool that you are bringing the 4th dimension to FAF!
                I knew the mod existed, had seen some cool videos in the past, but it didn't work with the current versions of FAF.

                As FAF has so many improvements over the original, I haven't used the mod before.
                Looking forward to change that soon, many thanks for the past and present effort!

                R 1 Reply Last reply Reply Quote 0
                • R Offline
                  Resin_Smoker @J_W_W
                  last edited by

                  @j_w_w V6 is available now.

                  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 Offline
                    J_W_W
                    last edited by

                    Great! Will probably have some time later this week to try it!

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

                      @Resin_Smoker

                      Some minor bugs:

                      Seraphim:

                      • T2 Shield Drone no longer works.

                      Aeon:

                      • T2 Abolisher Beam Cannon Gunship seems to not have defensive teleportation option or ability (?)
                      • Predator Sniper Bot doesn't display any information in T2 Land Factory when hovering arrow over it.

                      Cybran:

                      • T2 Termite Stealth Insectoid doesn't move legs when walking.
                      • T4 Vulcanizer doesn't leave track marks. Also, if your order unit to move a second time, it takes about 15+ seconds for it to move. Also, what is the purpose of the "change rate of fire" toggle, other than to change the rate of fire?

                      UEF:

                      • T3 Harkon Assault Walker doesn't leave any footprints/track marks.
                      • Why does the T3 Little John Ultra Heavy Assault Tank and the T3 Harkon have more health/hit points than the T4 Exp Fatboy? Aren't T4 Experimentals always have to have the highest hit points/health?
                      R 1 Reply Last reply Reply Quote 1
                      • R Offline
                        Resin_Smoker @Blackrobe
                        last edited by

                        @blackrobe Will give it a look, but I also need to know if your using any other mods.

                        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
                        • BlackrobeB Offline
                          Blackrobe
                          last edited by

                          No mods mate. Sorry, I meant to mention that.

                          R 1 Reply Last reply Reply Quote 0
                          • R Offline
                            Resin_Smoker @Blackrobe
                            last edited by Resin_Smoker

                            @blackrobe

                            Just tested the shield drone and its fine.... maybe your running into one of the unit restrictions is has?

                            	Verification = function(self)
                            
                            		--Check to see if a shield is already active.
                            		if self.GUnit and not self.GUnit.MyShield then
                            			local gUnitBP = self.GUnit:GetBlueprint()
                            			local gUnitCats = gUnitBP.Categories
                            
                            			--Check to see if the gUnit has a Cloak, BuildRate or Economy, if so return false
                            			if gUnitBP.Intel.Cloak then
                            				if myDebug then WARN('Shield Drone Verification, reason: Cloak', gUnitBP.Intel.Cloak) end
                            				self.FailReason = 'UNIT CAN CLOAK'
                            				return false
                            			elseif gUnitBP.Defense.Shield.ShieldMaxHealth > 0 then
                            				if myDebug then WARN('Shield Drone Verification, reason: Shield in already in blue print', gUnitBP.Defense.Shield) end
                            				self.FailReason = 'UNIT CAN SHIELD FROM BLUEPRINT'
                            				return false
                            			elseif gUnitBP.Enhancements.Shield then
                            				if myDebug then WARN('Shield Drone Verification, reason: Shield Enhancement', gUnitBP.Enhancements.Shield) end
                            				self.FailReason = 'UNIT CAN SHIELD FROM ENHANCEMENT'
                            				return false
                            			elseif gUnitBP.Economy.MaintenanceConsumptionPerSecondEnergy then
                            				if myDebug then WARN('Shield Drone Verification, reason: MaintenanceConsumptionPerSecondEnergy', gUnitBP.Economy.MaintenanceConsumptionPerSecondEnergy) end
                            				self.FailReason = 'UNIT CAN HAS ENERGY MAINTENANCE CONSUPTION'
                            				return false				
                            			end
                            
                            			--Unit Categories the shield drone is not allowed to enhance
                            			local excludedCats = {
                            				--Primary unit retrictions, basicly anything that build, upgrades or makes ammo
                            				'COMMAND','SUBCOMMANDER','ENGINEER','OMNI','FACTORY','ECONOMIC','SILO',
                            				--Custom unit restrictions
                            				'DRONE','MINE','PHASING','TRANSFORMABLE',
                            				--Misc unit restrictions
                            				'POD','SATELLITE','UNTARGETABLE','SHIELD','WALL','PROJECTILE','OPERATION','CIVILIAN','INSIGNIFICANTUNIT','UNSELECTABLE','BENIGN','PROP',
                            			}
                            			--Compare the gUnit BlueWARN with the excludedCats
                            			--Should no matches be found return false
                            			for k, v in excludedCats do
                            				if table.find(gUnitCats, v) then
                            					if myDebug then
                            						WARN('*** This Unit Type Not allowed due to exclusions: ', gUnitBP.General.UnitName)
                            						WARN('*** Reason: ', excludedCats[k] )
                            					end
                            					self.FailReason = excludedCats[k]
                            					return false
                            				end
                            			end
                            			--Return true if no matches are found
                            			if myDebug then WARN('Verification passed!') end
                            			return true
                            		else
                            			--Error Sound Effect
                            			self.FailReason = 'UNIT IS SHIELDED'
                            			if myDebug then WARN('Verification failed REASON: ', self.FailReason) end
                            			return false
                            		end
                            	end,
                            

                            Keep in mind that these restrictions are in place to keep the drop from enhancing units that shouldn't be enhanced for one reason or another.

                            Continued...

                            Seraphim:

                            T2 Abolisher Beam Cannon Gunship seems to not have defensive teleportation option or ability (?)
                            Works on my end

                            Predator Sniper Bot doesn't display any information in T2 Land Factory when hovering arrow over it.
                            Added this just recently so it will be in the next update

                            Cybran:

                            T2 Termite Stealth Insectoid doesn't move legs when walking.
                            Works on my end

                            T4 Vulcanizer doesn't leave track marks. Also, if your order unit to move a second time, it takes about 15+ seconds for it to move. Also, what is the purpose of the "change rate of fire" toggle, other than to change the rate of fire?
                            Works on my end, and changing the rate of fire also changes the accuracy. Fire slower for better accuracy. Maybe I should add details for this?

                            UEF:

                            T3 Harkon Assault Walker doesn't leave any footprints/track marks.
                            It never had any

                            Why does the T3 Little John Ultra Heavy Assault Tank and the T3 Harkon have more health/hit points than the T4 Exp Fatboy? Aren't T4 Experimentals always have to have the highest hit points/health?
                            **Can adjust the hitpoints once I've received feedback from more people. Though also consider that the Fatboy is pretty weak if not supported.

                            Anyways, all that being said, most of the problems your encountering are likely the results from other mods. Either they're breaking FAF completely on their own, or they're attempting to overright something within 4DFAF. I wont know unless I've looked at some of these mods, thus having a mod list from you is critical to be able to advice you, or for me to add mod restricitions within 4DFAF's mod_info.lua. (Which would prohibit them from running with 4DFAF)

                            -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 0
                            • R Offline
                              Resin_Smoker
                              last edited by

                              Version 7 uploaded.

                              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
                              • BlackrobeB Offline
                                Blackrobe
                                last edited by

                                @Resin_Smoker

                                To reiterate, no mods in use with yours. I only test a mod on its own.

                                • Regarding Sera T2 shield Drone: it does work on some units, when you first released it, it shielded every unit and building, including ACU; I see the logic in later versions only shields some; thus my confusion. Might be good to add shield health amount, as you can't tell how strong shield is.
                                • Regarding Aoen T2 Abolisher Beam Cannon Gunship: I assumed it was a manual toggle teleport. I see it does automatically mini teleport when attacked. Very nice I might add.
                                • Regarding Cybran T2 Termite Stealth Insectoid: Still moves motionless (I even deleted any old 4dc versions then installed v7) Very odd that it works for you. Are you using FAF default as I am? Just in case you are using FAF Beta, or FAF Dev as testing. Maybe someone else will have the same issue. Can't work out why it animates walking for you and not for me, despite the only mod being used for testing.
                                • Regarding Cybran vulcanizer: Yep, def add some detail for that.

                                Yep, that's why people like yourself created T4 Assault units to compensate for Fatboy weak health.

                                Overall, nice release. A few tweaks here and there. Love to see more "transformer" units. Fantastic idea mate.

                                R 1 Reply Last reply Reply Quote 0
                                • R Offline
                                  Resin_Smoker
                                  last edited by

                                  Wait till you see bouncing and reflected projectiles.... Then there is the singularity artillery.

                                  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

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

                                    @resin_smoker said in 4DFAF Uploaded:

                                    Wait till you see bouncing and reflected projectiles.... Then there is the singularity artillery.

                                    Now we're talkin!

                                    1 Reply Last reply Reply Quote 0
                                    • R Offline
                                      Resin_Smoker
                                      last edited by Resin_Smoker

                                      Updated the Vulcanizers description test to show: "The word Overkill, accurately describes this cannons level of overwhelming firepower. Fielding a quad barreled artillery cannon with selectable rate of fire (vs accuracy) and a secondary turret for close encounters."

                                      Will look to see if i can add something similar for the toggle mouseover as well.

                                      -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
                                      • R Offline
                                        Resin_Smoker
                                        last edited by Resin_Smoker

                                        Version 8 released!

                                        -Rescaled a few units to better match with the existing scale of the games original units.
                                        -Did a fair bit of rebalancing but is by no means prefect.
                                        -Reworked the help text for many units to better describe what they do and how to better use them.
                                        -Pushed all the custom UIs to show at the end of the UI build bar, so not to crowd out the preexisting units.
                                        -Added a few more Cybran and Aeon units.

                                        Only 3 or more until left from the 4DC core units to add. These are units that I've asked Domino to work with as they've been tied into DMS code such that It would take me weeks to figure out how they work.

                                        Enjoy!

                                        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

                                        R 1 Reply Last reply Reply Quote 0
                                        • R Offline
                                          Resin_Smoker @Resin_Smoker
                                          last edited by

                                          (Evil scientist laugh) Presenting shield piercing weapons...

                                          Snippet from hook'd shield.lua

                                          do
                                          		
                                          	local oldShield = Shield
                                          	Shield = Class(oldShield) {
                                          		OnCollisionCheck = function(self,other)
                                          			if self and not self:BeenDestroyed() then       
                                          				-- Allows Shield Piercing Projectiles to ignore shields, return true to process this collision, false to ignore it.       
                                          				if EntityCategoryContains( categories.PROJECTILE, other ) and EntityCategoryContains( categories.SHIELDPIERCING, other ) then         
                                          					return false
                                          				else
                                          					return oldShield.OnCollisionCheck(self,other)
                                          				end            
                                          			end
                                          		end,
                                          	}
                                          	
                                          end
                                          

                                          Enjoy!

                                          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

                                          R 1 Reply Last reply Reply Quote 1
                                          • R Offline
                                            Resin_Smoker @Resin_Smoker
                                            last edited by Resin_Smoker

                                            Got missile redirection working for the URA0206 Vampire stealth fighter, will be included in the next update!

                                            In /hook'd unit.lua

                                            	##########################################################################################
                                            	## --Unit intel 
                                            	##########################################################################################
                                            
                                            	GetEnabledIntels = function(self)
                                            		local Intels = {}
                                            		if self.IntelDisables and table.getsize(self.IntelDisables) > 0 then 
                                            			for id, value in self.IntelDisables do				
                                            				if not Intels[id] then
                                            					Intels[id] = false
                                            				end
                                            				
                                            				local intelenabled = self:IsIntelEnabled(id)				
                                            				if intelenabled then
                                            					Intels[id] = true
                                            				else
                                            					Intels[id] = nil
                                            				end
                                            			end
                                            		end				
                                            		return Intels
                                            	end, 
                                            

                                            Superclass called by the stealth unit...

                                            ----------------------------------------------------------------------------
                                            --	File		  : /mods/4DFAF/lua/4D_CloakRedirect/4D_CloakRedirect.lua
                                            --
                                            --	Author		  : Resin_Smoker
                                            --
                                            --	Summary 	  : 4D_SDR: Allows a structure so enhanced to resist enemy fire.
                                            --
                                            --	 Special Thanks: Mithy for his redirect script
                                            
                                            --	Copyright © 2024 4DFAF,  All rights reserved.
                                            ----------------------------------------------------------------------------
                                            --
                                            --	The following is required in the units script for Struture Damage Resistance (SDR)
                                            --	This calls into action the SDR scripts for AStructureUnit
                                            --
                                            --	local CAirUnit = import('/lua/cybranunits.lua').CAirUnit
                                            --	CAirUnit = import('/mods/4DC_V0.81/lua/CustomAbilities/4D_CloakRedirect/4D_CloakRedirect.lua').CloakRedirect( CAirUnit )
                                            --
                                            ----------------------------------------------------------------------------
                                            
                                            ### Start of CloakRedirect(SuperClass) ###
                                            function CloakRedirect(SuperClass)
                                            	return Class(SuperClass) {
                                            
                                            	OnCollisionCheck = function(self, other, firingWeapon)
                                            		-- Cloaking allows 50% chance to avoid anti-air missiles
                                            		if self and not ( self:IsDead() or self:BeenDestroyed() ) then
                                            			local EffectUnit = false
                                            			local EffectsIntels = { 'CloakStealth', 'Cloak', 'CloakField', 'RadarStealth', 'RadarStealthField' }
                                            			local EnabledIntels = self:GetEnabledIntels()
                                            			
                                            			for IntelType, Param in EnabledIntels do
                                            				if table.find(EffectsIntels, IntelType) then
                                            					EffectUnit = true
                                            					break
                                            				end
                                            			end
                                            
                                            			--check if unit is in field.
                                            			if not EffectUnit then
                                            				for id, IntelType in EffectsIntels do
                                            					if self:IsInField(IntelType) then
                                            						EffectUnit = true
                                            						break
                                            					end
                                            				end
                                            			end
                                            
                                            			if EffectUnit then
                                            				if ( other:GetBlueprint().Physics.TrackTarget or EntityCategoryContains(categories.MISSILE, other) ) and Random(1, 2) == 1 then
                                            					if other:GetLauncher() then
                                            						-- Projectile returns to launcher
                                            						other:SetNewTarget(other:GetLauncher())
                                            						other:TrackTarget(true)
                                            						other.DamageData.CollideFriendly = true
                                            						other.DamageData.DamageFriendly = true
                                            						other.DamageData.DamageSelf = true
                                            						other:SetLifetime(10)
                                            						other.Redirector = self
                                            						-- *** Mithy's Function *** Hook projectile's DoDamage to set (living) redirector to instigator on impact
                                            						local prevDoDamage = other.DoDamage
                                            						other.DoDamage = function(self, instigator, damageData, targetEntity)
                                            							--This should always allow the projectile to damage its launcher
                                            							instigator = self.Redirector or self
                                            							prevDoDamage(self, instigator, damageData, targetEntity)
                                            						end
                                            					else
                                            						-- Projectile passes thru and losses tracking
                                            						other:TrackTarget(false)
                                            					end
                                            					return false
                                            				else
                                            					-- Projectile impacts normally
                                            					return true
                                            				end
                                            			end
                                            			return SuperClass.OnCollisionCheck(self, other, firingWeapon)
                                            		end
                                            	end,
                                            }
                                            end
                                            ### End of CloakRedirect(SuperClass) ###
                                            

                                            Keep in mind that the above script only applies to the unit calling the SuperClass. Hence all of the stock units won't have this ability unless modified to use the SuperClass.

                                            Enjoy!

                                            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
                                            • First post
                                              Last post