Announcement

Collapse
No announcement yet.

Settimer() question

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

    Settimer() question

    I have tried to use settimer function on the player himself with no luck. If i try to set him in the 4th parameter, the settimer function wont even execute. If i try to use him to point to and start the function i lose control of my player. Is there anyway to use settimer on the player himself and keep control of the player?

    I've run my self ragged trying everything i can think of.

    Any help is much appreciated.

    #2
    If you don't pass a function name to SetTimer(), it will default to 'Timer', which may be used for other things. SetTimer() also takes an object as optional parameter, but that isn't really required as long as you don't want the timer to execute on an object other than the actor you called it on. (In any case, the actor you called SetTimer() on keeps track of the timer.)

    Keep in mind: The function name (use the nameof(...) compiler macro here!) must match an existing non-state function in the object the timer applies to. That function must not have any parameters.

    Comment


      #3
      Thanks for the info. I know the player is in a state and you just answewred the question and i thank you. I have this question then. What I'm trying to do is set a volume for being out of bounds and start a countdown on him which is running fine. But the issue i'm having is if 2 players step into the volume at the same time or one after the other it just blows or screws up the counter one the 1st guy. Or how shall i put this if second player steps in he takes control of the count down timer and totaly messes up the 1st player timer, i need to get each player to control his own timer when in the volume.

      Any ideas are much appreciated.

      Comment


        #4
        If the code is needed i dont mind showing it to help any others out.

        Comment


          #5
          You obviously need separate timers for each player, which I recommend solving by spawning dedicated timer actors, unless you want to add volume-specific code to the players or pawns.

          Comment


            #6
            Yeah All the code is in the touch function to activate the timer when they walk into it. I'm stuck on this and not sure how to set it per player as they step into it. lol very frustrating. Thanks for all the input.

            Comment


              #7
              Originally posted by Wormbo View Post
              You obviously need separate timers for each player, which I recommend solving by spawning dedicated timer actors, unless you want to add volume-specific code to the players or pawns.
              spawning dedicated timer actors, please explain. If you have an example of what you stated above, please show.

              Comment


                #8
                first see this :
                http://wiki.beyondunreal.com/Timing
                If I understood your means ,you can use the timers for create a time count down so for problems like your problem you can use a touch function for run timer and refer timer to function to do your work
                like this code :


                PHP Code:
                event Touch(Actor other ,PrimativeComponent otherComponent,vector HitLocation,Vector HitNormal)
                {

                settimers(5,false,HitFuntion);

                }


                Function 
                HitFunction()
                {




                Comment


                  #9
                  Thanks silsin, i understand how the settmer() is used. What you have in that touch settimer() above cant be used. That dont set it per player that sets a timer on that function. So the last guy thru controls it not any of the players before the last guy that are still in the volume.

                  Comment


                    #10
                    Solved The timer needs to be set in the players file on the timers 4th parameter.

                    Comment

                    Working...
                    X