FAForever Forums
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Login
    1. Home
    2. Resin_Smoker
    3. Best
    R
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 43
    • Posts 232
    • Groups 0

    Posts

    Recent Best Controversial
    • Messing around with unit intel and whats possible

      Here is a unit with a series of entities that are attached / offset from the parent unit. Each entity has its own intel range that displays for the player at a roughly 45 degree angle from the point of origin. Stopping at what is exactly the units max weapon range.

      11b89425-62cd-4bb3-9bc7-7e3cc9a49b37-image.png

      As the unit moves so do the attached entities. Effectively i can apply this to any intel type that's needed. Creating a cone of intel rather than a circle. (Which is more realistic)

      Script snippet (or it didn't happen)

      CreateIntelEntity = function(self, bone, intel, radius)
          if not self.IntelEntity then
              self.IntelEntity = {}
          end
          if not self:BeenDestroyed() and radius > 0 then
              local counter = 1
              while counter <= radius do
                  local angle = math.ceil(counter / 3.14)
                  if counter + angle < radius then
                      ent = import('/lua/sim/Entity.lua').Entity({Owner = self,})
                      table.insert(self.IntelEntity, ent)
                      self.Trash:Add(ent)					
                      ent:AttachBoneTo( -1, self, bone or 0 )
                      local pos = self:CalculateWorldPositionFromRelative({0, 0, counter})
                      ent:SetParentOffset(Vector(0,0, counter))
                      ent:SetVizToFocusPlayer('Always')
                      ent:SetVizToAllies('Always')
                      ent:SetVizToNeutrals('Never')
                      ent:SetVizToEnemies('Never')
                      ent:InitIntel(self.MyArmy, intel, angle)
                      ent:EnableIntel(intel)
                  end
                  counter = counter + 1
              end	
          end
      end,	
      
      

      Currently I'm calling this from the units OnCreate to facilitate easier testing.

      OnStopBeingBuilt = function(self,builder,layer)
          TAirUnit.OnStopBeingBuilt(self,builder,layer)
      
          --Start advanced radar
          self:ForkThread(self.CreateIntelEntity,'MuzzleFront', 'Vision', 45)
      end,
      

      This could be applied to every "radar" unit in the game including units that have rotating radar antenna.s Thus allowing the intel entities to sweep an area just like a real radar! Eventually, once i unravel the mystery that is the FAF intel system, I will make a mod using this ability as well as something similar for sonar as well.

      Enjoy!

      Resin

      posted in Modding & Tools
      R
      Resin_Smoker
    • 4DFAF Uploaded

      ******* Now on FAF client for download *******
      225dab7a-f8d0-48a4-9b4e-546f837f5229-image.png

      Been working on converting the old 4th-D mod to work with FAF. Just uploaded the 1st portion of it, the original UEF units.

      A few important things of note...

      • It wont modify the preexisting units or game assets. There maybe a follow on mod later that uses the 4th-D and 4DC content for the preexisting units.

      • Currently I've not added any AI support. Partly because its likely changed quite a bit since last I modded anything, and that I'd rather get the units in a playable state first before attempting this.

      • Balancing has been quickly looked at for some units but not all. Hence your constructive input is welcome.

      All in all its taken the better part of a week to go through all 14 of the UEF original units, get them working and cleaned up. There is a far bit of new script done to improve upon or outright replace what was done using DMS.

      Two examples...

      UEF land mines in 4DC used an area sensing technique that to this day I don't fully understand. It was replaced with a "weapon" based system, but does work as intended.

      UEF Thrasher T2 fighter has a all new afterburner script. Able to use the afterburner to catch up to targets or escape. While also able to automatically adjust its Break off distance / trigger based on the type of target it has.

      Enjoy!

      Resin

      posted in Modding & Tools
      R
      Resin_Smoker
    • Predator Camouflage

      Did a short little script to allow my bot to look like any prop its standing next to.

      Video (or it didn't happen): https://youtu.be/frnP8V9ZPW8

      Script...

      -----------------------------------------------------------------------------
      --	File	 : /units/ual0204/ual0204_script.lua
      --
      --	Author(s): EbolaSoup, Resin Smoker, Optimus Prime, Vissroid
      --
      --	Summary  : Aeon T2 Sniper Bot
      --
      --	Copyright © 2024 4DFAF, All rights reserved.
      -----------------------------------------------------------------------------
      
      -- Misc Lua called
      local AWalkingLandUnit = import('/lua/aeonunits.lua').AWalkingLandUnit
      local EffectUtils = import('/lua/EffectUtilities.lua')
      local EffectTemplate = import('/lua/effecttemplates.lua')
      local Custom_4D_EffectTemplate = import('/mods/4DFAF/lua/4D_EffectTemplates.lua')
      local utilities = import('/lua/utilities.lua')
      
      local myDebug = false
      
      -- Weapon Local lua called
      local SniperWeapon = import('/lua/aeonweapons.lua').ADFDisruptorCannonWeapon
      
      -- Bones for weapon recoil effects
      local weaponBones = { 'sniper_rifle', 'sniper_barrel' }
      
      ual0204 = Class(AWalkingLandUnit) {
      	Weapons = {
      		-- Shield Piercing Rifle
      		Sniper_Piercing_Rifle = Class(SniperWeapon) {
      			PlayFxMuzzleSequence = function(self, muzzle)
      				for k, v in weaponBones do
      				   local steamEffects = EffectUtils.CreateBoneEffects( self.unit, v, self.unit:GetArmy(), EffectTemplate.WeaponSteam01 )
      				end
      				local groundEffects = EffectUtils.CreateBoneEffects( self.unit, 'ual0204', self.unit:GetArmy(), Custom_4D_EffectTemplate.ConcussionRing )
      				if self.unit.CamoEntity then
      					self.unit.CamoEntity:Destroy()
      					self.unit.CamoEntity = nil
      					self.unit:DisableIntel('Cloak')
      					self.unit:SetVizToFocusPlayer('Always')
      					self.unit:SetVizToAllies('Always')
      				end
      				SniperWeapon.PlayFxMuzzleSequence(self)
      			end,
      		},
      	},
      
      	OnCreate = function(self,builder,layer)
      		AWalkingLandUnit.OnCreate(self)
      		self:DisableIntel('Cloak')
      		self.CamoEntity = nil
      	end,
      
      	OnMotionHorzEventChange = function(self, new, old)
      		if myDebug then WARN('OnMotionHorzEventChange') end
      		if self and not self:IsDead() then
      			if new == 'Stopped' then
      				if myDebug then WARN('	Stopped') end
      				local propTbl = self:GetPropsInRadius(2)
      				local propBp = propTbl[1].prop.Blueprint
      				if myDebug then WARN('	prop blueprint '..repr(propBp) ) end
      				local mesh = propBp.Display.MeshBlueprint or nil
      				local scale = propBp.Display.UniformScale
      				if myDebug then WARN('	Mesh / Scale: ', mesh, scale) end
      				if mesh then
      					self:EnableIntel('Cloak')
      					self:SetVizToFocusPlayer('Never')
      					self:SetVizToAllies('Never')
      					self.CreateCamoEntity(self, mesh, scale)
      				end
      			else
      				if myDebug then WARN('	moving') end
      				if self.CamoEntity then
      					self.CamoEntity:Destroy()
      					self.CamoEntity = nil
      					self:DisableIntel('Cloak')
      					self:SetVizToFocusPlayer('Always')
      					self:SetVizToAllies('Always')
      				end
      
      			end
      		end
      		AWalkingLandUnit.OnMotionHorzEventChange(self, new, old)
      	end,
      
      	CreateCamoEntity = function(self, mesh, scale)
      		if myDebug then WARN('CreateCloakEntity') end
      		ent = import('/lua/sim/Entity.lua').Entity({Owner = self,})
      		ent:AttachBoneTo( -1, self, 'ual0204' )
      		ent:SetMesh(mesh)
      		ent:SetDrawScale(scale or 1)
      		ent:SetVizToFocusPlayer('Always')
      		ent:SetVizToAllies('Always')
      		ent:SetVizToNeutrals('Intel')
      		ent:SetVizToEnemies('Intel')
      		self.CamoEntity = ent
      		self.Trash:Add(ent)
      	end,
      
      	GetPropsInRadius = function(self, radius)
      		if myDebug then WARN('GetPropsInRadius') end
      		radius = radius or 1
      		local pos = self:GetPosition()
      		local props = GetReclaimablesInRect(Rect(pos[1] - radius, pos[3] - radius, pos[1] + radius, pos[3] + radius))
      		if table.getn(props) then
      			local propsByDist = {}
      			for a, b in props do
      				if not b:BeenDestroyed() then
      					if not IsUnit(b) and not b.IsWreckage then
      						table.insert(propsByDist, {dist = utilities.XZDistanceTwoVectors(pos, b:GetPosition()), prop = b})
      					end
      				end
      			end
      			if myDebug then WARN('	num props after filter: ', table.getn(propsByDist)) end
      			table.sort(propsByDist, sort_by('dist'))
      			return propsByDist
      		else
      			if myDebug then WARN('	no props in radius') end
      			return false
      		end
      	end,
      
      }
      TypeClass = ual0204
      

      Still a lot of work to do on this concept, but at least the hard part is done.

      Resin

      posted in Modding & Tools
      R
      Resin_Smoker
    • Modular Fatboy (2014)

      See attached Zip
      Modular_FatBoy.zip

      If you haven't already guessed, this mod is not going to be compatible with the current iteration of FAF. My posting here is for those that wanted to know how it was done, and thus have my permission to use what's posted here as they see fit without my support.

      Cheers!

      Resin

      posted in Modding & Tools
      R
      Resin_Smoker
    • Blast from the past, Cybran Vulcanizer!

      Cybran Vulcanizer in FAF Client: https://youtu.be/Rp5_5j8A-UI

      Resin

      posted in Modding & Tools
      R
      Resin_Smoker
    • RE: Need a second set of eyes as I'm having a issue resolving a trashbag

      Figured it out...

      Looks like something wasn't liking my use of BeamExhaustEffectsBag to store the emitters used for the afterburner effects. Dropping the Bag for locals, solved the issue completely.

      posted in Modding & Tools
      R
      Resin_Smoker
    • RE: Advanced Intel (Work in Progress)

      Uploaded a quick and dirty video: https://youtu.be/smLBx5wSLBc

      posted in Modding & Tools
      R
      Resin_Smoker
    • RE: Firey Explosions mod FAF

      @nuggets Cause explosions are all sim side mate.

      posted in Modding & Tools
      R
      Resin_Smoker
    • RE: Are these mods possible?

      (Flash back to the old 4DC days)

      While Air units can "land", and thus temporarily change layers, they cannot be permanently swapped. Thus locking them into a specific mode of travel. The Kykhu Oss, transformed via "replacement" method creating a new unit, passing the significant details, and then deleting the former. The biggest issue we encountered was saving / copying orders from one unit mode to the other. (It was possible, but only just) The AI especially had problems with this, as effectively the unit was deleted from play. With the newly spawned unit not able to be reassociated with the AI of the former. Optimus tried at length to find a work around without much success. Not that the AI was well understood at the time either, as many of the AI bells and whistles are internal to the game engine.

      Note: The Cybran Naval walker got around this by having a workaround coded directly into the game engine. Thus enabling them to use the same unit for both Sea and Land layers. Far as I know of the unit just simply shifts from one animation set to another but otherwise its all seamlessly handled engine-side.

      At one point we had a version of the Kykhu Oss that was comprised of two units. A visible and invisible unit that were both interlinked. We'd could easily control which unit was selected, visible and was subject to attacks. While this worked out great, it did have the drawback of using two unit counters. No matter what we tried, we were never able to spawn a dummy unit that didn't count against the players unit-counter.

      In hindsight, I could of easily used projectiles, just having the "land" unit leap-frog from point to point. Effectively, we'd add a dummy weapon to the unit and have it target / fire on the location we wish to jump to. The projectile created would be invisible and would use a helper-bone to attach the firing unit to. On impact the unit would be removed from the projectile that's immediately deleted from play. Thing to watch out for here is that the units hitbox could impact the ground / water before it's helper-projectile, likely damaging or destroying the unit. This can be prevented by making the projectiles hit-sphere the diameter that's equal to the units largest XYZ dimension. Though also keep in mind that the games tick-rate is poo poo, thus what we perceive as an impact may or may not occur in the same game "tick".

      @CDRMV : I'm betting that the JetPack mod will run into errors if the game is at or near its max unit count. Simply put, you'll be unable to spawn a helper unit into play if your unit counter is already maxed. That is unless the FAF folks corrected the unit count problems my 4DC team encountered.

      You could try using the projectile methods as I've detailed above. Just use the units main bone as the weapon, while not requiring it to aim. Just add the requirement that the unit face towards the target before firing. The helper_projectile spawns in (fires), runs its Lua, to attach to parent unit. Once fired, you can remove the parent unit from the projectile as it's now inherited the projectiles velocity and direction. It should continue on to impact the target location, after the helper is removed. Keep in mind that many units don't survive being dropped from a transport, so it stands to reason that the JetPacks could lead to a units death from time to time. There is a Lua for this event as that you could override within your jetpack units Lua. The override would work only for that unit if done in this way, making it compatible with most everything else.

      Edit: You may need to add a bone to your JetPack unit in Blender to get the projectile method to work. Reason this may be is that the "bone" must face in the direction you want the projectile to travel. Thus adding a "helper" bone to the units main bone via Blender should be pretty easy. Just have the units updated mesh in the /unit file with its bp. When you call upon the bone via the weapon blueprint and associated Lua, you'll need to reference the name you've chosen. Something Simple like "Helper" is usually good as this doesn't interfere with any of the other set bones. Otherwise you risk breaking the units animations. An alternate method is to create an "entity" that's attached to your unit. I think, this entity can in itself act as a weapon bone. Like i said, its been a long while. (10 years)

      posted in Modding & Tools
      R
      Resin_Smoker
    • Projectile reflections v3 (2014)

      See attached Zip
      Projectile Reflections v3.zip

      If you haven't already guessed, this mod is not going to be compatible with the current iteration of FAF. My posting here is for those that wanted to know how it was done, and thus have my permission to use what's posted here as they see fit without my support.

      Cheers!

      Resin

      posted in Modding & Tools
      R
      Resin_Smoker
    • Galactic Colossus unit thrower V0.6 (2014)

      See attached ZIP.
      GC_Unit_Thrower.zip

      If you haven't already guessed, this mod is not going to be compatible with the current iteration of FAF. My posting here is for those that wanted to know how it was done, and thus have my permission to use what's posted here as they see fit without my support.

      Cheers!

      Resin

      posted in Modding & Tools
      R
      Resin_Smoker
    • RE: Galactic Colossus unit thrower V0.6 (2014)

      Here is another video i found for it: https://www.youtube.com/watch?v=QyXpYbzFZwc

      posted in Modding & Tools
      R
      Resin_Smoker
    • RE: Black Hole Script

      Was looking over the script for this after 10 years and I wondered how I could write this complex script while so intoxicated.

      posted in Modding & Tools
      R
      Resin_Smoker
    • RE: Is there a workaround or override ?

      Success !

      5a2121f2-addb-4f43-b8d6-cbd136d5c2b1-image.png

      posted in Modding & Tools
      R
      Resin_Smoker
    • RE: Shield Drone frustration

      YES !!!! I got the shield drone to work !

      Video link (If it first doesn't work, then YouTube may still be processing it): https://youtu.be/IV39URap11s

      posted in Modding & Tools
      R
      Resin_Smoker
    • How to add Phase shields to a unit and create custom unit meshes

      I took something from the old DMS files and modified it to create a custom phase mesh for any unit with "Phasing" in its unit blue print.

      Snippet from my custom hook'd BluePrint.lua

      function Custom_4DFAF_ExtractPhaseMeshBlueprint(bp)
      
      	--Recover the mesh ID or return
      	local meshid = bp.Display.MeshBlueprint
      	if not meshid then return end
      	
      	--Pull the original unit blueprints by its mesh ID
      	local meshbp = original_blueprints.Mesh[meshid]
      	if not meshbp then return end
      	     
      	--Verify the unit type is one that we are allowed to enhance with Phasing   
      	if not table.find(bp.Categories, 'PHASING') then
      		return
      	else	 
      
      		local LODCutoff, LookupName, NormalsName, SecondaryName, ShaderName, SpecularName
      		
      		--Custom mesh modifications
      		LODCutoff = 195
      		LookupName = '/effects/entities/PhaseShield/PhaseShieldLookup.dds'
      		NormalsName = '/mods/4DFAF/lua/CustomAbilities/4D_UnitPhasing/4D_Phase_Texture.dds'              
      		ShaderName = 'ShieldSeraphim'                       
      		SpecularName = '/mods/4DFAF/lua/CustomAbilities/4D_UnitPhasing/4D_Phase_Texture.dds'  
      		
      		--Create the new mesh						
      		local phasemeshbp = table.deepcopy(meshbp)
      		phasemeshbp.Merge = true
      		if phasemeshbp.LODs then
      			for i,lod in phasemeshbp.LODs do				
      				lod.LookupName = LookupName
      				lod.NormalsName = NormalsName
      				lod.ShaderName = ShaderName
      				lod.SpecularName = SpecularName
      				lod.LODCutoff = LODCutoff
      			end
      		end
      		
      		--Save the new mesh
      		phasemeshbp.BlueprintId = meshid .. '_phaseshield'
      		bp.Display.PhaseMeshBlueprint = phasemeshbp.BlueprintId
      		MeshBlueprint(phasemeshbp)		
      	end
      end
      

      The above Script called for the following textures...
      4D_Phase_Texture.zip

      My unit blue print has the following...

      	Categories = {
      		'MODCONTENT4D',
      		'AIR',
      		'DIRECTFIRE',
      		'MOBILE',
      		'OVERLAYANTINAVY',
      		'OVERLAYDIRECTFIRE',
      		'PHASING',
      		'RECLAIMABLE',
      		'SELECTABLE',
      		'SERAPHIM',
      		'TECH3',
      		'VISIBLETORECON',
      	},
      
      	Phasing = {
      		PhasePercent = 35,
      		StartEnabled = true,
      	},
      

      The unit enables the phase shield via toggle bit "7" or via the following function...

      self:ForkThread(self.PhaseEnable)
      

      Which in turn runs... /mods/4DFAF/lua/CustomAbilities/4D_UnitPhasing/4D_UnitPhasing.lua

      -----------------------------------------------------------------------------
      --	File		  : /lua/UnitPhasing.lua
      --
      --	Author		  : Resin_Smoker
      --
      --	Summary 	  : Unit Phasing: Allows a unit so enhanced to shift it's molecules
      --					around into extra spatial dimensions becoming translucent and
      --					semi-ethereal, almost completely non corporeal.
      --					The advantage to this is that a unit so enhanced can avoid a
      --					percentage direct fire weapons by allowing them to pass thru it
      --					harmlessly! While protected from directfire projectiles, a Phased
      --					unit is still very vunerable from laser weapons, damage over time
      --					weapons, and projectile with signifigant splash damage.
      --
      --	Copyright © 2024 4DFAF, All rights reserved.
      -----------------------------------------------------------------------------
      --
      --	The following is required in the units script for UnitPhasing
      --	This calls into action the UnitPhasing scripts for SAirUnit
      --
      --	local SAirUnit = import('/lua/seraphimunits.lua').SAirUnit
      --	SAirUnit = import('/mods/4DFAF/lua/CustomAbilities/4D_UnitPhasing/4D_UnitPhasing.lua').UnitPhasing( SAirUnit )
      --
      -----------------------------------------------------------------------------
      		
      local myDebug = true
      		
      -- Start of UnitPhasing(SuperClass)
      function UnitPhasing(SuperClass)
      	return Class(SuperClass) {
      	
      	OnStopBeingBuilt = function(self, builder, layer)
      		SuperClass.OnStopBeingBuilt(self, builder, layer)
      		
      		if myDebug then WARN('UnitPhasing OnStopBeingBuilt') end
      		
      		--Phase Global Variables
      		self.MyBp = self:GetBlueprint()
      		self.PhaseBp = self.MyBp.Phasing
      		if myDebug then WARN('	PhaseBP = '..repr(self.PhaseBp)) end
      		self.OldPhaseImpact = nil
      		self.PhaseAbilityEnabled = false
      		self.PriorPhaseStatus = false
      		self:SetMaintenanceConsumptionInactive()
      		
      		--Enable Phasing if StartsOn true in BP
      		if self.PhaseBp.StartEnabled == true then
      			self:SetScriptBit('RULEUTC_SpecialToggle', true)
      		end
      		--self:ForkThread(self.PhaseEconomyHeartBeat)
      	end,
      
      	PhaseEconomyHeartBeat = function(self)
      		local cost = self.MyBp.Economy.MaintenanceConsumptionPerSecondEnergy
      		while self and not ( self:IsDead() or self:BeenDestroyed() ) do
      		
      			--Verify that economy is capabile of supporting phasing and that the unit isnt in transport
      			local econ = self:GetAIBrain():GetEconomyStored('Energy')
      			if (econ < cost and self.PhaseAbilityEnabled == true and self.PriorPhaseStatus == false) or ((self:IsUnitState('Attached') or self:IsUnitState('TransportLoading')) and (self.PhaseAbilityEnabled == true and self.PriorPhaseStatus == false)) then
      				self.PriorPhaseStatus = true
      				self:ForkThread(self.PhaseDisable)
      			elseif (econ > cost and self.PriorPhaseStatus == true and self.PhaseAbilityEnabled == false) and (not self:IsUnitState('Attached') and not self:IsUnitState('TransportUnloading') and not self:IsUnitState('TransportLoading')) then
      				self.PriorPhaseStatus = false
      				self:ForkThread(self.PhaseEnable)
      			end
      			
      			--Short delay between checks
      			WaitTicks(Random(2, 4))
      		end
      	end,
      
      	OnScriptBitSet = function(self, bit)
      		if bit == 7 then
      		
      			if myDebug then WARN('OnScriptBitSet: ', bit)end
      			
      			self:ForkThread(self.PhaseEnable)
      		end
      		SuperClass.OnScriptBitSet(self, bit)
      	end,
      
      	OnScriptBitClear = function(self, bit)	
      		if bit == 7 then
      			if self.PriorPhaseStatus == true then
      				self.PriorPhaseStatus = false
      			end
      		   
      			if myDebug then WARN('OnScriptBitClear: ', bit, '	Prior Status: ', self.PriorPhaseStatus) end
      			
      			self:ForkThread(self.PhaseDisable)
      		end
      		SuperClass.OnScriptBitClear(self, bit)
      	end,
      
      	PhaseEnable = function(self)
      		WaitSeconds(1)
      		if self and not ( self:IsDead() or self:BeenDestroyed() ) then
      		
      			if myDebug then WARN('PhaseEnable called') end
      			
      			if self.PhaseAbilityEnabled == false and not self:IsUnitState('Attached') then
      			
      				if myDebug then WARN('	Adding mesh and economy') end
      				
      				self:SetMesh(self.MyBp.Display.PhaseMeshBlueprint, true)
      				self.PhaseAbilityEnabled = true
      				self:SetMaintenanceConsumptionActive()
      			end
      		end
      	end,
      
      	PhaseDisable = function(self)
      		if self and not ( self:IsDead() or self:BeenDestroyed() ) then
      			if myDebug then WARN('PhaseDisable called') end
      			
      			if self.PhaseAbilityEnabled == true then
      			
      				if myDebug then WARN('	Removing mesh and economy') end
      							
      				self.PhaseAbilityEnabled = false
      				self:SetMaintenanceConsumptionInactive()
      				self:SetMesh(self.MyBp.Display.MeshBlueprint, true)
      			end
      		end
      	end,
      
      	OnCollisionCheck = function(self, other, firingWeapon)
      		if self and not ( self:IsDead() or self:BeenDestroyed() ) then
      		
      			if myDebug then WARN('OnCollisionCheck, % chance of Phasing = ', self.PhaseBp.PhasePercent) end
      			
      			if self.PhaseAbilityEnabled then
      				if EntityCategoryContains(categories.PROJECTILE, other) then
      				
      					--Process phase chance, allows % of projectiles to pass 
      					if myDebug then WARN(' Hit by projectile') end
      					local ran = Random(1,100)
      					if ran <= self.PhaseBp.PhasePercent or other == self.OldPhaseImpact then
      						
      						--Remember what last impacted to prevent the same projectile from being checked twice
      						self.OldPhaseImpact = other
      						
      						--Returning false allows the projectile to pass thru
      						if myDebug then WARN('	Passing projectile through') end
      						return false
      					else
      					
      						--Projectile impacts normally
      						if myDebug then WARN('	Normal impact') end
      						self.OldPhaseImpact = nil
      						return true
      					end
      				end
      			end
      			return SuperClass.OnCollisionCheck(self, other, firingWeapon)
      		end
      	end,
      }
      end
      -- End of UnitPhasing(UnitPhasing)
      

      With the resulting unit looking like this..
      8c390484-b466-4fab-a05f-798f47b4e125-image.png

      Unphased the unit looks like this...
      526c70c6-d966-420b-a1a7-69242391157f-image.png

      posted in Modding & Tools
      R
      Resin_Smoker
    • RE: Blast from the past, Cybran Vulcanizer!

      @dorset One thing I forgot to show is that the unit deploys. In its non-firing state, its a treaded unit that later deploys support legs to fire. then there is the mini-turret, that is its own unit! This way the mini-turret can fire while the main gun is deployed. Don't think that there is another unit in FAF that does this. At some point I may remove the mini-turret and add a unit enhancement thats available to activate the turret.

      posted in Modding & Tools
      R
      Resin_Smoker
    • RE: Predator Camouflage

      @indexlibrorum

      Ok made the script into a SuperClass so it can be easily added to other units, including your Nasty Cybrans!

      ----------------------------------------------------------------------------
      --	File		  : /mods/4DFAF/lua/4D_TerrainCamo/4D_TerrainCamo.lua
      --
      --	Author		  : Resin_Smoker
      --
      --	Summary 	  : Allows a unit to take the appearance of nearby props.
      --
      
      --	Copyright © 2024 4DFAF,  All rights reserved.
      ----------------------------------------------------------------------------
      --
      --	Add the following within a units PlayFxMuzzleSequence or other OnFire type event to remove Terrain Camo	
      --
      -- 	-- Remove the Camo entity and cloaking during the units weapon firing event
      -- 	if self.unit.TerrainCamoEntity then
      --		self.unit.TerrainCamoEntity:Destroy()
      --		self.unit.TerrainCamoEntity = nil
      --		if self.TerrainCamo_Unit_BP.Intel.Cloak then self.unit:DisableIntel('Cloak') end
      --		if self.TerrainCamo_Unit_BP.Intel.RadarStealth then self.unit:DisableIntel('RadarStealth') end
      --		self.unit:SetVizToFocusPlayer('Always')
      --		self.unit:SetVizToAllies('Always')
      --	end
      --
      --	Add these two line within the units lua script, adjusting the local unit info called as nessisary
      --
      --	local CLandUnit = import('/lua/cybranunits.lua').CLandUnit
      --	ClandUnit = import('/mods/4DFAF/lua/CustomAbilities/4D_TerrainCamo/4D_TerrainCamo.lua').TerrainCamo( CLandUnit )
      --
      ----------------------------------------------------------------------------
      
      -- Misc Lua called
      local utilities = import('/lua/utilities.lua')
      
      -- Set flag "true" to see script progress within the error log
      local myDebug = false
      
      ### Start of TerrainCamo(SuperClass) ###
      function TerrainCamo(SuperClass)
      	return Class(SuperClass) {
      	
      	OnCreate = function(self,builder,layer)
      		SuperClass.OnCreate(self)
      		self.TerrainCamo_Unit_BP = self:GetBlueprint()
      		
      		-- Disable unit cloak / stealth until TerrainCamo goes active
      		if self.TerrainCamo_Unit_BP.Intel.Cloak then
      			self:DisableIntel('Cloak')
      		end
      		if self.TerrainCamo_Unit_BP.Intel.RadarStealth then
      			self:DisableIntel('RadarStealth')
      		end
      		
      		-- Global for our camo entity		
      		self.TerrainCamoEntity = nil
      	end,	
      	
      	
      	OnMotionHorzEventChange = function(self, new, old)
      		if myDebug then WARN('OnMotionHorzEventChange') end
      		if self and not self:IsDead() then
      			
      			-- When the units stops, engage cloak / camo
      			if new == 'Stopped' then
      				if myDebug then WARN('	Stopped') end
      				local propTbl = self:GetPropsInRadius(2)
      				local propBp = propTbl[1].prop.Blueprint
      				if myDebug then WARN('	prop blueprint '..repr(propBp) ) end
      				local mesh = propBp.Display.MeshBlueprint or nil
      				local scale = propBp.Display.UniformScale
      				if myDebug then WARN('	Mesh / Scale: ', mesh, scale) end
      				if mesh and scale then
      					if self.TerrainCamo_Unit_BP.Intel.Cloak then self:EnableIntel('Cloak') end
      					if self.TerrainCamo_Unit_BP.Intel.RadarStealth then self:EnableIntel('RadarStealth') end					
      					self:SetVizToFocusPlayer('Never')
      					self:SetVizToAllies('Never')
      					self:ForkThread(self.CreateFlashFX)
      					self.CreateTerrainCamoEntity(self, mesh, scale)
      				end
      			else
      				-- When unit moves, remove cloak / camo
      				if myDebug then WARN('	moving') end
      				if self.TerrainCamoEntity then
      					self.TerrainCamoEntity:Destroy()
      					self.TerrainCamoEntity = nil
      					if self.TerrainCamo_Unit_BP.Intel.Cloak then self:DisableIntel('Cloak') end
      					if self.TerrainCamo_Unit_BP.Intel.RadarStealth then self:DisableIntel('RadarStealth') end					
      					self:SetVizToFocusPlayer('Always')
      					self:SetVizToAllies('Always')
      				end
      
      			end
      		end
      		SuperClass.OnMotionHorzEventChange(self, new, old)
      	end,
      		
      	CreateFlashFX = function(self)
      		--	Simple FX to make the transition nicer looking
      		self:PlayUnitSound('EnhanceStart')
      		local fx = CreateAttachedEmitter(self, -1, self.Army, '/effects/emitters/aeon_sacrifice_02_emit.bp'):ScaleEmitter(1)
      		WaitTicks(5)
      		fx:Destroy()
      	end,
      
      	CreateTerrainCamoEntity = function(self, mesh, scale)
      		if myDebug then WARN('CreateCloakEntity') end	
      		ent = import('/lua/sim/Entity.lua').Entity({Owner = self,})
      		ent:AttachBoneTo( -1, self, 0 )	
      		ent:SetMesh(mesh)	
      		ent:SetDrawScale(scale or 1)
      		ent:SetVizToFocusPlayer('Always')
      		ent:SetVizToAllies('Always')
      		ent:SetVizToNeutrals('Intel')
      		ent:SetVizToEnemies('Intel')
      		self.TerrainCamoEntity = ent
      		self.Trash:Add(ent)
      	end,
      	
      	GetPropsInRadius = function(self, radius)
      		if myDebug then WARN('GetPropsInRadius') end
      		radius = radius or 1
      		local pos = self:GetPosition()
      		local props = GetReclaimablesInRect(Rect(pos[1] - radius, pos[3] - radius, pos[1] + radius, pos[3] + radius))
      		if table.getn(props) then
      			local propsByDist = {}
      			for a, b in props do
      				if not b:BeenDestroyed() then
      					if not IsUnit(b) and not b.IsWreckage then
      						table.insert(propsByDist, {dist = utilities.XZDistanceTwoVectors(pos, b:GetPosition()), prop = b})
      					end
      				end
      			end
      			if myDebug then WARN('	num props after filter: ', table.getn(propsByDist)) end
      			table.sort(propsByDist, sort_by('dist'))
      			return propsByDist
      		else
      			if myDebug then WARN('	no props in radius') end
      			return false
      		end
      	end,	
      
      }
      end
      ### End of TerrainCamo(SuperClass) ###
      
      posted in Modding & Tools
      R
      Resin_Smoker
    • Advanced Intel (Work in Progress)

      So I've made quite a bit of progress on this mod.

      File removed as an update has been made available further down the page.

      Which allows radar based intel to extend from the unit in the shape of a cone. For Radar structures this cone rotates around its highest point. (All of this 100% works with no errors) This mod applies to all units in play.

      That being said, for units where you can toggle the radar on / off, the intel for the enemy units is permanent. Its as if the intel hasn't been cleared out (Flushed) between the time the radar was removed and later when its reactivated. Not really sure what's causing this but I'm hoping that some sharp eyed individual can spot it and possibly clue me it as to what's going on.

      Edit: I may have left some of the script dialog active, so your likely to see things in the log like "WARN" and so on. I use this to see how the script flows to better understand the mechanics of the intel system. To disable those look for local myDebug = true within defaultcomponents.lua and set as many as you find to false.

      Resin

      posted in Modding & Tools
      R
      Resin_Smoker
    • RE: Advanced Intel (Work in Progress)

      So no feed back... Glad I didn't start the 2nd half of this mod.

      posted in Modding & Tools
      R
      Resin_Smoker