News: Welcome back to Bullworth! If you haven't already, you will need to reset your password..


Author Topic: *RELEASE* - Bully LUA Script Sources (just a few)  (Read 74124 times)

0 Members and 2 Guests are viewing this topic.

Offline MadmaN

  • Bully-Board Admin Team
  • Newbie
  • *
  • Posts: 0
  • Gender: Male
  • Biblio-Techa Mods (retired)
    • View Profile
*RELEASE* - Bully LUA Script Sources (just a few)
« on: December 25, 2012, 09:04:14 PM »
Here are some Bully LUA Script Sources to play around with.

You will need a proper IDE for editing these files if you want to use color coding to make the code easier to read. Notepad++ is one that I highly recommend since it has support for lua.

I have some lua code plugins for notepad++ that I can upload here as well to this topic.


NOTE:
This is NOT a complete release of every script in Bully. Bully has over 500 total lua scripts and I only have maybe about half in usable form. I am for now just releasing a small handful of intact rewritten script sources for people to play around with. I also will release a mod source for one of my mods that is fully commented so people basicly will know what various parts of code does.



TestAlly.lua - This is a test script that is part of the debug menu system. This just spawns a single ped and recruits them as your bodyguard.

Code: [Select]
ImportScript("\\Library\\LibTable.lua") -- imports the LibTable library
ImportScript("\\Library\\LibPed.lua") -- imports the LibPed library
local l_0_0 = false
 
MissionSetup = function() -- basic mission setup function which is used in almost all bully scripts
  local l_1_0 = 270 -- X coords
  local l_1_1 = -110 -- Y coords
  local l_1_2 = 6.4000000953674 -- Z coords
  PlayerSetHealth(200) -- gives the player 200 health
  AreaTransitionXYZ(0, l_1_0, l_1_1, l_1_2) -- teleports the player to the sidewalk outside the boys dorm
  local l_1_3 = 25 -- Lola (this is her model id number)
  local l_1_4, l_1_5, l_1_6 = PedGetPosXYZ(gPlayer) -- gets coordinates of the player on the map
  local l_1_7 = PedCreateXYZ(l_1_3, l_1_4 + 1, l_1_5 + 1, l_1_6) -- create a ped (Lola) and spawn them near the player
  PedRecruitAlly(gPlayer, l_1_7, true) -- recruits the spawned ped as a bodyguard (local l_1_7 is assigned to model id 25 which is Lola)
  PedMakeAmbient(l_1_7) -- makes the spawned ped ambient
end
 
MissionCleanup = function() -- mission cleanup function
end -- end statement
 
main = function() -- Main mission function
  repeat -- This makes the script run until the bodyguard is dismissed, attacked by the player or the player is busted
    Wait(0) -- wait 0 seconds
  until l_0_0 ~= false
  Wait(3000) -- wait 3 seconds
  MissionSucceed() -- ends mission
end
 




1_01.lua

Code: [Select]
ImportScript("Library/LibTable.lua")
ImportScript("Library/LibTrigger.lua")
ImportScript("Library/LibSchool.lua")
local l_0_0 = false
local l_0_1 = 0
local l_0_2 = false
local l_0_3 = nil
local l_0_4 = false
local l_0_5 = false
local l_0_6, l_0_7 = nil, nil
local l_0_8 = false
local l_0_9 = false
local l_0_10 = false
local l_0_11, l_0_12, l_0_13 = nil, nil, nil
local l_0_14 = 0
local l_0_15 = 0
local l_0_16, l_0_17 = nil, nil
local l_0_18 = {}
local l_0_19 = nil
local l_0_20 = 1
local l_0_21 = 1
local l_0_22 = false
local l_0_23 = 0
local l_0_24 = 0
local l_0_25 = false
local l_0_26 = true
local l_0_27 = false
local l_0_28 = {}
local l_0_29 = false
local l_0_30 = false
local l_0_31 = false
local l_0_32 = false
local l_0_33 = false
local l_0_34 = 0
local l_0_35 = false
local l_0_36, l_0_37 = nil, nil
local l_0_38 = false
local l_0_39 = false
local l_0_40 = 0
local l_0_41 = 0
local l_0_42 = 0
local l_0_43 = 0
local l_0_44 = 0
local l_0_45 = 0
local l_0_46 = 0
local l_0_47 = 0
local l_0_48 = 0
local l_0_49 = 0
local l_0_50 = 0
local l_0_51 = 0
local l_0_52 = 0
local l_0_53 = 0
local l_0_54 = 0
local l_0_55 = 0
local l_0_56 = 0
local l_0_57 = 0
local l_0_58 = false
 
