Calling Timer() problem

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

Moderator: Forum Guards

Calling Timer() problem

Postby Cozmo » Tue Nov 09, 10 11:49 am

This class is for custom teleporters that handle what goes on in jail. The other stuff outside of this class all works fine, and everything here does too, except the stuff in Timer(), oddly. None of it gets called.

Code: Select all
//=================================
// PoliceJailCell
//=================================
Class PoliceJailCell extends Teleporter;

Var PoliceCrimeMon PCMM;
Var Human Prisoner;
Var ReleasePlace RPLL;

function BeginPlay()
{
   local PoliceCrimeMon PCM;
   local ReleasePlace RPL;

   foreach AllActors(class'PoliceCrimeMon',PCM)
   {
      PCMM = PCM;
   }

   foreach AllActors(Class'ReleasePlace',RPL)
   {
      RPLL = RPL;
   }
}

simulated function bool Accept( actor Incoming, Actor Source )
{
   local int i;
   local int timein;
   local int timein2;
   local DeusExWeapon DEW;

   foreach AllActors(class'DeusExWeapon',DEW)
   {
      if(DEW.Owner == Human(Incoming))
      {
         if(DEW.IsA('CozCreditCard'))
         {
            //Cozmo: Don't destroy this. I think it's "if(!(stuff))" to do it properly but idk.
         }
         else
         {
            DEW.Destroy();
         }
      }
   }

   Super.Accept(Incoming, Source);

   if(Incoming.IsA('Human'))
   {
      for (i=1; i<20; i++)
      {
         if(Human(Incoming) == PCMM.Criminal[i])
         {
            timein = PCMM.CriminalLevel[i]*25;
            timein2 = timein / 60;

            Human(Incoming).Alliance = 'Player';

            Human(Incoming).ClientMessage("|p2When you were captured, you had a criminal level of "$PCMM.CriminalLevel[i]);
            Human(Incoming).ClientMessage("|p2This means your sentance is "$timein$" seconds long. ("$timein2$" minutes long.)");

            Prisoner = Human(Incoming);
            Prisoner.HealPlayer(50, true);

            PCMM.CriminalLevel[i] = 0;
            PCMM.Criminal[i] = None;

            SetTimer(float(timein), false);
         }
      }
   }
}

function Timer()
{
   Prisoner.SetLocation(RPLL.Location);
   Prisoner.ClientMessage("|P2We will be keeping any weapons you had when you were arrested.");
   Prisoner.ClientMessage("|P2You have been released from jail. For now.");

   Prisoner = None;
}

defaultproperties
{
}


Not sure why it's not working. I suspect it's a problem with "SetTimer(float(timein), false)" though. Tried it with the variable still as an int but I get the same result. Am I just doing something silly like converting it to float wrong?
Cozmo
Master
 
Posts: 1266
Joined: Tue Jun 28, 05 10:53 am
Location: UK

Postby ~ô¿ô~Nobody~ » Tue Nov 09, 10 12:16 pm

If the conversion of the value to float results into zero, then timer is not called.
Also.. I'm not sure if you're doing it but you cannot call a chain of timers.. a new call of setTimer overrides the last call before the actual timer function gets executed.
Nobody is perfect...
------------------------------
Longc[A]t wrote:I still think Dae is a russian spambot.

~[A]Daedalus~ wrote:There will be a day when my patience goes away and you, along with all who rant with you, will get banned.

ô¿ô¥[GODZ]¥NOCHANC wrote:I can ban any one I want ANY time I want. You have no rights here.
User avatar
~ô¿ô~Nobody~
Alpha
 
Posts: 2520
Joined: Fri Dec 31, 04 3:20 pm
Location: Proclarush Taonas

Postby Cozmo » Tue Nov 09, 10 12:48 pm

Only calling Timer once for the duration of stay in jail, but good point on 0 value. So I'm probably converting it wrong or can't call it like this?
Cozmo_RPG (v1 & v2)
MPConversations - A tool for creating multiplayer RPG stuff
Cozmo
Master
 
Posts: 1266
Joined: Tue Jun 28, 05 10:53 am
Location: UK

Postby ~ô¿ô~Nobody~ » Tue Nov 09, 10 1:04 pm

I would add log debug messages in the function accept and the timer function.. to see how far it executes..

If the timer function simply doesn't get called, you should check if it was disabled..
you can enable and disable probe functions like timer with enable('timer') or disable('timer)
Last edited by ~ô¿ô~Nobody~ on Tue Nov 09, 10 1:05 pm, edited 1 time in total.
Nobody is perfect...
------------------------------
Longc[A]t wrote:I still think Dae is a russian spambot.

~[A]Daedalus~ wrote:There will be a day when my patience goes away and you, along with all who rant with you, will get banned.

ô¿ô¥[GODZ]¥NOCHANC wrote:I can ban any one I want ANY time I want. You have no rights here.
User avatar
~ô¿ô~Nobody~
Alpha
 
Posts: 2520
Joined: Fri Dec 31, 04 3:20 pm
Location: Proclarush Taonas

Postby Cozmo » Tue Nov 09, 10 1:48 pm

From log debug, yeah, everything seems to be working except Timer(). Added enable('timer') just before SetTimer() but same results. Gotta go out now but will look at parent classes and stuff when I get back. Might have to do something silly and awkward like use Timer() of an external class. Thanks for the replies. :)
Cozmo_RPG (v1 & v2)
MPConversations - A tool for creating multiplayer RPG stuff
Cozmo
Master
 
Posts: 1266
Joined: Tue Jun 28, 05 10:53 am
Location: UK

Postby Cozmo » Tue Nov 09, 10 5:50 pm

I gave up and just made it extend another class and added the SetLocation stuff. It works properly now. :D
Cozmo_RPG (v1 & v2)
MPConversations - A tool for creating multiplayer RPG stuff
Cozmo
Master
 
Posts: 1266
Joined: Tue Jun 28, 05 10:53 am
Location: UK


Return to Editing issues

Who is online

Users browsing this forum: No registered users and 35 guests