Page 1 of 1

Simple question, not that hard

PostPosted: Mon Jan 28, 08 7:06 pm
by clyzm
How do I make a PlayerStart come equipped with selected inventory and items?

Kind of like in the first level of DX, player started with pistol, prod and medkit.

PostPosted: Tue Jan 29, 08 4:13 am
by Andrievskaya Veronika
Check DeusExPlayer.uc, function ResetPlayer

Override it in your own playerclass. This will work for SinglePlayer, i don't know what about MP.

PostPosted: Tue Jan 29, 08 4:19 am
by clyzm
Code: Select all
function ResetPlayer(optional bool bTraining)
{
   local inventory anItem;
   local inventory nextItem;

   ResetPlayerToDefaults();

   // Reset Augmentations
   if (AugmentationSystem != None)
   {
      AugmentationSystem.ResetAugmentations();
      AugmentationSystem.Destroy();
      AugmentationSystem = None;
   }

   // Give the player a pistol and a prod
   if (!bTraining)
   {
      anItem = Spawn(class'WeaponPistol');
      anItem.Frob(Self, None);
      anItem.bInObjectBelt = True;
      anItem = Spawn(class'WeaponProd');
      anItem.Frob(Self, None);
      anItem.bInObjectBelt = True;
      anItem = Spawn(class'MedKit');
      anItem.Frob(Self, None);
      anItem.bInObjectBelt = True;
   }
}


Seems to only work when a "new game" is started. I want the player class to start with a certain inventory on a specific map. Is this possible?

PostPosted: Tue Jan 29, 08 5:14 am
by Andrievskaya Veronika
Call that function from MissionScript.

Something like this:
Code: Select all
function FirstFrame()
{
   local DeusExPlayer AP;


Super.FirstFrame();

If (LocalURL=="NAMEOfTHEMap")
{

   AP=DeusExPlayer(GetPlayerPawn());
//   AP.GiveNewInventory();
                    ResetPlayer();
}
}


Or better: make a new function in your PlayerClass
Code: Select all
function GiveNewInventory()
{
   local inventory anItem;
   local inventory nextItem;

   ResetPlayerToDefaults();

   // Give the player a pistol and a prod
 
      anItem = Spawn(class'WeaponPistol');
      anItem.Frob(Self, None);
      anItem.bInObjectBelt = True;
      anItem = Spawn(class'WeaponProd');
      anItem.Frob(Self, None);
      anItem.bInObjectBelt = True;
      anItem = Spawn(class'MedKit');
      anItem.Frob(Self, None);
      anItem.bInObjectBelt = True;

}


And call it from MissionScript.

p.s.: This is quick solution. I think there is some better way %)

PostPosted: Tue Jan 29, 08 6:54 am
by Legion
Andrievskaya Veronika wrote:Check DeusExPlayer.uc, function ResetPlayer

Override it in your own playerclass. This will work for SinglePlayer, i don't know what about MP.

I think there's a way to do it in MP as well, but I think the only way to do it is to block certain weapons on the server.

PostPosted: Tue Jan 29, 08 9:12 pm
by Dae
Should work in both multiplayer and singleplayer.

Usage: compile the package with it, then place the actor the map, then set all items you want to give to the player. You may additionally change the collision of the trigger.

The trigger will give the player items specified only once.

PostPosted: Tue Jan 29, 08 11:46 pm
by clyzm
Thanks all for your solutions. :D