F_CheckInitialPOI = function(l_1_0)
  local l_1_1, l_1_2, l_1_3 = AreaPOIGetPosition(l_1_0)
  if DistanceBetweenCoords3d(l_1_1, l_1_2, l_1_3, 274.30499267578, -70.682403564453, 5.9864101409912) < 5 then
    if not l_0_10 then
      l_0_10 = true
      return true
    else
      return false
    end
  end
end
 
MissionSetup = function()
  DATLoad("1_01.DAT", 2)
  DATInit()
  LoadActionTree("Act/Conv/1_01.act")
  LoadActionTree("Act/Conv/1_02.act")
  MissionDontFadeIn()
  SoundEnableInteractiveMusic(true)
  ClockSet(8, 30)
  shared.lockClothingManager = true
  if GetMissionAttemptCount("1_01") > 1 then
    MissionSurpressMissionNameText()
    l_0_0 = true
  end
  if not l_0_0 then
    shared.gOverrideSchoolGates = false
    shared.gFrontGateOpen = false
    Wait(10)
    PAnimCreate(TRIGGER._TSCHOOL_FRONTGATE)
    AreaSetDoorOpen(TRIGGER._TSCHOOL_FRONTGATE, true)
    PAnimSetActionNode(TRIGGER._TSCHOOL_FRONTGATE, "/Global/1_01/Gates/BarUpHold", "Act/Conv/1_01.act")
    PlayCutsceneWithLoad("1-1-1", true, true, true)
    PAnimDelete(TRIGGER._TSCHOOL_FRONTGATE)
    GeometryInstance("ScGate01Closed", false, 301.43899536133, -72.505897521973, 8.0465698242188, true)
    GeometryInstance("ScGate02Closed", false, 225.92799377441, 5.7981600761414, 8.3947095870972, true)
  else
    CameraSetWidescreen(false)
  end
    local l_5_0 = -9.9879999160767
    local l_5_1 = 21.420000076294
    local l_5_2 = 30.059999465942
    AreaTransitionXYZ(22, l_5_0, l_5_1, l_5_2)
    PlayerFaceHeading(270, 1)

end
 

 
MissionCleanup = function()
  ToggleHUDComponentVisibility(21, false)
  if shared.gSecretaryID ~= nil and PedIsValid(shared.gSecretaryID) then
    PedDelete(shared.gSecretaryID)
    shared.gSecretaryID = nil
  end
  ClearTextQueue()
  EnablePOI()
  gMissionRunning = false
  shared.gMissionEventFunction = nil
  if l_0_3 then
    BlipRemove(l_0_3)
  end
  PedSetUniqueModelStatus(102, l_0_40)
  PedSetUniqueModelStatus(99, l_0_41)
  PedSetUniqueModelStatus(85, l_0_42)
  PedSetUniqueModelStatus(145, l_0_43)
  PedSetUniqueModelStatus(146, l_0_44)
  PedSetUniqueModelStatus(75, l_0_45)
  PedSetUniqueModelStatus(50, l_0_46)
  PedSetUniqueModelStatus(59, l_0_47)
  PedSetUniqueModelStatus(69, l_0_48)
  PedSetUniqueModelStatus(139, l_0_49)
  PedSetUniqueModelStatus(72, l_0_50)
  PedSetUniqueModelStatus(73, l_0_51)
  PedSetUniqueModelStatus(24, l_0_52)
  PedSetUniqueModelStatus(26, l_0_53)
  PedSetUniqueModelStatus(34, l_0_54)
  PedSetUniqueModelStatus(32, l_0_55)
  PedSetUniqueModelStatus(16, l_0_56)
  PedSetUniqueModelStatus(12, l_0_57)
  UnLoadAnimationGroup("Hang_Talking")
  UnLoadAnimationGroup("NPC_AggroTaunt")
  UnLoadAnimationGroup("Area_School")
  UnLoadAnimationGroup("SBULL_A")
  UnLoadAnimationGroup("POI_Smoking")
  UnLoadAnimationGroup("B_Striker")
  UnLoadAnimationGroup("NPC_Adult")
  PlayerSetInvulnerable(false)
  WeatherRelease()
  TutorialRemoveMessage()
  AreaRevertToDefaultPopulation()
  PlayerSetControl(1)
  DATUnload(2)
  PlayerSetPunishmentPoints(0)
