Quote: "I would like to have a dynamic shadow based on different lights"
You could check for the closest light source each loop (saved in an array maybe) and set the shadow light position to the closest light when it changes.
Also you could set the strength of the shadow based on distance from the source, that way your shadow wouldn't just suddenly change direction it would fade out first. The only problem I can forsee with that would be if you have too many lights close to each other then enemies near to a light that isn't closest to your main character would have a shadow from the wrong light.
I want to test this theory so if you can wait I'll make a test demo!
EDIT: Here's a quick demo of what I meant (WASD to move!):
Rem Project: LightingTest
Rem Created: 18/02/2010 13:20:07
Rem ***** Main Source File *****
autocam off
sync on
sync rate 60
`make world
make object box 2, 1000,2,1000
position object 2, 0,-1,0
color object 2, RGB(0,100,0)
`make player
make object cube 1, 6
position object 1, 0,3,0
set shadow shading on 1,-1,500,1
`setup lighting/shadows
set ambient light 10
hide light 0
`shadows
SET GLOBAL SHADOW COLOR 0,0,0, 1
set shadow position -1,-5,20,-5
`light array
type light
x as float
y as float
z as float
endtype
dim light(2) as light
`light 1
light(1).x=75
light(1).y=20
light(1).z=75
make object sphere 3, 3
position object 3, light(1).x,light(1).y-2,light(1).z
set object light 3, 0
ghost object on 3
make light 1
set point light 1, light(1).x,light(1).y-2,light(1).z
set light range 1, 140
`light 2
light(2).x=-25
light(2).y=20
light(2).z=-25
make object sphere 4, 3
position object 4, light(2).x,light(2).y-2,light(2).z
set object light 4, 0
ghost object on 4
make light 2
set point light 2, light(2).x,light(2).y-2,light(2).z
set light range 2, 140
global light as integer
DO
set cursor 0,0
move()
shadows()
camera()
sync
LOOP
function shadows()
light=0
mind#=1000
for l=1 to 2
dx#=object position x(1)-light(l).x
dy#=object position y(1)-light(l).y
dz#=object position z(1)-light(l).z
d#=sqrt(dx#^2+dy#^2+dz#^2)
if d#<mind# then mind#=d#:light=l
next l
set shadow position -1,light(light).x,light(light).y,light(light).z
if mind#<=50
s#=250-(mind#*5)
SET GLOBAL SHADOW COLOR 0,0,0, s#
color object light+2, RGB(255,255,0)
if light=1
color object 4, RGB(50,50,50)
endif
if light=2
color object 3, RGB(50,50,50)
endif
endif
endfunction
function move()
if keystate(17)=1 then move object 1, .5
if keystate(31)=1 then move object 1, -.5
if keystate(30)=1 then turn object left 1, 1
if keystate(32)=1 then turn object right 1, 1
endfunction
function camera()
position camera object position x(1),200,object position z(1)
point camera object position x(1),object position y(1),object position z(1)
endfunction