Did you know? UBerserker loves the Dispersion Pistol.

Help with a script?

For questions and discussion about UnrealEd, UnrealScript, and other aspects of Unreal Engine design.

Moderators: Semfry, ividyon

User avatar zacman
Skaarj Warlord Skaarj Warlord
Posts: 690
Joined: 23 Jun 2009, 02:51
Location: Under your bed with a Chainsaw

Subject: Help with a script?

Post Posted: 27 Aug 2009, 04:27

Well, I have this health pickup. What I want to do is, when the player touches it, they turn invisible and Stay that way. I already have bot support done, but the HUMAN players can see the player. I need help making a script that extends Botpack.HealthPack that will add Invisibility (Until Death)
ImageImage

Code: Select all

(11:32:26) Shivaxi: i love fat girls

Code: Select all

(03:01:24 PM) <+All_Rights_Reserved> i'm not masturbating

User avatar ividyon
Administrator Administrator
Posts: 2354
Joined: 12 Nov 2007, 14:43
Location: Germany
Contact:

Subject:

Post Posted: 27 Aug 2009, 06:55

copy 'n' paste code from the UT Invisibility pickup.
UnrealSP.org webmaster & administrator

User avatar zacman
Skaarj Warlord Skaarj Warlord
Posts: 690
Joined: 23 Jun 2009, 02:51
Location: Under your bed with a Chainsaw

Subject:

Post Posted: 27 Aug 2009, 10:27

sana wrote:copy 'n' paste code from the UT Invisibility pickup.

Tried it, didn't work (May have something to do with an existing alteration the Healthpack does)
ImageImage

Code: Select all

(11:32:26) Shivaxi: i love fat girls

Code: Select all

(03:01:24 PM) <+All_Rights_Reserved> i'm not masturbating

Z-enzyme
White Tusk White Tusk
Posts: 2136
Joined: 13 Nov 2007, 20:01

Subject:

Post Posted: 27 Aug 2009, 10:53

zacman wrote:
sana wrote:copy 'n' paste code from the UT Invisibility pickup.

Tried it, didn't work (May have something to do with an existing alteration the Healthpack does)


Do like this.

Code: Select all

function PickupFunction(Pawn Other)
{
   Invisibility(True);
}

function Invisibility (bool Vis)
{
   if (Pawn(Owner)==None) Return;

   if( Vis )
   {
      PlaySound(ActivateSound,,4.0);
      if ( PlayerPawn(Owner) != None )      
         PlayerPawn(Owner).ClientAdjustGlow(-0.15, vect(156.25,156.25,351.625));
      Pawn(Owner).Visibility = 10;
      Pawn(Owner).bHidden=True;
      if ( Pawn(Owner).Weapon != None )
         Pawn(Owner).Weapon.bOnlyOwnerSee=False;         
   }
   else
   {
      PlaySound(DeActivateSound);
      if ( PlayerPawn(Owner) != None )      
         PlayerPawn(Owner).ClientAdjustGlow(0.15, vect(-156.25,-156.25,-351.625));   
      Pawn(Owner).Visibility = Pawn(Owner).Default.Visibility;
      if ( Pawn(Owner).health > 0 )
         Pawn(Owner).bHidden=False;
      if ( Pawn(Owner).Weapon != None )
         Pawn(Owner).Weapon.bOnlyOwnerSee=True;
   }
}


In the Invisibility function set any player dispay properies you want. The PickupFunction is a function called when you pick up an item. This way it automatically turns on the invisibility.

The Invisibility function is copied from standard U invisibility pickup.

Dunno if it works with healhpack pickup. Gonna check it later.

EDIT:

With healthpack it's different. It destroys itself on touch. Thats why you need to redo the Autostate Pickup. Like this

Code: Select all

//=============================================================================
// InvPack.
//=============================================================================
class InvPack expands HealthPack;

auto state Pickup
{   
   function Touch( actor Other )
   {
      local int HealMax;
      local Pawn P;
         
      if ( ValidTouch(Other) )
      {   
         P = Pawn(Other);
         P.bHidden = True;   
         HealMax = P.default.health;
         if (bSuperHeal) HealMax = Min(199, HealMax * 2.0);
         if (P.Health < HealMax)
         {
            if (Level.Game.LocalLog != None)
               Level.Game.LocalLog.LogPickup(Self, P);
            if (Level.Game.WorldLog != None)
               Level.Game.WorldLog.LogPickup(Self, P);
            P.Health += HealingAmount;
            if (P.Health > HealMax) P.Health = HealMax;
            PlayPickupMessage(P);
            PlaySound (PickupSound,,2.5);
            Other.MakeNoise(0.2);      
            SetRespawn();
         }
      }
   }
}


This line:
P.bHidden = True;
makes the player completely invisible. You can change any player's display properties you wan adding just:
p.AnyPlayerDisplayProperties = something.

You know how it works.

