Load map from elsewhere

Load map from elsewhere

Postby ismellike » 01 Jul 2013, 18:27

I know how to do Level level = Level.Load("name"),but I want to know how to load a level from a different directory. I know it's possible since every game system does it, but I haven't been able to figure out how.
I've tried Level level= Level.Load("directory path", "name of map", "", MapType.Freebuild, false);, it didn't work.
What a beast...
User avatar
ismellike
Coder
 
Posts: 731
Joined: 31 Oct 2012, 04:04
Location: Kansas

Re: Load map from elsewhere

Postby joppiesaus » 01 Jul 2013, 18:46

I haven't find any method for Level.Find() for a derectory. The only argument you can give is the name.
Level.Load() does the same.
joppiesaus
 
Posts: 379
Joined: 20 Aug 2012, 07:28
Location: in a obsedian house, with glass in it so i can see the lava!

Re: Load map from elsewhere

Postby ismellike » 02 Jul 2013, 03:58

It's ok I found something that worked.

I did File.Copy(lvl.location,static map name,true); <- that won't compile, but it is to give you an idea.
and then I did Level.Load

I only did the above for a little game I was making on my server.
What a beast...
User avatar
ismellike
Coder
 
Posts: 731
Joined: 31 Oct 2012, 04:04
Location: Kansas

Re: Load map from elsewhere

Postby joppiesaus » 02 Jul 2013, 08:53

hmm... What if you do
Code: Select all
string path = string.Format(@"{0}\levels\{your name here}", Application.StartupPath)
using (System.IO.Directory.Create(path)){}
using (System.IO.File.Create(string.Combine(path + "\{level name here}.lvl")), 1024)


and then this:
Code: Select all
Level.Load(@"{your direcory here}\{name of map here}");


What will happen? You have a sub-directory in maps for your plugin level, and that can load I think.
joppiesaus
 
Posts: 379
Joined: 20 Aug 2012, 07:28
Location: in a obsedian house, with glass in it so i can see the lava!


Return to Help in Coding

Who is online

Users browsing this forum: No registered users and 7 guests