Problem with Zone:makeEntity and prob_filter
Posted: Fri Oct 01, 2010 1:51 am
I am using Zone:makeEntity to create some shotgun ammo to give to the player, and since shotgun ammo is rare I am using prob_filter to force computeRarities to run. Here is the command I am running the Lua console:
Now after commenting out the redefinition of print in Zone.lua I see the following after running it twice:
So there is a 100% change of getting the magazine... and yet the second time I get nothing! Maybe the if statement in Zone:pickEntity should be a less than or equal, rather than a strict less than? After limited testing that seems to fix it in at least this edge case.
Code: Select all
=game.zone:makeEntity(game.level, "object", {type="ammo", subtype="shotgun"}, nil, true)
Code: Select all
****************** 1
Entity( magazine of shotgun shells) got 16 (=833 / 50) chance to generate. Level range( 5-15), current 1
entity chance 1 : chance( 16 : 100.00000%): magazine of shotgun shells
*DONE 16 100%
[MAKE ENTITY] prob list generation magazine of shotgun shells from list size 1
84 ticks in 10.445 seconds = 8.04213 TPS
301 frames in 10.022 seconds = 30.0339 FPS
****************** 1
Entity( magazine of shotgun shells) got 16 (=833 / 50) chance to generate. Level range( 5-15), current 1
entity chance 1 : chance( 16 : 100.00000%): magazine of shotgun shells
*DONE 16 100%
[MAKE ENTITY] prob list generation nil from list size 1