Page 1 of 1

Minor Code Problem

PostPosted: Thu Apr 13, 06 8:48 pm
by Magus
You know how weapons disappear after a few seconds if you throw them away in MP? Well, how can I get that to work on a non-weapon item?

I've tried a couple of options to no avail. Help pl0x?

PostPosted: Thu Apr 13, 06 8:53 pm
by Allan
A bit of reverse engineering from the code for EMPGrenades will help you :)

Code: Select all
function BecomePickup()
{
   Super.BecomePickup();
   if (Level.NetMode != NM_Standalone)
      if (bTossedOut)
         Lifespan = 8.0;
}


Add that to the code of your offending items, and they'll be vanishing like the weapons in no time :P

PostPosted: Thu Apr 13, 06 9:07 pm
by Magus
I already tried that, it doesn't work. Thanks for trying though.

PostPosted: Thu Apr 13, 06 9:09 pm
by Allan
Hmm, prehaps try putting it in PostBeginPlay() , as pickups can't become pickups, they already are pickups :P

PostPosted: Thu Apr 13, 06 9:16 pm
by Magus
And how would I declare a function from within another function?

[EDIT] nvm, I figured it. Still don't work though =(

PostPosted: Thu Apr 13, 06 9:32 pm
by Allan
Err... Looks like i'm running out of options...

Try this:

Code: Select all
Simulated Function PostBeginPlay()
{
 If (Level.Netmode!=NM_StandAlone)
{
  If (bTossedOut==True)
 {
  SetTimer(7.0,False)//No need for looping, the timer only needs to go once, then we'll be gone.
  }
 }
}

Function Timer()
{
Destroy();
}