end
 
CB_RenderObj = function()
  misObj = MissionObjectiveAdd("1_01_StandGround")
end
 

 
main = function()
  --gEunice = PedCreatePoint(74, POINTLIST._PRINCIPALROOM, 2)
  --PedSetPosPoint(gEunice, POINTLIST._1_02_EUNICE, 1)


  CameraFade(500, 0)
  SoundPreloadSpeech(gPlayer, "NARRATION", 101, "supersize", true)
  CameraSetWidescreen(true)
  CameraReset()
  Wait(50)
  repeat
    Wait(0)
  until SoundIsSpeechPreloaded()
  Wait(10)
  CameraFade(500, 1)
  Wait(501)
  SoundPlayPreloadedSpeech()
  repeat
    Wait(0)
  until not SoundSpeechPlaying(gPlayer, "NARRATION", 101)
 -- TextPrintString("You win!", 4, 1)
  Wait(15000)
  MissionSucceed(true, false, false)
  PedSetActionNode(gPlayer, "/Global/Player", "Act/Player.act")
end
 
F_CreatePeds = function()
  Prefect1 = PedCreatePoint(13, POINTLIST._PUNISHTEST_P1)
  Wait(5000)
  PedFollowPath(Prefect1, PATH._PUNISHTEST_PATH2, 0, 1, F_CallBack)
  CreateThread("F_HitCheck")
end
 
F_CallBack = function(l_6_0, l_6_1, l_6_2)
  if l_6_2 == 2 then
    PedAttack(l_6_0, gPlayer)
  end
end




6_01.lua

Code: [Select]
local l_0_0 = false
local l_0_1 = nil
local l_0_3 = 0
local l_0_4 = nil
local l_0_5 = false
local l_0_6 = false
 
MissionSetup = function()
  DATLoad("6_01.DAT", 2)
  DATLoad("3_08.DAT", 2)
  MissionSurpressMissionNameText()
  MissionDontFadeIn()
end
 
main = function()
  PlayCutsceneWithLoad("6-0", true, true)
  if ClothingGetPlayer(1) == ObjectNameToHashID("S_Sweater5") then
    ClothingSetPlayer(1, "B_Jacket6")
  end
  if ClothingGetPlayer(4) == ObjectNameToHashID("S_Pants1") then
    ClothingSetPlayer(4, "B_Pants2")
  end
  ClothingBuildPlayer()
  AreaTransitionPoint(14, POINTLIST._6_01_BDORM, 1, false)
  CameraReset()
  CameraReturnToPlayer()
  CameraFade(500, 1)
  Wait(501)
  TextPrint("6_01_EXPELLED", 4, 1)
  shared.gPlayerInitialArea = nil
  MissionSucceed(false, false, false)
end
 
MissionCleanup = function()
  if l_0_0 then
    PlayerSetScriptSavedData(3, PlayerGetNumTimesBusted())
    PlayerSetScriptSavedData(14, 0)
  end
  UnpauseGameClock()
  CameraSetWidescreen(false)
  DATUnload(2)
end
 
F_PlayerGetOutOfBed = function()
  if l_0_4 then
    return 1
  end
  return 0
end





Bike_Gen.lua - This is a library script ran by other scripts that spawns random bikes on the bully world map.

