Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPSC Classic Product Chat / A Mod that launches another level from within a level

Author
Message
Flatlander
FPSC Tool Maker
19
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 21st Jun 2012 07:09 Edited at: 23rd Jun 2012 02:50
Edited.

See post #9 -- my post about changes made to the command line.

This is NOT a packer/launcher. It is also using code that is still in beta. Therefore there is no support for the beta code. There is only about 18 lines of code that is added to the beta code. This particular executable uses r675. If I get responses to this thread I will update it as it goes along. I would give you the code but I use commands from a plug-in for DBPro called STYX that you would have to purchase.

If anyone wants to use this then you will need to use it at your own risk and it should not be used for an official game. Only for testing.

Here is an explanation of what the engine does.

The command: executefile=X where X is the relative path to executable. A relative path is a path relative to the working directory of the user or application, so the full absolute path will not have to be given.

IMHO, the best way to organize your separate levels is to include the subsequent level folders within the root directory of the very first level of the game and not nesting it in each folder that would be in the files subfolder. Here is an image of an example root folder for the game which would be the startup level.



You will have to manually add these folders to the root folder.

Now, in the trigger zone or even the main script of an entity you will have a line similar to the following.

:state=1:executefile=..\level02\level02_executefile.exe,state=2

This line will execute the new level and end the current level.

You will notice the ..\ in front of the sub-folder that contains the executable file. Most of you probably know what this means. Since the path needs to be relative to the default or working directory, we need to let the command know that we need to go back one directory.

I tested this with the above script and it works fine.

So, I have been seeing a lot of people asking about this and because it was quite simple to do, I decided to provide it for those would be interested.

You will notice that the first thing that happens is the current game quits and goes back to the desktop and then the next loads. Therefore, it is noticeable. It is impossible to get it to merge smoothly. That is why Lee made the possibility for more than one level. It merges smoothly without any kind of a break. Of course before you make the transition, you can use huds or whatever to let the player know what is happening in the game.

Personally, I will not be using this method for most of my games as I don't particularly like the game going back to the desktop even if it is for a short while (maybe 1 to 3 seconds). This is just my personal feeling. If I had to do it that way I would like a launcher to do it for me as there probably wouldn't be such a vivid break.

Oh, BTW, the executable is in the download link.

"A programmer is just a tool which converts caffeine into code . . . reminds me….. if I had one more brain cell, I could have a synapse! woo hoo, Sparky!

~I'm the Terry of the Flatlands.
Bugsy
17
Years of Service
User Offline
Joined: 24th Nov 2008
Location: another place in time
Posted: 21st Jun 2012 07:23
a level within a level
gameception!

either way once I return home I may give this a try. thanks flatlander!

Nickydude
Retired Moderator
19
Years of Service
User Offline
Joined: 4th Nov 2006
Location: Look outside...
Posted: 21st Jun 2012 14:02
Quote: "You will notice that the first thing that happens is the current game quits and goes back to the desktop and then the next loads."


You could in theory create some sort of (loading level) picture that sits in the background over the desktop so when the game quits the loading pic will display while the next level loads.

I reject your reality and substitute my own...
Flatlander
FPSC Tool Maker
19
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 21st Jun 2012 15:52
Quote: "You could in theory create some sort of (loading level) picture that sits in the background over the desktop so when the game quits the loading pic will display while the next level loads."


Great idea, Nickydude. I may work on that today. It needs to be able to load/display in some way.

"A programmer is just a tool which converts caffeine into code . . . reminds me….. if I had one more brain cell, I could have a synapse! woo hoo, Sparky!

~I'm the Terry of the Flatlands.
bruce3371
15
Years of Service
User Offline
Joined: 4th Aug 2010
Location: Englishland
Posted: 21st Jun 2012 17:57
So could I use this to open a 'bonus level' from within a level, then, when you finish playing the 'bonus level', it goes back to the level which was 'interrupted'?

Flatlander
FPSC Tool Maker
19
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 21st Jun 2012 20:40
Hi Bruce,

