Invisible Wall Appears on Map, Blocks Units

@jip

I did just find another replay, same error, on a different map. Error occurs at 18 minutes.

https://replay.faforever.com/20925235

Yeah, I don't know what is causing the OnDamage error that floods the logs. That shows up in some logs, but not in others.

Could it be related to this code in AI Wave Survival mod? This script attaches other units onto the bones of the boss units.

AttachedLandUnitSpawn = function(self, selfId, attachedUnitId, selfBoneId)
local platOrient = self:GetOrientation()
local location = self:GetPosition()
local StellarCore = CreateUnit(attachedUnitId, self:GetArmy(), location[1], location[2], location[3], platOrient[1], platOrient[2], platOrient[3], platOrient[4], 'Land')
WaitTicks(2)
IncreaseHPForAUnit(StellarCore)
if DamageBoost ~= 'Off - 0' then
ModifyWeaponDamageBuffAndRange(StellarCore)
end
StellarCore:AttachTo(self, selfBoneId)
StellarCore:SetCreator(self)
self.Trash:Add(StellarCore)
end

@Rama try again on the FAF Develop game type, see also:

A work of art is never finished, merely abandoned

From my personal experience only things that do map flattering are buildings that are spawned outside of the map border

TA4Life: "At the very least we are not slaves to the UI" | http://www.youtube.com/user/dimatularus | http://www.twitch.tv/zlo_rd

@jip

Ah, yeah, I see the trench is in line with the Support Base. They spawn defensive buildings randomly around them every few minutes. One must have spawned off map.

Guess I can fix that by adding a check to the spawn location.

Not needed, I think - could you test my fix on the FAF Develop game type? I think I fixed the bug that ZLO mentions

A work of art is never finished, merely abandoned

@jip

Well, it would be better to not have structures/units accidentally spawn off map. And the new script I wrote up should actually be a little faster than the old one.

The new code has a X and Z check, to make sure the position is on the map. If the position is off the map, it will loop through again, randomly picking a position. This could result in an endless loop if a spawn is very near an edge and the loop keeps randomly picking off-map positions. So I added a fail safe to break the loop after so many tries.

Do you know if the function KillThread(self) will simply abort the thread? If it can't find a safe spawn, I'd prefer nothing spawn versus units/building being spawned off-map.

There can be reasons why you would want to spawns buildings outside of the map...
If it is gonna be really outside and map is not going to expand there and you just want to have some hidden buildings off map (like radar or energy for shields) Then just put them in the corners and then bug will not appear

TA4Life: "At the very least we are not slaves to the UI" | http://www.youtube.com/user/dimatularus | http://www.twitch.tv/zlo_rd

@zlo

Oh, the mod is AI Wave Survival. I'm not trying to spawn hidden buildings. All buildings/units are to be attackable by players. But the mod works on any map, and so there is a risk of defensive buildings and units spawning off map if Starting Positions (which sets the spawn points) are too close to a map edge.

I re-wrote the spawn script to check to make sure the randomly chosen spawn is actually on the map. This will prevent units/buildings from spawning off-map from Spawn Points that are too close to a map edge.

The issue is, as I am using a loop to check if the spawn is safe, and the loop runs again until a safe spawn is found, I need to add an abort to the script in the rare event it gets locked into an infinite loop. I could use BREAK to break the Repeat loop, but then the rest of the thread will run and spawn the map/building off-map.

I've added KillThread(self) instead. I was just hoping someone with more knowledge could confirm this will kill the thread and stop anything from spawning.

There's no need for your adjustments. I think I fixed the issue by adding guards before a structure flattens a bit of terrain. It should be fine now, regardless where you put the structure. Please check and confirm it is fine by launching a game on the FAF Develop gametype

A work of art is never finished, merely abandoned

@jip

Too late! I already spent hours last night re-writing the scripts and testing!

I figured it was worth doing, just to speed up the sim speed a little. The new script has only a third as many operations to complete, while the old script would call the Random function to run 12 different times when spawning a unit/building. Now it is only called 3 times.

I don't know how fast Lua is at running the Random function, but that was a lot of unnecessary work for every spawned unit. Now multiple that by hundreds of units. And I'm assuming just running a simple "ifelse = variable" is faster than calling a Random number. So, new scripts should help with spawning large waves. (Except in an issue where spawn is too close to map edge and triggers the test loop, hence why I need to add an abort to the script.)

Not that people should use the mod on maps with spawns close to map edge, but someone surely will. So just trying to correct for that issue.