Problem with Zone:makeEntity and prob_filter

Where bugs go to lie down and rest

Moderator: Moderator

Post Reply
Message
Author
yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Problem with Zone:makeEntity and prob_filter

#1 Post by yufra »

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:

Code: Select all

=game.zone:makeEntity(game.level, "object", {type="ammo", subtype="shotgun"}, nil, true)
Now after commenting out the redefinition of print in Zone.lua I see the following after running it twice:

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
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.
<DarkGod> lets say it's intended

darkgod
Master of Eyal
Posts: 10751
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: Problem with Zone:makeEntity and prob_filter

#2 Post by darkgod »

Ah yes sounds good!
Done
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

Post Reply