Jump to content

TS Buggy?


Xpert

Recommended Posts

Here is the TSVehicle crate.

class Rx_CrateType_TSVehicle extends Rx_CrateType;

var transient Rx_Vehicle GivenVehicle;
var config float ProbabilityIncreaseWhenVehicleProductionDestroyed;
var array > Vehicles;

function string GetPickupMessage()
{
return Repl(PickupMessage, "`vehname`", GivenVehicle.GetHumanReadableName(), false);
}

function string GetGameLogMessage(Rx_PRI RecipientPRI, Rx_CratePickup CratePickup)
{
return "GAME" `s "Crate;" `s "tsvehicle" `s GivenVehicle.class.name `s "by" `s `PlayerLog(RecipientPRI);
}

function float GetProbabilityWeight(Rx_Pawn Recipient, Rx_CratePickup CratePickup)
{			
local Rx_Building building;
local float Probability;

if (CratePickup.bNoVehicleSpawn || Vehicles.Length == 0)
	return 0;
else
{
	Probability = Super.GetProbabilityWeight(Recipient,CratePickup);

	ForEach CratePickup.AllActors(class'Rx_Building',building)
	{
		if((Recipient.GetTeamNum() == TEAM_GDI && Rx_Building_WeaponsFactory(building) != none  && Rx_Building_WeaponsFactory(building).IsDestroyed()) || 
			(Recipient.GetTeamNum() == TEAM_NOD && Rx_Building_AirStrip(building) != none  && Rx_Building_AirStrip(building).IsDestroyed()))
		{
			Probability += ProbabilityIncreaseWhenVehicleProductionDestroyed;
		}
	}

	return Probability;
}
}

function ExecuteCrateBehaviour(Rx_Pawn Recipient, Rx_PRI RecipientPRI, Rx_CratePickup CratePickup)
{
local Vector tmpSpawnPoint;

tmpSpawnPoint = CratePickup.Location + vector(CratePickup.Rotation)*450;
tmpSpawnPoint.Z += 200;

GivenVehicle = CratePickup.Spawn(Vehicles[Rand(Vehicles.Length)],,, tmpSpawnPoint, CratePickup.Rotation,,true);

GivenVehicle.DropToGround();
if (GivenVehicle.Mesh != none)
	GivenVehicle.Mesh.WakeRigidBody();
}

DefaultProperties
{
BroadcastMessageIndex = 14
PickupSound = SoundCue'Rx_Pickups.Sounds.SC_Crate_VehicleDrop'

Vehicles.Add(class'TS_Vehicle_Titan');
Vehicles.Add(class'TS_Vehicle_Wolverine');
Vehicles.Add(class'TS_Vehicle_HoverMRLS');
Vehicles.Add(class'TS_Vehicle_TickTank');
Vehicles.Add(class'TS_Vehicle_ReconBike');
Vehicles.Add(class'TS_Vehicle_Buggy');
}

Yosh previously suggested that there's an off-by-one error, but there's not, and here's why. Rand() generates a "random" number number between 0, and the input - 1; in this instance, Vehicles.Length == 6, so Rand(Vehicles.Length) would generate a number between 0 (Titan) and 5 (Buggy). Adding a one to this wouldn't fix the problem -- it would just add a bug, instead.

From a theoretical standpoint, I don't see anything wrong with this crate. From a practice standpoint, I have no idea why TS Buggys are so rare. Resolving this would likely involve using or writing some other sort of Rand()-type function.

Tl;dr: The crate's code isn't broken, but it's broken.

Link to comment
Share on other sites

  • Totem Arts Staff
Here is the TSVehicle crate.

class Rx_CrateType_TSVehicle extends Rx_CrateType;

var transient Rx_Vehicle GivenVehicle;
var config float ProbabilityIncreaseWhenVehicleProductionDestroyed;
var array > Vehicles;

function string GetPickupMessage()
{
return Repl(PickupMessage, "`vehname`", GivenVehicle.GetHumanReadableName(), false);
}

function string GetGameLogMessage(Rx_PRI RecipientPRI, Rx_CratePickup CratePickup)
{
return "GAME" `s "Crate;" `s "tsvehicle" `s GivenVehicle.class.name `s "by" `s `PlayerLog(RecipientPRI);
}

function float GetProbabilityWeight(Rx_Pawn Recipient, Rx_CratePickup CratePickup)
{			
local Rx_Building building;
local float Probability;

if (CratePickup.bNoVehicleSpawn || Vehicles.Length == 0)
	return 0;
else
{
	Probability = Super.GetProbabilityWeight(Recipient,CratePickup);

	ForEach CratePickup.AllActors(class'Rx_Building',building)
	{
		if((Recipient.GetTeamNum() == TEAM_GDI && Rx_Building_WeaponsFactory(building) != none  && Rx_Building_WeaponsFactory(building).IsDestroyed()) || 
			(Recipient.GetTeamNum() == TEAM_NOD && Rx_Building_AirStrip(building) != none  && Rx_Building_AirStrip(building).IsDestroyed()))
		{
			Probability += ProbabilityIncreaseWhenVehicleProductionDestroyed;
		}
	}

	return Probability;
}
}

function ExecuteCrateBehaviour(Rx_Pawn Recipient, Rx_PRI RecipientPRI, Rx_CratePickup CratePickup)
{
local Vector tmpSpawnPoint;

tmpSpawnPoint = CratePickup.Location + vector(CratePickup.Rotation)*450;
tmpSpawnPoint.Z += 200;

GivenVehicle = CratePickup.Spawn(Vehicles[Rand(Vehicles.Length)],,, tmpSpawnPoint, CratePickup.Rotation,,true);

GivenVehicle.DropToGround();
if (GivenVehicle.Mesh != none)
	GivenVehicle.Mesh.WakeRigidBody();
}

DefaultProperties
{
BroadcastMessageIndex = 14
PickupSound = SoundCue'Rx_Pickups.Sounds.SC_Crate_VehicleDrop'

Vehicles.Add(class'TS_Vehicle_Titan');
Vehicles.Add(class'TS_Vehicle_Wolverine');
Vehicles.Add(class'TS_Vehicle_HoverMRLS');
Vehicles.Add(class'TS_Vehicle_TickTank');
Vehicles.Add(class'TS_Vehicle_ReconBike');
Vehicles.Add(class'TS_Vehicle_Buggy');
}

Yosh previously suggested that there's an off-by-one error, but there's not, and here's why. Rand() generates a "random" number number between 0, and the input - 1; in this instance, Vehicles.Length == 6, so Rand(Vehicles.Length) would generate a number between 0 (Titan) and 5 (Buggy). Adding a one to this wouldn't fix the problem -- it would just add a bug, instead.

From a theoretical standpoint, I don't see anything wrong with this crate. From a practice standpoint, I have no idea why TS Buggys are so rare. Resolving this would likely involve using or writing some other sort of Rand()-type function.

Tl;dr: The crate's code isn't broken, but it's broken.

lol, I know it isn't broken 'logically', we've already been over this. But still... it's broken.

Link to comment
Share on other sites

Did you change anything in B5.02 Yosh? I just got a TS Buggy in EKT 1, 8:46 pm USCentral, XMountain, and it died to some retard (who is also a friend) who got out for a crate, gave them a MRLS in the process, and it dumped a clip into my buggy, which was then finished off by sbh lasers...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...