Creating Prototypes
Posted: Fri Jun 26, 2020 4:19 pm
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?
Example: to get unit for capturing Hex-- 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
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