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.

UE1 - UT Making class/arrays work together?

Discussion in 'Programming' started by Danjun1, Sep 18, 2010.

  1. Danjun1

    Danjun1 New Member

    Joined:
    Jul 15, 2010
    Messages:
    15
    Likes Received:
    0
    Hello!

    Right, I'm not cleared on how this kind of stuff works, I was wondering if someone can help me what can I do to make stuff like this happen, see this code for an example:-

    Code:
    Var() class<DeusExCarcass> CarcassClass[32];
    var DeusExCarcass Carcass;
    var() config bool bIsOn;
    
    function Tick(float deltaTime)
    {
    local int i;
    
        if(bIsOn)
        {
            if(CarcassClass[i] != None)
            {
                foreach allActors(class'DeusExCarcass',Carcass)
                {
                      Carcass(CarcassClass[i]).bQueuedDestroy = False;
                }
            }
        }
    
      Super.Tick(deltaTime);
    }
    
    defaultproperties
    {
         CarcassClass(0)=Class'KarkianCarcass'
         CarcassClass(1)=Class'KarkianBabyCarcass'
         CarcassClass(1)=Class'GreaselCarcass'
    }
    As you see of what I'm trying to do is.. that Carcass accesses the CarcassClass and only do stuff AT the carcassclass, which is carcass, but those specific classes on the CarcassClass on defaultproperties ONLY.. This code isn't legitimate, it's just kinda an example.. to try explain what I need..

    So anyway, help anyone, please? thanks!
     
    Last edited: Sep 18, 2010
  2. Wormbo

    Wormbo Administrator Staff Member

    Joined:
    Jun 4, 2001
    Messages:
    5,913
    Likes Received:
    36
    I'm not exactly sure what you're trying to do (the example confuses more than it helps, IMHO).
     
  3. Danjun1

    Danjun1 New Member

    Joined:
    Jul 15, 2010
    Messages:
    15
    Likes Received:
    0
    What I'm trying to do is.. well..

    You have this array of class, Carcass, for example, and they're like array of 32... and then you can add these to your default properties, only 32, ofcourse.

    Next, what I want to do is that ONLY the classes named/listed on the DefaultProperties get some of their bool edited.. Specific right, Example could be something like.. let's say I'm willing to change some weapon's default properties.. I want their ammo to be changed. I want it to do from a mutator so that even when someone spawns this weapon ingame does have it's default properties changed, too. So what I do is make a mutator with a tick, has an array of class, I add this weapon classname to my default properties, and bingo, It gets it ammo changed every tick.

    Hope that example helps? :O
     
  4. brold9999

    brold9999 New Member

    Joined:
    Apr 5, 2009
    Messages:
    142
    Likes Received:
    0
    In that case, you probably want to use a regular for loop rather than foreach, which is going to iterate over all instances of a class.

    I don't remember if there is a syntax for setting default properties from a class reference but it seems plausible that there is.
     
  5. Danjun1

    Danjun1 New Member

    Joined:
    Jul 15, 2010
    Messages:
    15
    Likes Received:
    0
    I want to do for every class existing? what do you mean use a loop-method? :S

    Well, if there is, anyone can help me here? :$

    or any source-free mods that do the same stuff so I can look up?
     
  6. brold9999

    brold9999 New Member

    Joined:
    Apr 5, 2009
    Messages:
    142
    Likes Received:
    0

Share This Page