The current skeleton system does not properly handle attachment.
Certain attached npcs will spawn up to the server cap of 200 (Meteors)
[ ] fixed issue
Killing attached npc seem cause problems
attached npcs seem to respawn oddly.
[ ] fixed issue
def OnCheckSpawn(player as TSPlayer , x as int, y as int):
if FindCustomNpcs("PP06").Length<=6:
return (AtSurfaceLevel(player) and 15 or 0)
else:
return 0
def OnSpawn(npc as CustomNpc):
npc["hostdead"]=false
npc["attach"]=false
npc["Ability1_Cooldown"]=1600
def OnCollision(npc, player):
npc["attach"]=true
def OnAiUpdate(npc as CustomNpc) as bool:
ability1_timer = npc.GetVariable("Ability1_Cooldown", 0)
if npc["once"]==false:
head = SpawnCustomNpc("PP06A", npc.Position + Vector2(0, 0))
npc.AttachChild(head)
host = npc.Parent
npc["once"]=true
if npc.Npc.active == true and CustomIDContains("PP06"):
pass
elif npc.Npc.active == false and CustomIDContains("PP06"):
npc.Children[0].Npc.aiStyle = 1
npc["hostdead"]=true
if npc.HasChildren == true:
child = npc.Children[0]
if ability1_timer > 0:
ability1_timer = ability1_timer - 1
npc["Ability1_Cooldown"]=ability1_timer
if npc["Ability1_Cooldown"]==0:
npc.Children[0].TargetClosestPlayer()
targetHead = npc.Children[0].Target
position = targetHead.TPlayer.position
if targetHead != null and npc.Children[0].HasLineOfSight(position):
npc.Children[0].ShootProjectileAt(position, 188, 20, 5, 20)
npc["Ability1_Cooldown"]=1600
if npc["hostdead"]==true and npc["attach"]==true and CustomIDContains("PP06A"):
child.Center = child.Target.TPlayer.position
return false
No eater of worlds examples
this should be included as a example of how to use the skeleton system.
[ ] include example
Find how terraria handles the skeleton hands npc and see if it's possible to attach this npc to other monsters without having it die..
[ ] Research
After researching is done, if it's possible let me know.
Converted from https://github.com/Pychnight/Custom-Npcs-2/issues/16
The current skeleton system does not properly handle attachment.
Killing attached npc seem cause problems
No eater of worlds examples
Find how terraria handles the skeleton hands npc and see if it's possible to attach this npc to other monsters without having it die..