Bully-Board

Bully Modding Section => Modding Questions/Help => Modding Questions/Help Archives => Topic started by: FearlessBloodseeker on April 19, 2013, 07:50:39 AM

Title: LUA Time Lock
Post by: FearlessBloodseeker on April 19, 2013, 07:50:39 AM
Hey guys, it's me again. Well, how do I lock time via LUA? Let's say I'd like to time lock on 12:00 AM. How do I do it?
Title: Re: LUA Time Lock
Post by: SWEGTA on April 19, 2013, 10:26:44 AM
You could make it set the time constantly in the main part of the script?
Have never actually done this though..
Title: Re: LUA Time Lock
Post by: Red Blaster on April 19, 2013, 10:49:07 AM
I'll have to dig through my backed up files and see if I can find the script, since I forgot the exact lua commands.
Title: Re: LUA Time Lock
Post by: Walter20210 on April 19, 2013, 10:58:41 AM
i think repeating the command of set the time will work
I have a zombie script that uses that
Title: Re: LUA Time Lock
Post by: Red Blaster on April 19, 2013, 11:13:02 AM
No need for a repeat command. There is a lua command that freezes time.
Title: Re: LUA Time Lock
Post by: SWEGTA on April 19, 2013, 01:15:04 PM
No need for a repeat command. There is a lua command that freezes time.

What he said :P
Title: Re: LUA Time Lock
Post by: Walter20210 on April 19, 2013, 04:42:07 PM
I Found it :D
Title: Re: LUA Time Lock
Post by: xXxNarumi on April 19, 2013, 04:51:40 PM
I noticed SWEGTA is moderator but im not yet D:
Title: Re: LUA Time Lock
Post by: Walter20210 on April 19, 2013, 04:53:06 PM
WUT HOW HE IS A MODERATOR??!!!

Sorry

Why he is a moderator? :D
Title: Re: LUA Time Lock
Post by: MadmaN on April 19, 2013, 05:16:17 PM
He is a moderator because I stepped down from being listed as a moderator for the modding section and asked that he be promoted in my place since he has really deserved it for all teh hard work he has done....since I also have been helping him learn what he can too regarding lua and other things. Steman aka prosecute is still a section mod in the modding section but is just temporarily removed from the listing until he returns to BB after which he will have his section mod abilities returned to him.


and @ xNarumi....

The reason why you are not a moderator or even a staff member yet is simple. You have made it very plain that you really want a position there and it is something that should never ever be asked or begged for since that just means the person asking is only after power and not really serious about doing the job as a proper staff member. That and the fact that swegta has worked very hard to earn what was given to him....he has been very active in the modding community...always helping when he can and never jumping on the newbies for asking even annoying questions and is always very precise about his posts.

Being picked to be a moderator whether its section moderator...full moderator or whatever is something that happens for very specific reasons....it is something that HAS to be earned and only the forum staff can decide who they will pick for such a position. Trust is another thing that goes hand in hand with getting a staff position since if the person is deemed very trustworthy....then that really helps but if ppl consider that person not quite trustworthy enough....then they will simply not get it at that time.

Chrissy does not just hand out staff positions to anyone that asks for it.....since any good admin knows that if one were to just hand out any position to anyone that asks....then it kinda defeats the purpose of the staff tiers that are used on various forums out there...BB  being no exception to that rule.

Even on forums where I hold a admin position I NEVER hand out a staff spot to just anyone and I carefully watch people and make an offer to those that I consider worthy of being considered as staff. I also talk it over with my own staff to make sure that everyone agrees...etc with that and basicly hold a vote at times....that is how I do things like in my clan for example....

I know it may seem unfair....but think of it from the other side of things...if you were in chrissy's shoes and were trying to decide whether to pick a staff member for your own forum....would you just promote anyone that asks? or would you base your decision on the actions of the individual in question and how they interact with the community?

