UnrealScript / a few tricks mostly for mutators

The best and quickest support by a group of top-notch editing specialists, guaranteed!

Moderator: Forum Guards

UnrealScript / a few tricks mostly for mutators

Postby Dae » Tue Aug 22, 06 12:29 pm

Taken from alpha labs private:

If a mutator is supposed to work only on a specific map, that's how you can teach it recognising maps:
Code: Select all
if ( Level.NetMode != NM_Standalone )
{
   switch LevelString
   {
      case "DXMP_CMD.LevelInfo0":
      // Actions only for DXMP_CMD
      break;
      case "DXMP_Area51Bunker.LevelInfo0":
      // Actions only for DXMP_Area51Bunker
      break;
   }
}


If you're planning to make functions of your mutator recognise user typed string, like, for example, user ID on the server (MMSwitcher), that's how you can do it:
Code: Select all
function Mutate (String S, PlayerPawn Player)
{
   local string usrstr;

   // The following code will obtain everything user
   // typed after command "mutate typed". If you
   // typed "mutate typed blah", it should return "blah"
   // in a client message
   
   if (mid(S, 0, 5) ~= "typed ")
   {
      usrstr = mid(S, 5);
      Player.ClientMessage("You typed"@usrstr);
   }
   Super.Mutate(S,Player);
}


The essence of MMSwitcher - the code of switching player's team without killing him or her and with updating his or her user.ini. Team IDs:
0 - UNATCO
1 - NSF
Code: Select all
local pawn victim;

Level.Game.ChangeTeam(victim,0); // set to needed team
PlayerPawn(victim).ClientChangeTeam(0); // set to needed team


That's how we can find a suitable for spawning spawn point (thanks to Nobody for the code):
Code: Select all
local navigationpoint navpoint;

navpoint=Level.Game.FindPlayerStart(victim,0);
// Move victim to it
victim.setLocation(navpoint.location);


If you want to erase all augs and to add a specific one, that's how you can do it (this is what me and Alex coded for upcoming mutator against dejavu's program which kills 0aug servers. However, this method will not be used in the mutator by other reasons).
Code: Select all
local augmentation aug;

DeusExPlayer(Owner).AugmentationSystem.ResetAugmentations();
aug = DeusExPlayer(Other).AugmentationSystem.Spawn(class'DeusEx.AugLight', DeusExPlayer(Other).AugmentationSystem);
DeusExPlayer(Other).AugmentationSystem.FirstAug = aug;
DeusExPlayer(Other).AugmentationSystem.GivePlayerAugmentation(class'DeusEx.AugLight');
User avatar
Dae
Alpha
 
Posts: 12086
Joined: Sat Sep 06, 03 4:40 pm

Return to Editing issues

Who is online

Users browsing this forum: No registered users and 2 guests