File Problems
Blitz3D Forums/Blitz3D Programming/File Problems
| ||
I have a file called lvl0.op and it looks like this:Loophole 0 ../../data/media/levels/articbase2.b3d createobject car jeep2 ../../data/media/models/vehicles/jeep2.3ds 0 0 0 0 1 0 0 0 0 .7 .7 .7 103 195 90 The only problem is with the file names (the lines with all the slashes). My file system will load the meshes perfectly if I make those filepaths: C:\Documents and Settings\Steven\Mine! Mine!\Games\Written Programs\Operation 600\Operation 600 - version 2\data\media\levels\articbase2.b3d And C:\Documents and Settings\Steven\Mine! Mine!\Games\Written Programs\Operation 600\Operation 600 - version 2\data\media\models\vehicles\jeep2.3ds But if I just have the relative file path, it doesn't work. What do you suppose I do? I've tried switching the slashes around, changing the relative file path, everything. |
| ||
It has to be relative to your blitz basic program (exe or main bb file), not the text file. Maybe that's what you're doing wrong? Edit : Just try : data/media/levels/articbase2.b3d instead of : ../../data/media/levels/articbase2.b3d |
| ||
Greetings Puppies, Have you tried setting a variable with the path name and appending the filename to that? Just a thought. Peace, Jes |
| ||
Haven't thought of that, SoggyP. |
| ||
OK, fall_x - thanks. I was writing the path relative to the level FILE, not the .bb FILE. Thanks alot, now it works! |
| ||
I have another problem. I changed the level file to this: Loophole 0 data/media/levels/articbase2.b3d 33 23 38 createobject crate crate1 data/media/models/objects/crate/Crate.3ds 0 0 0 0 1 0 0 0 0 .1 .1 .1 0 0 0 But it still loads the jeep, and not the crate. |
| ||
Without the code I can't tell you much, you probably have a variable that's being used instead of the content of this file or something similar. |
| ||
Here is the code:;loads level Function LoadLevel(filepath$) lvl.level = New level file = OpenFile(filepath$) lvl\title$ = ReadLine(file) lvl\id = ReadLine(file) lvl\mesh = LoadMesh(ReadLine(file)) ScaleEntity lvl\mesh, 2, 2, 2 EntityType lvl\mesh, LEVEL_COL camerax = ReadLine(file) cameray = ReadLine(file) cameraz = ReadLine(file) PositionEntity camera, camerax, cameray, cameraz Repeat If Lower(ReadLine$(file))="createobject" obj_type$ = ReadLine$(file) name$ = ReadLine$(file) obj_mesh$ = ReadLine$(file) el_dest = ReadLine(file) x = ReadLine(file) y = ReadLine(file) z = ReadLine(file) alpha = ReadLine(file) shine = ReadLine(file) xv = ReadLine(file) yv = ReadLine(file) zv = ReadLine(file) sx = ReadLine(file) sy = ReadLine(file) sz = ReadLine(file) rx = ReadLine(file) ry = ReadLine(file) rz = ReadLine(file) CreateObject(obj_type$, name$, obj_mesh$, el_dest, x, y, z, alpha, shine, xv, yv, zv, sx, sy, sz, rx, ry, rz) EndIf Until Eof(file) CloseFile file End Function |
| ||
Greetings Puppies, What happens if you replace the crate data with the data for the jeep - do you get two instances of the jeep? You could tell then if it's a problem with the data or the program. Peace, Jes |
| ||
But I don't load the jeep anywhere in the program! |
| ||
I'll try that, though. |
| ||
I'ma such an idiot! I WAS loading it in the program! :P |
| ||
The edit button is your friend...... |
| ||
Yep..... |
| ||
On topic though, i usually find it useful to keep a fileversion with the file so that if you upgrade after making a ton of levels, it can still read the old ones :)if fileversion>1.01 then ;New features since this version ;Do/read the new stuff here endif |
| ||
Yeah. OK, I got it to load the crate, but when I scaled it, as it was too big, it disappeared. I am sure I didn't scale it too much, it's a problem with the file. Here's the *.op file: createobject crate crate1 data\media\models\objects\crate\Crate.3ds 0 9 1 31 1 0 0 0 0 .07 .07 .07 0 0 0 createobject crate crate2 data\media\models\objects\crate\Crate.3ds 0 12 1 31 1 0 0 0 0 .07 .07 .07 0 30 0 createobject crate crate3 data\media\models\objects\crate\Crate.3ds 0 10 3.1 31 1 0 0 0 0 .07 .07 .07 0 -30 0 And the parser is same as above. |
| ||
But there are collisions between the camera and object. ?? |
| ||
Did you scale it negatively? |
| ||
Nope. I scaled it .07 x, y, and z. |
| ||
if collisions are happening or you have collisions enableed before positioning an entity, try using resetentity after positioning the entity :) |
| ||
Collisions are enabled afterwards. |