PDA

View Full Version : Can't get anywhere!



Taboen
12-07-2007, 11:30 AM
Right so I'm making a mod while learning how to make a mod, I have a book with a lot of information (the book is still for UT2004 but lots of information still validates). And I'm kinda stuck. The book is just giving me hard information and I know I will never remember it all and when I start coding I will just look it up in the book again. So I decided to have a little start on my mod. And things that should normally work, won't work. Got a little frustrated and deleted everything to start over again. But I think you guys might be able to help me.


// Made by Dirk 'Taboen' Broenink
// TFM stands for Team Flag Master. There are two ways to win a round, either cap the flag or completely kill the enemy team untill they don't have any lives left. The first team that wins a certain amount of rounds wins the game.
// Version 0.1

class TFM extends UTgame.UTCTFGame;

defaultproperties;
{
DefaultPawnClass=Class'TFMPawn'
PlayerControllerClass=Class'TFMPlayerController'
bAllowTranslocator=False
bAllowHoverboard=False
HUDType=Class'TFMHUD'
MapPrefixes(0)="TM"
}


// Made by Dirk 'Taboen' Broenink
// This is the HUD for TFM.

class TFMHUD extends UTgame.UTCTFHUD;


defaultproperties
{
}


// Made by Dirk 'Taboen' Broenink
// This is the Pawn for TFM.

class TFMPawn extends UTgame.UTPawn;


defaultproperties
{
}


// Made by Dirk 'Taboen' Broenink
// This is the PlayerController for TFM.

class TFMPlayerController extends UTgame.UTPlayerController;


defaultproperties
{
}

Yes I realize this is just basic CTF. This way everything is set to start modifying things. I want people to start with 100 hp and 100 shield when they spawn. And I want to add weapons to the inventory they spawn with, and make the ammo configurable in like an ini file. My question is: how?:)

Pfhoenix
12-07-2007, 01:06 PM
Since you admitted to just starting out, I advise you to start with a project more appropriate to learning how UT3 does things. Start with a mutator, especially since what you want to do can be done via a mutator anyways.

Taboen
12-07-2007, 02:47 PM
Well doesnt putting it in a mutator require the same code as in this case?

I've made some basic tutorial mutators though.

Tonester
12-07-2007, 03:33 PM
For the changes you mentioned in your original post, there is no need to extend any of the classes with the exception of UTMutator.

Now, if you plan on adding a bunch of other changes that you haven't specified yet, then yes, you may (maybe) need to extend Pawn, Controller, etc.

Aksen
12-07-2007, 03:35 PM
Taboen, this might help you.


