Stop reading a data file [Solved]

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
Noobasaurus
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2006
Joined: Tue Aug 17, 2010 5:56 pm

Stop reading a data file [Solved]

Post by Noobasaurus »

Let's say that I have this in my lua.

Code: Select all

ReadDataFile("2muchspace.lvl")
And I don't want to read it anymore because it's taking up too much memory. Is there any way to do this?
Last edited by Noobasaurus on Wed Jul 09, 2014 3:15 pm, edited 1 time in total.
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: Stop reading a data file

Post by Marth8880 »

Based on this list of Lua callbacks, probably not.

Why *exactly* do you need to un-load the LVL file? What all does it contain? :o
Noobasaurus
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2006
Joined: Tue Aug 17, 2010 5:56 pm

Re: Stop reading a data file

Post by Noobasaurus »

It contains a map. All the objects and stuff. I can't read another one because then the game runs out of memory, so I have to stop reading the first one.

Okay, so I'm thinking that I might be able to use ScriptCB_DoFile to load it, but I don't think that I'll be able to un-load it.
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: Stop reading a data file

Post by Marth8880 »

I see. Why exactly do you need to load more than one map in the same mission? :o There might be an easier way of doing what you might be trying to do.
Noobasaurus
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2006
Joined: Tue Aug 17, 2010 5:56 pm

Re: Stop reading a data file

Post by Noobasaurus »

Of course there's an easier way. I want to load the maps as people complete objectives. However, I need to keep the scores they have achieved from each world.
Hidden/Spoiler:
SITH LAWD
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: Stop reading a data file

Post by Marth8880 »

Hmm. Have you ever heard of/played Jaspo's One-Map Mappack? If the maps are modular (heck, I don't think they'd even have to be modular, seeing as how you could just use different terrain textures in the different "map" areas), you could try implementing similar concepts.
Noobasaurus
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2006
Joined: Tue Aug 17, 2010 5:56 pm

Re: Stop reading a data file

Post by Noobasaurus »

Yeah, I've played that and thought about using a similar method. I'll probably end up doing that. I'm just too lazy to make a map but I guess I'll have to now.

What I'm going for will probably work better with a custom map anyways.
User avatar
Teancum
Jedi Admin
Jedi Admin
Posts: 11080
Joined: Wed Sep 07, 2005 11:42 pm
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set
Location: Indiana

Re: Stop reading a data file

Post by Teancum »

Just to clarify, there is no "stopping" reading a data file. It reads it once and puts it in memory. It doesn't constantly stream it, nor is there a way to remove it from memory once its been loaded (aside from quitting to the menu or loading the next map).

Sorry if that bursts your bubble.
Noobasaurus
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2006
Joined: Tue Aug 17, 2010 5:56 pm

Re: Stop reading a data file

Post by Noobasaurus »

It doesn't quite burst my bubble, but it brings up another question. Is there a way to load a map, have the player do stuff there, and then load another map through the same lua? The reason why I'm saying the same lua is so that if x=1 it will stay 1 in the next map.
User avatar
Teancum
Jedi Admin
Jedi Admin
Posts: 11080
Joined: Wed Sep 07, 2005 11:42 pm
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set
Location: Indiana

Re: Stop reading a data file

Post by Teancum »

What you'll want to do is create a custom Galactic Conquest like Maveritchell's The Dark Times. By its nature it can save data from the LUA you can carry over things from one map to the next.
Noobasaurus
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2006
Joined: Tue Aug 17, 2010 5:56 pm

Re: Stop reading a data file

Post by Noobasaurus »

Oh, dang. Okay. I'll look into that. Thanks!
User avatar
Locutus
1st Lieutenant
1st Lieutenant
Posts: 420
Joined: Fri Jun 04, 2010 10:08 am
Projects :: Stargate Battlefront Pegasus
Location: Germany
Contact:

Re: Stop reading a data file

Post by Locutus »

Noobasaurus wrote:I want to load the maps as people complete objectives. However, I need to keep the scores they have achieved from each world.
Did you take a look at this: viewtopic.php?f=64&t=17867&p=309098#p309098 ?
Noobasaurus
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2006
Joined: Tue Aug 17, 2010 5:56 pm

Re: Stop reading a data file [Solved]

Post by Noobasaurus »

No I did not. That does look really interesting, and I would experiment with it if the source code link wasn't broken. Thanks.

And I also did look into a custom GC and it's a little bit over the top for what I'm trying to do. So now it's all in one map.
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: Stop reading a data file [Solved]

Post by Marth8880 »

Post Reply