Code: [Select]
F_VehicleGen = function()
  VehicleCreateCarGenerator(513.21002197266, -152.52000427246, 5.2109999656677, 15, 282, -1, -1, false, 0, 0, 1500, 45000, true)
  VehicleCreateCarGenerator(599.25, -12.78600025177, 6.3959999084473, 90, 274, -1, -1, false, 0, 0, 1500, 45000, true)
  VehicleCreateCarGenerator(518.20001220703, -32.770000457764, 6.2399997711182, 190, 279, -1, -1, false, 0, 0, 1500, 45000, true)
  VehicleCreateCarGenerator(485.29998779297, -79.319999694824, 5.4000000953674, 180, 274, -1, -1, false, 0, 0, 1500, 45000, true)
  VehicleCreateCarGenerator(552.15002441406, -367.70001220703, 2.2349998950958, 140, 279, -1, -1, false, 0, 0, 1500, 45000, true)
  VehicleCreateCarGenerator(522.72497558594, -487.27499389648, 4.3070001602173, 340, 282, -1, -1, false, 0, 0, 1500, 45000, true)
  VehicleCreateCarGenerator(238.06100463867, -439.70001220703, 2.6329998970032, 20, 281, -1, -1, false, 0, 0, 1500, 45000, true)
  VehicleCreateCarGenerator(223.51300048828, -303.35000610352, 5.4650001525879, 180, 274, -1, -1, false, 0, 0, 1500, 45000, true)
  VehicleCreateCarGenerator(129.80000305176, -407.79699707031, 2.6289999485016, 275, 279, -1, -1, false, 0, 0, 1500, 45000, true)
  VehicleCreateCarGenerator(118.05000305176, -517.75, 3.319000005722, 30, 274, -1, -1, false, 0, 0, 1500, 45000, true)
  VehicleCreateCarGenerator(12.75, -448.54998779297, 0.43200001120567, 225, 279, -1, -1, false, 0, 0, 1500, 45000, true)
  VehicleCreateCarGenerator(219.0299987793, 424.41598510742, 4.8899998664856, 235, 274, -1, -1, false, 0, 0, 1500, 45000, true)
  VehicleCreateCarGenerator(139.94999694824, 424.36999511719, 8.0349998474121, 342, 282, -1, -1, false, 0, 0, 1500, 45000, true)
  VehicleCreateCarGenerator(276.04998779297, 207.31799316406, 6.1680002212524, 270, 279, -1, -1, false, 0, 0, 1500, 45000, true)
  VehicleCreateCarGenerator(349.20001220703, 124.88800048828, 5.375, 90, 282, -1, -1, false, 0, 0, 1500, 45000, true)
  VehicleCreateCarGenerator(396.75, 148.60400390625, 5.2069997787476, 90, 274, -1, -1, false, 0, 0, 1500, 45000, true)
  VehicleCreateCarGenerator(401.31100463867, 189.78999328613, 6.6490001678467, 0, 274, -1, -1, false, 0, 0, 1500, 45000, true)
  VehicleCreateCarGenerator(387.93301391602, 393.29000854492, 21.471000671387, 0, 280, -1, -1, false, 0, 0, 1500, 45000, true)
  VehicleCreateCarGenerator(482.10000610352, 430.21600341797, 18.05299949646, 90, 279, -1, -1, false, 0, 0, 1500, 45000, true)
  VehicleCreateCarGenerator(603.45001220703, 393.61599731445, 16.471000671387, 90, 282, -1, -1, false, 0, 0, 1500, 45000, true)
  VehicleCreateCarGenerator(547.82000732422, 247.16700744629, 16.893999099731, 90, 274, -1, -1, false, 0, 0, 1500, 45000, true)
  VehicleCreateCarGenerator(332.13000488281, 270.67001342773, 5.9499998092651, 90, 282, -1, -1, false, 0, 0, 1500, 45000, true)
  VehicleCreateCarGenerator(445.29998779297, 236.5, 9.6999998092651, 90, 282, -1, -1, true, 0, 0, 1500, 45000, true)
  VehicleCreateCarGenerator(498.17001342773, -18.719999313354, 7.25, 0, 293, -1, -1, false, 0, 0, 1500, 45000, true)
  VehicleCreateCarGenerator(588.90002441406, -139, 6.9800000190735, 0, 297, -1, -1, false, 0, 0, 1500, 45000, true)
  VehicleCreateCarGenerator(467.9700012207, -204.32000732422, 4.1900000572205, -15, 286, -1, -1, false, 0, 0, 1500, 45000, true)
  VehicleCreateCarGenerator(548.57000732422, -455.08999633789, 5.4000000953674, -15, 296, -1, -1, false, 0, 0, 1500, 45000, true)
  VehicleCreateCarGenerator(487.19000244141, -384.2200012207, 3.3299999237061, 75, 294, -1, -1, false, 0, 0, 1500, 45000, true)
  VehicleCreateCarGenerator(429.67001342773, 163.66999816895, 7.1500000953674, 90, 297, -1, -1, false, 0, 0, 1500, 45000, true)
  VehicleCreateCarGenerator(317.55999755859, 401.48999023438, 25.729999542236, -30, 292, -1, -1, false, 0, 0, 1500, 45000, true)
  VehicleCreateCarGenerator(434.39999389648, 486.23999023438, 24.340000152588, 0, 286, -1, -1, false, 0, 0, 1500, 45000, true)
  VehicleCreateCarGenerator(576.25, 457.2200012207, 19.520000457764, 0, 293, -1, -1, false, 0, 0, 1500, 45000, true)
  VehicleCreateCarGenerator(310.79998779297, -328.48999023438, 3.5899999141693, 0, 294, -1, -1, false, 0, 0, 1500, 45000, true)
  VehicleCreateCarGenerator(161.33000183105, -375.48999023438, 3.9900000095367, 100, 291, -1, -1, false, 0, 0, 1500, 45000, true)
  VehicleCreateCarGenerator(60.419998168945, -462.30999755859, 5.9699997901917, 135, 291, -1, -1, false, 0, 0, 1500, 45000, true)
