Page 1 of 1
Creating Prototypes
Posted: Fri Jun 26, 2020 4:19 pm
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?
Re: Creating Prototypes
Posted: Sat Jun 27, 2020 1:48 am
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
Re: Creating Prototypes
Posted: Sat Jun 27, 2020 6:33 am
by Kerensky
Don't think those functions work in the live version of the game yet.
Re: Creating Prototypes
Posted: Sat Jun 27, 2020 10:00 pm
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
Re: Creating Prototypes
Posted: Fri Jul 10, 2020 12:54 pm
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.
Re: Creating Prototypes
Posted: Fri Jul 10, 2020 6:28 pm
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.