Announcement

Collapse
No announcement yet.

Adding delay

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

    Adding delay

    I have this function in my PlayerController class. All I want to do is to add a delay for 2 seconds so when I click a button and the function is called, I want to display the message (Call him) and after 2 seconds I want to change the map. Right now, the map is changing immediatelly and I can't read the message (only on editor since on editor, the map doesn't change).

    So how can I display the message and after 2 seconds, the map will change?

    Code:
    exec function CallHim()
    {
        `log("Open map after calling");
        ClientMessage("Call him!"); 
        ConsoleCommand("open mymap1"); 
    
    }

    #2
    You can add a delay by using a Timer.

    Code:
    exec function CallHim()
    {
        `log("Open map after calling");
        ClientMessage("Call him!");
        SetTimer(2.0, false, 'CallHimTimer');
    }
    
    simulated function CallHimTimer()
    {
        ConsoleCommand("open mymap1");
    }
    PS: Using "simulated" because of the unknown class you are using that code.

    Comment


      #3
      Excellent, it worked.

      Comment

      Working...
      X