If you work hard enough....maybe you will be considered for a staff position...but it takes real hard work and dedication to do that....and not everyone is cut out to handle that. Just ask the staff here about that and they will agree with me on what I just said.  8)
Title: Re: LUA Time Lock
Post by: xXxNarumi on April 19, 2013, 05:25:35 PM
I never asked to be a moderator once.
I was just saying that from here lol.
Doesn't matter to me if I'm not a moderator though although I have been able to figure who's a leecher and who's not.
Since I'm working with OwnageGFX I already have a job to do lol XD
But If I did see myself a moderator on BB wouldn't really be as fun since I like being a member and stuff and all in here.
Title: Re: LUA Time Lock
Post by: Chrissy on April 19, 2013, 11:08:22 PM
Swegta hacked BB and gave himself mod capabilities.
Title: Re: LUA Time Lock
Post by: MadmaN on April 19, 2013, 11:23:14 PM
Swegta hacked BB and gave himself mod capabilities.

ROFL

Now that I couldn't have said any better......nice one Chrissy.  :biggrin:
Title: Re: LUA Time Lock
Post by: SWEGTA on April 20, 2013, 05:33:19 AM
Swegta hacked BB and gave himself mod capabilities.

(http://www.troll.me/images/obama-meh/you-caught-me-well-played.jpg)
Title: Re: LUA Time Lock
Post by: Evolution on April 21, 2013, 01:12:38 AM
SWEGTA completely deserves being a moderator, he will make a good one for sure.
Title: Re: LUA Time Lock
Post by: SWEGTA on April 21, 2013, 07:15:13 AM
SWEGTA completely deserves being a moderator, he will make a good one for sure.


Pfffshaauwww Yoooouuuuu  :wub:
Title: Re: LUA Time Lock
Post by: FearlessBloodseeker on April 21, 2013, 08:46:21 AM
Err, sorry to interrupt. Well maybe I'm pretty rude, but I'm uh, asking how to freeze the time, not about moderator..? xD
Title: Re: LUA Time Lock
Post by: xbetstyler on April 21, 2013, 09:01:22 AM
You can used this command to freeze and unfreeze the game clock:

PauseGameClock()
UnpauseGameClock()
Title: Re: LUA Time Lock
Post by: Evolution on April 21, 2013, 09:05:46 AM
Err, sorry to interrupt. Well maybe I'm pretty rude, but I'm uh, asking how to freeze the time, not about moderator..? xD

RUDE BASTARD!!!! HOW DARE YOU ASK FOR WHAT YOU PREVIOUSLY REQUESTED BEFORE IT GOT DERAILED AND THAN YOU CHANGED THE TOPIC BACK ON TOPIC, HOW RUDE!!!! :P

Anyways, Betstyler (Now esai) explained how.
Title: Re: LUA Time Lock
Post by: xbetstyler on April 21, 2013, 09:12:11 AM
Do you mean how to script the command?
Title: Re: LUA Time Lock
Post by: FearlessBloodseeker on April 21, 2013, 09:14:23 AM
Well, via LUA of course :) and yes. What is the command should I add in the LUA script to freeze the time..?
Title: Re: LUA Time Lock
Post by: xbetstyler on April 21, 2013, 09:18:38 AM
I used if statement script:

example: if IsButtonPressed(14, 0) then
              PauseGameClock()
              elseif IsButtonPressed(15, 0) then
              UnpauseGameClock()
Title: Re: LUA Time Lock
Post by: FearlessBloodseeker on April 21, 2013, 09:21:27 AM
Well, how do I permanently freeze the time which is at 12:00 (or something) that has no class and spawns more students?
Title: Re: LUA Time Lock
Post by: xbetstyler on April 21, 2013, 09:27:39 AM
You can freeze and unfreeze anytime you want.
And to spawn more student you have to edit the PedPop.dat.
Title: Re: LUA Time Lock
Post by: deadpoolXYZ on April 21, 2013, 09:38:25 AM
He is asking if you can change the time to 12:00 and freeze it.

Save your game at 11:50 and start the arcade machine to freeze the time.
Title: Re: LUA Time Lock
Post by: xbetstyler on April 21, 2013, 09:44:20 AM
Like I said..the time will freeze when you press the "x" button.
so press the button at 12.00 to freeze the clock at that time.

