Essentials Series/Duplicatotron Tutorial
This page is part of the Essential Series modding tutorials. It will cover how to use Industrial Park to place a Duplicatotron in a level, the machine which continuously produces enemies.
Setting up the Duplicatotron
First of all, you must import the HIP file of the Duplicatotron to your stage's HOP. This is only needed if the stage didn't previously have a Duplicatotron. You also have to import the HIPs of all enemies you want to appear in the level.
After that, place a Duplicatotron template in the HIP's Default layer. The template will place a Duplicatotron VIL, which is the machine itself that you can move and rotate, a Group (GRUP) which will be our robots/move points group, and a NPCSettingsObject for the Duplicatotron.
Now, you should place the enemies which you want to spawn from the duplicatotron. Each enemy you place can only have one instance of itself active. For example, if you place one Fodder and one Ham-mer, no more than one Fodder and one Ham-mer will be spawned from the Duplicatotron at a time, it will only create another Fodder when the first one is killed, for example (it is technically the same Fodder that was killed).
When placing the enemy templates, the first thing you should do is delete all the move points (MVPT) that were placed along with the enemies. This is because those move points do not work with Duplicatotrons. If you placed a template that includes a trigger, delete the trigger as well.
After the enemies were placed, you must use the MovePoint template (not the area one) to place new move points. These will be the points in which the enemies will be spawned at. You do not need to place as many move points as there are enemies, there can be more or less.
If you want a specific enemy VIL to always spawn at the same point, you can set the MovePoint of that VIL to the move point you want it to spawn at. Otherwise, leave that field blank and the Duplicatotron will spawn the enemy at a random one.
With all VILs and new move points placed, open the Asset Data Editor for the group that was placed in the template along with the Duplicatotron. Add all the asset IDs of the enemies and move points to the group. You can do this by selecting all of them and clicking on "add all selected to group" in the Asset Data Editor. The order which the enemies and move points are in the group items list does not matter.
There is one more thing you need to do: add one (or more) MovePoint (Area) templates. This is because point move points do not allow enemies to move around and detect the player. You can use only one for the whole group of enemies, or one for each point you placed before, or one for a subset of the points, it doesn't really matter, as long as you add the area move point to the NextMovePoints of each point. Each point will use the area you specify in their list. You don't need to add the area move points to the Duplicatotron's group.
If you test ingame now, the Duplicatotron should work correctly and immediately. If you don't want the Duplicatotron to be active immediately as the level starts, add the link ScenePrepare => Duplotron_Pause to the Duplicatotron's VIL, with the target asset as itself. When you want it active (when entering a trigger for example, use the Duplotron_Resume event with the VIL as the target.
Note: you cannot use the same enemy in a Duplicatotron and outside of it. You also cannot have the same enemy in two or more different Duplicatotron groups.
The Duplicatotron Settings is a NPCSettingsObject asset that is placed along with the Duplicatotron. You can set which NPCSettings your Duplicatotron is using in the VIL asset editor, and if you have multiple Duplicatotrons in a level, it's okay if they share the same settings object (you can delete unused ones). These are some of the fields you can set in it:
- DuploWaveMode: if set to Continuous, the Duplicatotron will continuously respawn the enemies as you destroy them. If set to Discreet, it will only start respawing the enemies after all of them were destroyed.
- DuploSpawnDelay: how long it will take to spawn the next enemy. 1 is default, set to smaller values for faster respawning, bigger values for slower.
- DuploSpawnLifeMax: how many enemies it will spawn before pausing itself. If set to -1, this will be unlimited (default).
- Duplotron_Pause: send this to a Duplicatotron to pause it.
- Duplotron_Resume: send this to a Duplicatotron to resume it.
- Duplotron_WaveBegin: the Duplicatotron VIL receives this event when it starts spawning a new wave of enemies.
- Duplotron_WaveComplete: fired when all enemies in a Duplicatotron's wave are destroyed (when WaveMode is Discreet), or all enemies + Duplicatotron are destroyed otherwise
- Duplotron_NPCBorn: fired when one of the enemies is created.
- Duplotron_NPCKilled: fired when one of the enemies is killed.
- Duplotron_MaxNPCExpired: fired when the amount set in DuploSpawnLifeMax is reached.
- Duplotron_SuperDuperDone: send this to a Duplicatotron to resume it.
- Duplotron_DuperIsDoner: fired when all enemies specified in a Duplicatotron's events are killed.
- Duplotron_KillKids: send this to the Duplicatotron to kill all enemies it has spawned.
- Connect_IOwnYou: the Duplicatotron should send this to a GRUP containing move points and VILs to connect to them. This is set automatically when placing the Duplicatotron template in Industrial Park.
- SetUpdateDistance: much like platforms, Duplicatotrons stop working when you are at a distance from them. This can be unwanted if the move point where an enemy should spawn is very far away from the Duplicatotron itself (they can work from any distance). Send the SetUpdateDistance event to the Duplicatotron (this is usually done on ScenePrepare => SetUpdateDistance in the Duplicatotron's own links) to set a new update distance, which should be in the first argument. This is commonly left as 0, which will make the update distance infinite.
Aside from those, you can also use some of the events used in normal enemies: Kill, NPCSetActiveOn, NPCSetActiveOff.