I can confirm the error is now fixed
EDIT: except in the TOW missions and some skrimish maps, where the command returns with another message
ccm/ccm.luaconstauto.scar:21: attempt to index global 'BP_GetEntityBlueprint'(a nil value)
also, what I meant was how do I edit the scar file so that when I spawn buildings and such with it, that they are owned by the world player(unless a unit is selected by a player)
EDIT: broken code.
That sounds really weird. Are you able to use in standard 1v1/2v2 etc. maps without issues?
EDIT:
Fixed code for spawning as neutral if nothing is selected:
function SpawnSquadAtMouse(hkey)
local onwer = Selection.GetPlayer()
local spawn_as_neutral = not Selection.GetPlayer(true)
local page = g_help_page_index[g_settings.selected_race][2]
local num = table.getn(g_bindkeys)
local idx = ((page - 1) *num)
local index = idx + hkey
local t_source
if index == 0 then index = 1 end
if g_settings.spawntable == 1 then
t_source = g_sbp
elseif g_settings.spawntable == 2 then
t_source = g_raw_sbp
end
if index <= table.getn(t_source[g_settings.selected_race]) then
local sbp = BP_GetSquadBlueprint(t_source[g_settings.selected_race][index])
local pos = Misc_GetMouseOnTerrain()
local squad = Squad_CreateAndSpawnToward(sbp, onwer, 0, pos, pos)
DisplayText("Spawned squad "..Squad.GetText(squad))
if spawn_as_neutral then
Squad_SetWorldOwned(squad)
end
end
end
function SpawnEntityAtMouse(hkey)
local onwer = Selection.GetPlayer()
local spawn_as_neutral = not Selection.GetPlayer(true)
owner = Selection.GetPlayer()
local page = g_help_page_index[g_settings.selected_race][2]
local num = table.getn(g_bindkeys)
local idx = ((page - 1) *num)
local index = idx + hkey
local t_source
if index == 0 then index = 1 end
if g_settings.spawntable == 1 then
t_source = g_ebp
elseif g_settings.spawntable == 2 then
t_source = g_raw_ebp
end
if index <= table.getn(t_source[g_settings.selected_race]) then
local ebp = BP_GetEntityBlueprint(t_source[g_settings.selected_race][index])
local pos = Misc_GetMouseOnTerrain()
local entity = Entity_CreateAndSpawnToward(ebp, onwer, pos, pos)
DisplayText("Spawned entity "..Entity.GetText(entity))
if spawn_as_neutral then
Entity_SetWorldOwned(entity)
end
end
end
Thanks for the update!
Let me know if you run up to any issues with the script.