Edit: You still can access your save book when you freeze the clock.
Title: Re: LUA Time Lock
Post by: deadpoolXYZ on April 21, 2013, 10:03:41 AM
I know it. -.-

Im just saying that he should save his game at 11:50 so everytime he loads it he doesn't have to wait.
Title: Re: LUA Time Lock
Post by: FearlessBloodseeker on April 23, 2013, 08:16:41 AM
Alright. I tried like what you said, but I got an error in the uh.."prompting" stuffs.
So this is my LUA (Madman's)

Code: [Select]
GlobalImportScript("SObjTest.lua")
ImportScript("Library/LibTable.lua")
ImportScript("SZone.lua")

  l_0_0 = 60

MissionSetup = function()
  local l_1_0 = 270
  local l_1_1 = -110
  local l_1_2 = 6.4000000953674
  AreaTransitionXYZ(0, l_1_0, l_1_1, l_1_2)
  TextPrintString("Bully: Scholarship Edition Multi-Bodyguard  Mod v1 BETA.", 4, 1)
  Wait(5000)
  TextPrintString("By: |XF|-MadmaN [AR] ", 4, 1)
  Wait(5000)
     
  l_0_3 = PedCreatePoint(37, POINTLIST._BEGGINING, 1) -- Darby BOSS
  l_0_4 = PedCreatePoint(33, POINTLIST._BEGGINING, 1) -- Bif
   l_0_5 = PedCreatePoint(35, POINTLIST._BEGGINING, 1) -- Bryce
   l_0_6 = PedCreatePoint(34, POINTLIST._BEGGINING, 1) -- Justin
   l_0_7 = PedCreatePoint(40, POINTLIST._BEGGINING, 1) -- Parker
   l_0_8 = PedCreatePoint(32, POINTLIST._BEGGINING, 1) -- Chad
   l_0_9 = PedCreatePoint(30, POINTLIST._BEGGINING, 1) -- Gord
   l_1_0 = PedCreatePoint(31, POINTLIST._BEGGINING, 1) -- Tad
   l_1_1 = PedCreatePoint(38, POINTLIST._BEGGINING, 1) -- Pinky

 
        PedSetActionTree(gPlayer, "/Global/P_Striker_A", "Act/Anim/P_Striker_A.act") -- Player
    PedSetActionTree(l_0_3, "/Global/BOSS_Darby", "Act/Anim/BOSS_Darby.act") -- Darby BOSS
    PedSetActionTree(l_0_4, "/Global/P_Striker_A", "Act/Anim/P_Striker_A.act") -- Bif
        PedSetActionTree(l_0_5, "/Global/P_Grappler_A", "Act/Anim/P_Grappler_A.act") -- Bryce
        PedSetActionTree(l_0_6, "/Global/P_Striker_B", "Act/Anim/P_Striker_B.act") -- Justin
        PedSetActionTree(l_0_7, "/Global/P_Striker_B", "Act/Anim/P_Striker_B.act") -- Parker
        PedSetActionTree(l_0_8, "/Global/P_Grappler_A", "Act/Anim/P_Grappler_A.act") -- Chad
        PedSetActionTree(l_0_9, "/Global/P_Striker_A", "Act/Anim/P_Striker_A.act") -- Gord
        PedSetActionTree(l_1_0, "/Global/P_Striker_A", "Act/Anim/P_Striker_A.act") -- Tad
        PedSetActionTree(l_1_1, "/Global/GS_Female_A", "Act/Anim/GS_Female_A.act") -- Pinky                     
     
   -- Ally Blip Code Start
   --
    l_2_7 = AddBlipForChar(l_0_3, 6, 2, 2)
    l_2_8 = AddBlipForChar(l_0_4, 6, 2, 2)
   l_2_9 = AddBlipForChar(l_0_5, 6, 2, 2)
   l_3_0 = AddBlipForChar(l_0_6, 6, 2, 2)
   l_3_1 = AddBlipForChar(l_0_7, 6, 2, 2)
   l_3_2 = AddBlipForChar(l_0_8, 6, 2, 2)
   l_3_3 = AddBlipForChar(l_0_9, 6, 2, 2)
   l_3_4 = AddBlipForChar(l_1_0, 6, 2, 2)
   l_3_5 = AddBlipForChar(l_1_1, 6, 2, 2)
   
   -- Infinite Sprint Code Start for Allies
   --
    PedSetInfiniteSprint(l_0_3, true)
    PedSetInfiniteSprint(l_0_4, true)
   PedSetInfiniteSprint(l_0_5, true)
   PedSetInfiniteSprint(l_0_6, true)
   PedSetInfiniteSprint(l_0_7, true)
   PedSetInfiniteSprint(l_0_8, true)
   PedSetInfiniteSprint(l_0_9, true)
   PedSetInfiniteSprint(l_1_0, true)
   PedSetInfiniteSprint(l_1_1, true)
   
   PedSetHealth(l_0_3, 100000)
   PedSetHealth(l_0_4, 100000)
   PedSetHealth(l_0_5, 100000)
   PedSetHealth(l_0_6, 100000)
   PedSetHealth(l_0_7, 100000)
   PedSetHealth(l_0_8, 100000)
   PedSetHealth(l_0_9, 100000)
   PedSetHealth(l_1_0, 100000)
   PedSetHealth(l_1_1, 100000)
   
   -- Ped Recruit Code Start
   --
    PedRecruitAlly(gPlayer, l_0_3)
    PedRecruitAlly(l_0_3, l_0_4)
   PedRecruitAlly(l_0_4, l_0_5)
   PedRecruitAlly(l_0_5, l_0_6)
   PedRecruitAlly(l_0_6, l_0_7)
   PedRecruitAlly(l_0_7, l_0_8)
   PedRecruitAlly(l_0_8, l_0_9)
   PedRecruitAlly(l_0_9, l_1_0)
   PedRecruitAlly(l_1_0, l_1_1)
   
   PedSetAllyAutoEngage(l_0_3, true)
   PedSetAllyAutoEngage(l_0_4, true)
   PedSetAllyAutoEngage(l_0_5, true)
   PedSetAllyAutoEngage(l_0_6, true)
   PedSetAllyAutoEngage(l_0_7, true)
   PedSetAllyAutoEngage(l_0_8, true)
   PedSetAllyAutoEngage(l_0_9, true)
   PedSetAllyAutoEngage(l_1_0, true)
   PedSetAllyAutoEngage(l_1_1, true)
   

SoundPlayInteractiveStream("MS_DishonorableFight.rsm",MUSIC_DEFAULT_VOLUME)
SoundSetMidIntensityStream("MS_JockBossBattle.rsm",MUSIC_DEFAULT_VOLUME)
SoundSetHighIntensityStream("MS_TenementsHigh.rsm",MUSIC_DEFAULT_VOLUME)

              IsButtonPressed(14, 0) then
              PauseGameClock()
              IsButtonPressed(15, 0) then
              UnpauseGameClock()
end


F_MissionSetup = function()
  PlayerSetControl(1)
  CameraFollowPed(gPlayer)
  ClockSet(9, 30)
  ClockSetTickRate(0.0060000000521541)
  LaunchScript("SObjTest.lua")

end



MissionCleanup = function()
  ClearTextQueue()
  EnablePOI()
  gMissionRunning = false
  shared.gMissionEventFunction = nil
  WeatherRelease()
  PlayerSetControl(1)
  PlayerSetPunishmentPoints(0) 
end



main = function()
  F_MissionSetup()
  gMissionRunning = true
  while gMissionRunning do
    UpdateTextQueue()
    Wait(0)
   end
end

Two questions:
1. What should I add in?
2. Which section should I add in?
Title: Re: LUA Time Lock
Post by: xbetstyler on April 23, 2013, 09:10:43 AM
If your launch the script with arcade game the command doesn't effect.
Better you just compile this timecycle script.
It will lock the time at 1 pm.
compile the script as STimeCycle.lur and replace it in your Scripts.img.

Code: [Select]
main = function()
  repeat
    Wait(1000)
  until not Alive
end
 
F_AttendedClass = function()
  if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
    return
  end
  SetSkippedClass(false)
  PlayerSetPunishmentPoints(0)
end
 
F_MissedClass = function()
  if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
    return
  end
  SetSkippedClass(true)
  StatAddToInt(166)
end
 
F_AttendedCurfew = function()
  if not PedInConversation(gPlayer) and not MissionActive() then
    TextPrintString("You got home in time for curfew", 4)
  end
end
 
F_MissedCurfew = function()
  if not PedInConversation(gPlayer) and not MissionActive() then
    TextPrint("TM_TIRED5", 4, 2)
  end
end
 
F_StartClass = function()
  if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
    return
  end
  F_RingSchoolBell()
  local l_6_0 = PlayerGetPunishmentPoints() + GetSkippingPunishment()
end
 
F_EndClass = function()
  if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
    return
  end
  F_RingSchoolBell()
end
 
F_StartMorning = function()
  F_UpdateTimeCycle()
end
 
F_EndMorning = function()
  F_UpdateTimeCycle()
end
 
F_StartLunch = function()
  if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
    F_UpdateTimeCycle()
    return
  end
  F_UpdateTimeCycle()
end
 
F_EndLunch = function()
  F_UpdateTimeCycle()
  PauseGameClock()
end
 
F_StartAfternoon = function()
  F_UpdateTimeCycle()
  PauseGameClock()
end
 
F_EndAfternoon = function()
  F_UpdateTimeCycle()
  PauseGameClock()
end
 
F_StartEvening = function()
  F_UpdateTimeCycle()
  PauseGameClock()
end
 
F_EndEvening = function()
  F_UpdateTimeCycle()
  PauseGameClock()
end
 
F_StartCurfew_SlightlyTired = function()
  F_UpdateTimeCycle()
  PauseGameClock()
end
 
F_StartCurfew_Tired = function()
  F_UpdateTimeCycle()
  PauseGameClock()
end
 
F_StartCurfew_MoreTired = function()
  F_UpdateTimeCycle()
  PauseGameClock()
end
 
F_StartCurfew_TooTired = function()
  F_UpdateTimeCycle()
  PauseGameClock()
end
 
F_EndCurfew_TooTired = function()
  F_UpdateTimeCycle()
  PauseGameClock()
end
 
F_EndTired = function()
  F_UpdateTimeCycle()
  PauseGameClock()
end
 
F_Nothing = function()
end
 
F_ClassWarning = function()
  if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
    return
  end
  local l_23_0 = math.random(1, 2)
end
 
F_UpdateTimeCycle = function()
  if not IsMissionCompleated("1_B") then
    local l_24_0 = GetCurrentDay(false)
    if l_24_0 < 0 or l_24_0 > 2 then
      SetCurrentDay(0)
    end
  end
  F_UpdateCurfew()
end
 
F_UpdateCurfew = function()
  local l_25_0 = shared.gCurfewRules
  if not l_25_0 then
    l_25_0 = F_CurfewDefaultRules
  end
  l_25_0()
end
 
F_CurfewDefaultRules = function()
  local l_26_0 = ClockGet()
  if l_26_0 >= 23 or l_26_0 < 7 then
    shared.gCurfew = true
  else
    shared.gCurfew = false
  end
end
Title: Re: LUA Time Lock
Post by: deadpoolXYZ on April 23, 2013, 06:27:54 PM
Does STimeCycle.lur make changes to the game?
Because Im sick of starting the arcade machine everytime I start a custom script.
Title: Re: LUA Time Lock
Post by: xbetstyler on April 24, 2013, 04:30:51 AM
You can check this Madman's tutor:

What you will have to do is edit a library script and force that script to load the modified script you made.

One way to do this is to edit the stimecycle.lua which is a library script.

Library scripts are certain scripts that stay loaded all the time in the game.....stimecycle.lua, libplayer.lua, libped.lua, bdorm.lua, main.lua, mainmap.lua and a few others are library scripts.

To add a external script to a library script you need to edit at the beginning of a script and add:

ImportScript("ArcRace1.lua")

That line will add the external script which in this case is the Arcade Machine in the boys dorm.

You will also need to launch the external script which has to be done in key parts of the script. This can be launching the script only once or launch it any number of times and it should work.

To launch a imported script you need to use:

LaunchScript("ArcRace1.lua") This is the arcade machine in the boys dorm as per our example for importing the script.

what you need to do is compile the modified STimecycle.lua to STimeCycle.lur and replace the original file.

Example:

           
Code: [Select]
ImportScript("ArcRace1.lua")

main = function()
  repeat
    Wait(1000)
  until not Alive
end
 
F_AttendedClass = function()
  if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
    return
  end
  SetSkippedClass(false)
  PlayerSetPunishmentPoints(0)
end
 
F_MissedClass = function()
  if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
    return
  end
  SetSkippedClass(true)
  StatAddToInt(166)
end
 
F_AttendedCurfew = function()
  if not PedInConversation(gPlayer) and not MissionActive() then
    TextPrintString("You got home in time for curfew", 4)
  end
end
 
F_MissedCurfew = function()
  if not PedInConversation(gPlayer) and not MissionActive() then
    TextPrint("TM_TIRED5", 4, 2)
  end
end
 
F_StartClass = function()
  if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
    return
  end
  F_RingSchoolBell()
  local l_6_0 = PlayerGetPunishmentPoints() + GetSkippingPunishment()
end
 
F_EndClass = function()
  if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
    return
  end
  F_RingSchoolBell()
end
 
F_StartMorning = function()
  F_UpdateTimeCycle()
  LaunchScript("ArcRace1.lua")
end
 
F_EndMorning = function()
  F_UpdateTimeCycle()
  LaunchScript("ArcRace1.lua")
end
 
F_StartLunch = function()
  if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
    F_UpdateTimeCycle()
    return
  end
  F_UpdateTimeCycle()
  LaunchScript("ArcRace1.lua")
end
 
F_EndLunch = function()
  F_UpdateTimeCycle()
  LaunchScript("ArcRace1.lua")
end
 
F_StartAfternoon = function()
  F_UpdateTimeCycle()
  LaunchScript("ArcRace1.lua")
end
 
F_EndAfternoon = function()
  F_UpdateTimeCycle()
  LaunchScript("ArcRace1.lua")
end
 
F_StartEvening = function()
  F_UpdateTimeCycle()
  LaunchScript("ArcRace1.lua")
end
 
F_EndEvening = function()
  F_UpdateTimeCycle()
  LaunchScript("ArcRace1.lua")
end
 
F_StartCurfew_SlightlyTired = function()
  F_UpdateTimeCycle()
  LaunchScript("ArcRace1.lua")
end
 
F_StartCurfew_Tired = function()
  F_UpdateTimeCycle()
  LaunchScript("ArcRace1.lua")
end
 
F_StartCurfew_MoreTired = function()
  F_UpdateTimeCycle()
  LaunchScript("ArcRace1.lua")
end
 
F_StartCurfew_TooTired = function()
  F_UpdateTimeCycle()
  LaunchScript("ArcRace1.lua")
end
 
F_EndCurfew_TooTired = function()
  F_UpdateTimeCycle()
  LaunchScript("ArcRace1.lua")
end
 
F_EndTired = function()
  F_UpdateTimeCycle()
  LaunchScript("ArcRace1.lua")
end
 
F_Nothing = function()
end
 
F_ClassWarning = function()
  if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
    return
  end
  local l_23_0 = math.random(1, 2)
end
 
F_UpdateTimeCycle = function()
  if not IsMissionCompleated("1_B") then
    local l_24_0 = GetCurrentDay(false)
    if l_24_0 < 0 or l_24_0 > 2 then
      SetCurrentDay(0)
    end
  end
  F_UpdateCurfew()
end
 
F_UpdateCurfew = function()
  local l_25_0 = shared.gCurfewRules
  if not l_25_0 then
    l_25_0 = F_CurfewDefaultRules
  end
  l_25_0()
end
 
F_CurfewDefaultRules = function()
  local l_26_0 = ClockGet()
  if l_26_0 >= 23 or l_26_0 < 7 then
    shared.gCurfew = true
  else
    shared.gCurfew = false
  end
end