end
 
F_VehicleGen()
F_VehicleGen = nil




SCloth.lua - Library script that controls the clothing outfits

Code: [Select]

scloth = function()
  local l_1_0 = true
  local l_1_1 = false
  local l_1_2 = true
  local l_1_3 = false
  --                   FriendlyName                        Head             Torso             LeftWrist        RightWrist       Legs              Feet
  ClothingDefineOutfit("Underwear",     "CLT_Undies",     "Hair",           "P_SSleeves11",   "none",          "none",          "SP_Briefs",      "SP_Socks",        l_1_3, l_1_1)
  ClothingDefineOutfit("Starting",      "CLT_Start",      "Hair",           "B_Jacket6",      "none",          "none",          "B_Pants2",       "P_Sneakers2",     l_1_2, l_1_1)
  ClothingDefineOutfit("Uniform",       "CLT_Uniform",    "Hair",           "S_Sweater5",     "none",          "none",          "S_Pants1",       "P_Sneakers2",     l_1_3, l_1_1)
  ClothingDefineOutfit("Boxing",        "CLT_BOX_OUTFIT", "Hair",           "SP_BOXING_T",    "SP_Boxing_G_L", "SP_Boxing_G_R", "SP_BOXING_L",    "SP_BOXING_ft",    l_1_3, l_1_0)
  ClothingDefineOutfit("Boxing NG",     "CLT_BOX_NG",     "Hair",           "SP_BOXING_T",    "none",          "none",          "SP_BOXING_L",    "SP_BOXING_ft",    l_1_3, l_1_0)
  ClothingDefineOutfit("Wrestling",     "CLT_WRS_OUTFIT", "SP_Wrestling_H", "SP_Wrestling_T", "none",          "none",          "SP_Wrestling_L", "SP_Wrestling_ft", l_1_3, l_1_0)
  ClothingDefineOutfit("Mascot",        "CLT_MASCOT",     "SP_Mascot_H",    "none",           "none",          "none",          "none",           "SP_Mascot_B",     l_1_2, l_1_0)
  ClothingDefineOutfit("MascotNoHead",  "CLT_MASCOT",     "Hair",           "none",           "none",          "none",          "none",           "SP_Mascot_B",     l_1_2, l_1_0)
  ClothingDefineOutfit("Orderly",       "CLT_OLY_OUTFIT", "Hair",           "SP_Orderly_T",   "none",          "none",          "SP_Orderly_P",   "SP_Orderly_B",    l_1_2, l_1_0)
  ClothingDefineOutfit("Halloween",     "CLT_HALLOW",     "SP_Ween_H",      "SP_Ween_T",      "none",          "none",          "SP_Ween_L",      "B_Boots1",        l_1_2, l_1_1)
  ClothingDefineOutfit("PJ",            "CLT_PJ",         "Hair",           "SP_PJ_T",        "none",          "none",          "SP_PJ_L",        "SP_Socks",        l_1_3, l_1_1)
  ClothingDefineOutfit("Prison",        "CLT_Prison",     "Hair",           "SP_Prison_T",    "none",          "none",          "SP_Prison_L",    "P_Boots2",        l_1_3, l_1_0)
  ClothingDefineOutfit("Grotto Master", "CLT_DM",         "SP_DM_H",        "SP_DM_T",        "none",          "none",          "B_Pants2",       "P_Boots2",        l_1_3, l_1_1)
  ClothingDefineOutfit("Gnome",         "CLT_Gnome",      "SP_Gnome_H",     "SP_Gnome_T",     "none",          "none",          "SP_Gnome_L",     "SP_Gnome_ft",     l_1_2, l_1_0)
  ClothingDefineOutfit("Fast Food",     "CLT_Fastfood",   "SP_Fries_H",     "SP_Fries_T",     "none",          "none",          "SP_Fries_L",     "P_Boots2",        l_1_2, l_1_1)
  ClothingDefineOutfit("Gold Suit",     "CLT_Rocker",     "SP_Goldsuit_H",  "SP_Goldsuit_T",  "none",          "none",          "SP_Goldsuit_L",  "SP_Goldsuit_ft",  l_1_2, l_1_0)
  ClothingDefineOutfit("BMX Champion",  "CLT_BMX",        "SP_BikeHelmet",  "SP_BikeJersey",  "none",          "none",          "B_Pants2",       "P_Boots2",        l_1_2, l_1_1)
  ClothingDefineOutfit("Gym Strip",     "CLT_gym",        "Hair",           "S_SSleeves4",    "S_Wristband4",  "S_Wristband3",  "S_Shorts1",      "P_Sneakers1",     l_1_3, l_1_1)
  ClothingDefineOutfit("Ninja_BLK",     "CLT_NinjaBLK",   "SP_Ninja_H",     "SP_Ninja_T",     "none",          "none",          "SP_Ninja_L",     "SP_Ninja_Ft",     l_1_2, l_1_1)
  ClothingDefineOutfit("Ninja_WHT",     "CLT_NinjaWHT",   "SP_NinjaW_H",    "SP_NinjaW_T",    "none",          "none",          "SP_NinjaW_L",    "SP_NinjaW_Ft",    l_1_2, l_1_1)
  ClothingDefineOutfit("Ninja_RED",     "CLT_NinjaRED",   "SP_NinjaR_H",    "SP_NinjaR_T",    "none",          "none",          "SP_NinjaR_L",    "SP_NinjaR_Ft",    l_1_2, l_1_1)
  ClothingDefineOutfit("Columbus",      "CLT_Columbus",   "SP_Colum_H",     "SP_Colum_T",     "none",          "none",          "SP_Colum_L",     "SP_Colum_FT",     l_1_2, l_1_0)
  ClothingDefineOutfit("Nutcracker",    "CLT_Nutcracker", "SP_Nutcrack_H",  "SP_Nutcrack_T",  "none",          "none",          "SP_Nutcrack_L",  "SP_Nutcrack_FT",  l_1_2, l_1_0)
  ClothingDefineOutfit("Elf",           "CLT_Elf",        "SP_Elf_H",       "SP_Elf_T",       "none",          "none",          "SP_Elf_L",       "SP_Elf_FT",       l_1_2, l_1_0)
  ClothingDefineOutfit("Marching Band", "CLT_MBand",      "SP_MBand_H",     "SP_MBand_T",     "none",          "none",          "SP_MBand_L",     "SP_MBand_FT",     l_1_2, l_1_0)
  ClothingDefineOutfit("Nascar",        "CLT_Nascar",     "SP_Nascar_H",    "SP_Nascar_T",    "none",          "none",          "SP_Nascar_L",    "SP_Nascar_FT",    l_1_2, l_1_0)
  ClothingDefineOutfit("80 Rocker",     "CLT_80Rocker",   "SP_80Rocker_H",  "SP_80Rocker_T",  "none",          "SP_80Bracer",   "SP_80Rocker_L",  "SP_80Rocker_FT",  l_1_3, l_1_0)
  ClothingDefineOutfit("Panda",         "CLT_Panda",      "SP_Panda_H",     "none",           "none",          "none",          "none",           "SP_Panda_B",      l_1_2, l_1_0)
  ClothingDefineOutfit("Alien",         "CLT_Alien",      "SP_Alien_H",     "SP_Alien_T",     "none",          "none",          "SP_Alien_L",     "P_Boots4",        l_1_2, l_1_1)
  ClothingDefineOutfit("NerdJimmy",     "CLT_Nerd",       "SP_Nerd_H",      "SP_Nerd_T",      "none",          "SP_NerdWatch",  "SP_Nerd_L",      "SP_Nerd_FT",      l_1_3, l_1_0)
