Лучшие шаблоны ucoz бесплатно. Музыка и песни в альбомах. Строительный форум
11:25, 20.04.2024
[ New messages · Members · Forum rules · Search · RSS ]
  • Page 1 of 1
  • 1
Forums | Ultra Modding / Ultra Mapping Forums » Ultra Modding | Forums » Coding » [Tutorial] Adding A Custom ZED To The Game
[Tutorial] Adding A Custom ZED To The Game
UltraKillДата: Friday, 15.03.2013, 22:02 | Сообщение # 1
Main Developer.
Группа: ADMINISTRATOR
Сообщений: 59
Репутация: 665
Статус: Offline
This tutorial is currently out of date due to the 1044 update. I will be amending this soon.
This tutorial will show you how to add a custom ZED into the game.

Prerequisites

Creating A Basic Mutator by Benjamin

The Mutator

Version 1
Code:
class NewSquadMut extends Mutator;var string PackageName;

function PostBeginPlay()
{
local int i;
local string MID;
local KFGameType KF;

//Add the package with your new zed to the server
if (Level.NetMode != NM_Standalone)
AddToPackageMap(PackageName);

//Only for KFGameType or and extending GameType
KF = KFGameType(Level.Game);
if (KF == none)
{
Destroy();
return;
}

// Get new slot in monster list
i = KFGameType(Level.Game).StandardMonsterClasses.Length;
KFGameType(Level.Game).StandardMonsterClasses.Length = i + 1;
MID = Chr(65 + i); //Get the next character in the alphabet

// Add monster to monster list
KFGameType(Level.Game).StandardMonsterClasses.MClassName = PackageName$".NEWZED"; KFGameType(Level.Game).StandardMonsterClasses[i].MID = MID;

// Add monster to squads
KFGameType(Level.Game).StandardMonsterSquads[25] $= "2" $ MID; //Add 2 of the new Zed to the 25th squad
KFGameType(Level.Game).StandardMonsterSquads[26] $= "1" $ MID; //Add 1 of the new Zed to the 26th squad

SetTimer(0.1, false);
}

function Timer()
{
Destroy(); // Destroy here (after mut is loaded) otherwise it won't appear as set in webadmin
}

defaultproperties
{
PackageName="CustomZedPackage"
GroupName="KF-AddToSquad"
FriendlyName="Add to squad"
Description="Adds a to squad in spawn list."
}
Breakdown

Code:
var string PackageName;function PostBeginPlay()
{
local int i;
local string MID;
local KFGameType KF;
We declare the variables we will be using. Again [i]PostBeginPlay()
 play because we want to make these changes before we start the match.

Code:
if (Level.NetMode != NM_Standalone) AddToPackageMap(PackageName);
This statement checks to see if the game is a server or not. If it is a server it adds the package to the serverpackages. Similar to thebAddToServerPackages mutator variable. The difference being that this way allows the zed package to be dependent of the mutator you are using.
Code:
KF = KFGameType(Level.Game);if (KF == none)
{
Destroy();
return;
}
Here is an alternative to the error check we had in the previous ZED mutator. This works the same way, the difference being instead of logging the error it simply kills the mutator.
Code:
i = KFGameType(Level.Game).StandardMonsterClasses.Length;KFGameType(Level.Game).StandardMonsterClasses.Length = i + 1;
MID = Chr(65 + i);
Here we define i the value of the StandardMonsterClasses array length. Then we define a new array length by adding 1 to i. As each squad is assigned a letter we need to find the next avalible one. Becuase we've already found out the array length we can use i to do this as well. In the Uni8 encoding the alphabet begins at 65. So 65 is A, 65+8 would be I.
Code:
KFGameType(Level.Game).StandardMonsterClasses.MClassName = PackageName$".NEWZED";KFGameType(Level.Game).StandardMonsterClasses[i].MID = MID;
Now we use the information we've built to add our custom ZED to the standard monster load out. But that's not enough to get him in the game. [i]KFGameType
 calls on squads though out the game. So let's add our ZED to some existing squads.
Code:
KFGameType(Level.Game).StandardMonsterSquads[25] $= "2" $ MID;KFGameType(Level.Game).StandardMonsterSquads[26] $= "1" $ MID;
There are currently 26 squads in KF, so lets add him to the last two. Two in squad 25, One in 26.

Finally
Code:
SetTimer(0.1, false);}
So we can destroy the mutator after it has loaded, as it's no longer needed. We also do this so the WebAdmin can flag the mutator as on. Destroy it too early and WebAdmin wouldn't know the mutator was active.
Code:
function Timer(){
Destroy();
}
Finally we add the defualt properties
Code:
defaultproperties{
PackageName="CustomZedPackage"
GroupName="KF-AddToSquad"
FriendlyName="Add to squad"
Description="Adds a to squad in spawn list."
}
You're done. 

I'd like to thank matttthias aka J1gS4w for the code on this one. In his words "I want to do something for the community because they helped me so much to start with coding." Honourable mention to Benjamin for the original code.
Part 2 to follow soon.

---
Gartley
 
Forums | Ultra Modding / Ultra Mapping Forums » Ultra Modding | Forums » Coding » [Tutorial] Adding A Custom ZED To The Game
  • Page 1 of 1
  • 1
Search:

image

Ad's

Здесь может быть Ваша реклама.

Buy Place
image

Ad's

Здесь может быть Ваша реклама.

Buy Place

How To Contact?

  • Skype: CHEATER_1992
  • E-mail: CHEATER.Q3@gmail.com

Info About

  • Copying of materials is permitted only with reference to the source.