Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 946 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Level Loading #345017
10/22/10 17:11
10/22/10 17:11
Joined: Mar 2009
Posts: 186
V
Valdsator Offline OP
Member
Valdsator  Offline OP
Member
V

Joined: Mar 2009
Posts: 186
My game now has a menu and a working "New Game" button. When this button is pressed, the game loads my test level, but it creates some weird problems. First of all, the lighting is a bit messed up. My map's lighting is supposed to be dark blue, but when I load this level through the menu, the blue is a lot lighter. Also, some weird, giant, red block appears at the start of the level.

Here's the code for loading the level:
Code:
vec_set(sky_color,vector(180,130,40));
level_load("testlevel.wmb");
skybox = ent_createlayer("cityskylinebig.tga", SKY|CUBE|SHOW, 0);
snd_stop(musichandle);
SOUND* music = "SONG2.wav";
musichandle = snd_loop(music,80,0);
menu = 0;
gamemenu = 1;
game_save("restart",1,SV_ALL);


It's basically the same way the menu level is loaded, but the there's code that changes the music, switches some variables, and saves the game, so restarting the level is possible (although, I'm guessing this is inefficient :P).

Anyone know what's causing the level loading to mess up?

Re: Level Loading [Re: Valdsator] #345135
10/23/10 14:42
10/23/10 14:42
Joined: Mar 2004
Posts: 206
The Netherlands
R
Roy Offline
Member
Roy  Offline
Member
R

Joined: Mar 2004
Posts: 206
The Netherlands
The lightning may be brighter, because you have the sun or ambiance set. This affects the overall level lightning. You can check if these are set (they are by default) in File/Map Properties under the tab 'Sun'.

Is your lightning different when you load the level with script, than without script?

The giant red block is probably not created because of this section of your script. It might be created elsewhere or it is already in the level.

To check if it is already in the level, look in the project tab (left in WED) and make sure there are no blocks that are 'off' (right click->mode; mostly, they look different in the project tab) If 'off' is set, you can see the block ingame, but not in WED.


Re: Level Loading [Re: Roy] #345191
10/23/10 22:33
10/23/10 22:33
Joined: Mar 2009
Posts: 186
V
Valdsator Offline OP
Member
Valdsator  Offline OP
Member
V

Joined: Mar 2009
Posts: 186
When I load the "testlevel" in the main function though, the lighting is perfect and there is no red block. But, if I load the "menu" level, and then press New Game, the lighting messes up and the red block appears.

Is it because my script is interrupting the level loading, and causing it to mess up?

Re: Level Loading [Re: Valdsator] #345233
10/24/10 12:22
10/24/10 12:22
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Some questions:
- why do you set the skycolor, when you create a skycube anyway?
- why do you use game_save, when the level is just loaded?
- What happens, when you don't set a skycolor, and don't create a skycube?

Re: Level Loading [Re: Pappenheimer] #345628
10/27/10 23:36
10/27/10 23:36
Joined: Mar 2009
Posts: 186
V
Valdsator Offline OP
Member
Valdsator  Offline OP
Member
V

Joined: Mar 2009
Posts: 186
Originally Posted By: Pappenheimer
Some questions:
- why do you set the skycolor, when you create a skycube anyway?
- why do you use game_save, when the level is just loaded?
- What happens, when you don't set a skycolor, and don't create a skycube?

Sorry for the late reply! D:

1. Good question... tongue
2. I use game_load to restart the level when Restart Level is pressed. I'll probably change this to loading the level properly, but for now I haven't set up a variable to tell the game what level it should be at.
3. Taking out the skybox, and sky color did not seem to affect anything, but, I tried taking out the skybox from the function main, and from the level loading code, and the huge red block disappeared (which I noticed has some other colored parts, and might be my character's model). The lighting continued to stay messed up though.

Re: Level Loading [Re: Valdsator] #345629
10/27/10 23:58
10/27/10 23:58
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
i always had problems with ent_createlayer
before calling level_load, remove ent view entities (those created by ent_createlayer) and hopefully will solve your problem.
Code:
ent_remove(skybox);
level_load("testlevel.wmb");



Re: Level Loading [Re: MrGuest] #345631
10/28/10 02:38
10/28/10 02:38
Joined: Mar 2009
Posts: 186
V
Valdsator Offline OP
Member
Valdsator  Offline OP
Member
V

Joined: Mar 2009
Posts: 186
Awesome! That gets rid of the big block, but the messed up lighting remains. The lighting might be just not changing, because it does look kind of like the lighting in the menu (the menu and first level are very similar, but lighting is a bit different). Is there anything I should do to tell the program to relight the level?

Re: Level Loading [Re: Valdsator] #345988
10/31/10 03:08
10/31/10 03:08
Joined: Mar 2009
Posts: 186
V
Valdsator Offline OP
Member
Valdsator  Offline OP
Member
V

Joined: Mar 2009
Posts: 186
Bump. Still need help with the lighting problem!

Edit: I think I should give a bit more information about this problem. Here's a picture of how it looks after loading the level from the menu, how it should look (achieved by loading the level from the script), and what the menu lighting looks like, which is basically the same as how the 1st level's lighting should be.


Edit 2: Alright, after doing some testing that I should have done earlier, I've realized that the second level is taking the first level's light settings, and then mixing it's own light settings. I'm guessing I simply need to reset the light at the start of the level, somehow. But, I don't know how to do this. Help?

Last edited by Valdsator; 11/02/10 03:24.
Re: Level Loading [Re: Valdsator] #346373
11/04/10 21:37
11/04/10 21:37
Joined: Mar 2009
Posts: 186
V
Valdsator Offline OP
Member
Valdsator  Offline OP
Member
V

Joined: Mar 2009
Posts: 186
Bump? D:


Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1