end
 
scloth()
scloth = nil





STimeCycle.lua - This is the timecycle script. This controls whether Jimmy passes out after curfew...etc and so on. Passing out CAN be disabled by correctly editing this script.

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()
end
 
F_StartAfternoon = function()
  F_UpdateTimeCycle()
end
 
F_EndAfternoon = function()
  F_UpdateTimeCycle()
end
 
F_StartEvening = function()
  F_UpdateTimeCycle()
end
 
F_EndEvening = function()
  F_UpdateTimeCycle()
end
 
F_StartCurfew_SlightlyTired = function()
  F_UpdateTimeCycle()
end
 
F_StartCurfew_Tired = function()
  F_UpdateTimeCycle()
end
 
F_StartCurfew_MoreTired = function()
  F_UpdateTimeCycle()
end
 
F_StartCurfew_TooTired = function()
  F_UpdateTimeCycle()
end
 
F_EndCurfew_TooTired = function()
  F_UpdateTimeCycle()
end
 
F_EndTired = function()
  F_UpdateTimeCycle()
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


This should be enough script sources to get people started with learning lua and trying out their own bully mods. Any questions should be posted in this forum section and Red or I will try to answer them as best as we can. We will not respond to requests in this section. Requests need to go to the requests forum section where they belong and IF one of us or another modder has the time to make a requested mod....we will do so.

