Hi again well to make things more easier for you to understand
what's wrong here is the code in beta staium verry messy!
set window on
set window size 500,500
set window title "Multiplayer"
sync on : sync rate 0 : backdrop off: ``hide mouse
set text font "arial" : set text size 16
set text to bold : set text transparent
Rem Project: test2
Rem Created: 2003-05-25 13:44:14
``sync on : sync rate 0 : color backdrop rgb(0,128,0)
Rem ***** Main Source File *****
sync : center text screen width()/2,screen height()/2,"Setting up network game" : sync
rem Start net game
PlayerNumber=default net game("gamename","playername",4,1)
if net game exists()=1
rem Show name of player as Window Title
if PlayerNumber=1
set window title "HOST Player "+str$(PlayerNumber)
else
set window title "CLIENT Player "+str$(PlayerNumber)
endif
cls
sync : center text screen width()/2,screen height()/2,"Collecting game data" : sync
make matrix 1,5000,5000,10,10
load image "grass_1.jpg",1
PREPARE MATRIX TEXTURE 1, 1, 2, 2
set ambient light 50
rem Global data
global ambience# as integer
global blockobj as integer
global med$ as string
dim objtype(10000)
gosub _make_cursor
gosub _make_texteditorbox
gosub _make_hero
gosub _start_demo
cls
gosub _create_lights
gosub _make_terain
``load object "miko\miko.x",1
``xrotate object 1,270
``set object frame 1,1
``loop object 1,0,68083
``set object speed 1,1000
``position object 1,0,-50,0
``yrotate object 1,180
x#=500
z#=500
make camera 1
color backdrop 1,rgb(0,0,0)
scale object 1,50,50,50
fog off
fog distance (5000)
fog color rgb(255,255,255)
``make object sphere 62,100
load object "media\hero\roomdemo.x",62
``load object "miko\miko.x",1
xrotate object 62,270
fix object pivot 62
rotate object 62,0,180,0
set object speed 62,2000
heroframe2#=total object frames(62)/200.0
loop object 62,0,39*heroframe2#
scale object 62,50,50,50
make light 10
set spot light 10,50,60
do
make memblock 1,object position X(1)
make memblock 2,object position Z(1)
sprite 100, mousex()-33, mousey()-30,100
gosub _control_effects
position light 10,object position x(1),50,object position z(1)
gosub _control_hero
rem Control room effects
gosub _control_effects
``send net message integer 0,object position x(1)+object position z(1)
``send net message integer 0,object position z(1)
rem Draw Others
get net message
while net message exists()=1
PositionValue = net message memblock 1
PositionValue2 = net message memblock 2
med$=net message string$()
OtherNumber=net message player from()
OtherZ=PositionValue2
OtherX=PositionValue
position object 62,OtherX,0,OtherZ
``Othery=PositionValue2-(Othery*640)
``sprite OtherNumber, OtherX, OtherY, 2
``notx=positionvalue
``notz=net message string(2)
get net message
endwhile
``center text screen width()/2,screen height()-10,med$
center text screen width()/2,screen height()-35,med$
position light 0,object position x(1),200,object position z(1)
set point light 0,object position x(1),200,object position z(1)
y#=get ground height (1,x#,z#)
position object 1,x#,y#,z#
position camera 1,x#-200,y#+300,z#-200
point camera 1,x#,y#,z#
sync
loop
rem End net game
free net game
else
do : cls 0 : center text 160,113,"COULD NOT CREATED NET GAME" : sync : loop
endif
_control_hero:
rem Store hero position before action
oox1#=object position x(1)-40
ooy1#=object position y(1)
ooz1#=object position z(1)-40
oox2#=object position x(1)+40
ooy2#=object position y(1)+190
ooz2#=object position z(1)+40
rem Move hero
walk=0
scrape=0
if grabseq=0
if upkey()=1 then move object 1,4 : walk=1:send net message memblock 1,object position x(1):send net message memblock 2,object position z(1)
if downkey()=1 then move object 1,-4 : walk=1:send net message memblock 1,object position x(1):send net message memblock 2,object position z(1)
if leftkey()=1 then yrotate object 1,wrapvalue(object angle y(1)-4) : walk=1:send net message float 0,object position x(1):send net message float 0,object position z(1)
if rightkey()=1 then yrotate object 1,wrapvalue(object angle y(1)+4) : walk=1:send net message float 0,object position x(1):send net message float 0,object position z(1)
``if controlkey()=1 and grab=0 and pushslider>0 then grab=1 : grabseq=1 : change=0
``if controlkey()=1 then gosub _send_message
if mouseclick()=1 and mousex() > 126 and mousey() > 413 and mousex() < 515 and mousey() < 467 then gosub _send_message
if controlkey()=1 and returnkey()=1 then set window on: set window size 500,500
if controlkey()=1 and shiftkey()=1 then set window off
else
if grabseq>=2 and grabseq<=3 and upkey()=1 and pushslider>0
if object position z(pushslider)<1800
if pushdire=1 then move object 1,4 : move object pushslider,4 : scrape=1
endif
if object position x(pushslider)>200
if pushdire=2 then move object 1,4 : yrotate object pushslider,270 : move object pushslider,4 : yrotate object pushslider,0 : scrape=1
endif
endif
endif
if (controlkey()=0 or upkey()=0) and grab=1 and grabseq<>4 then grabseq=4 : change=0
if (controlkey()=0 or upkey()=0) then pushslider=0
``if scrape=1 then set sound volume 3,100 else set sound volume 3,0
rem Track hero with camera
x#=object position x(1)
y#=object position y(1)
z#=object position z(1)
a#=0``:object angle y(1)
d#=250.0
h#=185.0
s#=50.0
``set camera to follow x#,y#,z#,a#,d#,h#,s#,1
rem Ensure hero stays within blocks
ox1#=object position x(1)-40
oy1#=object position y(1)
oz1#=object position z(1)-40
ox2#=object position x(1)+40
oy2#=object position y(1)+190
oz2#=object position z(1)+40
if get static collision hit(oox1#,ooy1#,ooz1#,oox2#,ooy2#,ooz2#,ox1#,oy1#,oz1#,ox2#,oy2#,oz2#)>0
ox#=object position x(1)
oy#=object position y(1)
oz#=object position z(1)
ox#=ox#-get static collision x()
oz#=oz#-get static collision z()
``position object 1,ox#,oy#,oz#
endif
rem Ensure hero stays outside sliding blocks
colwithslider=object collision(1,0)
if colwithslider>0
ox#=object position x(1)
oy#=object position y(1)
oz#=object position z(1)
ox#=ox#-get object collision x()
oz#=oz#-get object collision z()
``position object 1,ox#,oy#,oz#
user$="USE CONTROL KEY AND FORWARD TO PUSH BLOCK"
else
user$="USE ARROW KEYS TO MOVE AROUND"
endif
if vic=1 then user$="YOU FOUND THE SECRET ROOM - WELL DONE!"
rem If touching slider, figure out which one
if colwithslider>0 and controlkey()=1
nearest=0
dist#=999999
for obj=101 to blockobj-1
if objtype(obj)=3
dx#=object position x(obj)-object position x(1)
dz#=object position z(obj)-object position z(1)
dd#=sqrt(abs(dx#*dx#)+abs(dz#*dz#))
da#=wrapvalue(atanfull(dx#,dz#))
if dd#<dist# and dd#<275
a#=wrapvalue(object angle y(1))
ok=0
if (a#>360-22 or a#<22) and (da#>360-16 or da#<16) then ok=1 : tdire=1
if (a#>270-22 and a#<270+22) and (da#>270-16 and da#<270+16) then ok=1 : tdire=2
if ok=1 then dist#=dd# : nearest=obj : dire=tdire
endif
endif
next obj
if nearest>0 then pushslider=nearest : pushdire=dire
endif
rem Ensure camera stays within blocks
``ocx1#=cx1# : ocy1#=cy1# : ocz1#=cz1#
``ocx2#=cx2# : ocy2#=cy2# : ocz2#=cz2#
``cx1#=camera position x()-20
``cy1#=camera position y()-10
``cz1#=camera position z()-20
``cx2#=camera position x()+20
``cy2#=camera position y()+10
``cz2#=camera position z()+20
``if get static collision hit(ocx1#,ocy1#,ocz1#,ocx2#,ocy2#,ocz2#,cx1#,cy1#,cz1#,cx2#,cy2#,cz2#)>0
``cx#=camera position x()
``cy#=camera position y()
``cz#=camera position z()
``cx#=cx#-get static collision x()
``cy#=cy#-get static collision y()
``cz#=cz#-get static collision z()
``position camera cx#,cy#,cz#
``endif
rem Animate hero for walking
if grab=0
if walk<>lastwalk then change=1
if change=1
if walk=0 then loop object 1,0*heroframe#,39*heroframe#
if walk=1 then loop object 1,40*heroframe#,59*heroframe#
change=0 : lastwalk=walk
endif
else
if change=0
if grabseq=1 then play object 1,60*heroframe#,80*heroframe#
if grabseq=2 then play object 1,120*heroframe#,150*heroframe#
if grabseq=3 then loop object 1,130*heroframe#,149*heroframe#
if grabseq=4 then play object 1,80*heroframe#,100*heroframe#
if grabseq=5 then play object 1,60*heroframe#,80*heroframe#
if grabseq=6 then play object 1,160*heroframe#,190*heroframe#
if grabseq=7 then loop object 1,170*heroframe#,189*heroframe#
change=1
else
if grabseq=1
rem Ensure hero faces slider slowly
if pushdire=1 then a#=curveangle(0,object angle y(1),4.0)
if pushdire=2 then a#=curveangle(270,object angle y(1),4.0)
yrotate object 1,a#
endif
if grabseq>=1 and grabseq<=2
rem Ensure hero moves far enough away
dx#=object position x(pushslider)-object position x(1)
dz#=object position z(pushslider)-object position z(1)
dd#=sqrt(abs(dx#*dx#)+abs(dz#*dz#))
if dd#<204 then move object 1,-4.0
endif
if grabseq=1 and object frame(1)>78*heroframe# then change=0 : inc grabseq
if grabseq=2 and object frame(1)>=148*heroframe# then change=0 : inc grabseq
if grabseq=4 and object frame(1)>=94*heroframe# then grabseq=0 : grab=0 : lastwalk=-1
if grabseq=5 and object frame(1)>78*heroframe# then change=0 : inc grabseq
if grabseq=6 and object frame(1)>=188*heroframe# then change=0 : inc grabseq
endif
endif
rem Control ambience based on light proximity
``dx#=abs(camera position x()-400) : dy#=abs(camera position z()-600)
``distamb#=sqrt((dx#*dx#)+(dy#*dy#))/35.0
``if distamb#>15 then distamb#=15
``ambience#=curvevalue(distamb#,ambience#,5.0)
``set ambient light ambience#
rem reposition listener for 3dsound
position listener object position x(1),object position y(1)+250,object position z(1)
return
_control_effects:
rem Scroll lightspot
``scroll object texture 2001,0,0.0005
rem Control effect on objects
for obj=101 to blockobj-1
if objtype(obj)>0
r#=wrapvalue(r#+0.5)
if objtype(obj)=1 then yrotate object obj,90+(cos(wrapvalue(r#+wrapvalue(obj*100)))*5.0)
if objtype(obj)=2 then yrotate object obj,0+(cos(wrapvalue(r#+wrapvalue(obj*100)))*5.0)
endif
next obj
rem Move particle in fire slightly
``position particle emissions 1,0,0,(rnd(20)-10)/20.0
rem Rotate green spotlight
``l#=wrapvalue(l#+1) : position light 4,400+sin(l#)*50,100,1700+cos(l#)*50
``if object position x(1)<600 and object position z(1)>1400 and vic=0 then play sound 4 : vic=1
``position light 1,object position x(1),500,object position z(1)
return
_make_hero:
rem Load Hero
load object "media\hero\roomdemo.x",1
``load object "miko\miko.x",1
xrotate object 1,270
fix object pivot 1
rotate object 1,0,180,0
set object speed 1,2000
``make object collision box 1,-40,0,-40,40,150,40,0
rem Load Sounds
load 3dsound "media\sounds\fire.wav",1 : position sound 1,1200,250,400
load 3dsound "media\sounds\wind.wav",2 : position sound 2,600,250,400
``load sound "media\sounds\move.wav",3 : set sound volume 3,0 : loop sound 3
``load sound "media\sounds\treat.wav",4
return
_start_demo:
rem Move particle in fire slightly
rem Rotate green spotlight
rem Begin Hero Activity
position object 1,400,0,600
yrotate object 1,90
heroframe#=total object frames(1)/200.0
loop object 1,0,39*heroframe#
rem Setup conelight object
make object cone 2001,500
position object 2001,400,0,600
scale object 2001,100,500,100
ghost object on 2001,0
load image "media\gfx\shimer.bmp",2001
texture object 2001,2001
scale object texture 2001,1,0.2
set object collision off 2001
rem Begins ounds
loop sound 1 : loop sound 2
rem Setup camera
``position camera 400,250,600
return
_create_lights:
``make light 1
``set spot light 1,5,20
rem Setup main soft light
``set point light 0,400,0,600
``position light 0,400,0,600
``set light range 0,10000
rem Create particles for fire
load image "media\gfx\fire.bmp",11
make particles 1,11,5,60.0
set particle gravity 1,1
set particle life 1,10
set particle speed 1,0.006
rem Create particles for
torchparticles=2
for t=2 to 3
make light t
set point light t,0,0,0
color light t,rgb(255,48,48)
make particles t,11,10,20.0
set particle gravity t,-3
set particle life t,15
set particle speed t,0.006
next t
return
_make_terain:
return
_send_message:
show object 66
show object 67
print " "
print " "
print " "
print " "
print " "
print " "
print " "
print " "
print " "
print " "
print " "
print " "
print " "
print " "
print " "
print " "
print " "
print " "
print " "
print " "
print " "
print " "
print " "
print " "
print " "
print " "
hide sprite 100
input " ";messg$
send net message string 0,messg$
med$=""
``hide object 66
``hide object 67
cls
show sprite 100
return
_make_cursor:
load image "mouse.bmp",100
paste image 100,0,0
sprite 100, mousex(), mousey(),2
return
_make_texteditorbox:
load image "texteditorbox.jpg",66
load image "texteditorbox2.bmp",67
make object plain 66,20,3
make object plain 67,20,3
disable object zdepth 66
disable object zdepth 67
lock object on 66
lock object on 67
position object 66,0,-10,20
position object 67,0,-10,20
texture object 66,66
texture object 67,67
set object 67,0,1,0,0
ghost object on 66
``hide object 66
``hide object 67
return
_control_effects:
position particle emissions 1,0,0,(rnd(20)-10)/20.0
return