snowburn -> RE: Random Lua Elements-How, When, and Why (5/26/2015 11:07:50 PM)
|
How to set random skill levels for units: Event: Scenario Start Trigger: Scenario is loaded Action: Lua Script: function SetSkill(side_name,unit_name, min, max) local unit = ScenEdit_GetUnit({side=side_name,name=unit_name}) if unit ~= nil then local unit_id=unit.guid ScenEdit_SetUnit({guid=unit_id, proficiency = math.random(min,max) }) end end math.randomseed(os.time()) SetSkill('Irak', 'Fishbed #1', 2, 4) SetSkill('Irak', 'Fishbed #2', 2, 3) SetSkill('Irak', 'Fishbed #3', 1, 3) SetSkill('Irak', 'Fishbed #4', 0, 2) SetSkill('Irak', 'Fishbed #5', 0, 2) SetSkill('Irak', 'Fishbed #6', 0, 2)
|
|
|
|