I will hold off on posting more script sources until I see where this goes since this is quite a large step for most of the community to attempt at this time....but this is the revolution of bully modding since now all hex editing should be stopped and people should give it a try to learn some lua modding instead. Everything that can be done via hex editing can be done via lua as well and is pretty easy to pull off for most things. Some things are a bit harder to do but I will do what I can to help everyone new to lua understand how things work with this new form of bully modding.


NOTES:

To COMPILE a script just open a windows command prompt window and type luac -o ArcRace1.lur scriptname.lua and just replace scriptname.lua with the script you want to try out. This will compile the script and name it ArcRace1.lur which is the script for the boys dorm arcade machine. Scripts like 1_01.lua need to be named the same as their compiled versions are (1_01.lur in this case) or any script with lib in the name.

I can explain more about this as needed.

For now....I hope everyone has had a great xmas and enjoy this gift since it has been a very long time coming.
« Last Edit: December 26, 2012, 03:08:11 PM by |XF|-MadmaN[AR] »

Offline Walter20210

  • Hero Member
  • ****
  • Posts: 1,102
  • Gender: Male
  • I keep loving the old things :P
    • View Profile
    • YouTube Account
Re: *RELEASE* - Bully LUA Script Sources (just a few)
« Reply #1 on: December 25, 2012, 10:56:10 PM »
Cool :P
(I gonna test this tomorrow)

Offline MadmaN

  • Bully-Board Admin Team
  • Newbie
  • *
  • Posts: 0
  • Gender: Male
  • Biblio-Techa Mods (retired)
    • View Profile
Re: *RELEASE* - Bully LUA Script Sources (just a few)
« Reply #2 on: December 25, 2012, 11:10:43 PM »
Don't forget...

You also need to make sure you have extracted your scripts.img to a folder that you can work from....backup your existing scripts.img and scripts.dir files for safekeeping incase you mess up and trust me....you will make mistakes with lua....and when you make scripts...you need to make a new scripts.img and scripts.dir file with the new modded script files in it or else bully will not see any changes you made.

I am releasing in a few days a special tool I made that will build brand new .img files  as well as build a new world.img file too which cannot easily be done with any tool out so far....its easier this way.

I will outline a proper tutorial for this in a day or two.

Offline c00ld0c26

  • The D0c
  • Can't Get Enough
  • *****
  • Posts: 5,137
  • Gender: Male
  • Just a dood doing dood things.
    • View Profile
    • My channel.
Re: *RELEASE* - Bully LUA Script Sources (just a few)
« Reply #3 on: December 26, 2012, 12:36:55 AM »
Ive been waiting for this for loooooooooooooooooooooooooong time. Awesome work Mad :D
Just 1 question...  I dont know how to script lua. where should I learn how? is there a tutorial?

Offline MadmaN

  • Bully-Board Admin Team
  • Newbie
  • *
  • Posts: 0
  • Gender: Male
  • Biblio-Techa Mods (retired)
    • View Profile
Re: *RELEASE* - Bully LUA Script Sources (just a few)
« Reply #4 on: December 26, 2012, 12:40:24 AM »
Start off with this: http://www.bully-board.com/index.php?action=downloads;sa=view;down=58

I made the first issue of the modding magazine specifically for this.  :biggrin:

Offline Al Arlington

  • 101A
  • Hero Member
  • ****
  • Posts: 3,179
  • Gender: Male
  • Money Handler
    • View Profile
    • My Official Youtube Channel
