TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ SpawnNPC()

virtual int Terraria.ModLoader.ModNPC.SpawnNPC ( int tileX,
int tileY )
inlinevirtual

Allows you to customize how this NPC is created when it naturally spawns (for example, its position or ai array). Return the return value of NPC.NewNPC. By default this method spawns this NPC on top of the tile at the given coordinates.

Parameters
tileX
tileY
Returns

Definition at line 655 of file ModNPC.cs.

656 {
657 return NPC.NewNPC(null, tileX * 16 + 8, tileY * 16, NPC.type);
658 }
NPC NPC
The NPC object that this ModNPC controls.
Definition ModNPC.cs:23
int type
The NPC ID of this NPC. The NPC ID is a unique number assigned to each NPC loaded into the game....
Definition NPC.cs:990
static int NewNPC(IEntitySource source, int X, int Y, int Type, int Start=0, float ai0=0f, float ai1=0f, float ai2=0f, float ai3=0f, int Target=255)
Spawns an NPC into the game world with the given type. This method should not be called on multipla...
Definition NPC.cs:91239

References Terraria.NPC.NewNPC(), and Terraria.NPC.type.

+ Here is the call graph for this function: