World Builder - Only Infantry Scripting?
Posts: 9
I have an question: How does it work, that only one Team have no Vehicles and no mortars on their side. The other Team is normally equipped.
Please can anyone help me?
Vincent
Posts: 3421 | Subs: 11
Posts: 9
And how can I get it work on ONE side?
But Thanks for the Link
;D
Posts: 3421 | Subs: 11
One side?
for i = 1, World_GetPlayerCount() do
local player = World_GetPlayerAt(i)
--team 0 or 1
if Player_GetTeam(player) == 0 then
-- disable vehicles
end
end
Posts: 9
for i = 1, World_GetPlayerCount() do
local player = World_GetPlayerAt(i)
--team 0 or 1
if Player_GetTeam(player) == 1 then
-- disable vehicles
"su_85_mp","t_34_76_green_mp","t_34_76_mp","t_34_85_mp","t_34_85_red_banner_mp","t_70m_mp","us6_truck_mp","zis_6_transport_mp",
end
end
Posts: 3421 | Subs: 11
Quide: http://www.lua.org/pil/1.html
Browser demo to run Lua code for testing: http://www.lua.org/demo.html
Posts: 9
Can you give me an example for my Problem?
I want to learn Lua and I know i need a lot of time and I cant learn all on a day.
But please send me an example
EDIT: And I'm sorry about your Text Mark(--disable vehicles), I understood it as:
--disable vehicles
(here the ID's)
Or was my idea right?
Posts: 3421 | Subs: 11
Basically it scans SBP tables from luaconstsauto and spawns them for testing. If the spawned squad is a vehicle, it will be disabled:
Player_SetSquadProductionAvailability(World_GetPlayerAt(i), sbp, ITEM_REMOVED)
And then removed from the map. All of this is happening in less than a second.
Posts: 9
Posts: 3421 | Subs: 11
[3] = {
name = "pm-82_41_mortar_squad_mp",
isVehcle = true,
},
Note the increasing table key [n]
Posts: 9
for i = 1, World_GetPlayerCount() do
local player = World_GetPlayerAt(i)
--team 0 or 1
if Player_GetTeam(player) == 0 then
local _vehicleAbilities = {
"mechanized_grenadier_group", "supply_truck", "tiger_tank", "mortar_halftrack", "elefant_unlock", "tiger_tank_ace", "stug_short_barrel", "stug_iii_e", "armor_commander",
"mechanized_assault_group", "cmd_kv-8_unlock_mp", "cmd_advanced_t34_85_medium_tank", "cmd_t34_85_medium_tank", "cmd_isu-152", "cmd_is2_heavy_tank", "cmd_kv-1_unlock","kv-2",
}
local SBP_IsVehicle = function(sbp)
--Skip problematic squads (pak creates splats, panzer_iii causes an error due to not existing yet)
local _skip_sbp = {
[1] = {
name = "pak43",
isVehcle = true,
},
[2] = {
name = "panzer_iii",
isVehcle = true,
},
[3] = {
name = "pm-82_41_mortar_squad_mp",
isVehcle = true,
},
[4] = {
name = "hm-120_38_mortar_squad_mp",
isVehcle = true,
},
[5] = {
name = "partisan_squad_granatewerfer_34_81mm_mortar_mp",
isVehcle = true,
},
[6] = {
name = "partisan_squad_pm-82_41_mortar_mp",
isVehcle = true,
},
[7] = {
name = "granatewerfer_34_81mm_mortar_mp",
isVehcle = true,
},
}
local isVehcle = false
local pos = World_Pos(-512, -512, -512)
local skipSBP = false
for key, _sbp in ipairs(_skip_sbp) do
if string.find(BP_GetName(sbp), _sbp.name) then
isVehcle = _sbp.isVehcle
skipSBP = true
end
end
if not skipSBP then
local squad = Squad_CreateAndSpawnToward(sbp, World_GetPlayerAt(1), 1, pos, pos)
local entity = Squad_EntityAt(squad, 0)
if Entity_IsOfType(entity, "vehicle") and not Entity_IsOfType(entity, "team_weapon") then
isVehcle = true
else
isVehcle = false
end
Squad_Destroy(squad)
end
return isVehcle
end
for key, race in pairs(SBP) do
for key, sbp in pairs(race) do
if SBP_IsVehicle(sbp) then
for i = 1, World_GetPlayerCount() do
Player_SetSquadProductionAvailability(World_GetPlayerAt(i), sbp, ITEM_REMOVED)
end
end
end
end
for key, abp in ipairs(_vehicleAbilities) do
for i = 1, World_GetPlayerCount() do
Player_SetAbilityAvailability(World_GetPlayerAt(i), BP_GetAbilityBlueprint(abp), ITEM_REMOVED)
end
end
end
end
or this:
for i = 1, World_GetPlayerCount() do
local player = World_GetPlayerAt(i)
--team 0 or 1
if Player_GetTeam(player) == 0 then
-- disable vehicles
end
end
local _vehicleAbilities = {
"mechanized_grenadier_group", "supply_truck", "tiger_tank", "mortar_halftrack", "elefant_unlock", "tiger_tank_ace", "stug_short_barrel", "stug_iii_e", "armor_commander",
"mechanized_assault_group", "cmd_kv-8_unlock_mp", "cmd_advanced_t34_85_medium_tank", "cmd_t34_85_medium_tank", "cmd_isu-152", "cmd_is2_heavy_tank", "cmd_kv-1_unlock","kv-2",
}
local SBP_IsVehicle = function(sbp)
--Skip problematic squads (pak creates splats, panzer_iii causes an error due to not existing yet)
local _skip_sbp = {
[1] = {
name = "pak43",
isVehcle = true,
},
[2] = {
name = "panzer_iii",
isVehcle = true,
},
[3] = {
name = "pm-82_41_mortar_squad_mp",
isVehcle = true,
},
[4] = {
name = "hm-120_38_mortar_squad_mp",
isVehcle = true,
},
[5] = {
name = "partisan_squad_granatewerfer_34_81mm_mortar_mp",
isVehcle = true,
},
[6] = {
name = "partisan_squad_pm-82_41_mortar_mp",
isVehcle = true,
},
[7] = {
name = "granatewerfer_34_81mm_mortar_mp",
isVehcle = true,
},
}
local isVehcle = false
local pos = World_Pos(-512, -512, -512)
local skipSBP = false
for key, _sbp in ipairs(_skip_sbp) do
if string.find(BP_GetName(sbp), _sbp.name) then
isVehcle = _sbp.isVehcle
skipSBP = true
end
end
if not skipSBP then
local squad = Squad_CreateAndSpawnToward(sbp, World_GetPlayerAt(1), 1, pos, pos)
local entity = Squad_EntityAt(squad, 0)
if Entity_IsOfType(entity, "vehicle") and not Entity_IsOfType(entity, "team_weapon") then
isVehcle = true
else
isVehcle = false
end
Squad_Destroy(squad)
end
return isVehcle
end
for key, race in pairs(SBP) do
for key, sbp in pairs(race) do
if SBP_IsVehicle(sbp) then
for i = 1, World_GetPlayerCount() do
Player_SetSquadProductionAvailability(World_GetPlayerAt(i), sbp, ITEM_REMOVED)
end
end
end
end
for key, abp in ipairs(_vehicleAbilities) do
for i = 1, World_GetPlayerCount() do
Player_SetAbilityAvailability(World_GetPlayerAt(i), BP_GetAbilityBlueprint(abp), ITEM_REMOVED)
end
end
end
Or did I misunderstood it again....
Posts: 3421 | Subs: 11
Posts: 9
Learn Lua and post again. Seriously, someone else might be willing to help you step by step but you are not even getting the basic idea. Learn how stuff like variables, functions, loops, and if statements work.
I know this from C++, but i dont know the COH2 codes/commands Librarys. I can read the scripts and I know what is meant, but I dont know how to Script WITH COH2.
I dont know how CoH2 basically was maded. It gaves so many scope.
Pls can you help me now?
You know what I mean?
Posts: 3421 | Subs: 11
You can extract archives in COH2 install directory using following commands with batch (.bat or cmd window)
archive.exe -a _path_to_sga_file -e _path_to_extract_folder_
e.g.
archive.exe -a CoH2\Archives\MPScenarios.sga -e CoH2\Data
I would recommend extracting Data.sga, AttribArchive.sga, SPScenariosEF.sga
Edit: coh scar documentation: http://www.europeinruins.com/ScarDoc/
Posts: 9
Posts: 9
Livestreams
27 | |||||
19 | |||||
906 | |||||
4 | |||||
2 | |||||
2 | |||||
1 |
Ladders Top 10
-
#Steam AliasWL%Streak
- 1.831222.789+37
- 2.34957.860+14
- 3.1109614.644+10
- 4.608220.734+2
- 5.276108.719+27
- 6.305114.728+1
- 7.916405.693-2
- 8.722440.621+4
- 9.261137.656+2
- 10.1041674.607-2
Replay highlight
- cblanco ★
- 보드카 중대
- VonManteuffel
- Heartless Jäger
Board Info
8 posts in the last week
34 posts in the last month
Welcome our newest member, Dedek545
Most online: 2043 users on 29 Oct 2023, 01:04 AM