I have created different pathing for different AISizeTypes on my map and I want to spawn in units and determine their AISizeType and thus their pathing via LUA.
Now as ZoomV states in this post, AISizeType is a [InstanceProperty] and should be able to being modified in the LUA script.
My function basically looks like this:
Code: Select all
OnTimerElapse(
function(timer)
if enemyCount == 0 then
enemyIndex = GetTeamMember(teamEnemy, enemyCount)
SpawnCharacter(enemyIndex, GetPathPoint("Enemy1_spawn", 0))
enemyUnit = GetCharacterUnit(enemyIndex)
SetProperty(enemyUnit, "AISizeType", "Soldier")
SetTimerValue(spawnEnemies, 2)
StartTimer(spawnEnemies)
end
if enemyCount == 1 then
enemyIndex = GetTeamMember(teamEnemy, enemyCount)
SpawnCharacter(enemyIndex, GetPathPoint("Enemy2_spawn", 0))
enemyUnit = GetCharacterUnit(enemyIndex)
SetProperty(enemyUnit, "AISizeType", "Hover")
end
enemyCount = enemyCount + 1
print("enemyCount", enemyCount)
end,
spawnEnemies
)
It would be an easy fix to spawn in different unit types that already have their AISizeType predefined in the ODF file. But in my case I want only one unit type, because the unit is also being used in other scripts.
Thanks for the help!
EDIT: I tried manipulating the MaxSpeed value in the function as a test, and it didn't work either. Am I addressing the units wrong? I saw in the Ambush script they are also using the value of GetCharacterUnit.