Page 1 of 1

PostPosted: Sun Nov 04, 07 8:09 am
by Andrievskaya Veronika
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() ??

PostPosted: Sun Nov 04, 07 9:52 am
by Alex
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.

PostPosted: Sun Nov 04, 07 10:29 am
by Dae
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).

PostPosted: Sun Nov 04, 07 10:35 am
by Andrievskaya Veronika
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)

PostPosted: Sun Nov 04, 07 10:38 am
by Alex
Ok, can you tell me how to change the FOV? As I didn't use it for a loooong time.

PostPosted: Sun Nov 04, 07 10:44 am
by Dae
player.consolecommand('setfov 56');

fov 56 would work as well I think

PostPosted: Sun Nov 04, 07 10:57 am
by Alex
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);

PostPosted: Sun Nov 04, 07 11:01 am
by Andrievskaya Veronika
... 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 :)

PostPosted: Sun Nov 04, 07 11:08 am
by Alex
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.

PostPosted: Sat Nov 24, 07 4:07 am
by Andrievskaya Veronika
I found a "wrapper" for Tick() here:

http://www.dxediting.com/forums/showthread.php?t=2741