Trigger API Reference DCEI Functions Weapon0 - BLKTower/TestWiki GitHub Wiki

Table of Contents

Trigger API Reference\DCEI Functions\Weapon {Trigger-API-ReferenceDCEI-FunctionsWeapon}

bool IsUnitWeaponEnabled(unit unit, string weaponName) {bool-IsUnitWeaponEnabledunit-unit-string-weaponName}

bool IsUnitWeaponEnabled(unit unit, string weaponName)

Description

Returns true if a weapon is enabled for a unit.

Parameters

  • unit unit the unit with the weapon.
  • string weaponName the name of the weapon to check.

Example Usage

local team_id = 1
local player_id = 1
local unit_type = "Standard MeleeUnit"
local x, y = 16, 16
local unit = DCEI.CreateUnitSync(team_id, player_id, unit_type, x, y)

local enabled
local weapons = DCEI.GetUnitWeaponList(unit)
local unit_name = DCEI.UnitName(unit)
for _, weapon in ipairs(weapons) do
    enabled = DCEI.IsUnitWeaponEnabled(unit, weapon)
    DCEI.LogMessage(unit_name .. "'s weapon " .. weapon .. (enabled and " is " or " is not ") .. "enabled for " .. unit_type)
end

Related

BehaviorModifier GetUnitWeaponDamageModifier(unit unit, string weaponName) {BehaviorModifier-GetUnitWeaponDamageModifierunit-unit-string-weaponName}

BehaviorModifier GetUnitWeaponDamageModifier(unit unit, string weaponName)

Description

Returns a BehaviorModifier for the damage modifiers on the given weapon.

Parameters

  • unit unit the unit with the weapon.
  • string weaponName the name of the weapon to check.

Example Usage

local team_id = 1
local player_id = 1
local unit_type = "Standard MeleeUnit"
local x, y = 16, 16
local unit = DCEI.CreateUnitSync(team_id, player_id, unit_type, x, y)

DCEI.ApplyBehavior(unit, "Damage Dealt Double", 2)

local damage_modifier
local weapons = DCEI.GetUnitWeaponList(unit)
local unit_name = DCEI.UnitName(unit)
for _, weapon in ipairs(weapons) do
    damage_modifier = DCEI.GetUnitWeaponDamageModifier(unit, weapon)
    DCEI.LogMessage(unit_name .. "'s weapon " .. weapon .. "has a damage multiplier of: " .. damage_modifier.multiplier_factor)
end

Related

BehaviorModifier GetUnitWeaponCriticalChanceModifier(unit unit, string weaponName) {BehaviorModifier-GetUnitWeaponCriticalChanceModifierunit-unit-string-weaponName}

BehaviorModifier GetUnitWeaponCriticalChanceModifier(unit unit, string weaponName)

Description

Returns a BehaviorModifier for the critical chance modifiers on the given weapon.

Parameters

  • unit unit the unit with the weapon.
  • string weaponName the name of the weapon to check.

Example Usage

local team_id = 1
local player_id = 1
local unit_type = "Standard MeleeUnit"
local x, y = 16, 16
local unit = DCEI.CreateUnitSync(team_id, player_id, unit_type, x, y)

DCEI.ApplyBehavior(unit, "Damage Dealt Double", 2)

local critical_modifier
local weapons = DCEI.GetUnitWeaponList(unit)
local unit_name = DCEI.UnitName(unit)
for _, weapon in ipairs(weapons) do
    critical_modifier = DCEI.GetUnitWeaponCriticalChanceModifier(unit, weapon)
    DCEI.LogMessage(unit_name .. "'s weapon " .. weapon .. " has a critical chance multiplier of: " .. critical_modifier.multiplier_factor)
end

Related

BehaviorModifier GetUnitWeaponAttackSpeedModifier(unit unit, string weaponName) {BehaviorModifier-GetUnitWeaponAttackSpeedModifierunit-unit-string-weaponName}

BehaviorModifier GetUnitWeaponAttackSpeedModifier(unit unit, string weaponName)

Description

Returns a BehaviorModifier for the attack speed modifiers on the given weapon.

Parameters

  • unit unit the unit with the weapon.
  • string weaponName the name of the weapon to check.

Example Usage

local team_id = 1
local player_id = 1
local unit_type = "Standard MeleeUnit"
local x, y = 16, 16
local unit = DCEI.CreateUnitSync(team_id, player_id, unit_type, x, y)

DCEI.ApplyBehavior(unit, "Damage Dealt Double", 2)

local speed_modifier
local weapons = DCEI.GetUnitWeaponList(unit)
local unit_name = DCEI.UnitName(unit)
for _, weapon in ipairs(weapons) do
    speed_modifier = DCEI.GetUnitWeaponAttackSpeedModifier(unit, weapon)
    DCEI.LogMessage(unit_name .. "'s weapon " .. weapon .. " has a attack speed multiplier of: " .. speed_modifier.multiplier_factor)
end

Related

float GetUnitWeaponCriticalChance(string weaponName) {float-GetUnitWeaponCriticalChancestring-weaponName}

float GetUnitWeaponCriticalChance(string weaponName)

Description

Returns the given weapon's critical chance.

Parameters

  • string weaponName the name of the weapon to check.

Example Usage

local weapon_name = "Standard MeleeUnit Weapon"
local critical_chance = DCEI.GetUnitWeaponCriticalChance(weapon_name)
DCEI.LogMessage(weapon_name .. " has an attack speed of: " .. critical_chance)

Related

float GetUnitWeaponAttackSpeed(string weaponName) {float-GetUnitWeaponAttackSpeedstring-weaponName}

float GetUnitWeaponAttackSpeed(string weaponName)

Description

Returns the given weapon's attack speed.

Parameters

  • string weaponName the name of the weapon to check.

Example Usage

local weapon_name = "Standard MeleeUnit Weapon"
local attack_speed = DCEI.GetUnitWeaponAttackSpeed(weapon_name)
DCEI.LogMessage(weapon_name .. " has an attack speed of: " .. attack_speed)

Related

void AddUnitWeapon(string unitType, string weaponName) {void-AddUnitWeaponstring-unitType-string-weaponName}

void AddUnitWeapon(string unitType, string weaponName)

Description

Parameters

Example Usage

void AddUnitWeaponSync(string unitType, string weaponName) {void-AddUnitWeaponSyncstring-unitType-string-weaponName}

void AddUnitWeaponSync(string unitType, string weaponName)

⚠️Warning⚠️: This api was deprecated at 7/19/2022, and will be removed after 90 days.

Description

Adds the given weapon to the unit type.

Parameters

  • string unitTypeName the name of the unit type.
  • string weaponName the name of the weapon to add.

Example Usage

DCEI.AddUnitWeaponSync("Standard MeleeUnit", "Standard RangedUnit Weapon")

void RemoveUnitWeapon(string unitType, string weaponName) {void-RemoveUnitWeaponstring-unitType-string-weaponName}

void RemoveUnitWeapon(string unitType, string weaponName)

Description

Parameters

Example Usage

void RemoveUnitWeaponSync(string unitType, string weaponName) {void-RemoveUnitWeaponSyncstring-unitType-string-weaponName}

void RemoveUnitWeaponSync(string unitType, string weaponName)

⚠️Warning⚠️: This api was deprecated at 7/19/2022, and will be removed after 90 days.

Description

Removes the given weapon from the unit type.

Parameters

  • string unitTypeName the name of the unit type.
  • string weaponName the name of the weapon to remove.

Example Usage

DCEI.RemoveUnitWeaponSync(unit_type, "Standard MeleeUnit Weapon")

⚠️ **GitHub.com Fallback** ⚠️