Re: *RELEASE* - Bully LUA Script Sources (just a few)
« Reply #5 on: December 26, 2012, 06:54:34 AM »
The script layout seems similar to GTA SA's. ._.



Offline SWEGTA

  • Da Forum Luffs Me!
  • *****
  • Posts: 6,422
  • Gender: Male
  • Swee Gee Tee Ayy
    • View Profile
    • Bully & GTA videos
Re: *RELEASE* - Bully LUA Script Sources (just a few)
« Reply #6 on: December 26, 2012, 07:43:45 AM »
CMD just says that luac -o ArcRace1.lur scriptname.lua is not a command :/

Offline Red Blaster

  • The BB Arab
  • More Than Halfway There
  • *****
  • Posts: 5,649
  • Gender: Male
  • Hi
    • View Profile
Re: *RELEASE* - Bully LUA Script Sources (just a few)
« Reply #7 on: December 26, 2012, 08:12:33 AM »
The file has to be in the same folder as the lua compiler, and in CMD, you have to be in the file folder for the command to work.

Not just that, you need VS 2008.
« Last Edit: December 26, 2012, 10:05:23 AM by Doctor Red »

deadpoolXYZ

  • Guest
Re: *RELEASE* - Bully LUA Script Sources (just a few)
« Reply #8 on: December 26, 2012, 08:25:13 AM »
The file has to be in the same folder as the lua compiler, and in CMD, you have to be in the file folder for the command to work.

Not just that, you need VS 2008.

I did that but it just says that the system can't execute the specified program. I have visual studio 2010, so I didn't execute the visual studio 2008.
« Last Edit: December 26, 2012, 10:05:52 AM by Doctor Red »

Offline Red Blaster

  • The BB Arab
  • More Than Halfway There
  • *****
  • Posts: 5,649
  • Gender: Male
  • Hi
    • View Profile
Re: *RELEASE* - Bully LUA Script Sources (just a few)
« Reply #9 on: December 26, 2012, 10:06:16 AM »
Won't work. It's strictly coded for VS 2008.

E32050TRA

  • Guest
Re: *RELEASE* - Bully LUA Script Sources (just a few)
« Reply #10 on: December 26, 2012, 11:05:45 AM »
I do not get lua all that much. How do i install the decompiler for lua? I already know how to do some stuff with lua. I just can't install it, and how to decompile scripts. Can anyone please help me please.

Offline Al Arlington

  • 101A
  • Hero Member
  • ****
  • Posts: 3,179
  • Gender: Male
  • Money Handler
    • View Profile
    • My Official Youtube Channel
Re: *RELEASE* - Bully LUA Script Sources (just a few)
« Reply #11 on: December 26, 2012, 11:36:39 AM »
Won't work. It's strictly coded for VS 2008.
So does that mean the PS2 script requires a earlier version of VS?

Offline Red Blaster

  • The BB Arab
  • More Than Halfway There
  • *****
  • Posts: 5,649
  • Gender: Male
  • Hi
    • View Profile
Re: *RELEASE* - Bully LUA Script Sources (just a few)
« Reply #12 on: December 26, 2012, 11:52:17 AM »
No. It's just that the compiler is strictly coded to be used with VS 2008.

I do not get lua all that much. How do i install the decompiler for lua? I already know how to do some stuff with lua. I just can't install it, and how to decompile scripts. Can anyone please help me please.

Make a folder, and place luac in it. Then install VS 2008. Then that's that. Follow the readme and the magazine.

deadpoolXYZ

  • Guest
Re: *RELEASE* - Bully LUA Script Sources (just a few)
« Reply #13 on: December 26, 2012, 12:12:06 PM »
I installed VS 2008 but the problem is still there. Honestly, I didn't expect it to work in my first try.  :wacko:




Offline Red Blaster

  • The BB Arab
  • More Than Halfway There
  • *****
  • Posts: 5,649
  • Gender: Male
  • Hi
    • View Profile
Re: *RELEASE* - Bully LUA Script Sources (just a few)
« Reply #14 on: December 26, 2012, 12:56:30 PM »
I suspect it's a missing .dll file...but with that said, are you opening the VS 2008 command line? Also, is luac in the Administrador folder? Is the file you want to compile also in there?

Don't worry, it's not like it worked right off the bat for me either.
« Last Edit: December 26, 2012, 01:01:15 PM by Doctor Red »