Help with new gametype code

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 10 of 19
  1. #1
    Whicked Sick 'Zac's Avatar
    Join Date
    Apr 2012
    Posts
    1,090
    Country:

    Help with new gametype code

    @Higor @Feralidragon
    I'm trying to create a new gametype where one team has only one buffed player against another team with multiple people with a basic inventory, but I got this problem.
    ( at the // single team inventory line )
    I create a function to give default inventory to the player on the single team, but I want to give that person amp and the keg.
    I can spawn a shield belt and that's it. I created a second variable called inv2 to spawn the Udamage ( took out this part because it didn't work ), but that didn't work.
    I think it has to deal with the inv != none because before that nothing has spawn onto the player.
    Also, I attempted to give the players max ammo with a small code from the LastManStanding gametype file, but that only gives ' some ' ammo, like one box for each gun. Everything works out perfectly except for the spawning of the amplifier and the max ammo part for all guns.
    Could it have to deal with the local variables in the first function?

    function AddDefaultInventory( pawn PlayerPawn )
    {
    local Inventory inv;
    local float tmp;
    local Inventory inv2;
    local Weapon weap;

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

    // Player team & inventory
    if (PlayerPawn.IsA('TournamentPlayer'))
    // Calculate score
    PlayerPawn.ClientMessage("Your score: " @ int(PlayerPawn.PlayerReplicationInfo.Score), 'CriticalEvent');
    // Reset frags
    PlayerPawn.PlayerReplicationInfo.Score = 0;
    PlayerPawn.PlayerReplicationInfo.Team = 0;

    // the single team inventory
    inv = Spawn(class'Mayhem.MayhemSB');
    if (inv != None)
    {
    inv.bHeldItem = true;
    inv.RespawnTime = 0.0;
    inv.GiveTo(PlayerPawn);
    }
    Super.AddDefaultInventory(PlayerPawn);
    GiveWeapon(PlayerPawn, "Botpack.SniperRifle");
    GiveWeapon(PlayerPawn, "Botpack.WarheadLauncher");
    GiveWeapon(PlayerPawn, "Botpack.UT_Eightball");
    GiveWeapon(PlayerPawn, "Botpack.UT_FlakCannon");
    GiveWeapon(PlayerPawn, "Botpack.ShockRifle");
    GiveWeapon(PlayerPawn, "Botpack.Minigun2");
    GiveWeapon(PlayerPawn, "Botpack.UT_biorifle");
    GiveWeapon(PlayerPawn, "Botpack.Ripper");
    GiveWeapon(PlayerPawn, "Botpack.PulseGun");

    PlayerPawn.SwitchToBestWeapon();

    // giving more or max ammo
    for ( inv=PlayerPawn.inventory; inv!=None; inv=inv.inventory )
    {
    weap = Weapon(inv);
    if ( (weap != None) && (weap.AmmoType != None) )
    weap.AmmoType.AmmoAmount = weap.AmmoType.MaxAmmo;
    }


    // Bot team & inventory
    else if (PlayerPawn.IsA('Bot'))
    {
    PlayerPawn.PlayerReplicationInfo.Team = 1;
    GiveWeapon(PlayerPawn, "Botpack.ImpactHammer");
    tmp = FRand();
    if (tmp <= 0.3)
    GiveWeapon(PlayerPawn, "Botpack.UT_Eightball");
    else if (tmp > 0.3 && tmp <= 0.6)
    GiveWeapon(PlayerPawn, "Botpack.UT_FlakCannon");
    else
    GiveWeapon(PlayerPawn, "Botpack.ripper");
    tmp = FRand();
    if (tmp <= 0.2)
    GiveWeapon(PlayerPawn, "Botpack.ShockRifle");
    else if (tmp > 0.2 && tmp <= 0.6)
    GiveWeapon(PlayerPawn, "Botpack.Minigun2");
    else
    GiveWeapon(PlayerPawn, "Botpack.PulseGun");
    }
    }


  2. #2
    Killing Spree jay2's Avatar
    Join Date
    Jun 2014
    Posts
    187
    Country:
    Could code better than this in one night with my left eye closed and just using my left hand.

  3. #3
    Whicked Sick UT-Sniper-SJA94's Avatar
    Join Date
    Oct 2011
    Location
    What was England
    Posts
    4,427
    Country:
    Quote Originally Posted by jay2 View Post
    Could code better than this in one night with my left eye closed and just using my left hand.
    I was hoping someone would give him the same treatment that he does to others that are trying to make something.

    He doesn't deserve help the way he acts.

  4. #4
    Moderator |uK|kenneth's Avatar
    Join Date
    Jan 2011
    Posts
    3,616
    Country:
    Quote Originally Posted by UT-Sniper-SJA94 View Post
    I was hoping someone would give him the same treatment that he does to others that are trying to make something.

    He doesn't deserve help the way he acts.
    +1

  5. #5
    Whicked Sick 'Zac's Avatar
    Join Date
    Apr 2012
    Posts
    1,090
    Country:
    Yolo
    For all the shit i went through with people in TS. Yeah no one can help, I can be independent.


  6. #6
    Whicked Sick Higor's Avatar
    Join Date
    Apr 2012
    Location
    Full sail ahead!
    Posts
    3,676
    Country:
    Step by step:

    On the ammo department.

    // giving more or max ammo
    for ( inv=PlayerPawn.inventory; inv!=None; inv=inv.inventory )
    {
    weap = Weapon(inv);
    if ( (weap != None) && (weap.AmmoType != None) )
    weap.AmmoType.AmmoAmount = weap.AmmoType.MaxAmmo;
    }

    Instead of looping for weapons, loop for ammos:
    if ( Ammo(inv) != none )
    Ammo(inv).AmmoAmount = Ammo(inv).MaxAmmo;
    Also, move the ammo iterator to the end of the weapon giving functions.
    ------------------------------------- * -------------------------------------

  7. #7
    Whicked Sick Shotman's Avatar
    Join Date
    Jul 2011
    Location
    San Diego, CA
    Posts
    1,468
    Country:
    Quote Originally Posted by UT-Sniper-SJA94 View Post
    I was hoping someone would give him the same treatment that he does to others that are trying to make something.

    He doesn't deserve help the way he acts.
    In other words "You reap what you sow." or "Judge not that ye be not judged, for with what judgment ye judge, ye shall be judged, and with what measure ye mete, it shall be measured to you again."
    "What's Yours Is Mine" Garret Thief (2013)
    Roberto Gómez Bolaños "Chespirito" fue si querer queriendo. You'll be missed.

  8. #8
    Whicked Sick |uK|Rays's Avatar
    Join Date
    Mar 2011
    Posts
    1,190
    all anyone does is hate on my boy zac you all whack as fuq YOLO

  9. #9
    Whicked Sick 'Zac's Avatar
    Join Date
    Apr 2012
    Posts
    1,090
    Country:
    Quote Originally Posted by Higor View Post
    Step by step:

    On the ammo department.

    // giving more or max ammo
    for ( inv=PlayerPawn.inventory; inv!=None; inv=inv.inventory )
    {
    weap = Weapon(inv);
    if ( (weap != None) && (weap.AmmoType != None) )
    weap.AmmoType.AmmoAmount = weap.AmmoType.MaxAmmo;
    }

    Instead of looping for weapons, loop for ammos:
    if ( Ammo(inv) != none )
    Ammo(inv).AmmoAmount = Ammo(inv).MaxAmmo;
    Also, move the ammo iterator to the end of the weapon giving functions.
    Ok thanks I got that part working, but what about spawning another pickup>?
    This is all i can manage to do

    // the single team inventory
    inv = Spawn(class'Mayhem.MayhemSB');
    if (inv != None)
    {
    inv.bHeldItem = true;
    inv.RespawnTime = 0.0;
    inv.GiveTo(PlayerPawn);
    }
    Last edited by 'Zac; 07-12-2014 at 05:48 PM.


  10. #10
    Dominating Disturbed//*.'s Avatar
    Join Date
    Jan 2011
    Posts
    607
    Country:
    Dayum! Lebron going back to Clevand and Zac got BURNED!!!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. CODE: 0x000000CF
    By SKULLZAPPER in forum Unreal Tournament Chit Chat
    Replies: 3
    Last Post: 05-07-2014, 07:37 PM
  2. Betrayal Gametype
    By Higor in forum Code Reviews
    Replies: 34
    Last Post: 05-25-2013, 06:30 AM
  3. Code review: sgHUD
    By Higor in forum #siegepug Discussion
    Replies: 6
    Last Post: 06-01-2012, 02:45 PM
  4. Code review: sgTeleporter
    By Higor in forum #siegepug Discussion
    Replies: 12
    Last Post: 05-26-2012, 08:24 PM
  5. Code review: Mines 2
    By Higor in forum #siegepug Discussion
    Replies: 5
    Last Post: 05-26-2012, 02:49 PM

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
  •