(fixed) on_spawn trigger conditions

This forum is for the Lua scriptable clone of DM/CSB called Dungeon Strikes Back by Sophia. Use DSB to build your own highly customised games.

Moderator: Sophia

Forum rules
Please read the Forum rules and policies before posting.
Post Reply
kaypy
Artisan
Posts: 171
Joined: Sun Jan 19, 2014 7:11 am

(fixed) on_spawn trigger conditions

Post by kaypy »

Hi

on_spawn doesn't appear to trigger if an item is created inside anther item. Should this be the case? Or am I misusing the API?

Here is a simple example, with a gem object that logs it's ID as an on_spawn event
http://en.file-upload.net/download-1126 ... n.zip.html

loggem #20 logs successfully, loggem #24 (inside a chest) does not...
Friends don't let friends eat worm round
User avatar
Sophia
Concise and Honest
Posts: 4239
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: on_spawn trigger conditions

Post by Sophia »

It's actually only broken for instances that are there at the very beginning. If you create a loggem (or whatever) inside of a chest via Lua code later on, everything works as it should. So at least there's a workaround.

I'll fix it so it works all the time, of course.
kaypy
Artisan
Posts: 171
Joined: Sun Jan 19, 2014 7:11 am

Re: (fixed) on_spawn trigger conditions

Post by kaypy »

Thanks for the fix. Since I was working with lua generated items anyway, my workaround was to manually call the method on each item* at the time it was created. But having an actual fix is always better of course 8-)

* after ensuring it would behave if double-called
Friends don't let friends eat worm round
Post Reply