⚙️ function core_action_createUnit(...)
Last updated: 11/17/2025
URL
https://github.com/42core-team/monorepo/blob/dev/client_lib/src/public/actions.c#L24
Description
Creates a new unit of specified type.
Your core needs to own a certain amount of money to be able to create a unit. This amount is different depending on the type of unit and can be found in the config.
Cores with a spawn cooldown that isn't 0 are unable to spawn new units. More info on spawn cooldowns.
Units are spawned as close to your core as possible - but if all positions directly next to your core are occupied, a flood fill algorithm will be used looking for the next empty space and the unit will be placed there.
Signature
void core_action_createUnit(t_unit_type unit_type);
Parameters
t_unit_type unit_type: The type of unit to create
Return
void
Examples
if (core_get_objs_filter_count(ft_is_own_team_warrior) < 3)
{
core_action_createUnit(UNIT_WARRIOR);
}