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

      Digging into all this further it appears that shields are not really holding the base health figures in self.MyShield and thus the UI has to constantly refer to the units blueprint. While for units that have their shields predefined in the blueprint or enhancement this is all good, but for units that are given shields via non standard means this creates a problem. How can the shields Max and current health figures be discovered if its not held in self.MyShields? Without which It's not possible to update Unitview.lua to show the shield max for that unit during a mouse over.

      Edit: Ok figured it out...

      Apparently the shields are being treated as entities (I forgot about this). Thus its possible to call on a units shield health via...

      if self.MyShield then
      	WARN('	self.Shield: ', self.MyShield:GetMaxHealth() )	
      end
      

      This its possible to alter the Unitview.lua to work with most custom shields that are not based off a units Blueprint such as the 4DFAF shield drones.

      Modified snippet from Unitview.lua, that I will try out...

      if not shield.ShieldMaxHealth then
      	if unitBp.Enhancements then
      		shield = unitBp.Enhancements[getEnh.GetEnhancements(info.entityId).Back]
      	elseif self.MyShield then
      		shield = self.MyShield:GetMaxHealth()
      	end
      end
      

      Side note: It could just as easily be unitviewdetail.lua as I'm not ever messed with either of these before and have yet to discover what each one does despite similar names and inferred purpose.

      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

        So far my attempts to do anything with the UI are showing nothing. None of the expected outputs, or errors of any kind.

        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

          Made a little more progress... It appears that unitviewDetail.lua specifically the "show" function is responsible for this portion of the UI. That being said, not much information is being passed to it to be able to pull the units ShieldMaxHealth from anything other than its blue print. This appears to be by design if i recall, to prevent players with UI mods from being able to directly alter SIM side assets.

          Unfortunately this means that it will NOT be possible to have the units ShieldMaxHealth shown on the UI, if the unit received its shields from anything other than a blueprint.

          Only possibility is to figure out how to alter the UI from the SIM such when the drone shield is created this gets added somehow. Not sure how this would be possible, as the UI triggers on mouse over, not on the shields creation.

          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

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

            @resin_smoker said in 4DFAF Uploaded:

            I took a look at how or rather where the information of where the shields health info is coming from. Far as I can tell, this isn't being provided by the shield, but by the units blueprint. Being that our shield drone adds a P-shield to a unit there isn't a blueprint to be drawn from. Maybe there is some way to "hook" in a change for that. Unfortunately , UI modding is not my area of knowledge.

            Well if there's one thing I've observed about you Resin, whether on your own, or with the aid of someone else, you always seem to figure things out 😉

            PS: Loving the custom Cybran cloak. I always thought that every faction should have its custom cloak. Now you can differentiate UEF and Cybran cloak. While not essential, to the aesthetic lovers amongst us, a treat. Might as well bring in what you can from DMS. Something different is always good.

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

              @resin_smoker said in 4DFAF Uploaded:

              So apart from feedback, what from DMS would folks like to see incorporated?

              Maybe a list of what features are inside DMS would help feedback on what to incorporate ?

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

                @krapougnak there is litteraly too much to write about, as Domino rescripted the entire game prior to FAF.

                I'd recommend playing a vanilla SC-FA with DMS and 4DC. If you think what I've done was good, prepare to be shocked.

                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

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

                  @blackrobe sad thing is that doing so, would break the UI ban on using SIM data. It's why UI mods are allowed in ranked matches, and why most sim-side mods are not. Being able to bridge that gap would enable rampant cheating and a huge amount of desyncs.

                  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
                  • JipJ Offline
                    Jip @Resin_Smoker
                    last edited by

                    A UI mod can not interfere with sim code, except through tailored engine calls and sim callbacks. The user layer is in a separate Lua context. You can import even sim files and make edits - the simulation wouldn't notice because it runs in a separate Lua context.

                    @resin_smoker said in 4DFAF Uploaded:

                    Unfortunately this means that it will NOT be possible to have the units ShieldMaxHealth shown on the UI, if the unit received its shields from anything other than a blueprint.
                    Only possibility is to figure out how to alter the UI from the SIM such when the drone shield is created this gets added somehow. Not sure how this would be possible, as the UI triggers on mouse over, not on the shields creation.

                    We'd probably need to use a unit statistic that is synced from the sim to the UI. And then update the UI code in FAForever to read from that statistic and use the blueprint as a fallback. I'm not entirely sure about the solution because I've not investigated what the exact problem is.

                    But there's solutions if you really want them, just ask for help of the game team and maybe there's something we can do for you 🙂 .

                    A work of art is never finished, merely abandoned

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

                      @resin_smoker said in 4DFAF Uploaded:
                      If you think what I've done was good, prepare to be shocked.

                      I am prepared, shoot ! 😁 👍 👏

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

                        @jip I'm down with that... I only need the shields:GetMaxHealth() to be passed to be able to update the UI. Otherwise, the drone custom p-shield, would never be able to display without hijacking the SIM in some game breaking way.

                        Edit: Just rubbed two neurons together and made coherent thought.

                        Some smart guy, could during the game startup, use blueprint.lua to go through the units that would be drone shield capable. Then assign, what the max shield value would be as a hard value. This is effect would allow me to pass the MaxShieldHealth into the blueprint to be later used by the UI !

                        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 Resin_Smoker

                          Half way there! Here is the Blueprint.lua script to merge the data that i needed...

                          ##########################################################################################
                          ## --Add drone shield max health into unit bp so UI can use it
                          ##########################################################################################
                          
                          function Custom_Drone_MaxHealth_Blueprint(bp)
                          	if not bp then return end
                          	local id = bp.BlueprintId
                          	local bpDefense = original_blueprints.defense[id]
                          	
                          	-- Check to see if the gUnit has a Cloak, BuildRate or Economy, if so return false
                          	if bp.Intel.Cloak or bp.Defense.Shield.ShieldMaxHealth > 0 or bp.Enhancements.Shield or bp.Economy.MaintenanceConsumptionPerSecondEnergy then
                          		return false				
                          	end
                          	
                          	-- Unit Categories to exclude
                          	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',
                          	}
                          	local cats = bp.Categories
                          	for k, v in excludedCats do
                          		if table.find(cats, v) then
                          			return false
                          		end
                          	end
                          
                          	-- Calc the drone shield max health based on the unit cat
                          	local droneShieldHealth = bp.Defense.MaxHealth
                          	if table.find(bp.Categories ,'EXPERIMENTAL') then
                          		droneShieldHealth = 10000
                          	elseif table.find(bp.Categories ,'TECH3') then
                          		droneShieldHealth = droneShieldHealth * 0.3
                          	elseif table.find(bp.Categories ,'TECH2') then
                          		droneShieldHealth = droneShieldHealth * 0.5
                          	else
                          		droneShieldHealth = droneShieldHealth * 0.75
                          	end
                          	
                          	WARN('Custom_Drone_MaxHealth_Blueprint for unit ID: ', bp.General.UnitName or 'no unit name found')
                          	
                          	local unitBp = table.deepcopy(bp.Defense)
                          	if unitBp then
                          		unitBp.Merge = true
                          		unitBp.DroneShieldMaxHealth = droneShieldHealth
                          		bp.Defense = unitBp		
                          	end		
                          end
                          

                          Repr of a units "self"... Look for the "Defense" and then "DroneShieldMaxHealth"...

                          WARNING:  - Defense: table: 11FB39D8
                          WARNING:  -    AirThreatLevel: 0
                          WARNING:  -    ArmorType: Normal
                          WARNING:  -    DroneShieldMaxHealth: 235.5
                          WARNING:  -    EconomyThreatLevel: 0
                          WARNING:  -    Health: 314
                          WARNING:  -    MaxHealth: 314
                          WARNING:  -    Merge: true
                          WARNING:  -    PersonalShieldThreat: 0
                          WARNING:  -    RegenRate: 0
                          WARNING:  -    Shield: table: 11FB36B8
                          WARNING:  -       RegenAssistMult: 1
                          WARNING:  -       ShieldSize: 0
                          WARNING:  -    SubThreatLevel: 0
                          WARNING:  -    SurfaceThreatLevel: 13
                          WARNING:  -    UnknownWeaponThreat: 0
                          WARNING:  - Description: Heavy Tank
                          WARNING:  - DesiredShooterCap: 3
                          

                          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

                            Got the shield info to display, but dam it displays for everything, when it should only display when the drone-shield is active. the problem is becoming a circular one.... I need info from the sim to activate or deactivate an ability but i can't. Not without using a sim.sync.

                            Notice that the unit is showing a shield stat, without it having a shield on it...
                            34cf31d4-ac81-430a-8eba-9f148407ac42-image.png

                            Sure I can pass the data to the units blueprint, but there isn't any way that i can figure to tell the UI that the shield is active or not.

                            Question: Isn't the shield data already in Sync somewhere ?

                            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

                              How's the progress going? Its been a while since you were quite prolific on the forums. Looking forward to your next iteration.

                              1 Reply Last reply Reply Quote 1
                              • First post
                                Last post