Minor Code Problem

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

Moderator: Forum Guards

Minor Code Problem

Postby Magus » Thu Apr 13, 06 8:48 pm

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?
-- Magus "Ours is not to question, only to act!"

Image
User avatar
Magus
Addict
 
Posts: 538
Joined: Wed Aug 17, 05 3:12 pm
Location: Manchester, England

Postby Allan » Thu Apr 13, 06 8:53 pm

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
User avatar
Allan
Alpha
 
Posts: 4545
Joined: Wed Dec 21, 05 1:41 pm
Location: Northamptonshire, England.

Postby Magus » Thu Apr 13, 06 9:07 pm

I already tried that, it doesn't work. Thanks for trying though.
-- Magus "Ours is not to question, only to act!"

Image
User avatar
Magus
Addict
 
Posts: 538
Joined: Wed Aug 17, 05 3:12 pm
Location: Manchester, England

Postby Allan » Thu Apr 13, 06 9:09 pm

Hmm, prehaps try putting it in PostBeginPlay() , as pickups can't become pickups, they already are pickups :P
User avatar
Allan
Alpha
 
Posts: 4545
Joined: Wed Dec 21, 05 1:41 pm
Location: Northamptonshire, England.

Postby Magus » Thu Apr 13, 06 9:16 pm

And how would I declare a function from within another function?

[EDIT] nvm, I figured it. Still don't work though =(
-- Magus "Ours is not to question, only to act!"

Image
User avatar
Magus
Addict
 
Posts: 538
Joined: Wed Aug 17, 05 3:12 pm
Location: Manchester, England

Postby Allan » Thu Apr 13, 06 9:32 pm

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();
}
User avatar
Allan
Alpha
 
Posts: 4545
Joined: Wed Dec 21, 05 1:41 pm
Location: Northamptonshire, England.


Return to Editing issues

Who is online

Users browsing this forum: No registered users and 31 guests