Modifiers are one of the more powerful aspects of the scripting system.
Through the use of modifiers, you can make numerous drastic changes to
the behavior of squads and entities based on the premade modifiers from
the attribute editor. For a list of Modifiers look in the directory...
\W40K\Data\Attrib\Modifiers\
function Rule_CreateModifier_Name1() --[[Mod the accuracy of the Ork Turret Gunz ]] mod_modifier_name = Modifier_Create(MAT_WeaponType, "accuracy_weapon_modifier", MUT_Multiplication, false, 1.5, "ork_shoota_turret") --[[ So what does all that do? mod_modifier_name - the function Modifier_Create() returns the ID of the defined ScarModifier which we store in this variable for future use MAT_WeaponType - this is the application type, what type of modifier are you creating, others include; MAT_EntityType, MAT_Entity, MAT_Player, MAT_Squad, MAT_SquadType "accuracy_weapon_modifier" - the string name of exact modifier you are applying, found in the modifier table in the Attribute Editor or \Warhammer\Root\W40K\Data\Attrib\Modifiers\ MUT_Multiplication - the type of operation to be performed, others include; MUT_Addition, MUT_Multiplication or MUT_Enable false - a boolean (true/false) that indicates exclusivity; "true" indicates that the modifier will only ever apply once no matter how many times you add it, "false" indicates it will stack 1.5 - this is the amount the operation will add or multiply the modifier by, for enable set it to 1 or 0 "ork_shoota_turret" - the string name of the target of the modifier, either an entity, squad or weapon blueprint from Scardoc ]] --[[ Now that we've defined the modifer, let's add it ]] Rule_AddOneShot(Rule_ApplyModifier_Name1, 5) end function Rule_ApplyModifier_Name1() --[[ again we store the output of the function into a variable for later use, and we're using the variable from above and a Player ID ]] g_mod_modifier_name = Modifier_ApplyToPlayer( mod_modifier_name, playerID ) --[[ This applies the Modifier only to the, in this case, "ork_shoota_turret" 's belonging to the assigned Player We could also apply it across squads, entities or groups using; Modifier_ApplyToSquad(), Modifier_ApplyToEntity(), ModifierUtil_ApplyToSGroup() ]] --[[ Once it's applied, you can leave it for the duration of the mission or remove it ]] Rule_AddOneShot(Rule_RemoveModifier_Name1, 5) end function Rule_RemoveModifier_Name1() --[[ here we remove the modifier using the above variable ]] Modifier_Remove( g_mod_modifier_name ) --[[ and if we don't want to use it again we can destroy it as well although this is unnecessary ]] Modifier_Destroy(mod_modifier_name) end