Author Topic: Resting script help please :)  (Read 350 times)

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
Resting script help please :)
« on: July 20, 2015, 07:21:40 am »


               

Hello hello!


 


So I found this nifty little script that I am totally intending of using. HOWEVER, the timer inbetween each rest is in my opinion WAAAAAY too long and was hoping that someone more capable in the arts of scripting than myself would be able to modify this for me. 


 




// Counting the actual date from Year0 Month0 Day0 Hour0 in hours

int GetHourTimeZero()

{

   int iHourTimeZero;

   iHourTimeZero = (GetCalendarYear()-1)*12*28*24 + (GetCalendarMonth()-1)*28*24 + (GetCalendarDay()-1)*24 + GetTimeHour();

   return iHourTimeZero;

}

 

// The main function placed in the onRest event

void main()

{

  object oPlayer = GetLastPCRested();

  int iRestDelay = 1; //The ammount of hours a player must wait between Rests

  int iBedrollRequired = 1; // 0=No requirements for resting

                            // 1=A "Bedroll" is needed in order to rest.

                            //   Optional may a "Rest-allowing-placable" be used,

                            //   that sets the value of the local "iRestAllowed"

                            //   variable on the player to "1".

 

  if (GetLastRestEventType() == REST_EVENTTYPE_REST_STARTED)

  {

    // Check if the Rest Dely is over.

    if (GetHourTimeZero() < GetLocalInt (oPlayer, "iNextRestHourTimeZero"))

    {

      AssignCommand (oPlayer, ClearAllActions()); // Prevent Resting

      SendMessageToPC (oPlayer, "You must wait " + IntToString (GetLocalInt (oPlayer, "iNextRestHourTimeZero")-GetHourTimeZero()) + " hour(s) before resting again.");

    }

    else   // Resting possible.

    {

      // Resting allowed if No Bedroll required or Player has a Bedroll or a Rest-allowing-placeable set the local "iRestAllowed" variable to 1

      if (iBedrollRequired == 0 || iBedrollRequired == 1 && (GetIsObjectValid (GetItemPossessedBy (oPlayer,"Bedroll")) || GetLocalInt (oPlayer,"iRestAllowed") == 1))

      {

        SetLocalInt (oPlayer, "iRestAllowed", 0);

        SetLocalInt (oPlayer, "iNextRestHourTimeZero", GetHourTimeZero()+iRestDelay);

      }

      else   // Resting not allowed

      {

        AssignCommand (oPlayer, ClearAllActions()); // Prevent Resting

        SendMessageToPC (oPlayer, "No Bed(roll) - No Rest");

      }

    }

  }

}

 

 



 



Now what do I want? currently the timer is set to 1 hour inbetween each rest, I actually would like it to be 15 minutes between each rest.


 


so if anyone could help me with this than THANK YOU SO MUCH!! '<img'>



               
               

               
            

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
Resting script help please :)
« Reply #1 on: July 21, 2015, 07:48:59 am »


               

issue is fixed =)