User avatar Shivaxi
Gilded Claw Gilded Claw
Posts: 1916
Joined: 24 Jun 2008, 19:51
Location: Behind You! =P
Contact:

Subject:

Post Posted: 27 Aug 2009, 18:18

There's a UScript section on Oldunreal that has a lot of support for things like this and actually gets paid attention to :P

Try asking there: http://www.oldunreal.com/cgi-bin/yabb2/ ... rd=UScript
http://img836.imageshack.us/img836/9950/shivavatar2.jpg Image

Waffnuffly: If there is any purpose for the god damned ocean, it is for us to eat it.
Jet_v4.3.5: I want to be Lincoln and kick Satan's ass. Emancipate and Proclimate on his ass.

User avatar zacman
Skaarj Warlord Skaarj Warlord
Posts: 690
Joined: 23 Jun 2009, 02:51
Location: Under your bed with a Chainsaw

Subject:

Post Posted: 28 Aug 2009, 01:41

Thanks. It **May** be caused by the fact that I am exploiting an engine bug for this pickup :lol:
ImageImage

Code: Select all

(11:32:26) Shivaxi: i love fat girls

Code: Select all

(03:01:24 PM) <+All_Rights_Reserved> i'm not masturbating

User avatar zacman
Skaarj Warlord Skaarj Warlord
Posts: 690
Joined: 23 Jun 2009, 02:51
Location: Under your bed with a Chainsaw

Subject:

Post Posted: 28 Aug 2009, 01:47

qtit wrote:
zacman wrote:
sana wrote:copy 'n' paste code from the UT Invisibility pickup.

Tried it, didn't work (May have something to do with an existing alteration the Healthpack does)


Do like this.

Code: Select all

function PickupFunction(Pawn Other)
{
   Invisibility(True);
}

function Invisibility (bool Vis)
{
   if (Pawn(Owner)==None) Return;

   if( Vis )
   {
      PlaySound(ActivateSound,,4.0);
      if ( PlayerPawn(Owner) != None )      
         PlayerPawn(Owner).ClientAdjustGlow(-0.15, vect(156.25,156.25,351.625));
      Pawn(Owner).Visibility = 10;
      Pawn(Owner).bHidden=True;
      if ( Pawn(Owner).Weapon != None )
         Pawn(Owner).Weapon.bOnlyOwnerSee=False;         
   }
   else
   {
      PlaySound(DeActivateSound);
      if ( PlayerPawn(Owner) != None )      
         PlayerPawn(Owner).ClientAdjustGlow(0.15, vect(-156.25,-156.25,-351.625));   
      Pawn(Owner).Visibility = Pawn(Owner).Default.Visibility;
      if ( Pawn(Owner).health > 0 )
         Pawn(Owner).bHidden=False;
      if ( Pawn(Owner).Weapon != None )
         Pawn(Owner).Weapon.bOnlyOwnerSee=True;
   }
}


In the Invisibility function set any player dispay properies you want. The PickupFunction is a function called when you pick up an item. This way it automatically turns on the invisibility.

The Invisibility function is copied from standard U invisibility pickup.

Dunno if it works with healhpack pickup. Gonna check it later.

EDIT:

With healthpack it's different. It destroys itself on touch. Thats why you need to redo the Autostate Pickup. Like this

Code: Select all

//=============================================================================
// InvPack.
//=============================================================================
class InvPack expands HealthPack;

auto state Pickup
{   
   function Touch( actor Other )
   {
      local int HealMax;
      local Pawn P;
         
      if ( ValidTouch(Other) )
      {   
         P = Pawn(Other);
         P.bHidden = True;   
         HealMax = P.default.health;
         if (bSuperHeal) HealMax = Min(199, HealMax * 2.0);
         if (P.Health < HealMax)
         {
            if (Level.Game.LocalLog != None)
               Level.Game.LocalLog.LogPickup(Self, P);
            if (Level.Game.WorldLog != None)
               Level.Game.WorldLog.LogPickup(Self, P);
            P.Health += HealingAmount;
            if (P.Health > HealMax) P.Health = HealMax;
            PlayPickupMessage(P);
            PlaySound (PickupSound,,2.5);
            Other.MakeNoise(0.2);      
            SetRespawn();
         }
      }
   }
}


This line:
P.bHidden = True;
makes the player completely invisible. You can change any player's display properties you wan adding just:
p.AnyPlayerDisplayProperties = something.

You know how it works.

Thanks! any idea if it will work with a healthpack that recovers -999999999 (no, the negative is NOT a typo)
<EDIT>
It works :tup:
Thx m8
ImageImage

Code: Select all

(11:32:26) Shivaxi: i love fat girls

Code: Select all

(03:01:24 PM) <+All_Rights_Reserved> i'm not masturbating


Who is online

Users browsing this forum: No registered users and 25 guests

Copyright © 2001-2024 UnrealSP.org

Powered by phpBB® Forum Software © phpBB Limited