• Reference
  • LUA API
  • Classes
  • Area

Area

The Area is one of the base elements within the project that can be controlled against a fixed region, triggering the unit to enter and leave the region event.

Functions

get_circle_area_by_scene_id

Get the circle area by scene ID.

Parameter

VariableTypeDescription
scene_idnumberID in the edit scene.
cli.get_circle_area_by_scene_id(scene_id)

get_rectangle_area_by_scene_id

Get the rectangle area by scene ID.

Parameter

VariableTypeDescription
scene_idnumberID in the edit scene.
cli.get_rectangle_area_by_scene_id(scene_id)

get_polygon_area_by_scene_id

Get polygon area by scene ID.

Parameter

VariableTypeDescription
scene_idnumberID in the edit scene.
cli.get_polygon_area_by_scene_id(scene_id)

get_lua_area_from_py

Create area from py object.

Parameters

VariableTypeDescription
py_areatablePy layer object.
typetableSee area.enum.
area.get_lua_area_from_py(py_area, type)

add_trigger

Add a trigger to the area.

area:add_trigger(event_name, action)

remove_area

Remove an area.

area:remove()

set_collision

Set area collision.

Parameters

VariableTypeDescription
is_collision_effectbooleanWhether collision is in effect.
is_land_effectbooleanGround collision switch.
is_air_effectbooleanAerial collision switch.
area:set_collision(is_collision_effect, is_land_effect, is_air_effect)

add_tag

Add a tag to the area.

Parameter

VariableTypeDescription
tagstringTag.
area:add_tag(tag)

remove_area_tag

Remove a tag from an area.

Parameter

VariableTypeDescription
tagstringTag.
area:remove_area_tag(tag)

has_tag

Whether the area has a tag or not.

Parameter

VariableTypeDescription
tagstringTag.

Return

TypeDescription
booleanWhether the region has tag.
area:has_tag(tag)

set_area_visibility

Set the visibility of the polygon area to the player.

Parameters

VariableTypeDescription
playerplayerPlayer.
is_visibilitybooleanWhether to turn on visibility.
is_real_visibilitybooleanWhether to turn on real visibility.
area:set_area_visibility(player, is_visibility, is_real_visibility)

set_circle_area_radius

Set the radius of the circle area.

Parameter

VariableTypeDescription
radiusnumberRadius.
area:set_circle_area_radius(radius)

set_rectangle_area_size

Set the radius of the rectangle area.

Parameters

VariableTypeDescription
horizontal_lengthnumberLength.
vertical_lengthnumberWidth.
area:set_rectangle_area_size(horizontal_length, vertical_length)

get_circle_area_radius

Get the radius of the circle area.

Return

TypeDescription
numberRadius.
area:get_circle_area_radius()

get_circle_area_min_x

Get the minimum X coordinate in the circle area.

Return

TypeDescription
numberX coordinate.
area:get_circle_area_min_x()

get_circle_area_min_y

Get the minimum Y coordinate in the circle area.

Return

TypeDescription
numberY coordinate.
area:get_circle_area_min_y()

get_circle_area_max_x

Get the maximum X coordinate in the circle area.

Return

TypeDescription
numberX coordinate.
area:get_circle_area_max_x()

get_circle_area_max_y

Get the maximum Y coordinate in the circle area.

Return

TypeDescription
numberY coordinate.
area:get_circle_area_max_y()

get_rectangle_area_min_x

Get the minimum X coordinate in the rectangle area.

Return

TypeDescription
numberX coordinate.
area:get_rectangle_area_min_x()

get_rectangle_area_min_y

Get the minimum Y coordinate in the rectangle area.

Return

TypeDescription
numberY coordinate.
area:get_rectangle_area_min_y()

get_rectangle_area_max_x

Get the maximum X coordinate in the rectangle area.

Return

TypeDescription
numberX coordinate.
area:get_rectangle_area_max_x()

get_rectangle_area_max_y

Get the maximum Y coordinate in the rectangle area.

Return

TypeDescription
numberY coordinate.
area:get_rectangle_area_max_y()

get_circle_area_center_point

Get the center point of the circle area.

Return

TypeDescription
pointPoint.
area:get_circle_area_center_point()

get_random_point_in_circle_area

Get random points in a circle area.

Return

TypeDescription
pointPoint.
area:get_random_point_in_circle_area()

get_rectangle_area_center_point

Get the rectangle area center point.

Return

TypeDescription
pointPoint.
area:get_rectangle_area_center_point()

get_random_point_in_rectangle_area

Get random points in rectangle area.

Return

TypeDescription
pointPoint.
area:get_random_point_in_rectangle_area()

get_weather

Get the weather of the area.

Return

TypeDescription
numberWeather enumeration.
area:get_weather()

get_all_unit_in_area

All units (groups of units) in the area.

Return

TypeDescription
tableUnit group.
area:get_all_unit_in_area()

get_unit_group_in_area

Player units in area (unit group).

Parameter

VariableTypeDescription
playerplayerPlayer.

Return

TypeDescription
tableUnit group.
area:get_unit_group_in_area(player)

get_unit_num_in_area

The number of units in the area.

Return

TypeDescription
numberNumber.
area:get_unit_num_in_area()

get_usable_map_range

Get the full map area.

area.get_usable_map_range()

get_rectangle_area_last_created

Get the last created rectangle area.

area.get_rectangle_area_last_created()

create_circle_area

Create a circular area.

Parameters

VariableTypeDescription
pointpointPoint.
radiusnumberRadius.

Return

TypeDescription
areaCircular area.
area.create_circle_area(point, radius)

create_rectangle_area

Creates a rectangle area.

Parameters

VariableTypeDescription
pointpointPoint.
horizontal_lengthnumberLength.
vertical_lengthnumberWidth.

Return

TypeDescription
areaRectangular area.
area.create_rectangle_area(point, horizontal_length, vertical_length)

create_rectangle_area_from_two_points

Creates a rectangle area from two points.

Parameters

VariableTypeDescription
point_onepointPoint 1.
point_twopointPoint 2.

Return

TypeDescription
areaRectangular area.
area.create_rectangle_area_from_two_points(point_one, point_two)

get_circle_areas_by_tag

Circle area -- iterate through the tags to do the action.

area.get_circle_areas_by_tag(tag)