Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
5 registered members (Dico, AndrewAMD, TipmyPip, NewbieZorro, Grant), 15,791 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
level_load problems #240440
12/10/08 23:20
12/10/08 23:20
Joined: Nov 2007
Posts: 18
J
JimmyJazz Offline OP
Newbie
JimmyJazz  Offline OP
Newbie
J

Joined: Nov 2007
Posts: 18
Hi,

I'm working on a small project that requires some data initialisation following each new level that is loaded. However, despite the fact that the Lite-C documentation says scripts continue following the level_load instruction, this initialisation doesn't take place when the player model leaves the initial level.

The code I'm using is:

function Main_loadLevel(STRING* strLevel) {

level_load(strLevel);
wait(2);

DebugOutputPanel_addToLog("qwertyuisxcvbnm");

Global_entCharacter = ent_create(NULL, NULL, CharacterBehaviour);
Character_calculateArmour();
Character_calculateDamage();

STRING* temp1 = "";
str_for_num(temp1, Global_vecPlayerLocation[0]);
DebugOutputPanel_addToLog(temp1);
str_for_num(temp1, Global_vecPlayerLocation[1]);
DebugOutputPanel_addToLog(temp1);
str_for_num(temp1, Global_vecPlayerLocation[2]);
DebugOutputPanel_addToLog(temp1);

Global_entPlayer = ent_for_name("entPlayer");
Global_entPlayer.x = Global_vecPlayerLocation[0];
Global_entPlayer.y = Global_vecPlayerLocation[1];
Global_entPlayer.z = Global_vecPlayerLocation[2];
Global_entPlayer.pan = Global_numPlayerPan;

// Initialise level entities to saved states
IO_loadLevel(Global_strLevelToLoad);

// Set the level name and character info component text
HudPanel_setLevelName();
HudPanel_setCharacterName();
HudPanel_setCharacterHp();
}

It works fine when the game is first loaded but doesn't work when a new level is loaded - none of the debug text is displayed within the log.

Thanks in advance!

Jim

Re: level_load problems [Re: JimmyJazz] #240483
12/11/08 07:48
12/11/08 07:48
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Try if it works if you add the following line of code at the top of your function:
Code:
my = NULL;


comment:
functions have a my pointer, if they are called from an entity it points to that entity.
If a level_load happens, all functions which have a my pointer unequal to NULL will be terminated.
So this could be the problem here. (just a guess)

edit: thanks lukas, didn't watch my typing here ;-)

Last edited by Xarthor; 12/11/08 15:48.
Re: level_load problems [Re: Xarthor] #240528
12/11/08 12:52
12/11/08 12:52
Joined: May 2007
Posts: 2,043
Germany
Lukas Offline

Programmer
Lukas  Offline

Programmer

Joined: May 2007
Posts: 2,043
Germany
Yes, null must be NULL in Lite-C, because it's case-sensitive. wink

Re: level_load problems [Re: Lukas] #240866
12/12/08 23:29
12/12/08 23:29
Joined: Nov 2007
Posts: 18
J
JimmyJazz Offline OP
Newbie
JimmyJazz  Offline OP
Newbie
J

Joined: Nov 2007
Posts: 18
Nice one, guys! It's working now - it wasn't the only problem (there were other bugs I had to track down) but it solved the initial error of the script ending.

Much obliged to you all...

Jim


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | 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