New unit on an edited campaign map does not show up

A forum to discuss custom scenarios, campaigns and modding in general.

Moderator: Panzer Corps 2 Moderators

Post Reply
Tassadar
Lieutenant Colonel - Elite Panther D
Lieutenant Colonel - Elite Panther D
Posts: 1345
Joined: Mon Mar 11, 2019 1:03 pm

New unit on an edited campaign map does not show up

Post by Tassadar »

I've been working with the existing AO campaign in the editor a bit and wanted to play a slightly edited version of the AO campaign - with changed factions, heroes and so on. After some work I managed to do a lot of things I wanted - custom core, custom heroes and a few other small details, but as I moved from Seville to Antequera I am having trouble doing one more thing.

I want to add a CR.32 fighter for the Hungarian faction on hex 3,11. While I was able to edit and add core units on the Seville map, doing the same on the Antequera map does not work - the unit simply does not spawn at all, while in Seville I could make all the changes I want to the core units placed on the map. The only way around it I found is to separately spawn it using the lua script (independent of the map file), but when doing so it remains Italian, not Hungarian:

Code: Select all

function OnNewRound(action)
	if world.round == 1 then
	
	player = 0
	zone = { {3,11}, {3,12}}
	units = { {"CR32", "", 0, 0}  }

	SpawnWaveAir(player, zone, units)

	if not world.round == 1 then return end
	
	end
end
As such my question is:

1. Is it possible to specify the faction the unit will spawn for? Adding faction=x under player = 0 does nothing.
2. If not, is there some lua script I am missing that "activates" the units added to the map in the editor?
3. If also not, possibly I am missing a trigger in the editor?
asuser
Sergeant Major - SdKfz 234/2 8Rad
Sergeant Major - SdKfz 234/2 8Rad
Posts: 628
Joined: Tue May 28, 2013 8:48 pm

Re: New unit on an edited campaign map does not show up

Post by asuser »

I think I would do it differently.

First, a player other than Italy (> 0) must be created in the editor for Hungary. Then it must be ensured in the units file that Hungary can also fly a CR.32 fighter. By default, the CR.32 fighter is only intended for Italy.
The corresponding player must then be named in the LUA command (> 0). Otherwise the LUA command does not know that a player with the nation Hungary should be assigned a CR.32 fighter.
Tassadar
Lieutenant Colonel - Elite Panther D
Lieutenant Colonel - Elite Panther D
Posts: 1345
Joined: Mon Mar 11, 2019 1:03 pm

Re: New unit on an edited campaign map does not show up

Post by Tassadar »

Thanks for the suggestion. I'm afraid however, that adding another player, even if I allowed playing as these at the same time, would refer to too many other scripts that I'd have to change in each scenario and possibly cause various issues. Might work, but seems far too complex for what I want to do.

I also did some extra checks and tried modifying existing auxiliary units placed on the Antequera map, by changing the Italian tank unit and their infantry into something else. This did not work, just as it did not work for placing a new fighter in the first place. However, this approach worked just fine in the Seville scenario where I only edited the map, not the lua file. As such, I suspect there is either a part of the script that validates the units that exists in the Seville lua, but not in the Antequera lua or there is a trigger in the scenario itself.

Also as for the CR.32 not being available for the Hungarians - from the editor level this can be overwritten without changing the Units.csv file. I already successfully used it in Seville to replace some of the existing core with a Nationalist L3/33 and a Finnish Pak 3.7 cm AT unit. In this mission I can freely modify the map core units and spam as many as I want of any kind, but not in the next mission.

EDIT - the plane somehow spawns when I open the scenario from the editor directly (as on the image provided), but not when loading it in the campaign as the next mission on the list. I wonder if the issue lies elsewhere entirely...

EDIT 2 - after some more digging it seems I found the cause, but not the solution. This issue is cause by the fact that the core is imported from the previous mission, so it overrides any core pre-placed on the map. This means the new core units can only be spawned then via the lua script. Oh well, I guess the simple solution is not feasible.
Attachments
test.jpg
test.jpg (241.37 KiB) Viewed 708 times
Post Reply

Return to “Panzer Corps 2 Scenario Design”