I suppose it's possible. You will probably need to set a variable then prior to going to the "Bonus level" you would do a quick save and then when you come back check the variable to see if you have returned to a quick load. I'm not sure how this will work, though. The issue is if you want to have everything the same when you left. In RPGmod this is pretty easy to accomplish. You may need to do some trial and error with it.

I don't think I will make any additions to this mod, however.

"A programmer is just a tool which converts caffeine into code . . . reminds me….. if I had one more brain cell, I could have a synapse! woo hoo, Sparky!

~I'm the Terry of the Flatlands.
bruce3371
15
Years of Service
User Offline
Joined: 4th Aug 2010
Location: Englishland
Posted: 21st Jun 2012 21:00
Thanks for the answer.

The reason I was asking is that in one of my game's levels, there is a computer monitor which displays a static image of an area which the player can't access. I've created a seperate level which depicts this area, and I was wanting to be able to have a hidden way of accessing this extra level, as a sort of 'easter egg' that the player has to unlock.

My original intention was to complete this game 1st, then try out RPG Mod with a new game. However, now I'm wondering if it's possible to convert an existing vanilla FPSC game to RPG Mod, or is it only possible to create NEW games with RPG Mod?

Braden 713
18
Years of Service
User Offline
Joined: 3rd Aug 2007
Location: Canada
Posted: 23rd Jun 2012 01:37
This sounds like a very neat concept, I'm just wondering as I'm not exactly sure how it works, if for example I had a 5 level game and in theory I wanted to be able to load into a different map (i.e. a bonus map) from within the 1st level, will the game return me to the remaining 4 levels of my game when I've completed the bonus one? Or would I simply just need to restart the .exe and play through normally? (Except, without triggering the bonus map in the 1st level of course).

Life would be much easier if I had the source code.
Flatlander
FPSC Tool Maker
19
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 23rd Jun 2012 02:47 Edited at: 23rd Jun 2012 02:51
I updated the code so that the desktop will not be shown between levels. You can download it by the download link in the first post. This update uses r676 of the beta code.

There is a change in the command line.

The command: executefile=X (Y) where X is the relative path to the executable. A relative path is a path relative to the working directory of the user or application, so the full absolute path will not have to be given. Y is a length of time in milliseonds. It is optional. If it is not used then the default of 1500 (1.5 seconds) will be used. However, if you still see a glimpse of the desktop then you might want to increase this. You could start with 1750 and go in increments of 250 until you are satisfied with the result.


@Braden 713 and others interested in a Bonus level concept.

The concept was born out of the desire by some developers who did not want to compile a multilevel game; but, instead be able to load one level at a time of a single built level. However, the biggest drawback is that there cannot be anything saved and taken to the next level. However, I know of one development where this is not necessary. Now, you and bruce3371 have brought up an interesting use for this.

In your situation, Braden, is that you can build a single level for level #1, and execute the bonus level from there. Again, nothing can be saved and therefore everything done in level #1 cannot be taken to level #2-5. You will build a multilevel (2-5) and execute that from the bonus level.

However, there is another way around the save issue between levels and still be able to use a bonus level. Build the game with all six levels. In v119 there is a command you can use to go to any level you wish. So, if the player earned a bonus level then you can send him to that level. Say levels 1-5 are the main game. You will make the bonus level #6. From level #1 you would use the following command:

NEXTLEVEL=X
Description: This defines which level will be the next when the win zone is triggered. In order to make the action work, it may be necessary to use the “suspend” action after the “nextlevel=” action.
Range: X = 0 to highest level.
Example: :state=1:nextlevel=6,suspend

then from the bonus level #6 you will use this command again:

:state=:nextlevel=2,suspend

Everything should be saved from level #1 to level #6 and then to level #2.

I have not tested this so I cannot guarantee it will work; but, it makes perfect sense that it should.

"A programmer is just a tool which converts caffeine into code . . . reminds me….. if I had one more brain cell, I could have a synapse! woo hoo, Sparky!

~I'm the Terry of the Flatlands.

Login to post a reply

Server time is: 2026-07-04 15:04:00
Your offset time is: 2026-07-04 15:04:00