From LastManStanding (http://unreal.student.utwente.nl/uncodex-ut/Source_botpack/lastmanstanding.html)



function AddDefaultInventory( pawn PlayerPawn )
{
local Weapon weap;
local int i;
local inventory Inv;
local float F;

if ( PlayerPawn.IsA('Spectator') || (bRequireReady && (CountDown > 0)) )
return;
Super.AddDefaultInventory(PlayerPawn);

GiveWeapon(PlayerPawn, "Botpack.ShockRifle");
GiveWeapon(PlayerPawn, "Botpack.UT_BioRifle");
GiveWeapon(PlayerPawn, "Botpack.Ripper");
GiveWeapon(PlayerPawn, "Botpack.UT_FlakCannon");

if ( PlayerPawn.IsA('PlayerPawn') )
{
GiveWeapon(PlayerPawn, "Botpack.SniperRifle");
GiveWeapon(PlayerPawn, "Botpack.PulseGun");
GiveWeapon(PlayerPawn, "Botpack.Minigun2");
GiveWeapon(PlayerPawn, "Botpack.UT_Eightball");
PlayerPawn.SwitchToBestWeapon();
}
else
{
// randomize order for bots so they don't always use the same weapon
F = FRand();
if ( F < 0.7 )
{
GiveWeapon(PlayerPawn, "Botpack.SniperRifle");
GiveWeapon(PlayerPawn, "Botpack.PulseGun");
if ( F < 0.4 )
{
GiveWeapon(PlayerPawn, "Botpack.Minigun2");
GiveWeapon(PlayerPawn, "Botpack.UT_Eightball");
}
else
{
GiveWeapon(PlayerPawn, "Botpack.UT_Eightball");
GiveWeapon(PlayerPawn, "Botpack.Minigun2");
}
}
else
{
GiveWeapon(PlayerPawn, "Botpack.Minigun2");
GiveWeapon(PlayerPawn, "Botpack.UT_Eightball");
if ( F < 0.88 )
{
GiveWeapon(PlayerPawn, "Botpack.SniperRifle");
GiveWeapon(PlayerPawn, "Botpack.PulseGun");
}
else
{
GiveWeapon(PlayerPawn, "Botpack.PulseGun");
GiveWeapon(PlayerPawn, "Botpack.SniperRifle");
}
}
}

for ( inv=PlayerPawn.inventory; inv!=None; inv=inv.inventory )
{
weap = Weapon(inv);
if ( (weap != None) && (weap.AmmoType != None) )
weap.AmmoType.AmmoAmount = weap.AmmoType.MaxAmmo;
}

inv = Spawn(class'Armor2');
if( inv != None )
{
inv.bHeldItem = true;
inv.RespawnTime = 0.0;
inv.GiveTo(PlayerPawn);
}
}



it's old code, but i think the concept is still relevant

Taboen
12-07-2007, 04:51 PM
In the future this will be a very big mod, im just starting on the little things. What I mentioned can be done with a simple mutator. But my modicafications will be so big that I don't want it as an mutator. I want it as a whole gametype. Especially because I will use the maps in this gametype with TM- prefix for more gametypes than just this one. I have many plans and ideas written down and this is just a start.

Thanks for that code Aksen.

Taboen
12-08-2007, 09:20 AM
Got this now:


// Made by Dirk 'Taboen' Broenink
// TFM stands for Team Flag Master. There are two ways to win a round, either cap the flag or completely kill the enemy team untill they don't have any lives left. The first team that wins a certain amount of rounds wins the game.
// Version 0.1

class TFM extends UTgame.UTCTFGame;

// When player starts give them some weapons!
function AddDefaultInventory(Pawn p)
{
local Inventory Inv;

Super.AddDefaultInventory(p);

p.CreateInventory("UTGame.UTWeap_BioRifle");
p.CreateInventory("UTWeap_FlakCannon");
p.CreateInventory("UTWeap_LinkGun");
p.CreateInventory("UTWeap_Stinger");
p.CreateInventory("UTWeap_RocketLauncher");
p.CreateInventory("UTWeap_ShockRifle");
p.CreateInventory("UTWeap_SniperRifle");

if ( bFullAmmo )
{
For ( Inv=P.Inventory; Inv!=None; Inv=Inv.Inventory )
{
if ( Weapon(Inv) != None )
Weapon(Inv).MaxOutAmmo();
}
}
}

defaultproperties;
{
bAllowTranslocator=False
bAllowHoverboard=False
HUDType=Class'UTCTFHUD'
MapPrefixes(0)="TM"
}


As you can see, I removed the references to a new pawn and playercontroller etc, I will add that when I need it. Leaving it out for now.

Problem is, it says:
'Error, Type mismatch in Call to 'CreateInventory', parameter 1'

What to change?:)

Xyx
12-08-2007, 08:34 PM
Nowhere is it (correctly) written that a gametype mod is (necessarily) more complex than a mutator mod. The one gametype I ever wrote was a couple dozen lines of code, but some of the mutators... thousands.

Sarcen
12-08-2007, 09:19 PM
the declaration is
event final Inventory CreateInventory( class<Inventory> NewInvClass, optional bool bDoNotActivate )

so its expecting a inventory (or sub)class so try

p.CreateInventory(class'UTWeap_FlakCannon')

