Page 1 of 1

Game Crashes After Unmorphing

Posted: Tue Nov 15, 2016 10:11 pm
by buu342
Hi there.

My game seems to be crashing after unmorphing in a multiplayer match. The bug is rather odd. I don't crash if I play in Singleplayer, but I do crash if I play in Multiplayer. Even weirder is I am always the only player that crashes, as anyone else on the server unmorphs with no problems...

Here's my ACS, Decorate, and the Crash Report:

ACS:

Code: Select all

Script 2 (void)
{
	SetActorAngle(0,0.25);
	DoCodeClient[PlayerNumber()] = false;
	SetFont("BIGFONT");
	SpawnSpotForced("MapSpot",1337+PlayerNumber(),2337+PlayerNumber(),0);
	thing_move(1337+PlayerNumber(),170+PlayerNumber(),false);
	SetFont("BIGFONT");
	SpawnSpotForced("KartTranslator",1337+PlayerNumber(),3337+PlayerNumber(),0);
	Thing_SetTranslation(3337+PlayerNumber(),-1);
	MorphActor(0,"KartPlayer",1,698-(35*SpeedupNum),0,"","");
	Thing_ChangeTID(0, 1337+PlayerNumber()); // Morphing the player resets his TID ._.
	//printBold(d:ActivatorTID());
	hudmessage(s:"Finish a lap";HUDMSG_PLAIN,1,cR_ORANGE,0.5,0.3,1);
	hudmessage(s:"\n\nShoot To Accelerate";HUDMSG_PLAIN,2,cR_RED,0.5,0.3,1);
	setplayerproperty(1, 1, PROP_TOTALLYFROZEN);
	delay(70);
	setplayerproperty(1, 0, PROP_TOTALLYFROZEN);
	delay(630-(35*SpeedupNum));
	hudmessage(s:"";HUDMSG_PLAIN,2,cR_ORANGE,0.5,0.3,1);
	Thing_ChangeTID(0, 1337+PlayerNumber());
	thing_move(1337+PlayerNumber(),2337+PlayerNumber(),false);
	thing_remove(2337+PlayerNumber());
	Thing_ChangeTID(0, 1337+PlayerNumber());
}
Decorate:

Code: Select all

ACTOR KartPlayer : DoomPlayer
{
  player.forwardmove 0
  player.sidemove 0
  player.viewheight 24
  player.jumpz 0
  Health 100
  Radius 16
  Height 30
  Mass 100
  Player.ColorRange 112, 127
  PainSound ""
  DeathSound ""
  Player.MorphWeapon "KartWeapon"
  +NOBLOOD
  +pushable
  +NOSKIN 
  States
  {
  Pain:
  Melee:
  Missile:
   Goto See
  See:
  Spawn:
   KART A 5
   Loop
  Death:
    MISL B 5 bright A_Playsound("weapons/rocklx")
    MISL C 5 bright
	MISL D 5 bright
    MISL D -1
    Stop    
  Death:
    goto Death
  }
}

actor KartWeapon : DoomWeapon
{
  Weapon.SelectionOrder 2000
  +WEAPON.DONTBOB
  Weapon.KickBack 20000
  States
  {
  Ready:
    KRTW A 1 A_WeaponReady
	KRTW A 0 A_StopSound(6)
    loop
  Deselect:
	KRTW A 0 A_StopSound(6)
    KRTW A 1 A_Lower
    loop
  Select:
    KRTW A 1 A_Raise
    Loop
  Fire:
    KRTW A 2 A_Recoil(-4)
	KRTW A 0 A_PlaySound("DoomWare/KartEngine", 6, 1)
    KRTW A 0 A_ReFire
    goto Ready
  AltFire:
    goto Ready
  }
}
Crash Report:
http://www.mediafire.com/file/bbc718c68 ... Report.zip

Re: Game Crashes After Unmorphing

Posted: Tue Nov 15, 2016 10:29 pm
by Combinebobnt
I didn't look at all the code but why did you define two death states, one that will infinitely loop too?

Watch out in the future if you use invalid tids in acs, the game just crashes with no error. (May or may not be reported idk)

Re: Game Crashes After Unmorphing

Posted: Tue Nov 15, 2016 11:11 pm
by buu342
Combinebobnt wrote:I didn't look at all the code but why did you define two death states, one that will infinitely loop too?

Watch out in the future if you use invalid tids in acs, the game just crashes with no error. (May or may not be reported idk)
The death states are there to overwrite the default ones as the pawn inherits from DoomPlayer, and I wanted to avoid it using the doom player sprites.

Hmm, the TID thing could be the issue. It's rather annoying because the TID's of actors are reset to 0 upon morphing/unmorphing, so it could be causing the issue here. I'll give it a shot.

Edit:

Yes! Adding a little bit of delay before moving the player and having him unmorph AFTER all the code is run seems to have fixed it (for now). I'll do a little more extensive testing and come back if it continues.

Re: Game Crashes After Unmorphing

Posted: Wed Nov 16, 2016 1:10 am
by Combinebobnt
i was talking about this

Code: Select all

Death:
    MISL B 5 bright A_Playsound("weapons/rocklx")
    MISL C 5 bright
   MISL D 5 bright
    MISL D -1
    Stop   
  Death:
    goto Death
Death:
goto death
looks like an infinite loop nightmare

+

use this flag MRF_NEWTIDBEHAVIOUR to keep the tid

Re: Game Crashes After Unmorphing

Posted: Wed Nov 16, 2016 7:22 am
by buu342
Combinebobnt wrote:i was talking about this

Code: Select all

Death:
    MISL B 5 bright A_Playsound("weapons/rocklx")
    MISL C 5 bright
   MISL D 5 bright
    MISL D -1
    Stop   
  Death:
    goto Death
Death:
goto death
looks like an infinite loop nightmare

+

use this flag MRF_NEWTIDBEHAVIOUR to keep the tid
Ohh shoot. That was a typo as that second death state should be XDeath. Good eye.

And I didn't know about that flag. Thanks. Must have missed it when reading the wiki.