Tick() + changing FOV value

The best and quickest support by a group of top-notch editing specialists, guaranteed!

Moderator: Forum Guards

Postby Andrievskaya Veronika » Sun Nov 04, 07 8:09 am

Explain me please, how to use Tick(). For example i want to slowly increase Fov from 55 to 75, how i can do this using Tick() ??
User avatar
Andrievskaya Veronika
Poster
 
Posts: 164
Joined: Sat Sep 02, 06 7:35 am
Location: Database read error

Postby Alex » Sun Nov 04, 07 9:52 am

I guess you've already used Timer() in your script? As I would recommend using Timer().
Tick() gets called 20x per second or some, the client/host can actually change this. (I think)

If anyone can confirm this? As I'm not 100% sure. And if they could tell me what variable is used to modify this --> Then I can code something that something gets executed every second.
Alex
Alpha
 
Posts: 8067
Joined: Wed Nov 12, 03 4:51 pm

Postby Dae » Sun Nov 04, 07 10:29 am

Isn't tick() called every frame? I've read that somewhere on beyondunreal Wiki, and it seems a little bit strange for me, because if that was truth, different players would have different amount of ticks (I have 60 frames per second, some people have 100+, some play on 20-30).
User avatar
Dae
Alpha
 
Posts: 12086
Joined: Sat Sep 06, 03 4:40 pm

Postby Andrievskaya Veronika » Sun Nov 04, 07 10:35 am

I not used nor timer nor tick() yet. I don't have idea how to use them in my case (i want to decrease fov from 75 to 56 slowly)
User avatar
Andrievskaya Veronika
Poster
 
Posts: 164
Joined: Sat Sep 02, 06 7:35 am
Location: Database read error

Postby Alex » Sun Nov 04, 07 10:38 am

Ok, can you tell me how to change the FOV? As I didn't use it for a loooong time.
Alex
Alpha
 
Posts: 8067
Joined: Wed Nov 12, 03 4:51 pm

Postby Dae » Sun Nov 04, 07 10:44 am

player.consolecommand('setfov 56');

fov 56 would work as well I think
User avatar
Dae
Alpha
 
Posts: 12086
Joined: Sat Sep 06, 03 4:40 pm

Postby Alex » Sun Nov 04, 07 10:57 am

Code: Select all
var DeusExPlayer Player;

function PostBeginPlay()
{
  Super.PostBeginPlay();
  SetTimer(1.0, False); // Call Timer in 1 second, do not repeat.
}

function Timer()
{
  if(Player.DefaultFOV > 56)
  {
    Player.DefaultFOV      = Player.DefaultFOV-1.0;
    Player.DefaultFOV      = FClamp(Player.DefaultFOV, 1, 170);
    Player.DesiredFOV      = Player.DefaultFOV;
    if(Player.DesiredFOV > 56)
    {
      SetTimer(1.0, False); // We have to run Timer again.
    }
  }
}


Should work... I think. Decreases FOV with 1 every 1 second. You can of course changes these values. I wouldn't change the FOV, I would change the time, so change SetTimer(1.0, False); into SetTimer(your value, False);
Last edited by Alex on Sun Nov 04, 07 10:58 am, edited 1 time in total.
Alex
Alpha
 
Posts: 8067
Joined: Wed Nov 12, 03 4:51 pm

Postby Andrievskaya Veronika » Sun Nov 04, 07 11:01 am

... i did something, but it does not works :o


The code is located in my own PlayerClass

Code: Select all
exec function AZoomIn()
{
local DeusExWeapon W;

   if ( (DeusExWeapon(inHand).bHasScope) && (DeusExPlayer(GetPlayerPawn()).IsInState('Dying') ))
   {
      ClientMessage("Вы не можете использовать функцию приближения вида если у вас в руках оружие с прицелом :)");
      Return;
   }
   else
//      SetDesiredFov(56);
   SetTimer(0.01, true);
   GoToState('ZoomInA');
}


exec function AZoomRelease()
{
      SetDesiredFov(75);
}


state ZommInA
{
      function Timer()
      {
         DesiredFov=(DesiredFov - 0.5);
         log("changing fov...");

            If (DesiredFov >= 56)
               {
                  SetTimer(0, false);
               }
      }
}

// in user.ini...
/*


Enter=AzoomIn | onrelease AZoomRelease




*/


In log i see that State not found, and function AZoomIn accessed None
And game freezes, when i using that function.

Edit:

Alex posted faster :)
Last edited by Andrievskaya Veronika on Sun Nov 04, 07 11:03 am, edited 1 time in total.
User avatar
Andrievskaya Veronika
Poster
 
Posts: 164
Joined: Sat Sep 02, 06 7:35 am
Location: Database read error

Postby Alex » Sun Nov 04, 07 11:08 am

Code: Select all
function MultiplayerTick(float DeltaTime)
{
  local float newFOV;

  Super.MultiplayerTick(DeltaTime);
  if(DefaultFOV > 56)
  {
    newFOV      = DefaultFOV - (1.0 * DeltaTime);
    DefaultFOV      = FClamp(newFOV, 1, 170);
    DesiredFOV      = newFOV;
  }
}

What I posted will not be useable. Timer() is already used in DeusExPlayer.uc
Try using what I posted above.
Last edited by Alex on Sun Nov 04, 07 11:09 am, edited 1 time in total.
Alex
Alpha
 
Posts: 8067
Joined: Wed Nov 12, 03 4:51 pm

Postby Andrievskaya Veronika » Sat Nov 24, 07 4:07 am

I found a "wrapper" for Tick() here:

http://www.dxediting.com/forums/showthread.php?t=2741
User avatar
Andrievskaya Veronika
Poster
 
Posts: 164
Joined: Sat Sep 02, 06 7:35 am
Location: Database read error


Return to Editing issues

Who is online

Users browsing this forum: No registered users and 12 guests