Results 1 to 4 of 4
  1. #1
    MSgt. Shooter Person
    Join Date
    Mar 2011
    Location
    Quebec, Canada & Florida, USA
    Posts
    279

    Default Typecast projectile class in weapon class?

    I would like to use variables that are inside my custom projectile, from my custom weapon class

    Ex: MyProjectile(Something).MyVar

    what would "Something" be if I am inside my custom weapon class?

    Thank you

  2. #2
    MSgt. Shooter Person
    Join Date
    Aug 2010
    Location
    Australia
    Posts
    144

    Default

    I think you'd need to spawn it first, and then you can access it like any other variable. Ie, inside your weapon ProjectileFire function you would do:

    Code:
    SpawnedProjectile = Spawn(GetProjectileClass(), Self,, RealStartLoc);
    SpawnedProjectile.MyVar // This is the var I want

  3. #3
    MSgt. Shooter Person
    Join Date
    Mar 2011
    Location
    Quebec, Canada & Florida, USA
    Posts
    279

    Default

    thank you it did the trick

  4. #4
    Palace Guard

    Join Date
    Jun 2007
    Location
    Christchurch
    Posts
    3,513

    Default

    It depends what you want to use. If the variables are class defaults, you can just access them like this:

    Code:
    class'UDKProjectile'.default.MyVar
    If you're using archetypes, you can reference the archetype and then use it as if you've instanced it.

    Code:
    local UDKProjectile UDKProjectileArchetype;
    
    UDKProjectileArchetype = UDKProjectile'MyPackage.MyProjectile';
    if (UDKProjectileArchetype != None)
    {
      UDKProjectileArchetype.MyVar;
    }


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.