Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: Can't get anywhere!

  1. #1
    Taboen
    Guest

    Can't get anywhere!

    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.

    Code:
    // 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"
    }
    Code:
    // Made by Dirk 'Taboen' Broenink
    // This is the HUD for TFM.
    
       class TFMHUD extends UTgame.UTCTFHUD;
    
    
    defaultproperties
    {
    }
    Code:
    // Made by Dirk 'Taboen' Broenink
    // This is the Pawn for TFM.
    
       class TFMPawn extends UTgame.UTPawn;
    
    
    defaultproperties
    {
    }
    Code:
    // 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?

  2. #2
    Pfhoenix
    Guest
    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.

  3. #3
    Taboen
    Guest
    Well doesnt putting it in a mutator require the same code as in this case?

    I've made some basic tutorial mutators though.

  4. #4
    Tonester
    Guest
    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.

  5. #5
    Aksen
    Guest
    Taboen, this might help you.


    From LastManStanding

    Code:
    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

  6. #6
    Taboen
    Guest
    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.

  7. #7
    Taboen
    Guest
    Got this now:

    Code:
    // 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?

  8. #8
    Xyx
    Guest
    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.

  9. #9
    Sarcen
    Guest
    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')

  10. #10
    Taboen
    Guest
    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •