Announcement

Collapse
No announcement yet.

actor groups

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

    actor groups

    hi there,
    i've mod'ed up a few vehicles but how can i tell them apart from the regular vehicles in code. If i want to call a function on one of my vehicles do i have to query every vehicle one at a time? ie.
    Code:
    function Scanner
    {
    local svehicle WhatIfound;
    
    foreach touchingactors(class'svehicle',WhatIfound)
    {
    if (WhatIfound.isa('MyRaptor'))WhatIfound 'MyRaptor'(WhatIfound).myAddedFunction;
    else
    if (WhatIfound.isa('MyManta)) WhatIfound MyManta(WhatIfound).myAddedFunction;
    etc...
    }
    }
    or as the function is exactly the same in each vehicle
    Code:
    foreach touchingactors(class'svehicle',WhatIfound)
    {
    if ((WhatIfound.isa('MyRaptor') || (WhatIfound.isa('MyManta')(WhatIfound.isa('MyHovertank') etc....)
    MyManta(WhatIfound).myAddedFunction;
    The second way is easyer but i cant help thinking its not good coding. I could seach for some non essential property in the Svehicle class that i could set to something that none of the original vehicles will have it set to and use that as a flag as last resort. Is there any other way to solve this problem.
    thanks.

    #2
    This is a restriction of the Unreal Engine... There is no decent way to provide one set of functionality to different classes.

    If your code is totally generic, perhaps you could simply mutate ONSVehicle. I'm not sure about how mutator replacement works... but if mutating ONSVehicle also mutates all Raptors, Mantas, etcetera, you have options.

    Comment


      #3
      oh well..i thought that was going to be the case.
      am i right in saying that if i went up the class tree a bit and subclassed svehicle and then made my own Vehicle branch by copying all the code from the svehicle classes and children that things wont run as fast? because i wont be able to use any native c++ used in the svehicle class?

      Comment


        #4
        You're right... if you could reproduce all native code in script. Which I doubt is worth the immense effort.

        Comment


          #5
          how does the native code work in conjunction with the uscript?
          Is it a total copy of the Uscript but written in C++ ?
          C++ is supposed to be close to uscipt in structure..how hard is it to make the jump to programming c++?

          Comment

          Working...
          X