Weird crash

Discussions about Coding and Scripting
Post Reply
User avatar
Rakiayn
Masterful
Posts: 550
Joined: Fri Aug 28, 2009 3:33 pm

Weird crash

Post by Rakiayn »

I have this weird crash I cant explain. it has something to do with the 'tick' function
Image



here is the code of the function tick:

Code: Select all

simulated event Tick(float TimeDelta)
{ 


if ((master != none) && (monsterwindow != none)  && (spawner != none))
{
      if (master.health > 0)
      {
      
          veel += 1;
          
          if (veel >= 80)
          {
          master.health+=1;
          monsterwindow.changetext();
          spawner.windowmutate4("textchanged",0);
          veel = 0;
          }
      monsterwindow.update3dbox();
      
      }
}









BroadcastMessage(textchanged);
BroadcastMessage(whatspawns[selectedslot]);
BroadcastMessage(selectedactornumber[selectedslot]);




                                     if ((monsterwindow != none) )
                                     {
                                     monsterwindow.update3dbox();

                                     }
                                     if ((projectilewindow != none) )
                                     {
                                     projectilewindow.update3dbox();
                                     }
                                     if ((projectilewindow2 != none) )
                                     {
                                     projectilewindow2.update3dbox();
                                     }


if (master == none)
{
BroadcastMessage("Alarm: SpawnerMasterinfo, MASTER = NONE!!!!!!!!!!");
return;
}


if (firstinfocalled == false)
{

	if (playerpawn(master) != none)
	{
	MMPlayerIP = left(playerpawn(master).GetPlayerNetworkAddress(), InStr(playerpawn(master).GetPlayerNetworkAddress(), ":"));
	}
	if (bots(master) != none || bot(master) != none)
	{
	MMbotname = master.playerreplicationinfo.playername;

	}



firstinfocalled = true;
FirstInfo();

}


//	if ( Role == ROLE_Authority )
//		RemoteRole = ROLE_AutonomousProxy;

//Disable('Tick');
}
Master = player who owns the info actor
spawner = A certain weapon owned by the master
monsterwindow = A window

If I look at the error sign, I would think that there is a mainloop, somehwhere a function refers to the tick function, and the tick function refers back to that function, causing a crash
however this is not the case.
the crash occurs when You die and then respawn
also the crash only occurs when I play as a client, not when I play in a practise session.
User avatar
anth
Adept
Posts: 257
Joined: Thu May 13, 2010 2:23 am

Re: Weird crash

Post by anth »

Your code is extremely confusing. You're using windows so I'm assuming that the code is supposed to run on the clientside only. Yet I see several BroadcastMessage calls (which cannot be run on clients). You need a better separation between your clientside code and your serverside code.
User avatar
Rakiayn
Masterful
Posts: 550
Joined: Fri Aug 28, 2009 3:33 pm

Re: Weird crash

Post by Rakiayn »

well the code I posted is not in a window, but in an info actor, and yes the window is client side
but If I place the code betwee this

Code: Select all

simulated event Tick(float TimeDelta)
{
if (role < role_authority)
{
code....
}
}
it will still crash
User avatar
anth
Adept
Posts: 257
Joined: Thu May 13, 2010 2:23 am

Re: Weird crash

Post by anth »

you can't call BroadcastMessage on a client
User avatar
Rakiayn
Masterful
Posts: 550
Joined: Fri Aug 28, 2009 3:33 pm

Re: Weird crash

Post by Rakiayn »

I removed the broadcastmessage but it still crashes
User avatar
Rakiayn
Masterful
Posts: 550
Joined: Fri Aug 28, 2009 3:33 pm

Re: Weird crash

Post by Rakiayn »

I have been trying to figure out wich code in the tick function causes the crash. I didnt solve it. I moved the code to a 'timer' function. after that the error message said sometihng about the timer, instead of the tick. then I changed some stuff in the code and now It crashes over another tick function from an other actor :| .
this actor Is spawned when I open the window, and gets destroyed when I close it. the crash occurs when you die and after respawning attempt to open the window. sometimes it crashes the first time you try after respawning, sometimes you can open the window,and respawn 6 times before it crashes. I think it is just about the tick function itself. I hope there is a way to solve it. i dont want to remove it
User avatar
anth
Adept
Posts: 257
Joined: Thu May 13, 2010 2:23 am

Re: Weird crash

Post by anth »

Are you spawning this actor in the entrylevel?
User avatar
Rakiayn
Masterful
Posts: 550
Joined: Fri Aug 28, 2009 3:33 pm

Re: Weird crash

Post by Rakiayn »

no
User avatar
Rakiayn
Masterful
Posts: 550
Joined: Fri Aug 28, 2009 3:33 pm

Re: Weird crash

Post by Rakiayn »

no one knows?
I have been removing acces nones and other errors. and it seems the crash occurs less often now. hopefully I will be albe to get it out completly
User avatar
anth
Adept
Posts: 257
Joined: Thu May 13, 2010 2:23 am

Re: Weird crash

Post by anth »

Well, in general there are two cases in which this particular crash occurs. Either you're screwing around in the memory with a native module (which I assume is not the case) or you're calling a native function from a context that is not supposed to be calling the native function. For example: calling a PlaySound function on the server.

I can write you a small tool so you can see exactly what's going on under the hood.
User avatar
anth
Adept
Posts: 257
Joined: Thu May 13, 2010 2:23 am

Re: Weird crash

Post by anth »

http://utgl.unrealadmin.org/VMMonitor/20100708/

Feel free to try. This will dump all uscript calls (including uscript -> native ones) to the UT.log file. Keep in mind that this is done using hooks. After you've used it, you MUST use the "Close/Unload" button before you go to a server that runs UTDC or ACE.
User avatar
Rakiayn
Masterful
Posts: 550
Joined: Fri Aug 28, 2009 3:33 pm

Re: Weird crash

Post by Rakiayn »

thanks I will try it.
I think it is not the 'native module' thing since I dont even know what that is.
so I think its the second thing, I didnt know that you can not call a playsound server side so I guess it must be something like that
User avatar
anth
Adept
Posts: 257
Joined: Thu May 13, 2010 2:23 am

Re: Weird crash

Post by anth »

I'm guessing it could also be one of the window functions since afaik, the windowing system isn't loaded on the serverside.
Post Reply