Module:GetRandomCreature: Difference between revisions

m
no edit summary
(replace _pagecategory with ParentObject bc page category is buggy)
mNo edit summary
Line 4: Line 4:
function p.a(seed)
function p.a(seed)
   math.randomseed(tonumber(seed))
   math.randomseed(tonumber(seed))
   local count = cargo.query('Characters=C, GeneralData=GD', 'TRIM(COUNT(C._pageName))=Number', {join='C.JoinKey=GD.JoinKey', where='C._pageNamespace="0" AND NOT GD.ParentObject WITHIN "Wall"'})[1]['Number']
   local count = cargo.query('Characters=C, GeneralData=GD', 'TRIM(COUNT(C._pageName))=Number', {join='C.ObjectID=GD.ObjectID', where='C._pageNamespace="0" AND NOT GD.ParentObject WITHIN "Wall"'})[1]['Number']
   local offsetin = math.random(0 , tonumber(count)-2)
   local offsetin = math.random(0 , tonumber(count)-2)
   local tables = 'Characters=C, GeneralData=GD'
   local tables = 'Characters=C, GeneralData=GD'