Respawn Issues

Soul_RiderSoul_Rider Mod Bean Join Date: 2004-06-19 Member: 29388Members, Constellation, Squad Five Blue
edited October 2013 in Modding
I am re-making Proving Grounds, and one of the features that I had was an instant respawn on death. It was a temporary feature until a real spawn system was designed. This worked well when it was implemented in Build 217, however, there seems to be an issue with build 258 and the same fix.

The trouble is, there is no error generated apart from this line in the log:
Error: Script Error: Setting the parent of an entity (SoundEffect) to an entity that has been destroyed (Avatar)

I understand what the code means, I don't understand where it is happening. The instant respawn was very easy to implement, as I just entered the following code at the end of Player:OnKill -
self:GetTeam():ReplaceRespawnPlayer(self,nil,nil)

As I use a custom team spawn system, which does not use eggs or IP's, instant spawn is fine. However the error now introduced is telling me that a sound effect is trying to be assigned to the old Avatar entity, rather than the new one. However, I have no idea where this sound is being added. The only difference between the OnKill functions between 217-258 is the removal of
self:SetNextThink(0)

I can't see how that would break it. Somewhere in the background, sound assigning has changed, or the timing is out, and a soundeffect is being called on the old entity, after the OnKill function is completed. My guess is it is the death sound, as it doesn't play before the game locks up, but I can't be sure.

Any help or advice?

Comments

  • SamusDroidSamusDroid Colorado Join Date: 2013-05-13 Member: 185219Members, Forum Moderators, NS2 Developer, NS2 Playtester, Squad Five Gold, Subnautica Playtester, NS2 Community Developer, Pistachionauts
    Look in files for how respswn is done. Find in files with Decoda.
  • Soul_RiderSoul_Rider Mod Bean Join Date: 2004-06-19 Member: 29388Members, Constellation, Squad Five Blue
    Thanks @SamusDroid, but I've been coding NS2 mods for a long time, I understand how the respawn system works. This is an issue with soundeffect playing after the player (Avatar) is dead. It is trying to attach the death soundeffect to the player entity, which has already been destroyed.

    What I need to understand is how and when the soundeffect is called, and try to work my spawning system around it.

    NS2 makes you a spectator, then assigns you to the relevant queue for your team, queuing you up in the egg queue or the IP queue as neccesary. The code then pulls you into the IP or Egg once your spawn is available. I do not have any such system. You just spawn at a team spawn point, immediately after you have died. It seems that the problem lies in skipping this transition period, but it is a new issue as my previous system worked all the way up to build 234 at least, I didn't work on the mod after that, so I am not sure when the issue came about.
  • SamusDroidSamusDroid Colorado Join Date: 2013-05-13 Member: 185219Members, Forum Moderators, NS2 Developer, NS2 Playtester, Squad Five Gold, Subnautica Playtester, NS2 Community Developer, Pistachionauts
    Yes what I mean is search for part of that error log in the files. There is only 1 sound that plays while dead, I don't remember, but it's only 1 and it would make sense it's that one. Respawn sound effect or something like that.
  • Soul_RiderSoul_Rider Mod Bean Join Date: 2004-06-19 Member: 29388Members, Constellation, Squad Five Blue
    OK,

    I relented, I modified the UpdateToSpectator to perform the respawn, as once the kFadetoBlack timer has completed, the sound has played, so it works. I am not happy eith that, I consider it to be a hack, but it will do for now.

    Just need to work out why the entity respawns with 0 health. It has a tiny fraction as per NS2 code so player still counts as alive.

    Also just had a look at the movement. It seems movement has been completely re-written since my last modding attempts, all my favorite functions (GetAirMoveScalar, GetAirFrictionForce etc) have been removed. Looks like it will be a while before I can re-implement the movement system I had so painstakingly devised...

Sign In or Register to comment.