Simple question, not that hard

The best and quickest support by a group of top-notch editing specialists, guaranteed!

Moderator: Forum Guards

Simple question, not that hard

Postby clyzm » Mon Jan 28, 08 7:06 pm

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.
Image
User avatar
clyzm
Forum Master God
 
Posts: 16023
Joined: Sun Nov 28, 04 2:48 am
Location: Chiraq

Postby Andrievskaya Veronika » Tue Jan 29, 08 4:13 am

Check DeusExPlayer.uc, function ResetPlayer

Override it in your own playerclass. This will work for SinglePlayer, i don't know what about MP.
User avatar
Andrievskaya Veronika
Poster
 
Posts: 164
Joined: Sat Sep 02, 06 7:35 am
Location: Database read error

Postby clyzm » Tue Jan 29, 08 4:19 am

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?
Image
User avatar
clyzm
Forum Master God
 
Posts: 16023
Joined: Sun Nov 28, 04 2:48 am
Location: Chiraq

Postby Andrievskaya Veronika » Tue Jan 29, 08 5:14 am

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 %)
User avatar
Andrievskaya Veronika
Poster
 
Posts: 164
Joined: Sat Sep 02, 06 7:35 am
Location: Database read error

Postby Legion » Tue Jan 29, 08 6:54 am

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.
Image
Death is often silent... But I Prefer making it loud and bloody.
CHECK OUT MY RADIO STATION: http://eternalnights.listen2myradio.com/
http://www.erepublik.com/en/referrer/Venom637
User avatar
Legion
Regular
 
Posts: 452
Joined: Wed Jul 19, 06 6:00 pm

Postby Dae » Tue Jan 29, 08 9:12 pm

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.
Attachments
GiveItemTrigger.uc
(853 Bytes) Downloaded 68 times
User avatar
Dae
Alpha
 
Posts: 12086
Joined: Sat Sep 06, 03 4:40 pm

Postby clyzm » Tue Jan 29, 08 11:46 pm

Thanks all for your solutions. :D
Image
User avatar
clyzm
Forum Master God
 
Posts: 16023
Joined: Sun Nov 28, 04 2:48 am
Location: Chiraq


Return to Editing issues

Who is online

Users browsing this forum: No registered users and 4 guests