A little help :p

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

Moderator: Forum Guards

A little help :p

Postby Mastakilla » Thu Jan 12, 06 11:23 pm

Ok I'm trying to make a pickup that increases walkspeed by 2 times.

Code: Select all
class SpeedAmplifier extends GuRuPickup;

state Activated
{
   function Activate()
   {
      // can't turn it off
   }

   function BeginState()
   {
      local Human player;
      
      Super.BeginState();

      player = Human(Owner);
      if (player != None)
                    Player.mpWaterSpeed=220.000000;
                    Player.mpGroundSpeed=460.000000;
              Player.ClientMessage("|p5You can now walk and swim 2 times faster.");
                    Player.PlaySound(sound'PlasmaRifleReload');

      UseOnce();
   }
Begin:
}


Any idea how I can make it so the effect goes away when you die?
Lol sorry not such a good modder.
When life gives you lemons... Squeeze them into your eyes and run across a busy intersection, faggot.
User avatar
Mastakilla
Forum Super Hero
 
Posts: 3634
Joined: Wed Aug 17, 05 7:47 pm

Re: A little help :p

Postby Snakey » Thu Jan 12, 06 11:33 pm

O_O

This brings back memories..

It took me ages to do what you're trying to do now, the code is on my other comp, I'm sure I could dig it up from some forums I posted it on.


Ahh, found it. This should do it, for the ground speed at least

Code: Select all
replication
{
    reliable if(ROLE == ROLE_Authority)
      ClientChangeGroundSpeed;
}

function PreBeginPlay()
{
    super.PreBeginPlay();
    maxCopies=1;
}

simulated function Activate()
{
if(DeusExPlayer(owner)!=None && owner.IsInState('Dying'))
   DeusExPlayer(owner).GroundSpeed=class'DeusExPlayer'.default.GroundSpeed;
if(DeusExPlayer(owner)!=None && owner.IsInState('Dying'))
   DeusExPlayer(owner).GroundSpeed=class'DeusExPlayer'.default.GroundSpeed;
    if(Human(Owner) == none) return;
    Human(Owner).mpGroundSpeed=1000;
    Human(Owner).ClientMessage("|p2You can now walk and swim two times faster");
    ClientChangeGroundSpeed(Human(Owner).mpGroundSpeed);
    Destroy();
}

simulated function ClientChangeGroundSpeed(float newSpeed)
{
    Human(Owner).mpGroundSpeed=newSpeed;
    PlaySound(sound'PlasmaRifleReload');
}
<center>

Image
User avatar
Snakey
Alpha
 
Posts: 3926
Joined: Wed Mar 30, 05 7:09 pm
Location: Wales

Postby Mastakilla » Thu Jan 12, 06 11:46 pm

I can figure out the waterspeed from here lol, thanks :)

- Just tryd it, I'm still walking fast when I die and respawn :?
When life gives you lemons... Squeeze them into your eyes and run across a busy intersection, faggot.
User avatar
Mastakilla
Forum Super Hero
 
Posts: 3634
Joined: Wed Aug 17, 05 7:47 pm

Postby ~ô¿ô~Nobody~ » Fri Jan 13, 06 12:14 am

you could make a mutator, that sets the groundspeed back to normal

this works with


Code: Select all
function ModifyPlayer(Pawn Other)


the code could looke like this

Code: Select all
class SpeedReturnMutator extends Mutator;

simulated function PostBeginPlay()
{
    Level.Game.BaseMutator.AddMutator(Self);
    super.PostBeginPlay();
}

function AddMutator (Mutator M)
{
   if(M.IsA('SpeedReturnMutator') )
   {
      return;
   }
   Super.AddMutator(M);
}


function ModifyPlayer(Pawn Other)
{
    if(Human(Other) == none) return;
     SetOwner(Other);
    Human(Owner).mpGroundSpeed=Human(Owner).default.mpGroundSpeed;
    ClientChangeGroundSpeed(Human(Owner).mpGroundSpeed);

    super.ModifyPlayer(Other);
}

simulated function ClientChangeGroundSpeed(float newSpeed)
{
    Human(Owner).mpGroundSpeed=newSpeed;
}
Nobody is perfect...
------------------------------
Longc[A]t wrote:I still think Dae is a russian spambot.

~[A]Daedalus~ wrote:There will be a day when my patience goes away and you, along with all who rant with you, will get banned.

ô¿ô¥[GODZ]¥NOCHANC wrote:I can ban any one I want ANY time I want. You have no rights here.
User avatar
~ô¿ô~Nobody~
Alpha
 
Posts: 2520
Joined: Fri Dec 31, 04 3:20 pm
Location: Proclarush Taonas

Postby Mastakilla » Fri Jan 13, 06 12:24 am

Thanks alot Nobody it worked :lol:

* Aidivn helped me out to make it woek without mutator, here's code if anyone ever needs it :)

Code: Select all
simulated function bool TestMPBeltSpot(int BeltSpot)
{
   return (BeltSpot == 4);
}

function bool HandlePickupQuery( inventory Item )
{
   super.HandlePickupQuery( Self );
}

state Activated
{
   function Timer()
   {
      local DeusExPlayer Player;
      Player = DeusExPlayer(Owner);
      
      if (Player != None)
      {
         Charge = Player.Health;

         if (Charge <= 0)
            Deactivate();
      }
   }
   function Activate()
   {
      // remove it from our inventory, but save our owner info
      if (bOneUseOnly)
      {
         // Remove from player's hand
         Human(Owner).PutInHand(None);
         
         SetOwner(Human(Owner));
         
         Human(Owner).mpGroundSpeed = 640;
         Human(Owner).mpWaterSpeed = 640;
         Human(Owner).JumpZ = 650;
         PlaySound(sound'PlasmaRifleReload');
         Human(Owner).ClientMessage("|p2You can now walk, swim and jumptwo times faster");
      }
   }
}

function Deactivate()
{
   Human(Owner).mpGroundSpeed = Human(Owner).Default.mpGroundSpeed;
   Human(Owner).JumpZ = Human(Owner).Default.JumpZ;
      Human(Owner).mpWaterSpeed = Human(Owner).Default.mpWaterSpeed
   Human(Owner).DeleteInventory(Self);
   
}
When life gives you lemons... Squeeze them into your eyes and run across a busy intersection, faggot.
User avatar
Mastakilla
Forum Super Hero
 
Posts: 3634
Joined: Wed Aug 17, 05 7:47 pm


Return to Editing issues

Who is online

Users browsing this forum: No registered users and 3 guests