I honestly cant wait until reading a post like that doesn't take me 5 tries to understand.Ixnatifual wrote:Ixnatifual wrote: Stuff#
This partseems kind of heavy duty, though. Even on a super simple level it looped the second for 117 times. I tried on one of the larger levels and it was a whopping 1968! If only there was an allMonsters function instead of allEntities.Code: Select all
for e in allEntities(level) do for _, t in ipairs(spawnedEntityNames) do if (e.name == t) then count = count + 1 end end end
[Script] - Smart Spawner
Re: [Script] - Smart Spawner
Grimrock Community 'FrankenDungeon 2012. Submit your entry now!: http://tinyurl.com/cnupr7h
SUBMIT YOUR ASSETS! Community Asset Pack (C.A.P.): http://tinyurl.com/bqvykrp
Behold! The HeroQuest Revival!: http://tinyurl.com/cu52ksc
SUBMIT YOUR ASSETS! Community Asset Pack (C.A.P.): http://tinyurl.com/bqvykrp
Behold! The HeroQuest Revival!: http://tinyurl.com/cu52ksc
-
Ixnatifual
Re: [Script] - Smart Spawner
On the positive side, to test the impact of the script I put a timer that runs the script every .1 seconds on the 1968 level and at least on my machine it gave no noticable performance issues despite the high loop number.Xanathar wrote:Another solution could be to keep the count at the spawn and in the onDie hooks, but then one must be aware of monsters falling in pits which could alter the count (so maybe also keep count in onMove). If there is a real performance problem it might be worth rewriting it with jkos hooks this way.Even on a super simple level it looped the second for 117 times. I tried on one of the larger levels and it was a whopping 1968! If only there was an allMonsters function instead of allEntities.