I not too clear on lighting using .x, i know it creates 2 models and i think you ghost the lightmap model yes?
Anyhow i added some more code to highlight just what i was trying to achieve! which is to delete unwanted limbs and replace them with a model of your choice at them coords,also slammed in a couple of rem statements to make it slightly clearer... here it is for anyone to look at:
Function make_objects()
load object "leveltest2.dbo",2001
position object 2001,0,0,0
load image "stripes.png",1
load image "rust.bmp",2
perform checklist for object limbs 2001
v=checklist quantity()
for c=1 to checklist quantity()
print checklist string$(c)
if limb exist(2001, c)=1
name$(c)=limb texture name(2001,c)
endif
for n2=1 to checklist quantity()
if limb exist(2001,n2)
if name$(n2)="brick2.png"
`v2$="YEH!!"
rem get the x,y,z coords of the limb we are gunna delete
limbx#= LIMB POSITION X(2001, n2)
limby#= LIMB POSITION y(2001, n2)
limbz#=LIMB POSITION z(2001, n2)
rem place a baddy where the limb we dont want is
make_baddie(limbx#,limby#,limgz#,baddiecount)
inc baddiecount
rem now remove the limb we dont want
remove limb 2001,n2
endif
endif
next
next
phy make rigid body static mesh 2001
endfunction
function make_baddie(x#,y#,z#,baddiecount)
load object "baddy.x",baddiecount
position object baddiecount,x#,y#,z#
endfunction
baddiecount of course is just some var i set high like 5000 initially so as to avoid making the same object twice!
Hail to the king, baby!