Taboen
12-09-2007, 05:10 AM
Xyx, sure I can make a mutator for this. I just think its better to make a gametype for this. Why? This mutator would be a mutator to CTF so it would use CTF maps, and the maps will need special design for this, a normal CTF map can't do the trick.. That means it would show up in the CTF list between normal servers, and I change so much I don't its responsible for doing so. That's why I will start using the TM- prefix and want to put in its own Tab. The TM- maps will be made in such a way that people will be able to use these maps for more gametypes I will create, of which I have some ideas for.

Sarcen, adding class to it didn't do the trick :(
I feel like I'm missing something simple here.
Thanks for your time.

Xyx
12-09-2007, 10:04 AM
I'm not saying you should make a mutator. I'm just saying that complexity is not the deciding factor. I've read a lot of claims that mutators are small and easy and that gametypes are the next step on the ladder to the almighty total conversion. I think that's nonsense. A mutator simply does not alter the game in such a way that it requires a custom gametype object.

Your mod is a gametype. It contains specific game rules and requires specific maps. Of course you're not making a mutator.

I'd reconsider the specific maps part, though. Writing a gametype is one thing, adapting/creating half a dozen maps is another.

Taboen
12-09-2007, 10:47 AM
Well that was exactly what I thought about mutators and gametypes aswell.

Anyway, I was thinking. If I can let the gametype search the middle point between the red flag and the blue flag, it could be possible that you don't need TM maps. But CTF maps too. Though my plan is to make the free flag spawn randomly on tactically decided points. For example on and underneath the bridge. Or left and right of the map (if the map is completely symetrical). So that can't be down with a script, and if it was possible you would get flags on spots I don't want them.
I just don't know if a script like that would be possible, how it would work out and how to make something like that.

Xyx
12-09-2007, 05:41 PM
UT2004's Gem Feeder had a special configuration "gametype" in which you could run around a map and configure it by dropping various markers. Worked great. It allowed players to set up Onslaught maps for Gem Feeder without ever touching an editor or hacking an .ini file.

Taboen
12-10-2007, 01:08 PM
So does anything what that message means? Anyone?

Taboen
12-11-2007, 07:53 PM
Got this now:


// Made by Dirk 'Taboen' Broenink
// TFM stands for Team Flag Master. There are two ways to win a round, either cap the flag or completely kill the enemy team untill they don't have any lives left. The first team that wins a certain amount of rounds wins the game.
// Version 0.1

class TFM extends UTgame.UTCTFGame;

// When player starts give them some weapons!
function AddDefaultInventory(Pawn p)
{
local Inventory Inv;

Super.AddDefaultInventory(p);

p.CreateInventory("UTGame.UTWeap_BioRifle");
p.CreateInventory("UTWeap_FlakCannon");
p.CreateInventory("UTWeap_LinkGun");
p.CreateInventory("UTWeap_Stinger");
p.CreateInventory("UTWeap_RocketLauncher");
p.CreateInventory("UTWeap_ShockRifle");
p.CreateInventory("UTWeap_SniperRifle");

if ( bFullAmmo )
{
For ( Inv=P.Inventory; Inv!=None; Inv=Inv.Inventory )
{
if ( Weapon(Inv) != None )
Weapon(Inv).MaxOutAmmo();
}
}
}

defaultproperties;
{
bAllowTranslocator=False
bAllowHoverboard=False
HUDType=Class'UTCTFHUD'
MapPrefixes(0)="TM"
}


As you can see, I removed the references to a new pawn and playercontroller etc, I will add that when I need it. Leaving it out for now.

Problem is, it says:
'Error, Type mismatch in Call to 'CreateInventory', parameter 1'

What to change?:)

Malachor
12-29-2007, 12:57 AM
Hmm, about 17 days ago.
Anyway, parameter 1 is looking for UTWeap_BioRifle_Content (or UTGameContent.UTWeap_BioRifle_Content), since the non _Content version is abstract.

Taboen
12-29-2007, 07:03 AM
Thanks for your response. I thought I had more chance getting help making a new topic so I made this one:
http://utforums.epicgames.com/showthread.php?t=593159&page=2
Last page last post is my current problem.