Page 1 of 1
Guide about editor and lua scripting for creating custom campaings
Posted: Fri Jan 01, 2021 9:08 pm
by Ezequiel1996
hi guys it's there a detailed guide on how to use the editor and lua scripting for creating custom campaigns? i want to recreate the PzC original grand campaigns, but i have no clue about the scenario editor or lua scripting, does anybody knows and article or a video about it?
Re: Guide about editor and lua scripting for creating custom campaings
Posted: Fri Jan 01, 2021 10:50 pm
by dalfrede
No.
There are LUA manuals, but they don't help because PzC2 uses Subroutine Calls.
The Subroutines/Functions are PzC2 calls written in LUA, not LUA functions.
If you look at the DLC scenarios you can find any function used, each scenario has a LUA file.
They tend to have a template included before the function call.
As far a the maps go I suspect recreating the maps by hand might be the easiest way to get around the rotation issue.
If you have two computers you can have PzC1 on one and PzC2 on the other.
Just copy the terrain from to the PzC2 map. Slow but that is how the maps were made in the first place.
Re: Guide about editor and lua scripting for creating custom campaings
Posted: Sat Jan 02, 2021 1:53 am
by Ezequiel1996
oh thanks i have been experiencing with editor and i managed to create the first mission of dlc 1939, with a custom biefring, but i don't know how to create a victory condition that is achieving by acomplishing only the primary objectives. because sometimes just by acomplishing a secondary objective the missions ends with a victory, and that's not intended for sure
Re: Guide about editor and lua scripting for creating custom campaings
Posted: Sat Jan 02, 2021 4:12 am
by dalfrede
Post what you did and have Kerensky or some one look at it.
Re: Guide about editor and lua scripting for creating custom campaings
Posted: Sat Jan 02, 2021 4:34 am
by Ezequiel1996
i've actually created a script on lua following the lua script that achieves hidden units in the AO campaigns but it didn't worked, i don't know why, i did it like it was on the lua script file of the AO

Re: Guide about editor and lua scripting for creating custom campaings
Posted: Sat Jan 02, 2021 6:14 am
by Ezequiel1996
here is the script i created
VHs = {{16,16},{14,23},{10,23}}
Trainstation = {4,16}
Hangars = {{13,8},{15,10},{16,15},{17,19},{6,23},{9,13}}
string_1 = NSLOCTEXT ("scenario_Poznan", "string_1", "<bi>Staff Member: </>General hemos capturado reservas de un tanque polaco que es bastante superior a nuestros Panzers I y II, sugiero que los preparemos y utilizemos dentro de nuestras fuerzas hasta que nos entreguen los poderoso Panzer III y IV.")
string_2 = NSLOCTEXT ("scenario_Poznan", "string_2", "<bi>Staff Member: </>Mein general, con la destruccion de los hangares polacos la Luftwaffe esta mas que contenta y nos han prometido concedernos una unidad de bombarderos stuka experimentada para nuestros esfuerzos en el frente.")
function OnCaptureTrainStation(action)
if(action.new_owner ~= 0 and action.new_owner ~= 1) then return end
if IsItemInTable(Trainstation, action.flag) then
AddEquipment(0, "203mmM1931", 20, captured)
TutorialMessage(string_1)
table.insert(captured_depots, action.flag)
else
return
end
end
Re: Guide about editor and lua scripting for creating custom campaings
Posted: Sat Jan 02, 2021 6:14 am
by Ezequiel1996
im creating my campaign on spanish btw
Re: Guide about editor and lua scripting for creating custom campaings
Posted: Sat Jan 02, 2021 6:18 am
by Ezequiel1996
it's says error attempt to call a nill value ( global:IsItemInTable)
Re: Guide about editor and lua scripting for creating custom campaings
Posted: Sat Jan 02, 2021 7:38 am
by Ezequiel1996
actually i managed to solve it, i copied the utility scripts in the lua files of the official campaigns, but i've found another dead end, i tried to make a script where when you acomplish an especific objective that is achieved by destroying enemy units you get an aircraft unit, similar to antequera scenario when capturing the airfield. i used this script:
function OnObjective1(action)
if (action.side == 0 and action.objective == 1 and action.status == ObjectiveStatus.Success) then
player = 0
zone = { {4,3} }
units = { {"Ju87 B", "", 2, 1500} }
SpawnWaveAir(player, zone, units)
TutorialMessage(string_2)
end
end
function Objective1Condition(action)
return action.side == 0 and action.objective == 1 and action.status == ObjectiveStatus.Success
end
but when i acomplished the objetive of destroying units nothing happened

so what i should do to fix it?
Re: Guide about editor and lua scripting for creating custom campaings
Posted: Sat Jan 02, 2021 10:15 am
by o_t_d_x
Isnt it interesting, how hard it can be to use an editor that was advertised as: "easy to use" ?
With the old editor in panzer corps one you didnt need to program at all. And you could make things with it, even the developer never did and thought of.
They did this, to prevent the making of high quality mods, which i understand. They want to sell their dlcs first. We just can hope, that they will include the old way of scripting, with simple pull down menues.
Because even the best pc1 designers, are often lousy programmers. I gave up modding, till they make modding possible for non lua programmers. (what good for is an editor that only a very minor part of the modders can use ? and then they advertise it as easy to use even if its the complete opposite)
Re: Guide about editor and lua scripting for creating custom campaings
Posted: Sat Jan 02, 2021 5:03 pm
by Ezequiel1996
i really agree with you, its ridiculous that to create a mod, you have to actually spent like 90% of the work time scripting to make at least something decent, is cool in the way that you learn something new, but kinda useless considering the time you have to spend on a scenario multiplies by many times the time you had to spend on other editors and without having any kind of finantial reward, unless this is some kind of test to found new map or campaign developers for the game haha. i would love to see a more easy editor to use because lua scripting can be a nightmare, i spent 6 hours trying to do 2 simple triggers and ain't even get the second trigger to work that's stupid
Re: Guide about editor and lua scripting for creating custom campaings
Posted: Sat Jan 02, 2021 5:26 pm
by WookieeDavidson
I haven't used a single piece of LUA scripting in any of my campaigns, however they are extremely basic. So its 50/50, you can either have a simple working campaign or a complex time consuming campaign
Re: Guide about editor and lua scripting for creating custom campaings
Posted: Sat Jan 02, 2021 5:48 pm
by Ezequiel1996
in fact i plan on recreate the GC from panzer corps 1 i will do it because after 300hours playing PzC2 i cant play the pzc 1 too slow tbh

but i don't want to recreate it in a simple way, im planning on adding new scenarios covering events in the war, and have a similar gameplay that AO but with some improvements and for that i really need scripting or in the future a more powerful editor

Re: Guide about editor and lua scripting for creating custom campaings
Posted: Sun Jan 03, 2021 2:45 pm
by o_t_d_x
I want to port my very complex and very big pc1 mod (it includes ALL maps of the grand campaign and many that i designed completly new) into the engine of part 2.
My maps have tons of scripts, for example every unit is used, at least at the end. No units that do nothing forever, like in warshaw in 39dlc of pc2. If you bypass units, they WILL attack you and they dont do it at the same turn. You never know when they attack, because every playthrough is different.
But without the old editor, its impossible. Even if i would understand the new system perfectly, its just too much extra work. My mod has so many things, that arent in pc2 or the dlcs, so reverse engineering like kerensky does, wouldnt help me. At best i could produce a worse mod that looks better. I did so much work over years and ruined my hands nearly, so i dont want to make compromises.
Seems that we sit in the same boat, we just can wait and hope, that they help us modders, with easy to use scripting tools and the old zones. Its just frustrating, that the easiest things with the old editor of pc1, are now hard to do. But on the other hand, if we would release a game, we would want to make money with dlcs too.