remove translocator at spawn

Discussions about Coding and Scripting
Post Reply
Bloeb
Experienced
Posts: 95
Joined: Tue Apr 06, 2010 11:07 am

remove translocator at spawn

Post by Bloeb »

I want to remove the translocator from the inventory when a player spawns, even if it is enabled. This doesn't seem like a hard task. Something like this should work, but it doesnt.

Code: Select all

function ModifyPlayer (Pawn P)
{
	/* Remove Translocator */
	Inv = P.FindInventoryType(class'Translocator');
	If(Inv!=None) P.DeleteInventory(Inv);
}
I've traced the problem back to the function AddDefaultInventory in DeathMatchPlus. The super-function (super.AddDefaultInventory) is called before the translocator is spawned. This is a big problem, because the super-function calls the ModifyPlayer-function. This could probably be solved using a timer, but I'de rather not use it. Anyone got a better solution?

Code: Select all

class DeathMatchPlus extends TournamentGameInfo
	config;

function AddDefaultInventory( pawn PlayerPawn )
{
	... do stuff

	Super.AddDefaultInventory(PlayerPawn);

	... spawn translocator and do more stuff
}

Code: Select all

class GameInfo extends Info
	native;

function AddDefaultInventory( pawn PlayerPawn )
{
	... do stuff
	BaseMutator.ModifyPlayer(PlayerPawn);
}

edit:

I forgot to tell, that I still need to be able to pickup the Translocator.
So something like this doesn't cut it:

Code: Select all

function bool CheckReplacement(Actor Other, out byte bSuperRelevant)
{
	if(Other.IsA('Translocator')) return false;
}
gopostal

Re: remove translocator at spawn

Post by gopostal »

Do an actor PRI inventory iteration with a trans destroy in postbeginplay, then keep the removal in modify player for the respawns.
Bloeb
Experienced
Posts: 95
Joined: Tue Apr 06, 2010 11:07 am

Re: remove translocator at spawn

Post by Bloeb »

gopostal wrote:Do an actor PRI inventory iteration with a trans destroy in postbeginplay, then keep the removal in modify player for the respawns.
What exactly do you mean by 'PRI inventory'?


---------------------------

I've found a better method btw :loool:

Code: Select all

function PreBeginPlay()
{
    ...
    DeathMatchPlus(Level.Game).bUseTranslocator = false;
    ...
}
Post Reply