Creating Prototypes

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

Moderator: Panzer Corps 2 Moderators

Post Reply
jvpontilhao
Private First Class - Wehrmacht Inf
Private First Class - Wehrmacht Inf
Posts: 5
Joined: Wed Jun 24, 2020 4:05 pm

Creating Prototypes

Post by jvpontilhao »

I was searching on how to give prototype units to the player but couldn't find anything related to it on the scenario editor. Is it made on the campaign level? If yes, how can I do it?
dalfrede
Colonel - Fallschirmjäger
Colonel - Fallschirmjäger
Posts: 1490
Joined: Wed Mar 15, 2017 7:48 pm

Re: Creating Prototypes

Post by dalfrede »

-- Possible categories: Prototypes, Captured, LimitedAvailability
function AddEquipment(player_id, unit_type, quantity, category)
local player = world:GetPlayer(player_id)
local equipment = player.equipment
local type = GetUnitType(unit_type)
local eq = equipment[type]
if (eq == nil) then
eq = NewEquipment()
eq.category = category
equipment[type] = eq
end
eq.quantity = eq.quantity + quantity
player.equipment = equipment
end
Example: to get unit for capturing Hex
Village = {{27,25}}

function OnCaptureVillage(action)

-- If this flag was not captured by player 0 or 1 (Axis), do nothing
if(action.new_owner ~= 0 and action.new_owner ~= 1) then return end

if IsItemInTable(Village, action.flag) then

--Do not put other nation equipment into Prototypes

--Temporary All Campaign Bonuses Trigger


AddEquipment(0, "Ju87A", 10, Prototypes)
AddEquipment(0, "203mmM1931", 19, Captured)

else
return
end

end
There comes a time on every project when it is time to shoot the engineer and ship the damn thing.
Kerensky
Content Designer
Content Designer
Posts: 8624
Joined: Wed Jan 12, 2011 2:12 am

Re: Creating Prototypes

Post by Kerensky »

Don't think those functions work in the live version of the game yet.
Cortilein
Sergeant - 7.5 cm FK 16 nA
Sergeant - 7.5 cm FK 16 nA
Posts: 216
Joined: Mon Feb 25, 2008 10:11 am

Re: Creating Prototypes

Post by Cortilein »

dalfrede wrote: Sat Jun 27, 2020 1:48 am
eq.quantity = eq.quantity + quantity
Nice - this "equation" reminds me of Commodore Basic in the late 80s... ;D
dalfrede
Colonel - Fallschirmjäger
Colonel - Fallschirmjäger
Posts: 1490
Joined: Wed Mar 15, 2017 7:48 pm

Re: Creating Prototypes

Post by dalfrede »

With the new update, these scripts should now work.
The 1.01.04 update does not require FM or SCW.
AO:SCW requires the new scripting, the new scripting does not require AO:SCW.
There comes a time on every project when it is time to shoot the engineer and ship the damn thing.
Kerensky
Content Designer
Content Designer
Posts: 8624
Joined: Wed Jan 12, 2011 2:12 am

Re: Creating Prototypes

Post by Kerensky »

Best sample to look at for LUA scripts to give players prototypes and captured units are the Seville and Antequera scenarios. Loaded with scripts and examples in both.
Post Reply

Return to “Panzer Corps 2 Scenario Design”