-
Notifications
You must be signed in to change notification settings - Fork 1
CustomNpc
Timothy Barela edited this page Jan 23, 2018
·
3 revisions
Note: This is a work in progress.
{
"Name": "npc-internal-name",
"BaseType": 46,
"ScriptPath": "Npc.boo",
"BaseOverride": {
"AiStyle": null,
"BuffImmunities": [],
"Defense": null,
"HasNoCollision": false,
"HasNoGravity": false,
"IsBoss": false,
"IsImmortal": false,
"IsImmuneToLava": false,
"IsTrapImmune": false,
"KnockbackMultiplier": 1.0,
"MaxHp": 100,
"Name": "Npc Display Name",
"NpcSlots": null,
"Value": null
},
"Loot": {
"TallyKills": false,
"IsOverride": false,
"Entries": []
},
"Spawning": {
"ShouldSpawn": true,
"ShouldReplace": false,
"SpawnRateOverride": 1000
}
}- OnCheckReplace(npc as NPC) as double
- OnCheckSpawn(player as TSPlayer,x as int, y as int) as int
- OnSpawn(npc as CustomNpc)
- OnKilled(npc as CustomNpc)
- OnTransformed(npc as CustomNpc)
- OnAiUpdate(npc as CustomNpc) as bool
- OnStrike(npc as CustomNpc, player as TSPlayer, damage as int, knockback as single, critical as bool) as bool
- OnCollision(npc as CustomNpc, player as TSPlayer)
- OnTileCollision(npc as CustomNpc, tileHits as List[of Point])
Important: these are the real signatures, but you may omit the types since the compiler will insert them for you. However, make sure whatever you return from your callbacks matches the signature!
- NpcDefinition Definition { get; }
- int Hp { get; set; }
- int Index { get; }
- NPC Npc { get; }
- Vector2 Center { get; set; }
- Vector2 OldPosition { get; set; }
- Vector2 Position { get; set; }
- int OldDirection { get; set; }
- int OldDirectionY { get; set; }
- int Direction { get; set; }
- int DirectionY { get; set; }
- bool SendNetUpdate { get; set; }
- TSPlayer Target { get; set; }
- Vector2 Velocity { get; set; }
- string GivenName { get; set; }
- HasVariable(string variableName) : bool
- GetVariable(string variableName, object defaultValue = null) : object
- SetVariable(string variableName, object value)
- CustomTransform(string name)
- Teleport(Vector2 position)
- HasLineOfSight(Vector2 position) : bool
- TargetClosestPlayer()
- ForEachNearbyPlayer( Action callback, int tileRadius = 50)
- BuffNearbyPlayers(int type, int seconds, int tileRadius = 50)
- MessageNearbyPlayers(string message, Color color, int tileRadius = 50)
- OnlyOnce(int key, Action callback)
- Periodically(int key, Action callback, int period)
- ShootProjectileAt(Vector2 position, int type, int damage, float speed, float knockback)
- ShootCustomProjectileAt(Vector2 target, string projectileName, float speed)
- ShootCustomProjectileAt(Vector2 target, string projectileName, float speed, Offset offset)
- ShootCustomProjectileAt(Vector2 target, string projectileName, float speed, Vector2 offset)
- AttachEmote(int emoteId, int lifeTime)