1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

new scripter question

Discussion in 'Programming' started by navboy, Sep 10, 2001.

  1. navboy

    navboy New Member

    Joined:
    Jan 5, 2001
    Messages:
    340
    Likes Received:
    0
    Been at this about 2 weeks now, have subclassed 4 actors, it's working pretty well, but now i'm worried about performance and side effects. Here's something i see done both ways alot:

    How are these different and if they're equivalent which one is better (for
    network play)?

    1:
    if( Other.IsA('Pawn') )

    2:
    if( Pawn(Other)!=None

    anyway, thanks for any help
     
  2. nighthack

    nighthack New Member

    Joined:
    Sep 8, 2001
    Messages:
    21
    Likes Received:
    0
    I guess (Pawn(Other)!=None) should work faster, even if the difference shouldn't be that big.

    Ohter.IsA('Pawn') is a function call which naturally takes more processing time than a simple comparsion.
     
  3. navboy

    navboy New Member

    Joined:
    Jan 5, 2001
    Messages:
    340
    Likes Received:
    0
    hmm, and Pawn() is not a function call? Or is it a game engine call therefore "special" and/or faster? Please bear with my newness ;)
     
  4. ca

    ca CHiMERiC Grandmaster

    Joined:
    Oct 11, 1999
    Messages:
    84
    Likes Received:
    0
    You can (try) to cast any object into a specific class, and Pawn(SomeObject) is just an attempt to cast into the Pawn class. If you try to cast an object into a class that it isn't a child of, or isn't an instance, then it will return None.

    I don't remember the specifics, but I'm pretty sure Other.IsA('Pawn') is more network friendly than the none check, Pawn(Other) != None. I don't think it'll make much of a difference either way, so I wouldn't worry too much about it.
     

Share This Page