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
3 registered members (TipmyPip, AndrewAMD, NewbieZorro), 16,055 guests, and 7 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
Page 1 of 2 1 2
the engine crashes on level load.... #203983
04/25/08 14:30
04/25/08 14:30
Joined: Apr 2008
Posts: 28
India,Kolkata
A
ayan Offline OP
Newbie
ayan  Offline OP
Newbie
A

Joined: Apr 2008
Posts: 28
India,Kolkata
when i am tryin to change level m engine crashes....here is the code i am usin to change level...i am using A7.07
 Code:
 
function level_change()
{
 	//wait(1); // i put comment it because it is preventing 
                   // this function to work
	
if (EVENT_TYPE == event_impact)
	{
		my = NULL;
		freeze_mode = 1;
		level_load(“level2.wmb”);
		wait(2);
		freeze_mode = 0;
	}
}

action zone_block
{
	my.enable_impact = on;
	my.event = level_change;
}





Last edited by ayan; 04/25/08 14:31.
Re: the engine crashes on level load.... [Re: ayan] #203990
04/25/08 15:07
04/25/08 15:07
Joined: Jan 2006
Posts: 59
Desert Zone
WolfCoder Offline
Junior Member
WolfCoder  Offline
Junior Member

Joined: Jan 2006
Posts: 59
Desert Zone
If this is an event as a part of an entity, then it's crashing because I think level_loads aren't supposed to be called by an entity (because the entities get wasted and die, or something).

I don't know if my way is anywhere near the best way, but it works ^^

 Code:
var change_level_now = 0;
string new_level_str;
function handle_level_change()
{
   while(1)
   {
      if(change_level_now == 1)
      {
         // Plus you can add cool transitions and stuff here with freeze mode and such ^^
         change_level_now = 0;
         level_load(new_level_str);
      }
      wait(1);
   }
}
function change_the_level(newlevel)
{
   // Can be safely called in entities events and stuff
   new_level_str = newlevel;
   change_level_now = 1;
}

function main()
{
... stuff
handle_level_change(); // Get it goin'
... stuff
}


Once the handler has been called once in main ya can just use change_the_level("level.wmb"); to do it within the event and eventually and hopefully, safety, it will change the level.

That's back when I didn't use C++ to write Acknex games.

Last edited by WolfCoder; 04/25/08 15:09.
Re: the engine crashes on level load.... [Re: WolfCoder] #203999
04/25/08 15:49
04/25/08 15:49
Joined: Apr 2008
Posts: 28
India,Kolkata
A
ayan Offline OP
Newbie
ayan  Offline OP
Newbie
A

Joined: Apr 2008
Posts: 28
India,Kolkata
iwill definitely try ur mehod but regarding entiity issue....i have used "me = NULL" , sets the pointer to the entity calling this function to null so that the function istance no lomger exists and the function run on its own.....i have seen this method in a tutorial

Re: the engine crashes on level load.... [Re: ayan] #204002
04/25/08 15:56
04/25/08 15:56
Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey
AFAIK there is nothing like you cant call level_load from entities. You can use it every possible place.

i use this way:

the level block entity's string1 is set to next levels name(say "level2.wmb")

and i have a function like that:
 Code:
function baslat(){
	SOUND* wwry = "wwry.ogg";
	var i;
	for (i =0;i <= 5;i++) {kollar[i] = 0; }
        //above are initialazition of the global variables, that needs to be set 0 on every level starts

	level_load(level);//i have a STRING* level;
	freeze_mode = 0;
	wait(-1);
	snd_stopall(4);
	snd_loop(wwry,10,0);
	
}

and in the impact event i use

 Code:
if (EVENT_TYPE == event_impact)
	{
		level = my.string1;
		baslat();
	}




Last edited by Quadraxas; 04/25/08 15:57.

3333333333
Re: the engine crashes on level load.... [Re: Quad] #204006
04/25/08 16:30
04/25/08 16:30
Joined: Apr 2008
Posts: 28
India,Kolkata
A
ayan Offline OP
Newbie
ayan  Offline OP
Newbie
A

Joined: Apr 2008
Posts: 28
India,Kolkata
actually the enggine is crashing well before the level change....the thing is on calling the event function on impact....

i.e.,

action levelchange
{
my.enable_impact = on;
my.event = change_the_level(); // the problem is here...if we pass parameter
// in this event driven function the engine
// crashes
}

Re: the engine crashes on level load.... [Re: ayan] #204008
04/25/08 16:43
04/25/08 16:43
Joined: Apr 2008
Posts: 28
India,Kolkata
A
ayan Offline OP
Newbie
ayan  Offline OP
Newbie
A

Joined: Apr 2008
Posts: 28
India,Kolkata
changing levels within entity event driven function is resulting in engine crash

Last edited by ayan; 04/25/08 16:49.
Re: the engine crashes on level load.... [Re: ayan] #204009
04/25/08 16:48
04/25/08 16:48
Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey
you cannot pass paramaters to events. but you can use "my" as usual in the events.


3333333333
Re: the engine crashes on level load.... [Re: Quad] #204010
04/25/08 16:55
04/25/08 16:55
Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey
sorry for double posting but, it doent crashes. Problem is that the impact event called over and over instantly, thus you are calling level_load too many times, this make engine crash.

 Code:
function level_event(){
	my.emask &= ~ENABLE_IMPACT;
	ent_remove(me);
	wait(-1);
	my = NULL;
	you = NULL;
	level_load("level.wmb");
	wait(2);
}


works fine.


3333333333
Re: the engine crashes on level load.... [Re: Quad] #204011
04/25/08 16:57
04/25/08 16:57
Joined: Apr 2008
Posts: 28
India,Kolkata
A
ayan Offline OP
Newbie
ayan  Offline OP
Newbie
A

Joined: Apr 2008
Posts: 28
India,Kolkata
but quadrexas during level load all the entities and its instances and functions associated with it will become non existent so we will get stucked/crash inside the function blast(); as the instances of the entity calling this function no longer exists after level_load();....i.e i have used my = NULL; before level_load() as prescribed in the tutorial bui that too is resulting in a engine crash

Re: the engine crashes on level load.... [Re: ayan] #204013
04/25/08 17:03
04/25/08 17:03
Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey
i dont know if you read my prev post but the reason is the event is called too many times during impact.

at first impact if you make it non-sensitive to impact by "my.emask &= ~ENABLE_IMPACT;" line, your entity wont respond to further impacts and it will work fine.


3333333333
Page 1 of 2 1 2

Moderated by  HeelX, rvL_eXile 

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