Announcement

Collapse
No announcement yet.

Valid Actor Refference

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

    Valid Actor Refference

    can i grab a valid refference to an actor through the trigger function in the same way as as in functions touch,bump etc.
    Ive got a bunch of movers that sucessivly trigger each other and i want the mover being triggered to match up some default values with the mover that triggered it.
    Do i use the same typecasting method as in tuch,bump etc?

    function touch(actor other)
    {
    if (MYSubclassedMover(other)!= none)
    {
    if (MYSubclassedMover(other).DefaultValue != self.defaultvalue)
    self.defaultvalue=MYSubclassedMover(other).Default Value;

    }

    If this is ok then i must have an error somewhere alse in the code.

    #2
    Try
    Code:
    function touch(actor other){
      if ( other.ISA('MyClass') ) {
          if (Class'MyClass'.Default.value != self.default.value)
                self.default.value=Class'MyClass'.Default.Value; 
      }
    }
    Although esentially the same, you should be using default.value like:

    MYSubclassedMover(other).Default.bHidden = False;

    If you don't get an error with this, then what is the error?

    Comment


      #3
      Don't use the defaults, that's not going to give you whatever value you entered in the mover properties.

      Comment


        #4
        but doesnt whatever value you set in an objects properties become its default value? or is there a difference between the coded default value and what a mapper specifies in the default properties?

        its not so much an error as im just not getting anything through trigger.
        just noticed that trigger open timed is an extension of another state.
        What are the rules for modifying functions in extended states?

        Comment


          #5
          Mappers dont access default properties.

          If your movers trigger each other (as in call TriggerEvent()), then they (are supposed to) pass themselves into the function as Other. So that when function Trigger(Actor Other, Pawn EventInstigator) gets called, Other is the actor that actually called the TriggerEvent function.

          If that helps any, lol.

          Comment


            #6
            Originally posted by FatalOverdose
            but doesnt whatever value you set in an objects properties become its default value? or is there a difference between the coded default value and what a mapper specifies in the default properties?

            its not so much an error as im just not getting anything through trigger.
            just noticed that trigger open timed is an extension of another state.
            What are the rules for modifying functions in extended states?
            Default values are a refference only.
            You can get/set the default, by you shouldn't use them in a class.

            Eg:
            class'MyClass'.default.value = global value.
            MyClass.Value = Non Static value, unless specified to be static.

            So going MyClass.Value = 100 does not change the class default value, which might be 10.

            Comment


              #7
              Thanks , i think i might have been getting a little confused.
              But the problem still remains that i cant even get a log command off trigger if i overwrite it out of states. As the function i want to modify is in an extended state im unsure on how to go about overwritting it.

              Comment


                #8
                If you want to override a function that's in a certain state of a super class, just put it in a state of the same name:
                Code:
                state TheState
                {
                  function Touch(Actor Other)
                  {
                     // do stuff
                  }
                }

                Comment


                  #9
                  Thanks but 'TriggerOpentimed' is an 'extended' state so if you copy the whole state across to the new script you just get an error.
                  Tarquin solved it;-you just extend the TriggerOpenTimed state in the subclass and alter the functions inside.
                  Gonna kick myself for missing that one.lol.

                  Comment


                    #10
                    well ive sort of got it working. There seems to be no problem in passing individual variables through the 'actor other' in the trigger
                    function but as theres about 7-8 values to be passed it would be far easyer for me to wrap them up in a struct and compare
                    the two structs like you would with a vector.
                    The Custom Movers are leg segments that make up a larger object, My spidercore. (Further Info On spidercore from earlier post)

                    (I know i should be using enums in the structs but i cant find any info on how to use them on wiki)

                    Code:
                    Struct FDBeginOpening                                            // DataType
                    {
                    var() Bool                         FD_SpawnAT_BeginOpening;
                    var() Bool                         FD_HardAttachFX;
                    };
                    Struct FDFinishedOpening                                        // DataType
                    {
                    var() Bool                         FD_SpawnAT_FinishedOpening;
                    var() Bool                         FD_HardAttachFX;
                    };
                    Struct FDReturnBegin                                            // DataType
                    {
                    var() Bool                         FD_SpawnAT_ReturnBegin;
                    var() Bool                         FD_HardAttachFX;
                    };
                    Struct FDReturnFinished                                         // DataType
                    {
                    var() Bool                         FD_SpawnAT_ReturnFinished;
                    var() Bool                         FD_HardAttachFX;
                    };
                    struct FDSpawnPacket               //=====================Start Struct for FX====
                    {                                                                             //=
                    var() class<FD_FX>                 FD_TheFX;                                  //=
                    Var() FDBeginOpening               FD_BeginOpening;      // Structs             =
                    Var() FDFinishedOpening            FD_FinishedOpening;   // Structs             =
                    Var() FDReturnBegin                FD_ReturnBegin;       // Structs             =
                    Var() FDReturnFinished             FD_ReturnFinished;    // Structs             =
                    Var() name                         FD_SpawnAt_Body_Femur_Tibia_Tarsus;
                    };Var(FDSpawnPacket) FDSpawnPacket FD_SpawnPacket;//=============================
                    
                    function Trigger( actor Other, pawn EventInstigator )
                    {
                    if(FDb_DataCaptureOnTrigger==True)
                       {
                       if ( other.ISA('FD_2VTMover') )
                          {
                           if (FD_2VTMover(other).FD_SpawnPacket != FD_SpawnPacket)
                     self.FD_SpawnPacket=FD_2VTMover(other).FD_SpawnPacket;
                          }
                    
                    }
                    wont let me use != saying the FD_Spawnpackets are not compatable with that operator.

                    Morphius suggested ;-

                    function touch(actor other){
                    if ( other.ISA('MyClass') ) {
                    if (Class'MyClass'.Default.value != self.default.value)
                    self.default.value=Class'MyClass'.Default.Value;
                    }
                    }{
                    but that way im getting an error saying FD_Spawnpacket is not a property of actor.



                    Now if i go into the struct further and compair the individual vaules
                    like;-
                    Code:
                    function Trigger( actor Other, pawn EventInstigator )
                    {
                    if(FDb_DataCaptureOnTrigger==True)
                       {
                       if ( other.ISA('FD_2VTMover') )
                          {
                           if (FD_2VTMover(other).FD_SpawnPacket.Vaule1 != FD_SpawnPacket.Vaule1) 
                    self.FD_SpawnPacket.Vaule1=FD_2VTMover(other).FD_SpawnPacket.Vaule1;
                          }
                    }
                    It seems to work ok.!?
                    To tell you the truth i wouldnt mind using the longer method execpt i cant get it to work with enums. Im half toying withe the idea of cramming all the data into some sort of 16 bit data string to cut down on the variables being sent.

                    Comment


                      #11
                      Been think about it and decided as much as i'd like to know why this isnt working im more interested in getting my mod out. The only reason i was doing it through trigger in the first place was so that the whole system was a bit more user friendly. Im just gonna pass all the data through a function call... nice and easy. I've worked out a little number system for the data so that i can squash 2 or 3 variables into a single Int variable while trying to solve this problem. A sort of data compression really, its simplistic but it cut the number of variables that need to be passed to the leg segments down by under half
                      I just wanna play with my SpiderCore.lol.

                      Comment

                      Working...
                      X