Quote: " ah... media. I will do it by replace it by my own. I think I may have some of the texture you had in your lastest rpg engine."
kewl, I guess thats the best way to keep your system safe, the texture is a DBP one so I'm sure you got it
.
Quote: "edit
Umm... Thanks. (forgot to say that)"
Yey politeness
not much of that these days, or at least where I live
[edit]
Sett I sent you the source code
also, I prefer to work in functions, so if you were to make all of these as functions that will be great, I noticed a problem with the email sent, the lines were moved, so I will, post it here,
Rem Project: Collision tester
Rem Created: 08/02/2005 12:37:05
Rem ***** Main Source File *****
Rem ***** Main Source File *****
`Main Source File
remstart
Woot! This is Ronin code!!! Oh yeah! Oh Right, I'm ment to write
something here....well
this code uses GMANs/Lost In Thoughts code, and this is being coded in
DBP 5.8, which is an important
note as a 5.8 bug fix helps the collisions command, and well umm its
still in progress
remend
Hide Mouse
load music "sad, lonely.mid",1
loop music 1
goto menu
Rem *** Include File: Source\opening menu.dba ***
Rem Created: 08/31/2005 14:36:52
Rem Included in Project: C:\Program Files\Dark Basic Software\Dark Basic Professional\Projects\RPG Engines\RPG Engines.dbpro
menu:
cls
sync on
sync rate 8
load image "ronin back copy.jpg",21
load image "inactive.bmp",22
load image "New game.bmp",23
load image "options.bmp",24
load image "quit.bmp",25
menu2:
paste image 21,0,0
paste image 22,30,0
paste image 22,30,70
paste image 22,30,140
v# = 0
do
if joystick up()=1 then dec v#,1
if joystick down()=1 then inc v#,1
if upkey()=1 then dec v#,1
if downkey()=1 then inc v#,1
if v# = 0 then cls : paste image 21,0,0 : paste image 23,30,0
if v# = 1 then cls : paste image 21,0,0 : paste image 24,30,70
if v# = 2 then cls : paste image 21,0,0 : paste image 25,30,140
if v# > 2 then v# = 0
if v# < 0 then v# = 2
if v# = 0 and returnkey()=1 then goto start
if v# = 2 and returnkey()=1 then end
if v# = 0 and joystick fire c()=1 then goto start
if v# = 2 and joystick fire c()=1 then end
sync
loop
start:
stop music 1
load music "calm-sad2.mid",2
loop music 2
`First set up some of the screen particulars
Sync On : Sync Rate 90
Autocam Off : Hide Mouse
set camera range 3,20000
`Set up the Camera's view frustrum
set text font "Arial"
set text size 15
`this global variable holds the player's movement rate
`in quants per second. This equates roughly to inches
`per second
Global MovePerSec As Float
`set the movement rate to 20 feet per second
MovePerSec = 240
`This next variable determines If a reticle will be drawn on the screen
Global UseReticle As Boolean
`we'll set it to the default value, switching the reticle on. A value of
`0 would switch it off
UseReticle = 1
`This variable holds the height from the floor to the player's eye
`this is again in quants, with 1 quant equating roughly to an inch
Global EyeHeight As Integer
`set the eye height to 64 inches
EyeHeight = 64
`This next variable set the mouse's sensitivity for the mouse look
Global MouseSens As integer
`we'll set the default mouse sensitivity value to 3. Valid values range from 1
`(very sensitive)upwards growing less sensitive with each increase
MouseSens = 3
`This variable is used to determine if the character is jumping or falling
Global Airborn as Boolean
`This variable contains the speed at which the player will fall in
`inches per second
Global Gravity as Float
Gravity = 512
`now we load the map. Swap the name of your map file in here
goto LoadMap
Rem *** Include File: Source\load test evel.dba ***
Rem Created: 08/31/2005 13:02:11
Rem Included in Project: C:\Program Files\Dark Basic Software\Dark Basic Professional\Projects\RPG Engines\RPG Engines.dbpro
LoadMap:
Load Object "roninx.x", 1
position object 1,0,-100,0
scale object 1,1000,1000,1000
`we set collision to polygons here. Normally collsion is set to boxes or spheres
`but because we are gouing to be walking around inside the map, we'd be colliding
`all of the time using either of those methods because the collision horizon is set
`to the model's maximum extents
Set Object Collision To Polygons 1
`we will create an Object to do our colliding for the Camera. We'll use a sphere and position it around
`the Camera. Because its polygons all face out, it won't be rendered by the Camera.
`normally, this would be your player model
`now we'll create the actual collider Object
`set up its collision method
Set Object Collision On 1
make object box 20,60,170,60
`now we'll place theobject
Position object 20, 0,0,500
`set up its collision method
Set Object Collision On 20
`NPCs! Find US!!!!
make object box 21,60,170,60
position object 21,571,0,-2850
set object collision to polygons 21
make object box 22,60,170,60
position object 22,344,0,1224
set object collision to polygons 22
make object box 23,60,170,60
position object 23,54,0,-233
set object collision to polygons 23
make light 1
position light 1,500,500,500
set point light 1,0,0,0
set shadow shading on 1
set shadow shading on 20
set shadow shading on 21
set shadow shading on 22
set shadow shading on 23
`at this point we'll set the ambient light level so we can see where we're going
`this will probably need to be tweaked to your liking
set ambient light 70
Fog Color RGB(128,128,128)
Fog Distance 3000
Fog On
load image "hud1.png",10
load image "head hud.bmp",11
goto MainLoop
MainLoop:
`this was going to be the level variable, but hasn't been done yet
lvl# = 1
Do
ox#=Object Position x(20)
oy#=Object Position y(20)
oz#=Object Position z(20)
if ox# > 151 and ox# < 1091 and oz# > -3170 and oz# < -2330 then text 0,70, "Press Action to talk" : point object 21,ox#,oy#,oz#
if ox# > 151 and ox# < 1091 and oz# > -3170 and oz# < -2330 and returnkey()=1 then talk()
if ox# > 151 and ox# < 1091 and oz# > -3170 and oz# < -2330 and joystick fire c()=1 then talk()
`next we need to know how fast the machine is running so that
`we can move our player at a consistent speed
if ox# > 151 and ox# < 600 and oz# > 900 and oz# < 1500 then text 0,70, "Press Action to talk" : point object 22,ox#,oy#,oz#
if ox# > 151 and ox# < 600 and oz# > 900 and oz# < 1500 and returnkey()=1 then controls()
if ox# > 151 and ox# < 600 and oz# > 900 and oz# < 1500 and joystick fire c()=1 then controls()
if ox# > -70 and ox# < 170 and oz# > -300 and oz# < -100 then text 0,70, "Press Action to talk" : point object 23,ox#,oy#,oz#
if ox# > -70 and ox# < 170 and oz# > -300 and oz# < -100 and returnkey()=1 then hidden1()
if ox# > -70 and ox# < 170 and oz# > -300 and oz# < -100 and joystick fire c()=1 then hidden1()
paste image 10,0,0,1
paste image 11,10,10,50
set text size 20
set text font "Artistik"
text 120,20,"Character: Himika Kiyamoto"
text 120,40,"Level 1"
`call our sliding collision function
if Airborn=0 then CheckCollision()
if Airborn=1 then Fall()
`render our scene
Sync
Loop
End
Function Fall()
`This function handles falling. During a fall, the user can not control
`the character's actions until they land.
`We'll start by collecting the collider's current position
ox#=Object Position x(20)
oy#=Object Position y(20)
oz#=Object Position z(20)
if ox# > 151 and ox# < 1091 and oz# > -3170 and oz# < -2330 then text 0,70, "Hello I am the NPC, woot!"
`We'll calculate how far we're going to fall based upon the frame rate
Delta#=Gravity/Screen FPS()
`We'll figure out the Y value we're falling to
ny#=EyeHeight + (oy#-Intersect Object(1, ox#, oy#, oz#, ox#, -1000, oz#))
`We check if the player is done falling
If (oy#-ny#)<=Delta#
`If the difference between the old Y position and the new Y
`position is equal to or
`less than the amount we are going to let the player fall this
`iteraction, then
`the fall is done.
`Position the camera and collider at the final position
Position Object 20, ox#, ny#, oz#
`Shut off the AirBorn flag
Airborn = 0
Else
`Since the player is not done falling, we'll drop the player's Y value
`according to the calculated amount
Position Object 20, ox#, oy#-delta#, oz#
EndIf
`we'll draw the reticle during the fall
If UseReticle = 1
circle screen width()/2,screen height()/2,8
EndIf
EndFunction
Function CheckCollision()
`This is the meat of the sliding collision routine. It is based on a simple premise.
`any move the player makes through the map will be composed of an X and Z component.
`If the player attempts to make a move that causes a collision with the map, we will
`seperate the requested move into these two components and give them the portion of
`the move that does not create a collsion condition. If neither portion of the move
`can be allowed, the player will be simply halted. This final case could only occur
`If the player's move was exactly aligned with either the X or Z axis.
Moving = 0
`Begin Routine
ox#=Object Position x(20)
oy#=Object Position y(20)
oz#=Object Position z(20)
`First we need to record the current Camera position before attempting the move
`Because the collider could pass through a wall without triggering a collision
`condition If the allowable move is too large, we need to ensure that the delta
`pacing formula does not allow it to exceed the collider's size.
If Delta#>EyeHeight
Delta#=EyeHeight
EndIf
`accept the user's input
set text size 15
set text font "Arial"
position camera ox#,oy#+400,oz#-420
point camera ox#,oy#,oz#
set cursor 0,100
print ox#
set cursor 0,120
print oy#
set cursor 0,130
print oz#
k$=upper$(Inkey$())
`This code constitutes the movement functionality
If UpKey()=1 or joystick up()=1
`move the player forward
move object 20,20
EndIf
If DownKey()=1 or joystick down()=1
move object 20,-10
EndIf
If LeftKey()=1 or joystick left()=1
`strafe left
turn object left 20,3
EndIf
If RightKey()=1 or joystick right()=1
`strafe right
turn object right 20,3
EndIf
`with that done, we'll record the collider's new X/Z position
nx#=Object Position x(20)
nz#=Object Position z(20)
`retrieve the floor height at the new position
ny#=EyeHeight + (oy#-Intersect Object(1, nx#, oy#, nz#, nx#, -1000, nz#))
`there appears to be an inconsistancy in the way DBPro registers collsions
`in certain circumstances. The following code remedies that situation
`To fix the west wall problem check to see if the distance to collision
`is less than half the collider's size and if it is then nx# = ox#
if nx# < ox#
newxeast# = intersect object(1,nx#,ny#,nz#,nx#-(EyeHeight/2),ny#,nz#)
endif
if newxeast# > 0
if newxeast# < object size x(20)/2
nx# = ox#
endif
endif
`now that we're done moving the collider around, we'll check to see if there's
`a collision
if object collision(20,0) <> 0
`The player's requested move caused a collision, so we'll try to give them
`as much of their move as we can without allowing them to collide
`So first off we'll see if using the old X value eliminates the collision condition
position object 20, ox#, ny#, nz#
if object collision(20, 0)<>0
`Using the old X value did not eliminate the collision. Now we'll try the
`old Z value.
Position object 20, nx#, ny#, oz#
If Object Collision(20, 0)<>0
`Using the old Z value did not eliminate the collision, so now we'll
`see if the new Y value is the one causing the problem.
Position Object 20, nx#, oy#, nz#
If Object Collision(20, 0)<>0
`Ok, nothing we've tried will eliminate the collision condition, so
`we'll just put the player back where they started from.
ny#=oy#
nx#=ox#
nz#=oz#
Else
`The new Y value, was the problem, so we'll just set the Y value back to OY#
ny#=oy#
EndIf
Else
`The New Z value was the problem so we'll set it back to OZ#
nz#=oz#
EndIf
else
`The new X value was the culprit, so we'll set it back to OX#
nx# = ox#
endif
EndIf
if (oy#-ny#) > EyeHeight
`If the Y value is lower than the current Y value, by more than the Eyeheight,
`we need to start the falling process. To do that, we'll reset ny# to oy# because
`the falling routine will handle changing it. Also, we'll set the AirBorn flag to 1
`to tell the program to use the falling routine.
AirBorn = 1
ny#=oy#
`=========================================================================
`NOTE: If the player is going to be damaged by falls, here is where that
`damage is best calculated.
`=========================================================================
`Before we leave, let's just check and make sure that we can
`safely allow the player to fall at this location.
CheckFall()
EndIF
`move the Camera and collider to the final adjudicated position
Position object 20, nx#, ny#, nz#
Position Object 20, nx#, ny#, nz#
EndFunction
Function CheckFall()
`this function checks to see if the place you are going to fall to is going to
`create a collision.
ox#=Object Position x(20)
oy#=Object Position y(20)
oz#=Object Position z(20)
position camera ox#,oy#+400,oz#-420
point camera ox#,oy#,oz#
`to do that, we'll determine where the final resting location is after the fall is
`complete
ny#=EyeHeight + (oy#-Intersect Object(1, ox#, oy#, oz#, ox#, -1000, oz#))
`We'll quickly position the collider there
position object 20, ox#, ny#, oz#
`then see if there is a collision at the proposed location
if object collision(20,0) <> 0
`This code constitutes the movement functionality
If UpKey()=1 or joystick up()=1
`move the player forward
move object 20,10
EndIf
If DownKey()=1 or joystick down()=1
move object 20,-5
EndIf
If LeftKey()=1 or joystick left()=1
`strafe left
turn object left 20,3
EndIf
If RightKey()=1 or joystick right()=1
`strafe right
turn object right 20,3
EndIf
`If there is a collision, we'll simply turn off the AirBorn flag
Airborn=0
EndIf
EndFunction
Rem *** Include File: Source\Engine talking characters.dba ***
Rem Created: 08/31/2005 13:00:24
Rem Included in Project: C:\Program Files\Dark Basic Software\Dark Basic Professional\Projects\RPG Engines\RPG Engines.dbpro
function talk()
sync on
sync rate 30
a# = 0
do
set text size 25
text 0,120,"Kuroi:Hey, Akai, I haven't seen the damn stone anywhere, oh well keep looking"
paste image 10,0,0,1
paste image 11,10,10,50
set text size 20
set text font "Artistik"
text 120,20,"Character: Himika Kiyamoto"
text 120,40,"Level 1"
if a# = 3 then talk2()
if spacekey()=1 then inc a#,1
if joystick fire a()=1 then inc a#,1
sync
loop
endfunction
function talk2()
sync on
sync rate 30
a# = 0
do
set text size 25
text 0,120,"Himika: I will look deeper into the cave, keep my back watched"
paste image 10,0,0,1
paste image 11,10,10,50
set text size 20
set text font "Artistik"
text 120,20,"Character: Himika Kiyamoto"
text 120,40,"Level 1"
if a# = 3 then talk3()
if spacekey()=1 then inc a#,1
if joystick fire a()=1 then inc a#,1
sync
loop
endfunction
function talk3()
sync on
sync rate 30
a# = 0
do
set text size 25
text 0,120,"Kuroi: I will"
paste image 10,0,0,1
paste image 11,10,10,50
set text size 20
set text font "Artistik"
text 120,20,"Character: Himika Kiyamoto"
text 120,40,"Level 1"
if a# = 3 then goto mainloop
if spacekey()=1 then inc a#,1
if joystick fire a()=1 then inc a#,1
sync
loop
endfunction
function controls()
sync on
sync rate 30
a# = 0
do
set text size 25
text 0,120,"Hello, the controls are;"
text 0,150,"Joybutton C/3 and Enter key= action"
text 0,170,"Joybutton A/1 and space key = select/skip text"
text 0,200,"Cursor buttons/keys = move"
text 0,230,"There will be an NPC mini game in this engine on later releases"
paste image 10,0,0,1
paste image 11,10,10,50
set text size 20
set text font "Artistik"
text 120,20,"Character: Himika Kiyamoto"
text 120,40,"Level 1"
if a# = 3 then goto mainloop
if spacekey()=1 then inc a#,1
if joystick fire a()=1 then inc a#,1
sync
loop
endfunction
function hidden1()
sync on
sync rate 30
a# = 0
do
set text size 25
text 0,120,"Himika: interesting, the cave looks dangerous, I think I'll need to sharpen up on techniques"
paste image 10,0,0,1
paste image 11,10,10,50
set text size 20
set text font "Artistik"
text 120,20,"Character: Himika Kiyamoto"
text 120,40,"Level 1"
if a# = 3 then hidden2()
if spacekey()=1 then inc a#,1
if joystick fire a()=1 then inc a#,1
sync
loop
endfunction
function hidden2()
sync on
sync rate 30
a# = 0
do
set text size 25
text 0,120,"Akai: So do you need to spar?"
paste image 10,0,0,1
paste image 11,10,10,50
set text size 20
set text font "Artistik"
text 120,20,"Character: Himika Kiyamoto"
text 120,40,"Level 1"
if a# = 3 then hidden3()
if spacekey()=1 then inc a#,1
if joystick fire a()=1 then inc a#,1
sync
loop
endfunction
function hidden3()
sync on
sync rate 30
a# = 0
do
set text size 25
text 0,120,"Himika: Yes, I will call up our assistant for us to fight with"
paste image 10,0,0,1
paste image 11,10,10,50
set text size 20
set text font "Artistik"
text 120,20,"Character: Himika Kiyamoto"
text 120,40,"Level 1"
if a# = 3 then hidden4()
if spacekey()=1 then inc a#,1
if joystick fire a()=1 then inc a#,1
sync
loop
endfunction
function hidden4()
sync on
sync rate 30
a# = 0
do
set text size 25
text 0,120,"Akai: Okay, take it easy"
paste image 10,0,0,1
paste image 11,10,10,50
set text size 20
set text font "Artistik"
text 120,20,"Character: Himika Kiyamoto"
text 120,40,"Level 1"
if a# = 3 then hidden5()
if spacekey()=1 then inc a#,1
if joystick fire a()=1 then inc a#,1
sync
loop
endfunction
function hidden5()
sync on
sync rate 30
a# = 0
do
set text size 25
text 0,120,"*THE BATTLE ENGINE IS TEMPORARILY UNAVAILIBLE, sorry for getting your hopes up"
paste image 10,0,0,1
paste image 11,10,10,50
set text size 20
set text font "Artistik"
text 120,20,"Character: Himika Kiyamoto"
text 120,40,"Level 1"
if a# = 3 then goto mainloop
if spacekey()=1 then inc a#,1
if joystick fire a()=1 then inc a#,1
sync
loop
endfunction
If people wanna use what I coded for anything I don't mind, but try not to use the engine and take it as your own credit, its too dishonest, as you noticed I've given credit to people I've taken coding from