Menu
 

Hytale Entity Spawning: No Lua API, Use /npc spawn

Hytale Entity Spawning: There Is No Lua API, Use /npc spawn

Hytale has no Lua scripting, so snippets that spawn mobs with Lua calls such as trork:setComponent do not run on any server, and the max_scripted_entities limit in config.json and the universe/entities.db file they mention do not exist in build 0.7.3. World.spawnEntity does exist, but as a deprecated method of the server's Java World class that takes an entity object, so only a Java plugin can call it. Entities and NPCs are spawned with commands, and plugins do it in Java. This page covers the commands.

Spawn NPCs with a command

/npc spawn <role> [--count <n>] [--radius <r>] [--position <x,y,z>] [--scale <s>] [--flock <flock>]

role is the NPC role to spawn. Options are named and written with two dashes: --count (how many), --radius, --position (three numbers separated by commas, such as 100,64,-20), --scale, --flock (a flock asset or a size), --frozen (spawn it frozen), --facingRotation (face the player), --spawnOnGround and --test, which only checks whether the NPC could be spawned at that position. Related: /npc clean removes all NPCs, /npc freeze and /npc thaw pause and resume them, and /npc give gives an NPC an item.

Work with entities

  • /entity count prints the entity count in the world.
  • /entity remove removes an entity, /entity clone copies one and /entity clean removes all entities. They act on the entity you are looking at, or within a radius if you give one.
  • /entity invulnerable, /entity intangible and /entity interactable add or remove those components on selected entities.
  • /entity nameplate changes an entity's nameplate, and /entity effect applies an effect.
  • /spawnitem drops an item into the world, and /blockspawner works with block spawners.

World settings that affect spawning

Each world's config.json has IsSpawningNPC (on by default), IsBlockSpawnersEnabled, IsSpawnMarkersEnabled and IsAllNPCFrozen. In game, /world settings spawningnpc gets or sets whether NPCs spawn in the world. Entities are saved with the world's chunks, so a mob you spawn stays after a restart; clean them with /npc clean or /entity clean.

Spawning from code

A plugin spawns entities from Java through the server's entity and NPC systems. See Does Hytale Support Lua? for how plugins are built and loaded.

Running spawn-heavy events? Host your Hytale server on Supercraft with a live console for the commands above.

Tired of fighting this issue every patch?

Run a managed Hytale server with us. We handle the patches, mod-version pinning, save backups, and DDoS protection. Set up in minutes, multiple datacenter regions, no contract.

See Hytale hosting plans →
Top