How do I go about adding connectors (onDie) or Items to a monster spawned from a script?
Example spawn script line
spawn("uggardian", 4, 15, 26, 1, 0)
Is there something I can add to the end of this? Eg: :addItem / addConnector:onDie ?
Sorry if this has been asked before, I've a had a good look around, but I can't find a clear answer.
Spawning Monster with Connectors and/or Dropped Items?
-
- Posts: 14
- Joined: Wed Dec 10, 2014 6:07 pm
Re: Spawning Monster with Connectors and/or Dropped Items?
Code: Select all
spawn("uggardian", 4, 15, 26, 1, 0).monster:addItem(spawn("dagger").item)
Last edited by Isaac on Mon Jul 18, 2016 6:59 pm, edited 4 times in total.
- Zo Kath Ra
- Posts: 940
- Joined: Sat Apr 21, 2012 9:57 am
- Location: Germany
Re: Spawning Monster with Connectors and/or Dropped Items?
Spawns the uggardian at the script entity's location and adds a connector for onDie:
Code: Select all
local ugga = spawn("uggardian", self.go.level, self.go.x, self.go.y, self.go.facing, self.go.elevation)
ugga.monster:addConnector("onDie", self.go.id, "uggaDies")
function uggaDies()
hudPrint("Dead")
end
-
- Posts: 14
- Joined: Wed Dec 10, 2014 6:07 pm
Re: Spawning Monster with Connectors and/or Dropped Items?
Thanks again guys - I had a brief chance to try it out this morning, all working perfectly 
