Unit
Unit is one of the basic elements in the project, skill and magic effect need to be attached to the unit to produce subsequent effects.
Functions
create_unit
Create unit.
Parameters
Variable | Type | Description |
---|---|---|
unit_id | number | Unit type ID. |
point | table | Point. |
direction | nubmer | Facing angle. |
unit: create_unit(unit_id, point, direction)
remove_unit
Delete unit.
unit:remove_unit()
Deleting a unit will trigger a Unit Destroyed Event.
Teleport_to_Point
Move unit to point instant.
Parameter
Variable | Type | Description |
---|---|---|
point | table | Target point. |
unit: Teleport_to_Point(point)
Units may get stuck in weird positions if the target point is not reachable.
set_unit_to_point
Force move unit to point.
Parameters
Variable | Type | Description |
---|---|---|
point | table | Target point. |
isSmooth | bool | Whether to move smoothly. |
unit:set_unit_to_point(point, isSmooth)
After smooth movement is checked, the unit will translate to the target point, forcing the movement to ignore restrictions such as collisions.
resurrect_unit
Resurrection unit to target point.
Parameter
Variable | Type | Description |
---|---|---|
point | table | Target point. |
unit:resurrect_unit(point)
Only units that have not been destroyed can be revived.
heals
Heal the unit.
Parameters
Variable | Type | Description |
---|---|---|
value | number | Healing amount. |
isShowTxt | bool | Whether to display skip text. |
skill | ability | Associated skill of this treatment. |
from_unit | unit | Source unit for this healing. |
txt_enum | table | Skipping style of this skipping word. |
unit:heals(value, isShowTxt, skill, from_unit, txt_enum)
add_tag
Label an organization.
Parameter
Variable | Type | Description |
---|---|---|
str | str | Label content. |
unit:add_tag(tag)
remove_tag
Remove an organization's label.
Parameter
Variable | Type | Description |
---|---|---|
str | str | Label content. |
unit:remove_tag(tag)
add_state
Add status to unit.
Parameter
Variable | Type | Description |
---|---|---|
state_enum | number | Enumeration corresponding to the state. |
unit:add_state(state_enum)
The unit's status exists counted, that is, after being added twice, it needs to be removed twice before it can actually be removed.
remove_state
Remove the status of the unit.
Parameter
Variable | Type | Description |
---|---|---|
state_enum | number | Enumeration corresponding to the state. |
unit:remove_state(state_enum)
The unit's status exists counted, that is, after being added twice, it needs to be removed twice before it can actually be removed.
learns_ability
Let units learn skills.
Parameter
Variable | Type | Description |
---|---|---|
ability_id | number | Id of the corresponding skill. |
unit:learns_ability(ability_id)
Learning requires skill points.
release_command
Issue orders to units.
Parameter
Variable | Type | Description |
---|---|---|
command | number | Player operation command. |
unit:release_command(command)
set_orientation
Set the orientation of the unit.
Parameters
Variable | Type | Description |
---|---|---|
direction | number | Steering angle of the unit. |
turn_time | number | Turn time. |
unit: set_orientation(direction, turn_time)
The unit will slowly turn its face towards it during the turn time.
set_name
Set the name of the unit.
Parameter
Variable | Type | Description |
---|---|---|
name | str | Unit name. |
unit:set_name(name)
set_description
Set the description of the unit.
Parameter
Variable | Type | Description |
---|---|---|
description | str | Unit description. |
unit:set_description(description)
set_attributes
Set the properties of the unit
Parameters
Variable | Type | Description |
---|---|---|
attrName | str | Attribute name. |
value | number | Attribute value. |
attrType | number | Attribute type. |
unit:set_attributes(attrName, value, attrType)
increase_attributes
Add unit properties.
Parameters
Variable | Type | Description |
---|---|---|
attrName | str | Attribute name. |
value | number | Attribute value. |
attrType | number | Attribute type. |
unit:increase_attributes(attrName, value, attrType)
Negative values decrease.
set_level
Set the level of the unit.
Parameter
Variable | Type | Description |
---|---|---|
level | number | Corresponding level. |
unit:set_level(level)
Downgrading does not reclaim skill points.
increase_level
Increase the level of the unit.
Parameter
Variable | Type | Description |
---|---|---|
level | number | Corresponding level. |
unit:increase_level(level)
Downgrading does not reclaim skill points.
set_exp
Set the unit's current experience.
Parameter
Variable | Type | Description |
---|---|---|
exp | number | Experience value. |
unit:set_exp(exp)
increase_exp
Add experience to units.
Parameter
Variable | Type | Description |
---|---|---|
exp | number | Experience value. |
unit:increase_exp(exp)
set_current_hp
Set the unit's current health.
Parameter
Variable | Type | Description |
---|---|---|
hp | number | Life value. |
unit:set_current_hp(hp)
increase_current_hp
Increase the unit's current health.
Parameter
Variable | Type | Description |
---|---|---|
hp | number | Life value. |
unit:increase_current_hp(hp)
set_current_mp
Set the unit's current mana.
Parameter
Variable | Type | Description |
---|---|---|
mp | number | Magic value. |
unit:set_current_mp(mp)
increase_current_mp
Increase the unit's current mana.
Parameter
Variable | Type | Description |
---|---|---|
mp | number | Magic value. |
unit:increase_current_mp(mp)
set_hero_ability_point
Set the number of skill points for a unit.
Parameter
Variable | Type | Description |
---|---|---|
skill_point | number | Number of skill points. |
unit:set_hero_ability_point(skill_point)
increase_hero_ability_point
Add skill points to units.
Parameter
Variable | Type | Description |
---|---|---|
skill_point | number | Number of skill points. |
unit:increase_hero_ability_point(skill_point)
set_unit_height
Set the flying height of the unit.
Parameters
Variable | Type | Description |
---|---|---|
height | number | Height. |
trans_time | number | Change time. |
unit:set_unit_height(height, trans_time)
After changing the altitude, the unit will slowly move past within the changing time.
set_life_cycle
Set the lifecycle of the unit.
Parameter
Variable | Type | Description |
---|---|---|
time | number | Life cycle. |
unit:set_life_cycle(time)
After the life cycle runs out, the unit will die naturally.
set_pause_state_of_life_cycle
Set a unit's lifecycle paused state.
Parameter
Variable | Type | Description |
---|---|---|
is_stop | bool | Whether to stop the life cycle lapse. |
unit:set_pause_state_of_life_cycle(is_stop)
set_alert_range
Set the alert range of the unit.
Parameter
Variable | Type | Description |
---|---|---|
range | number | Warning range. |
unit:set_alert_range(range)
set_cancel_alert_range
Set the unit's disarm range.
Parameter
Variable | Type | Description |
---|---|---|
range | number | Cancel alert range. |
unit:set_cancel_alert_range(range)
set_unit_pkg_cnt
Set the number of slots in the unit's inventory slot.
Parameter
Variable | Type | Description |
---|---|---|
number | number | Number of slots. |
unit:set_unit_pkg_cnt(number)
set_unit_bar_cnt
Set the number of slots in the unit's inventory.
Parameter
Variable | Type | Description |
---|---|---|
number | number | Number of slots. |
unit:set_unit_bar_cnt(number)
set_default_switch_behavior
Set the default behavior of units.
Parameter
Variable | Type | Description |
---|---|---|
behavior | number | Unit behavior. |
unit:set_default_switch_behavior(behavior)
set_attr_growth
Set the property growth of the unit.
Parameters
Variable | Type | Description |
---|---|---|
unit_id | number | Unit ID. |
attr_name | str | Attribute name. |
value | number | Reward value. |
unit:set_attr_growth(unit_id, attr_name, value)
set_unit_reward_exp
Set the experience value reward for the unit being killed.
Parameter
Variable | Type | Description |
---|---|---|
exp | number | Number of experience. |
unit:set_unit_reward_exp(exp)
set_unit_reward_res
Set the attribute reward of the killed player.
Parameters
Variable | Type | Description |
---|---|---|
player_attr_name | str | Player attribute name. |
value | number | Reward value. |
unit:set_unit_reward_res(player_attr_name, value)
set_attack_type
Set the unit's attack type.
Parameter
Variable | Type | Description |
---|---|---|
attack_name | str | Attack type name. |
unit:set_attack_type(attack_name)
set_armor_type
Set the armor type of the unit.
Parameter
Variable | Type | Description |
---|---|---|
armor_type_name | str | Armor type name. |
unit:set_armor_type(armor_type_name)
enable_afterimage
Turn on afterimages of units.
Parameters
Variable | Type | Description |
---|---|---|
green | number | Green. |
blue | number | Blue. |
alpha | number | Opacity. |
break_time | number | Interval time. |
show_time | number | Full display time. |
start_time | number | Start time. |
end_time | number | End time. |
is_origin_martial | bool | Whether to use the original material. |
unit:enable_afterimage(green, blue, alpha, break_time, show_time, start_time, end_time, is_origin_martial)
disable_afterimage
Turn off the afterimage of the unit.
unit:disable_afterimage()
set_afterimage_color
Set the afterimage color for units.
Parameters
Variable | Type | Description |
---|---|---|
red | number | Red. |
green | number | Green. |
blue | number | Blue. |
alpha | number | Opacity. |
unit:set_afterimage_color(red, green, blue, alpha)
set_afterimage_time
Set the afterimage time for the unit.
Parameters
Variable | Type | Description |
---|---|---|
break_time | number | Interval time. |
show_time | number | Full display time. |
start_time | number | Start time. |
end_time | number | End time. |
unit:set_afterimage_time(break_time, show_time, start_time, end_time)
set_unit_avatar
Set unit avatar.
Parameter
Variable | Type | Description |
---|---|---|
img_id | number | Image ID. |
unit:set_unit_avatar(img_id)
set_blood_bar_type
Set the unit's health bar style.
Parameter
Variable | Type | Description |
---|---|---|
bar_type_name | str | Blood bar type name. |
unit:set_blood_bar_type(bar_type_name)
set_health_bar_display
Set the health bar display mode of the unit.
Parameter
Variable | Type | Description |
---|---|---|
bar_show_type_name | str | Name of the blood bar display method. |
unit:set_health_bar_display(bar_show_type_name)
set_minimap_avatar_for_unit
Set the unit minimap avatar.
Parameter
Variable | Type | Description |
---|---|---|
img_id | number | Image ID. |
unit:set_minimap_avatar_for_unit(img_id)
set_minimap_avatar_for_enemy_unit
Set the minimap portrait of the enemy unit.
Parameter
Variable | Type | Description |
---|---|---|
img_id | number | Image ID. |
unit:set_minimap_avatar_for_enemy_unit(img_id)
set_model_scale
Set model scaling in units.
Parameter
Variable | Type | Description |
---|---|---|
scale | number | Zoom factor. |
unit:set_model_scale(scale)
set_turning_speed
Set the unit's turn speed.
Parameter
Variable | Type | Description |
---|---|---|
speed | number | Turn speed. |
unit:set_turning_speed(speed)
replace_model
Replace model.
Parameter
Variable | Type | Description |
---|---|---|
model_id | number | Model ID. |
unit:replace_model(model_id)
cancel_replace_model
Cancel model replacement.
Parameter
Variable | Type | Description |
---|---|---|
model_id | number | Model ID. |
unit: cancel_replace_model(model_id)
Restore the unit's model to how it was originally.
set_semitransparency_when_hidden_unit_is_visible
Set whether to be translucent or not when invisible.
Parameter
Variable | Type | Description |
---|---|---|
is_visible | bool | Whether translucent. |
unit:set_semitransparency_when_hidden_unit_is_visible(is_visible)
set_corpse_recyclable_status_after_fading
Set whether to recycle or not after the corpse disappears.
Parameter
Variable | Type | Description |
---|---|---|
is_recycle | bool | Whether to recycle the corpse. |
unit:set_corpse_recyclable_status_after_fading(is_recycle)
set_Xray_is_open
Set perspective state.
Parameter
Variable | Type | Description |
---|---|---|
is_open | bool | Switch. |
unit:set_Xray_is_open(is_open)
add_tech_to_unit
Units add technology.
Parameter
Variable | Type | Description |
---|---|---|
tech_id | number | Technology ID. |
unit:add_tech_to_unit(tech_id)
remove_tech_from_unit
Unit delete technology.
Parameter
Variable | Type | Description |
---|---|---|
tech_id | number | Technology ID. |
unit:remove_tech_from_unit(tech_id)
research_tech
Research technology.
Parameter
Variable | Type | Description |
---|---|---|
tech_id | number | Technology ID. |
unit:research_tech(tech_id)
play_animation
play animation.
Parameters
Variable | Type | Description |
---|---|---|
anim_name | str | Animation name. |
speed | number | Playback speed. |
start_time | number | Start time. |
end_time | number | End time. |
isloop | bool | Whether to loop. |
is_back_normal | bool | Whether to return to the default state after playback is complete. |
unit:play_animation(anim_name, speed, start_time, end_time, isloop, is_back_normal)
stop_animation
Stop animation.
Parameter
Variable | Type | Description |
---|---|---|
anim_name | str | Animation name. |
unit:stop_animation(anim_name)
change_animation
Replace animation.
Parameters
Variable | Type | Description |
---|---|---|
replace_anim_name | str | Animation name. |
bereplace_anim_name | str | Replaced animation name. |
unit:change_animation(replace_anim_name, bereplace_anim_name)
cancel_change_animation
Cancel animation replacement.
Parameters
Variable | Type | Description |
---|---|---|
replace_anim_name | str | Animation name. |
bereplace_anim_name | str | Replaced animation name. |
unit:cancel_change_animation(replace_anim_name, bereplace_anim_name)
clear_change_animation
reset animation replacement
Parameter
Variable | Type | Description |
---|---|---|
replace_anim_name | str | Animation name. |
unit:clear_change_animation(anim_name)
stop_cur_animation
Stop the currently playing animation.
unit:stop_cur_animation()
set_animation_speed
Set the animation playback rate.
Parameter
Variable | Type | Description |
---|---|---|
speed | number | Playback speed. |
unit:set_animation_speed(speed)
add_item
Add items to the store.
Parameters
Variable | Type | Description |
---|---|---|
tag_name | str | Store page name. |
item_id | number | Item ID. |
unit: add_item(tag_name, item_id)
remove_item
Remove item from store.
Parameters
Variable | Type | Description |
---|---|---|
item_name | str | Type of item. |
item_id | number | ID of the item. |
unit: remove_item(item_name, item_id)
set_item_stock
Set the inventory of items in the store.
Parameters
Variable | Type | Description |
---|---|---|
tag_name | str | Store page name. |
item_id | number | Item ID. |
number | number | Quantity. |
unit:set_item_stock(tag_name, item_id, number)
sell_item_to_shop
Sell items to shop.
Parameters
Variable | Type | Description |
---|---|---|
unit | unit | Target shop to sell the item. |
item_id | number | Item ID. |
unit:sell_item_to_shop(unit, item_id)
purchase_item_from_shop
Purchase items from the store.
Parameters
Variable | Type | Description |
---|---|---|
unit | unit | Target store to buy the item from. |
tag_num | number | Index of the tag page. |
item_id | number | Item ID. |
unit: purchase_item_from_shop(unit, tag_num, item_id)
remove_item_from_unit
Unit removes items.
Parameter
Variable | Type | Description |
---|---|---|
item_id | number | Item ID. |
unit:remove_item_from_unit(item_id)
transfer_item_to_unit
Transfer items.
Parameters
Variable | Type | Description |
---|---|---|
item | item | Item. |
type | number | Backpack slot type. |
position | number | Slot. |
is_move | bool | Whether to move if the target slot already has an item. |
unit: transfer_item_to_unit(item, type, position, is_move)
add_item_to_unit
Unit add items.
Parameter
Variable | Type | Description |
---|---|---|
item_id | number | Item ID. |
unit:add_item_to_unit(item_id)
add_modifier
Add magic effects to units.
Parameters
Variable | Type | Description |
---|---|---|
modifier_type | number | Magic effect type ID. |
source_unit | unit | Source unit. |
associated_ability | ability | Associated skill. |
seconds | number | Duration. |
duration | number | Cycle period. |
stacks | number | Number of magic effect layers. |
unit:add_modifier(modifier_type, source_unit, associated_ability, seconds, duration, stacks)
remove_modifier_type
Unit removal magic effect type.
Parameter
Variable | Type | Description |
---|---|---|
modifier_type | number | Magic effect type ID. |
unit:remove_modifier_type(modifier_type)
delete_all_modifiers_by_effect_type
Remove magic effects that affect the type.
Parameter
Variable | Type | Description |
---|---|---|
modifier_type | number | Magic effect type ID. |
unit:delete_all_modifiers_by_effect_type(modifier_type)
get_specified_modifier_type
Get the magic effect of the specified type for the unit.
Parameter
Variable | Type | Description |
---|---|---|
modifier_type | number | Magic effect type ID. |
unit:get_specified_modifier_type(modifier_type)
get_recovery_interval_of_shop_goods
Get the stock interval of store items.
Parameters
Variable | Type | Description |
---|---|---|
page | number | Page index. |
index | number | Commodity index. |
Return
Type | Description |
---|---|
number | Inventory interval. |
unit: get_recovery_interval_of_shop_goods( page, index)
get_remaining_recovery_time_of_shop_goods
Get the remaining recovery time of a store item.
Parameters
Variable | Type | Description |
---|---|---|
page | number | Page index. |
index | number | Commodity index. |
Return
Type | Description |
---|---|
number | Remaining recovery time of the item. |
unit: get_remaining_recovery_time_of_shop_goods(page, index)
remove_abilities_in_type
Remove skills (specific types).
Parameters
Variable | Type | Description |
---|---|---|
type | str | Ability type (AbilityType). |
id | number | Object code ID. |
unit:remove_abilities_in_type(type, ID)
get_abilities_by_type
Get a specific type of skill.
Parameter
Variable | Type | Description |
---|---|---|
type | str | Ability type (AbilityType). |
Return
Ability specifies the type of skill.
unit:get_abilities_by_type(type)
api_switch_ability
Exchange skill positions.
Parameters
Variable | Type | Description |
---|---|---|
ability_1 | ability | First ability. |
ability_2 | ability | Second ability. |
unit:api_switch_ability(ability_1, ability_2)
add_ability
Add skills.
Parameters
Variable | Type | Description |
---|---|---|
type | str | Ability type see AbilityType. |
id | number | Object code ID. |
slot | number | Skill slot. |
level | number | Level. |
unit:add_ability(type, ID, slot, level)
remove_ability
Remove skill.
Parameters
Variable | Type | Description |
---|---|---|
type | number | Skill position. |
slot | number | Level. |
unit:remove_ability(type, slot)
get_ability_by_type
Find skills by skill name.
Parameters
Variable | Type | Description |
---|---|---|
type | str | Ability type see AbilityType. |
ability_type | number | Skill type ID (object code ID). |
unit:get_ability_by_type(type, ability_type)
get_ability_by_slot
Acquiring the skill of a certain skill position.
Parameters
Variable | Type | Description |
---|---|---|
type | str | Ability type see AbilityType. |
slot | number | Skill slot. |
unit: get_ability_by_slot(type, slot)
get_item_by_slot
Get the item in the unit's backpack slot.
Parameters
Variable | Type | Description |
---|---|---|
type | number | Backpack slot type enumeration. |
slot | number | Slot. |
unit:get_item_by_slot(type, slot)
get_all_items
All items in the unit.
unit:get_all_items()
kill_unit
Kill unit.
Parameter
Variable | Type | Description |
---|---|---|
killer | unit | Killer. |
unit: kill_unit(killer)
create_illusion
Create illusion.
Parameters
Variable | Type | Description |
---|---|---|
illusion_unit | unit | Unit to be copied. |
call_unit | unit | Caller. |
player | player | Player who belongs to. |
point | table | Generated position. |
direction | number | Direction. |
unit: create_illusion(illusion_unit, call_unit, player, point, direction)
unit_gains_tech
Units gain technology.
Parameter
Variable | Type | Description |
---|---|---|
TECH_KEY | number | Technology ID. |
unit:unit_gains_tech(TECH_KEY)
change_unit_role
Set owning player.
Parameter
Variable | Type | Description |
---|---|---|
player | player | Player. |
unit:change_unit_role(player)
get_tech_list
Traversing research and development technology to do actions.
Return
Type | Description |
---|---|
table | Technology list. |
unit:get_tech_list()
get_affect_techs
Traversing applied technology doing actions.
Return
Type | Description |
---|---|
table | Technology list. |
unit:get_affect_techs()
get_shop_item_list
Iterate through the items in the store to perform actions.
Parameter
Variable | Type | Description |
---|---|---|
tag_name | str | Tab name. |
Return
Type | Description |
---|---|
table | Product list. |
unit:get_shop_item_list(tag_name)
get_current_unit_hp
Get the current health value.
Return
Type | Description |
---|---|
number | Life value. |
unit:get_current_unit_hp()
get_current_unit_mp
Get the current mana.
Return
Type | Description |
---|---|
number | Magic value. |
unit:get_current_unit_mp()
get_attr_other
Get the property of the unit's extra property type.
Parameter
Variable | Type | Description |
---|---|---|
attr_name | str | Attribute name. |
Return
Type | Description |
---|---|
number | Attribute value. |
unit:get_attr_other(attr_name)
get_attr_base
Get the property of the unit's base property type.
Parameter
Variable | Type | Description |
---|---|---|
attr_name | str | Attribute name. |
Return
Type | Description |
---|---|
number | Attribute value. |
unit:get_attr_base(attr_name)
get_attr_base_ratio
Get the attribute of the unit's basic attribute bonus type.
Parameter
Variable | Type | Description |
---|---|---|
attr_name | str | Attribute name. |
Return
Type | Description |
---|---|
number | Attribute value. |
unit:get_attr_base_ratio(attr_name)
get_attr_bonus
Get properties of unity gain property type.
Parameter
Variable | Type | Description |
---|---|---|
attr_name | str | Attribute name. |
Return
Type | Description |
---|---|
number | Attribute value. |
unit:get_attr_bonus(attr_name)
get_attr_all_ratio
Get the attribute of the unit's total attribute bonus type.
Parameter
Variable | Type | Description |
---|---|---|
attr_name | str | Attribute name. |
Return
Type | Description |
---|---|
number | Attribute value. |
unit:get_attr_all_ratio(attr_name)
get_attr_bonus_ratio
Get the attribute of the unit gain attribute bonus type.
Parameter
Variable | Type | Description |
---|---|---|
attr_name | str | Attribute name. |
Return
Type | Description |
---|---|
number | Attribute value. |
unit:get_attr_bonus_ratio(attr_name)
get_unit_attribute_growth
Get unit attribute growth.
Parameters
Variable | Type | Description |
---|---|---|
unit_id | number | Unit ID. |
attr_name | str | Attribute name. |
Return
Type | Description |
---|---|
number | Attribute value. |
unit: get_unit_attribute_growth(unit_id, attr_name)
get_life_cycle_of_unit
Get unit lifecycle.
Return
Type | Description |
---|---|
number | Lifetime of the unit. |
unit:get_life_cycle_of_unit()
get_height
Get unit flight altitude.
Return
Type | Description |
---|---|
number | Flight altitude. |
unit:get_height()
get_unit_turning_speed
Get unit turn speed.
Return
Type | Description |
---|---|
number | Turn speed. |
unit:get_unit_turning_speed()
get_unit_alert_range
Get unit alert range.
Return
Type | Description |
---|---|
number | Warning range. |
unit:get_unit_alert_range()
get_unit_cancel_alert_range
Get unit cancel alert range.
Return
Type | Description |
---|---|
number | Cancel the warning range. |
unit:get_unit_cancel_alert_range()
get_unit_collision_radius
Get the unit collision radius.
Return
Type | Description |
---|---|
number | Collision radius. |
unit:get_unit_collision_radius()
get_unit_resource_cost
Get unit construction resource consumption property.
Parameters
Variable | Type | Description |
---|---|---|
unit_id | number | Unit ID. |
player_attr_name | str | Player resource name consumed. |
Return
Type | Description |
---|---|
number | Resource consumption value. |
unit:get_unit_resource_cost(unit_id, player_attr_name)
get_player_attribute_gained_from_killing_unit
Get the attribute of the player who was killed by the unit.
Parameter
Variable | Type | Description |
---|---|---|
player_attr_name | str | Player resource name that can be obtained. |
Return
Type | Description |
---|---|
number | Resource consumption value. |
unit:get_player_attribute_gained_from_killing_unit(player_attr_name)
get_scale
Get the unit scale.
Return
Type | Description |
---|---|
number | Zoom factor. |
unit:get_scale()
get_unit_selection_range_scale
Get unit selection circle zoom.
Return
Type | Description |
---|---|
number | Zoom factor. |
unit:get_unit_selection_range_scale()
get_unit_xaxis_scale
Get the X-axis scaling of the unit.
Return
Type | Description |
---|---|
number | Zoom factor. |
unit:get_unit_xaxis_scale()
get_unit_zaxis_scale
Get the Z-axis scaling of the unit.
Return
Type | Description |
---|---|
number | Zoom factor. |
unit:get_unit_zaxis_scale()
get_unit_yaxis_scale
Get the Y-axis scaling of the unit.
Return
Type | Description |
---|---|
number | Zoom factor. |
unit:get_unit_yaxis_scale()
get_shop_purchase_range
Get the purchase scope of the store.
Return
Type | Description |
---|---|
number | Purchase range. |
unit:get_shop_purchase_range()
get_unit_level
Get unit level.
Return
Type | Description |
---|---|
number | Rank of the unit. |
unit:get_unit_level()
get_key
Get the unit type ID of the unit.
Return
Type | Description |
---|---|
number | Unit type ID. |
unit:get_key()
get_current_exp_of_unit
Get the current experience value of the unit.
Return
Type | Description |
---|---|
number | Unit type ID. |
unit:get_current_exp_of_unit()
get_exp_required_for_current_upgrade
Gain the experience needed for the unit's current upgrade.
Return
Type | Description |
---|---|
number | Unit type ID. |
unit:get_exp_required_for_current_upgrade()
get_hero_ability_point_number
Get the hero's skill points.
Return
Type | Description |
---|---|
number | Unit type ID. |
unit:get_hero_ability_point_number()
get_unit_bag_slot_number
Get the number of slots in the unit's inventory.
Return
Type | Description |
---|---|
number | Unit type ID. |
unit:get_unit_bag_slot_number()
get_unit_inventory_slot_number
Get the number of slots in the unit's inventory.
Return
Type | Description |
---|---|
number | Unit type ID. |
unit:get_unit_inventory_slot_number()
get_item_type_number_of_unit
Get the number of item types owned by the unit.
Parameters
Variable | Type | Description |
---|---|---|
item_id | item ID |
Return
Type | Description |
---|---|
number | Unit type ID. |
unit:get_item_type_number_of_unit(item_id)
get_exp_gained_from_killing_unit
Get unit kill experience.
Return
Type | Description |
---|---|
number | Unit type ID. |
unit:get_exp_gained_from_killing_unit()
get_shield_value_of_specified_type_for_unit
Get the shield value of the specified shield type for the unit.
Parameter
Variable | Type | Description |
---|---|---|
shield_type_name | str | Shield type name. |
Return
Type | Description |
---|---|
number | Shield value. |
unit:get_shield_value_of_specified_type_for_unit(shield_type_name)
get_shop_tab_number
Get the number of store tabs.
Return
Type | Description |
---|---|
number | Number of tabs. |
unit:get_shop_tab_number()
get_shop_item_stock
Get the store's item inventory.
Parameters
Variable | Type | Description |
---|---|---|
tag_index | number | Store tag index. |
item_id | number | Item ID. |
Return
Type | Description |
---|---|
number | Inventory quantity. |
unit: get_shop_item_stock(tag_index, item_id)
get_unit_name
Get unit name.
Return
Type | Description |
---|---|
str | Unit name. |
unit:get_unit_name()
get_unit_description
Get the description of the unit.
Return
Type | Description |
---|---|
str | Description of the unit. |
unit:get_unit_description()
get_unit_type_name
Get unit type name.
Parameter
Variable | Type | Description |
---|---|---|
unit_id | number | Unit type ID. |
Return
Type | Description |
---|---|
str | Unit type name. |
unit:get_unit_type_name(unit_id)
get_unit_type_description
Get the description of the unit type.
Parameter
Variable | Type | Description |
---|---|---|
unit_id | number | Unit type ID. |
Return
Type | Description |
---|---|
str | Unit type description. |
unit:get_unit_type_description(unit_id)
get_shop_tab_name
Get the store's page signature.
Parameter
Variable | Type | Description |
---|---|---|
unit_id | number | Unit type ID. |
Return
Type | Description |
---|---|
str | Store's page signature. |
unit:get_shop_tab_name(tag_index)
get_unit_subtype
Get unit classification.
Return
Type | Description |
---|---|
number | Unit classification. |
unit:get_unit_subtype()
get_image_of_unit_type_icon
Get the avatar of the unit type.
Parameter
Variable | Type | Description |
---|---|---|
unit_id | number | Unit type ID. |
Return
Type | Description |
---|---|
number | Picture ID. |
unit:get_image_of_unit_type_icon(unit_id)
get_unit_type
Get unit type.
Return
Type | Description |
---|---|
number | Unit type ID. |
unit:get_unit_type()
last_unit_created
Last created unit.
Return
Type | Description |
---|---|
unit | Unit to create. |
unit:last_unit_created()
get_unit_owner
Get the owner of the unit unit.
Return
Type | Description |
---|---|
unit | Owner of the unit unit. |
unit:get_unit_owner()
get_illusion_summoner
Get the summoner of visions.
Return
Type | Description |
---|---|
unit | Caller of the illusion. |
unit:get_illusion_summoner()
get_unit_orientation
Get the orientation of the unit.
Return
Type | Description |
---|---|
number | Orientation of the unit. |
unit:get_unit_orientation()
get_armor_type
Get armor type.
Return
Type | Description |
---|---|
number | Armor type ID. |
unit:get_armor_type()
get_attack_type
Get attack type.
Return
Type | Description |
---|---|
number | Attack type ID. |
unit:get_attack_type()
get_shop_goods
Get items from the store.
Parameters
Variable | Type | Description |
---|---|---|
tag_index | number | Tag index. |
item_index | number | Item index. |
Return
Type | Description |
---|---|
item | Item. |
unit: get_shop_goods(tag_index, item_index)
get_current_unit_model
Get the current model of the unit.
Return
Type | Description |
---|---|
number | Model ID. |
unit:get_current_unit_model()
get_original_unit_model
Get the original model of the unit.
Return
Type | Description |
---|---|
number | Model ID. |
unit:get_original_unit_model()
get_unit_location_point
Get the location of the unit.
Return
Type | Description |
---|---|
point | Point where the unit is located. |
unit:get_unit_location_point()
get_nearest_reachable_point_to_unit
Get the nearest passable point of the unit.
Return
Type | Description |
---|---|
point | Passable point. |
unit:get_nearest_reachable_point_to_unit()
get_camp
Get unit's team.
Return
Type | Description |
---|---|
number | Team ID. |
unit:get_camp()
has_tag
Whether to have a label or not.
Parameter
Variable | Type | Description |
---|---|---|
tag_name | str | Tag name. |
Return
Type | Description |
---|---|
bool | Whether to have this tag. |
unit:has_tag(tag_name)
is_unit_alive
Whether to survive or not.
Return
Type | Description |
---|---|
bool | Whether the unit is alive. |
unit:is_unit_alive()
visibility_of_unit
Whether it is visible or not.
Parameter
Variable | Type | Description |
---|---|---|
target_unit | unit | Target unit. |
Return
Type | Description |
---|---|
bool | Is it visible. |
unit:visibility_of_unit(target_unit)
is_unit_moving
Whether the unit is moving or not.
Return
Type | Description |
---|---|
bool | Whether the unit is moving. |
unit:is_unit_moving()
is_in_radius
Whether it is near the unit or not.
Parameters
Variable | Type | Description |
---|---|---|
point_or_unit | unit/point | Target unit/point. |
range | number | Range. |
Return
Type | Description |
---|---|
bool | Whether it is in the unit range. |
unit:is_in_radius(point_or_unit, range)
unit_is_shop
Whether the unit is a store or not.
Return
Type | Description |
---|---|
bool | Whether it is a store. |
unit:unit_is_shop()
is_unit_illusion
Whether the unit is an illusion or not.
Return
Type | Description |
---|---|
bool | Whether the unit is an illusion. |
unit:is_unit_illusion()
unit_in_group
Whether the unit is in the unit group or not.
Parameter
Variable | Type | Description |
---|---|---|
group | unit_group | Unit group. |
Return
Type | Description |
---|---|
bool | Whether the unit is in a unit group. |
unit: unit_in_group(group)
is_in_battle
Whether the unit is in combat or not.
Return
Type | Description |
---|---|
bool | Whether the unit is in combat. |
unit:is_in_battle()
has_buff_status
Whether the unit has a designated status or not.
Parameter
Variable | Type | Description |
---|---|---|
state_name | str | State name. |
Return
Type | Description |
---|---|
bool | Whether the unit has the assigned state. |
unit:has_buff_status(state_name)
check_has_ability_type
Whether the unit has a specific type of skill or not.
Parameter
Variable | Type | Description |
---|---|---|
ability_id | number | Skill type ID. |
Return
Type | Description |
---|---|
bool | Whether the unit has the specified type of skill. |
unit:check_has_ability_type(ability_id)
unit_has_item
Whether there are items or not.
Parameter
Variable | Type | Description |
---|---|---|
item | item | Item. |
Return
Type | Description |
---|---|
bool | Whether the unit has a corresponding item. |
unit: unit_has_item(item)
unit_has_item_name
Whether there are items of the specified type or not.
Parameter
Variable | Type | Description |
---|---|---|
item_id | number | Item type ID. |
Return
Type | Description |
---|---|
bool | Whether the unit has items of the specified type. |
unit:unit_has_item_name(item_id)
unit_has_modifier
Whether the unit has magic effect or not.
Parameter
Variable | Type | Description |
---|---|---|
modifier_id | number | Magic effect type ID. |
Return
Type | Description |
---|---|
bool | Whether the unit has the assigned state. |
unit: unit_has_modifier(modifier_id)
unit_has_modifier_style
Whether the unit has magic effects of the specified affect type or not.
Parameter
Variable | Type | Description |
---|---|---|
state_name | str | State name. |
Return
Type | Description |
---|---|
bool | Whether the unit has magic effects of the specified affect type. |
unit:unit_has_modifier_style(modifier_type_name)
unit_has_modifier_tag
Whether the unit has the magic effects with specified tags or not.
Parameter
Variable | Type | Description |
---|---|---|
tag_name | str | Tag name. |
Return
Type | Description |
---|---|
bool | Whether the unit has the magic effect of the specified tag. |
unit: unit_has_modifier_tag(tag_name)
check_unit_key_precondition
Whether the unit type precondition is passed or not.
Parameters
Variable | Type | Description |
---|---|---|
player | player | Corresponding player. |
unit_id | number | Unit type ID. |
Return
Type | Description |
---|---|
bool | Whether the unit has the assigned state. |
unit. check_unit_key_precondition(player, unit_id)
is_enemy_relation
Whether the unit is a hostile relationship or not.
Parameter
Variable | Type | Description |
---|---|---|
target_unit | unit | Target unit. |
Return
Type | Description |
---|---|
bool | Whether the unit is hostile to the target unit. |
unit:is_enemy_relation(target_unit)
can_teleport_to
Whether the unit can be sent to the point or not.
Parameter
Variable | Type | Description |
---|---|---|
point | point | Target point. |
Return
Type | Description |
---|---|
bool | Whether the unit can teleport to the point. |
unit:can_teleport_to(point)
unit_can_collide_with_point
Whether to collide with the point or not.
Parameters
Variable | Type | Description |
---|---|---|
point | point | Target point. |
range | number | Collision range of the unit. |
Return
Type | Description |
---|---|
bool | Whether the unit collides with the point. |
unit:unit_can_collide_with_point(point, range)
unit_can_from_point_to_point
Whether pathfinding is reachable or not.
Return
Type | Description |
---|---|
bool | Whether pathfinding is reachable. |
unit:unit_can_from_point_to_point(start_point, end_point)
get_unit_move_collision
Whether to have the specified collision type or not.
Return
Type | Description |
---|---|
bool | Whether to have the specified collision type. |
unit:get_unit_move_collision(collision_type_name)
get_unit_player
Get the player the unit belongs to.
Return
Variable | Type | Description |
---|---|---|
player | player | Player. |
unit:get_unit_player()
Events
Unit triggers need to be included in a group to use group variables.
Before unit die
Dying.
local unit_group = cli.unit.create_unit_trigger_group ( 100001 )
unit_group . add_trigger ( "Before unit die" , function ( data )
print ( "Is about to die" )
end )
Unit Die
Die.
local unit_group = cli.unit.create_unit_trigger_group ( 100001 )
unit_group . add_trigger ( "Unit Die" , function ( data )
print ( "Death" )
end )
Kill unit
Kill event.
local unit_group = cli.unit.create_unit_trigger_group ( 100001 )
unit_group . add_trigger ( "Kill unit" , function ( data )
print ( "Kill event" )
end )
Unit born
Create.
local unit_group = cli.unit.create_unit_trigger_group ( 100001 )
unit_group . add_trigger ( "Unit born" , function ( data )
print ( "Create" )
end )
Revive unit
Rebirth.
local unit_group = cli.unit.create_unit_trigger_group ( 100001 )
unit_group . add_trigger ( "Revive unit" , function ( data )
print ( "Rebirth" )
end )
Upgrade unit
Upgrade.
local unit_group = cli.unit.create_unit_trigger_group ( 100001 )
unit_group . add_trigger ( "Upgrade unit" , function ( data )
print ( "Upgrade" )
end )
Unit pre add exp
About to gain experience.
local unit_group = cli.unit.create_unit_trigger_group ( 100001 )
unit_group . add_trigger ( "Unit pre add exp" , function ( data )
print ( "Experience is about to be gained" )
end )
Unit on add exp
Get experience.
local unit_group = cli.unit.create_unit_trigger_group ( 100001 )
unit_group . add_trigger ( "Unit on add exp" , function ( data )
print ( "Gain experience" )
end )
Unit be hurt
Hurt.
local unit_group = cli.unit.create_unit_trigger_group ( 100001 )
unit_group . add_trigger ( "Unit be hurt" , function ( data )
print ( "Taken damage" )
end )
Unit hurt other
Cause some damages.
local unit_group = cli.unit.create_unit_trigger_group ( 100001 )
unit_group . add_trigger ( "Unit hurt other" , function ( data )
print ( "Cause damage" )
end )
Unit hurt other finish
After inflicting damage.
local unit_group = cli.unit.create_unit_trigger_group ( 100001 )
unit_group . add_trigger ( "Unit hurt other finish" , function ( data )
print ( "After damage is done" )
end )
Unit be hurt complete
After being hurt.
local unit_group = cli.unit.create_unit_trigger_group ( 100001 )
unit_group . add_trigger ( "Unit be hurt complete" , function ( data )
print ( "After taking damage" )
end )
Unit get cure
Be treated.
local unit_group = cli.unit.create_unit_trigger_group ( 100001 )
unit_group . add_trigger ( "Unit get cure" , function ( data )
print ( "Healed" )
end )
Unit releaseability
Cast skills.
local unit_group = cli.unit.create_unit_trigger_group ( 100001 )
unit_group . add_trigger ( "Unit release ability" , function ( data )
print ( "Cast skill" )
end )
Unit start move
Start moving.
local unit_group = cli.unit.create_unit_trigger_group ( 100001 )
unit_group . add_trigger ( "Unit start move" , function ( data )
print ( "Start moving" )
end )
Unit enter battle
Enter combat state.
local unit_group = cli.unit.create_unit_trigger_group ( 100001 )
unit_group . add_trigger ( "Unit enter battle" , function ( data )
print ( "Enter combat state" )
end )
Unit exit battle
Out of combat.
local unit_group = cli.unit.create_unit_trigger_group ( 100001 )
unit_group . add_trigger ( "Unit exit battle" , function ( data )
print ( "Out of combat state" )
end )
Unit enter grass
Into the grass.
local unit_group = cli.unit.create_unit_trigger_group ( 100001 )
unit_group . add_trigger ( "Unit enter grass" , function ( data )
print ( "Enter the grass" )
end )
Unit leave grass
Leave the grass.
local unit_group = cli.unit.create_unit_trigger_group ( 100001 )
unit_group . add_trigger ( "Unit leave grass" , function ( data )
print ( "Leave the grass" )
end )
Unit on command
Request order.
local unit_group = cli.unit.create_unit_trigger_group ( 100001 )
unit_group . add_trigger ( "Unit on command" , function ( data )
print ( "Request command" )
end )
Ability plus point
Learning skills.
local unit_group = cli.unit.create_unit_trigger_group ( 100001 )
unit_group . add_trigger ( "Ability plus point" , function ( data )
print ( "Learning skills" )
end )
Unit remove
Delete.
local unit_group = cli.unit.create_unit_trigger_group ( 100001 )
unit_group . add_trigger ( "Unit remove" , function ( data )
print ( "Delete" )
end )