Announcement

Collapse
No announcement yet.

config weapon array [Solved]

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    config weapon array [Solved]

    I'm trying to define a set of weapons in an array but I want to be able to define the weapons in the config .ini

    in compiled code
    Code:
    var globalconfig array<type> Weapon;
    in the ini
    Code:
    [test.test]
    Weapon=UTweapon1
    Weapon=UTweapon2
    Weapon=UTweapon3
    Weapon=UTweapon4
    something like that. Is there a way I can do this? I know I cant store a class in a config variable but I was thinking some form of class reference so that the code knows what weapons to give the player in runtime

    #2
    Would probably have to be a string array and the INI must contain entries in the form "package.classname" - these would be DynamicLoadObject()'d to get the weapon classes.

    Comment


      #3
      Warning: Failed to load 'UTWeapon UTGame.UTWeap_RocketLauncher': Failed to find object 'UTWeapon UTGame.UTWeap_RocketLauncher'
      Code:
      UTW = UTWeapon (DynamicLoadObject("UTGame.UTWeap_RocketLauncher", class'UTWeapon'));
      Cant seem to get this working either it seems like it should work

      [Edit]
      I can see I'm doing something stupid, just can't work out how to fix it

      Comment


        #4
        What I'm using atm is:
        Code:
        UTW = UTWeapon (UTPawn(PlayerPawn).CreateInventory(class 'UTWeap_RocketLauncher', false));
        and I want is to make the class 'UTWeap_RocketLauncher' dynamic rather than hadcoded.

        Comment


          #5
          You don't load a UTWeapon instance, you load a class extending UTWeapon. In other words, you need to tell the DLO() function it should look for an object of class'Class' and you have to typecast the result to class<UTWeapon>.

          The weapon replacement mutator contains nice examples for this very case.

          Comment


            #6
            Thanks alot, got it working now that I understand DynamicLoadObject(). Ripped apart the mutator code and learned a bit from that too.

            Comment

            Working...
            X