Respawn Issues
Soul_Rider
Mod Bean Join Date: 2004-06-19 Member: 29388Members, Constellation, Squad Five Blue
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:
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 -
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
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?
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
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.
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...