Hyper.nl Unreal Services Forum Index Hyper.nl Unreal Services
The forum of Hyper.nl Unreal Services and the semi-offical resource for Winged Unicorn's Unreal mods
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Restart Map On Death

 
Post new topic   Reply to topic    Hyper.nl Unreal Services Forum Index -> HelpDesk
View previous topic :: View next topic  
Author Message
TheGuyWhoGotOn



Joined: 21 Nov 2006
Posts: 40

PostPosted: Thu Nov 18, 2010 1:57 am    Post subject: Restart Map On Death Reply with quote

I was wondering if anyone has a mod or some uscript I could use to make it so if any players die that the server either re-loads the current map or re-loads a state so people would be back to their health, armour, and ammo after someone dies.

Thanks
Back to top
View user's profile Send private message Send e-mail
Zombie



Joined: 27 Jan 2004
Posts: 295

PostPosted: Sun Nov 28, 2010 10:39 pm    Post subject: Reply with quote

Since this question was answered and resolved from the Oldunreal forum I will post the working solution here below too.

227 GameRules + mutator code (by Dots):
Code:
class UnrealSurvival extends Mutator;

function PreBeginPlay()
{
   local GameRules G;

   G = Spawn(class'USGR');
   if( Level.Game.GameRules==None )
      Level.Game.GameRules = G;
   else Level.Game.GameRules.AddRules(G);
   Destroy();
}


Code:
class USGR extends GameRules;

function NotifyKilled( Pawn Killed, Pawn Killer, name DamageType )
{
   local Pawn P;

   if(Killed.isA('PlayerPawn'))
   {
      for( P=Level.PawnList; P!=None; P=P.nextPawn )
         if( P.bIsPlayer && P!=Killed && PlayerPawn(P)!=None && P.Health>0 && !P.PlayerReplicationInfo.bIsSpectator )
            return;
      Level.ServerTravel("?restart",false);
   }
}

function bool CanRestartPlayer( PlayerPawn Other )
{
   if( Other.Health<=0 )
      Other.GoToState('PlayerSpectating');
   return false;
}

defaultproperties
{
   bHandleDeaths=true
   bHandleMapEvents=true
}

Note: For players to keep what is left of their inventory after every level restart with a gametype that retains inventory, change the Level.ServerTravel function call second parameter to true.

EDIT: 1/27/2011
Compiled by Gizzy with link: http://www.freewebs.com/unrealgizzy/UnrealSurvival.zip
Mutator: UnrealSurvival.UnrealSurvival


-Zombie
_________________
GameType: JCoopZ1 - Build137 (11/30/12)
Mutator: DZMapM - 2.34 (12/15/11)
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Hyper.nl Unreal Services Forum Index -> HelpDesk All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group