Little problem with wait

Posted By: Ch40zzC0d3r

Little problem with wait - 11/23/12 13:26

Hey guys laugh
Ive got a problem and stuck now over 2 days. I have a simple function in my game, and I call it to respawn people. When I call the wait(-10) or any other wait, the function is terminating itself o_0
So before wait is an error box, after it nothing happens. Yes, Im using proc_kill in my game, but just with function pointers and not in my netcode at all. Please help me frown

Code:
function net_respawnPlayer(var time, var id)
{
	createWeapon(id);
	
	wait(-time);
	
	pHealth[id] = 100;
	pPlayer[id].health = pHealth[id];
	enet_sendto(&(pPlayer[id].health), sizeof(int), BROADCAST);
.......

Posted By: Yashas

Re: Little problem with wait - 11/23/12 14:10

A negative number in wait indicates seconds.
Are you sure you have waited that many time seconds before taking the desicion that the functions never continues??
Are you sure that the value you to time is not something 100 or 1000 or so??
Did you try wait(-10); once??
Can you please give the arguments that you give to the function
An Example Working Code(Extract from my app):
Code:
PANEL * Splashscreen =
{
	bmap = SplashscreenImage;	
	alpha = 100;
	flags = TRANSLUCENT;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
void VideoStartup ()
{
	video_mode = 10;
	video_screen = 1;
	mouse_mode = 4;
	master_vol = 100;	
}
////////////////////////////////////////////////////////////////////////////////////////////////////
int main ()
{
	VideoStartup ();
	wait_for(VideoStartup);
	var time = 5;

	wait(-t1ime);
	Splashscreen.scale_x = screen_size.x / bmap_width(SplashscreenImage) - 0.04;
	Splashscreen.scale_y = screen_size.y / bmap_height(SplashscreenImage);
	wait(-time);
	while(Splashscreen.alpha > 0)
	{
		Splashscreen.alpha -= 5;
		wait(0.01);	
	}
	reset(Splashscreen,SHOW);
	bmap_purge(SplashscreenImage);
	return 0;	
}

Posted By: Ch40zzC0d3r

Re: Little problem with wait - 11/23/12 15:34

I just fixed this :|
It was a wrong set my-pointer, IDK why it paused my wait instruction.
And yeah, I was sure about the wait. I even tried wait(1) and it didnt work.
However now its working, thanks for your help laugh

BTW: Someone has got a nice zombie model?
Posted By: Yashas

Re: Little problem with wait - 11/24/12 11:11

I don't understand what caused your function freeze in the middle of execution smirk
Posted By: WretchedSid

Re: Little problem with wait - 11/24/12 13:00

The scheduler will automatically unschedule all functions which my pointer becomes NULL. That's why the wait never "returned".
Posted By: Yashas

Re: Little problem with wait - 11/24/12 15:39

humm... Thanks laugh
© 2024 lite-C Forums