Posted: 17th May 2003 0:23
Does anyone know the code to detect and run external levels? I could use it.
Posted: 17th May 2003 1:43
what do you mean by external levels? loading a matrix from a file? tilemaps? heightmaps?
Posted: 17th May 2003 1:47
Making external levels in txt files and my main program detecting them and putting them in a list to choose a level from
Posted: 17th May 2003 1:48
Then having the main program extract the data and make the level
Posted: 17th May 2003 2:29
Sigh. Here is EXAMPLE code for this, this now cancelled project, to which I have posted the source, shows you how you can load and save level data to/from text files.

The functions which you need to look at are:

LoadLevel()
LoadLevelObject()

and the Save level code (the Code Snippet box below, click the SOURCE button to see the rest of the code)

+ Code Snippet
If scancode()=31
      savename$ = XInput("Enter the filename for this level")
      levelfname$ = "levels/"+savename$+".srl"


      If File Exist(levelfname$) = 1
         If XInput("Overwrite Existing File Y/N") = "y" Then Delete File levelfname$
      Endif

      If savename$ <> "" and File Exist(levelfname$) = 0

         `Write Data
         Open To Write 1,levelfname$
         Write String 1,"["+levelname$+":"+Str$(levelgravity)+":"+str$(levelfuelrate)+":"+str$(leveloxygenrate)+"]"

         `Write Each line (cycle through all objects)
         for i = 0 to 2001
            if object exist(1000+i) = 1
               obj = 1000+i
               prepstring$ = str$(objType(i))+","
               prepstring$ = prepstring$ + str$(Object Position X(obj))+","
               prepstring$ = prepstring$ + str$(Object Position Y(obj))+","
               prepstring$ = prepstring$ + str$(Object Position Z(obj))+","
               prepstring$ = prepstring$ + str$(objscale(i).ScaleX)+","
               prepstring$ = prepstring$ + str$(objscale(i).ScaleY)+","
               prepstring$ = prepstring$ + str$(objscale(i).ScaleZ)+","
               prepstring$ = prepstring$ + str$(objTexture(i))+","
               prepstring$ = prepstring$ + str$(objGhoststatus(i))+","
               prepstring$ = prepstring$ + str$(objSpecial(i))+","
               Write String 1,prepstring$
            endif
         next i

         Close File 1

      endif
   endif


NOTE: This code can only handle two types of object, cubes and cylinders, however this could easily be expanded to take any object you wanted.

If you want to see Matrix saving / loading, then search for MatEdit on Google.
Posted: 17th May 2003 14:18
Here's a systme that make 3d maps, and then save them into files
it work well only in dbc, but you can delete the collisions system and replace it by my sliding collisions mk2
http://sensai.free.fr/attreid/
look for darkmaps
(it's very old, I know, but it work )
Posted: 17th May 2003 17:09
One little note: THIS FORUM IS NOT FOR POSTING CODE REQUESTS. Do that in the general, or newcomers forum.
Posted: 17th May 2003 18:56
Thanks guys. Now to go practice using external levels.