PDA

View Full Version : Help with new gametype code



'Zac
07-11-2014, 03:35 PM
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");
}
}

jay2
07-12-2014, 12:53 AM
Could code better than this in one night with my left eye closed and just using my left hand.

UT-Sniper-SJA94
07-12-2014, 10:19 AM
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.

|uK|kenneth
07-12-2014, 10:20 AM
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

'Zac
07-12-2014, 12:29 PM
Yolo
For all the shit i went through with people in TS. Yeah no one can help, I can be independent.

Higor
07-12-2014, 03:05 PM
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.

Shotman
07-12-2014, 03:15 PM
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."

|uK|Rays
07-12-2014, 03:52 PM
all anyone does is hate on my boy zac you all whack as fuq YOLO

'Zac
07-12-2014, 05:39 PM
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);
}

Disturbed//*.
07-12-2014, 09:51 PM
Dayum! Lebron going back to Clevand and Zac got BURNED!!!

SogeKing
07-13-2014, 08:53 AM
all anyone does is hate on my boy zac you all whack as fuq YOLO

Zac got that YOLOSWAG that's why bitches be hatin'

'Zac
07-13-2014, 01:31 PM
can we please leave this to the thread topic...

DANGERBOY
07-13-2014, 02:59 PM
#SWA...ZAC

'Zac
07-13-2014, 04:16 PM
Higor
When trying to test my gametype on a map in single player i get this error. ( from unrealtournament.log )
I think it has to deal with something spawning and spawning and spawning over and over again.

Critical: appError called:
Critical: Mayhem DM-Constructor][.Mayhem0 (Function Engine.GameInfo.IsRelevant:0001) Runaway loop detected (over 10000000 iterations)
Critical: Windows GetLastError: The system cannot find the file specified. (2)
Exit: Executing UObject::StaticShutdownAfterError
Exit: Executing UWindowsClient::ShutdownAfterError
Exit: UGalaxyAudioSubsystem::ShutdownAfterError
Log: DirectDraw End Mode
Exit: UD3D9RenderDevice::ShutdownAfterError
Critical: FFrame::Serialize
Critical: UObject::ProcessEvent
Critical: (MayhemSB DM-Constructor][.MayhemSB95220, Function Engine.Actor.PreBeginPlay)
Critical: ULevel::SpawnActor
Critical: (MayhemSB)
Critical: UObject::ProcessEvent
Critical: (Mayhem DM-Constructor][.Mayhem0, Function Mayhem.Mayhem.InitGame)
Critical: BeginPlay
Critical: UGameEngine::LoadMap
Critical: LocalMapURL
Critical: UGameEngine::Browse
Critical: ClientTravel
Critical: UGameEngine::Tick
Critical: UpdateWorld
Critical: MainLoop
Exit: Exiting.
Uninitialized: Name subsystem shut down
Uninitialized: Log file closed, 07/12/14 22:54:03

Chamberly
07-13-2014, 06:50 PM
Critical: Mayhem DM-Constructor][.Mayhem0 (Function Engine.GameInfo.IsRelevant:0001) Runaway loop detected (over 10000000 iterations)
Critical: Windows GetLastError: The system cannot find the file specified. (2)

I guess it have something to do with the gametype you put in, and it said it can't start with a gametype that isn't found/ready/make yet. My guess tho. since Higor would be afk.

A little note, FeraliD is stepping away from UT99, so he won't be around much. Just thought I'd let you know, he made his announcement on UT99.org site about leaving the UT scene a few months ago.

|uK|B|aZe//.
07-15-2014, 04:58 AM
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."

when did moko start using your pc?

http://i3.kym-cdn.com/entries/icons/original/000/004/815/lol-guy.jpg

Shotman
07-15-2014, 07:24 AM
when did moko start using your pc?

http://i3.kym-cdn.com/entries/icons/original/000/004/815/lol-guy.jpg

It was straight out of my philosophy book. Man that was a hard class

utbusta
07-15-2014, 05:07 PM
Could code better than this in one night with my left eye closed and just using my left hand.

We can assume what he's doing with his right hand. Left eye closed due to the actions of the right hand.
1846

Back to topic, what is this new game type called?

|uK|B|aZe//.
07-16-2014, 06:44 AM
ahahahaha utbusta