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


Author Topic: D0c's Bully LUA wiki  (Read 57573 times)

0 Members and 1 Guest are viewing this topic.

Offline c00ld0c26

  • The D0c
  • Can't Get Enough
  • *****
  • Posts: 5,137
  • Gender: Male
  • Just a dood doing dood things.
    • View Profile
    • My channel.
D0c's Bully LUA wiki
« on: June 16, 2013, 06:17:13 AM »
Introduction :

Hello there, I am c00ld0c26, a 15 years old modder. Ive been working with lua and I learned that you can do much with it, Even though its limited. Here I will post all the tutorials, commands and video tutorials I will make. This is specialy for lua, I hope it will help you guys to learn lua.

Table of Content :

(1)Introduction
(2)Table of Content
(3)Notes
(4)What Do you need
(5)Basic lua Orginaztion
(6)Basic Commands
(7)Compiling Scripts
(8)Errors
(9)Advanced Commands (Lua Rules)
(10)Creating a mission
(11) Action nodes
(12)Functions
(13)Tables
(14) Thank to...

Notes

I am NOT a lua expert (Atlist not yet). I dont know every single thing in lua.
Make sure to put Captial letters exactly where I put them in the lua commands. It is importent.
Please fix me if there is anything that I am wrong at.
I am doing this to make lua scripting easier to learn for beginners.
Feel free to post and ask everything you need.

What Do You Need

(Thanks to SWEGTA and Madman for the downloads)

NotePad++
Download : http://notepad-plus-plus.org/download/v6.2.3.html
It is extreamly importent that you download this. Since it supports lua. I highly Suggest you download it and use it!

Lua Compiler (Luac)
Download : http://www.bully-board.com/index.php?action=downloads;sa=view;down=60
Use this to compile your script to make it playable for bully. You must have it or you wont be able to play your scripts.

Visual Studio 2008
Download: http://download.microsoft.com/download/d/c/3/dc3439e7-5533-4f4c-9ba0-8577685b6e7e/vcsetup.exe
You must Install this in order to use Luac.

IMGTOOL
Download : http://grandtheftauto.filefront.com/file/IMG_Tool;44920
This is a really importent tool. Use it to put your scripts in the game.

Basic Lua Orginization

Before trying to make a lua mod, you must know how lua is orginaized.
So lets get started with this example(Thanks for SWEGTA for the lua script Example) :
 
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)
 
end
 
MissionCleanup = function()
end -- end statement
 
main = function() -- Main mission function
  repeat
    Wait(0)
  until l_0_0 ~= false
  Wait(3000)
  MissionSucceed()
end
So what is what? Where to place? Here we go :

Before you start, make sure to change the language to lua. You can choose a language at the top of the noteped++ . Just go to L => Lua.

Local - It remembers things. For example : local l_1_0 = 270
when you will write a teleport command, and put l_1_0 as the X point. It will use the X coords after the =

MissionSetup = Function() - Here you write all the commands you want that the mission will start with on setup.

MissionCleanup = function() - Here you write codes that you want them to happen after you finish a mission and the script is over.

main = function() - This is the main part of the script. This is the place where you add new functions, which will happen by the order you code them. The only way to make it loop (do the same over and over) is to put the repeat function.

End - The command the closes everything up. You must put it one line under the last line of every function you make (main = function() for example), or Lua Rules.
Without putting those end's in the right places, the lua compiler will refuse to compile the script, you MUST put end's.


-- - This is a special command for notes. For example if I do a command like :
PedCreateXYZ(33, l_1_0, l_1_1, l_1_2) --Spawns Bif
It will ignore what I write after the -- and will consider it as a note for the author of the script.

Basic Lua Commands

AreaTransitionXYZ(0, l_1_0, l_1_1, l_1_2) -
This command will teleport the player to the saved coords. You can put the locals in there (the l_1_0 stuff) or write the actuall coords inside it. Keep in mind that the Z coord is the hight of where the player will spawn, do not ignore it, replace it to, or you may be teleported underground or on a high place.
The 0 at the start is the Area code. Area codes are used to teleport the player to interors, if you wont put the area code of the interor you want him to spawn which is found inside the Trigger.img then the game will most likely crash


TextPrintString("Text Here", 4, 1) -
This command will show a red text on the screen. You can change the Text in the "Text Here" place. Make sure to keep the " " or the command will not work.

PedCreateXYZ(ID, X,Y,Z) -
This command will create a ped where that you tell it to. Replace the ID with the number ID of the character you want to spawn. For example : PedCreateXYZ(33, X,Y,Z)
This will spawn Bif. Also make sure you write the local coords you have setted or the actuall coords in it :PedCreateXYZ(33, l_1_0, l_1_1, l_1_2)
I recommend that you will write first under the MissionSetup = Function() this : local Bif = Nil and then when you want to spawn him write it like this :
Bif = PedCreateXYZ(33, l_1_0, l_1_1, l_1_2)


           
Code: [Select]
Ped Id list
-------------------------------------------
|   ID   |    MODEL NAME    | Outfit Type |
|--------|--------------------------------|
|        |                  |             |
|0  | Jimmy           |   Normal    |
-------------------------------------------
|1  | Jimmy           | Default Ped |
-------------------------------------------
|2  | Zoe             |             |
-------------------------------------------
|3  | Beatrice        |             |
-------------------------------------------
|4  | Algernon        |             |
-------------------------------------------
|5  | Fatty           |             |
-------------------------------------------
|6  | Melvin          |             |
-------------------------------------------
|7  | Thad            |             |
-------------------------------------------
|8  | Bucky           |             |
-------------------------------------------
|9  | Cornelius       |             |
-------------------------------------------
|10 | Earnest         |             |
-------------------------------------------
|11 | Donald          |             |
-------------------------------------------
|12 | Damon           |             |
-------------------------------------------
|13 | Kirby           |             |
-------------------------------------------
|14 | Mandy           |             |
-------------------------------------------
|15 | Dan             |             |
-------------------------------------------
|16 | Luis            |             |
-------------------------------------------
|17 | Casey           |             |
-------------------------------------------
|18 | Bo              |             |
-------------------------------------------
|19 | Ted             |             |
-------------------------------------------
|20 | Juri            |             |
-------------------------------------------
|21 | Peanut          |             |
-------------------------------------------
|22 | Hal             |             |
-------------------------------------------
|23 | Johnny          |             |
-------------------------------------------
|24 | Lefty           |             |
-------------------------------------------
|25 | Lola            |             |
-------------------------------------------
|26 | Lucky           |             |
-------------------------------------------
|27 | Vance           |             |
-------------------------------------------
|28 | Ricky           |             |
-------------------------------------------
|29 | Norton          |             |
-------------------------------------------
|30 | Gord            |             |
-------------------------------------------
|31 | Tad             |             |
-------------------------------------------
|32 | Chad            |             |
-------------------------------------------
|33 | Bif             |             |
-------------------------------------------
|34 | Justin          |             |
-------------------------------------------
|35 | Bryce           |             |
-------------------------------------------
|36 | Bryce           |             |
-------------------------------------------
|37 | Darby           |             |
-------------------------------------------
|38 | Pinky           |             |
-------------------------------------------
|39 | Angie           |             |
-------------------------------------------
|40 | Parker          |             |
-------------------------------------------
|41 | Jerry           |             |
-------------------------------------------
|42 | Otto            |             |
-------------------------------------------
|43 | Leon            |             |
-------------------------------------------
|44 | Duncan          |             |
-------------------------------------------
|45 | Henry           |             |
-------------------------------------------
|46 | Gurney          |             |
-------------------------------------------
|47 | Omar            |             |
-------------------------------------------
|48 | Zoe             |             |
-------------------------------------------
|49 | Max             |             |
-------------------------------------------
|50 | Seth            |             |
-------------------------------------------
|51 | Edward          |             |
-------------------------------------------
|52 | Karl            |             |
-------------------------------------------
|53 | Theo            |             |
-------------------------------------------
|54 | MissPeabody     |             |
-------------------------------------------
|55 | MrBurton        |             |
-------------------------------------------
|56 | MrLuntz         |             |
-------------------------------------------
|57 | MrGalloway      |             |
-------------------------------------------
|58 | Edna            |             |
-------------------------------------------
|59 | MissWinston     |             |
-------------------------------------------
|60 | MrsMcRae        |             |
-------------------------------------------
|61 | MrHuntingdon    |             |
-------------------------------------------
|62 | MrsCarvin       |             |
-------------------------------------------
|63 | MsPhillips      |             |
-------------------------------------------
|64 | MrSlawter       |             |
-------------------------------------------
|65 | DrCrabblesnitch |             |
-------------------------------------------
|66 | Sheldon         |             |
-------------------------------------------
|67 | Christy         |             |
-------------------------------------------
|68 | Gloria          |             |
-------------------------------------------
|69 | Pedro           |             |
-------------------------------------------
|70 | Constantinos    |             |
-------------------------------------------
|71 | Ray             |             |
-------------------------------------------
|72 | Ivan            |             |
-------------------------------------------
|73 | Trevor          |             |
-------------------------------------------
|74 | Eunice          |             |
-------------------------------------------
|75 | Russell         |             |
-------------------------------------------
|76 | DrBambillo      |             |
-------------------------------------------
|77 | MrSullivan      |             |
-------------------------------------------
|78 | MsKopke         |             |
-------------------------------------------
|79 | MsRushinski     |             |
-------------------------------------------
|80 | MsIsaacs        |             |
-------------------------------------------
|81 | BethanyJones    |             |
-------------------------------------------
|82 | ORourke         |             |
-------------------------------------------
|83 | OfficerMonson   |             |
-------------------------------------------
|84 | ZackOwens       |             |
-------------------------------------------
|85 | Trent           |             |
-------------------------------------------
|86 | TobiasMason     |             |
-------------------------------------------
|87 | MrGrant         |             |
-------------------------------------------
|88 | Mascot          |             |
-------------------------------------------
|89 | MrOh            |             |
-------------------------------------------
|90 | Christy         |             |
-------------------------------------------
|91 | Edgar           |             |
-------------------------------------------
|92 | Luis            |             |
-------------------------------------------
|93 | Mandy           |             |
-------------------------------------------
|94 | Pinky           |             |
-------------------------------------------
|95 | Beatrice        |             |
-------------------------------------------
|96 | Lola            |             |
-------------------------------------------
|97      | OfficerWilliams |             |
-------------------------------------------
|98      | Jimmy           |  Wrestling  |
-------------------------------------------
|99      | Davis           |             |
-------------------------------------------
|100 | MrBreckindale   |             |
-------------------------------------------
|101 | MrDoolin        |             |
-------------------------------------------
|102 | Troy            |             |
-------------------------------------------
|103 | Nate            |             |
-------------------------------------------
|104 | MrCarmichael    |             |
-------------------------------------------
|105 | NickyCharles    |             |
-------------------------------------------
|106 | MrWatts         |             |
-------------------------------------------
|107 | MissAbby        |             |
-------------------------------------------
|108 | Mihailovich     |             |
-------------------------------------------
|109 | Kirby           |             |
-------------------------------------------
|110 | Ted             |             |
-------------------------------------------
|111 | Dan             |             |
-------------------------------------------
|112 | Damon           |             |
-------------------------------------------
|113 | Freeley         |             |
-------------------------------------------
|114 | Dorsey          |             |
-------------------------------------------
|115 | Hector          |             |
-------------------------------------------
|116 | Osbourne        |             |
-------------------------------------------
|117 | Chad            |             |
-------------------------------------------
|118 | Justin          |             |
-------------------------------------------
|119 | Parker          |             |
-------------------------------------------
|120 | MariaTheresa    |             |
-------------------------------------------
|121 | Bob             |             |
-------------------------------------------
|122 | Fatty           |             |
-------------------------------------------
|123 | Chuck           |             |
-------------------------------------------
|124 | Ian             |             |
-------------------------------------------
|125 | Fenwick         |             |
-------------------------------------------
|126 | Neil            |             |
-------------------------------------------
|127 | MrSvenson       |             |
-------------------------------------------
|128 | Denny           |             |
-------------------------------------------
|129 | MrGalloway      |             |
-------------------------------------------
|130 | Gary            |             |
-------------------------------------------
|131 | Krakauer        |             |
-------------------------------------------
|132 | MrMoratti       |             |
-------------------------------------------
|133 | Bif             |             |
-------------------------------------------
|134 | Peter           |             |
-------------------------------------------
|135 | MrSmith         |             |
-------------------------------------------
|136 | Rat             |             |
-------------------------------------------
|137 | Melody          |             |
-------------------------------------------
|138 | Karen           |             |
-------------------------------------------
|139 | Gordon          |             |
-------------------------------------------
|140 | Brandy          |             |
-------------------------------------------
|141 | Pitbull         |             |
-------------------------------------------
|142 | Lance           |             |
-------------------------------------------
|143 | Crystal         |             |
-------------------------------------------
|144 | MrMartin        |             |
-------------------------------------------
|145 | Ethan           |             |
-------------------------------------------
|146 | Wade            |             |
-------------------------------------------
|147 | Tom             |             |
-------------------------------------------
|148 | MrRamirez       |             |
-------------------------------------------
|149 | MrHuntingdon    |             |
-------------------------------------------
|150 | Otto            |             |
-------------------------------------------
|151 | MrWiggins       |             |
-------------------------------------------
|152 | Floyd           |             |
-------------------------------------------
|153 | Leon            |             |
-------------------------------------------
|154 | Henry           |             |
-------------------------------------------
|155 | Fatty           |             |
-------------------------------------------
|156 | Stan            |             |
-------------------------------------------
|157 | Handy           |             |
-------------------------------------------
|158 | Gregory         |             |
-------------------------------------------
|159 | Pedro           |             |
-------------------------------------------
|160 | Gary            |             |
-------------------------------------------
|161 | Lucky           |             |
-------------------------------------------
|162 | Donald          |             |
-------------------------------------------
|163 | Parker          |             |
-------------------------------------------
|164 | Casey           |             |
-------------------------------------------
|165 | Peter           |             |
-------------------------------------------
|166 | Angie           |             |
-------------------------------------------
|167 | Pinky           |             |
-------------------------------------------
|168 | Damon           |             |
-------------------------------------------
|169 | Gordon          |             |
-------------------------------------------
|170 | Ivan            |             |
-------------------------------------------
|171 | Trevor          |             |
-------------------------------------------
|172 | Bif             |             |
-------------------------------------------
|173 | Vance           |             |
-------------------------------------------
|174 | Thad            |             |
-------------------------------------------
|175 | Pinky           |             |
-------------------------------------------
|176 | Russell         |             |
-------------------------------------------
|177 | Tad             |             |
-------------------------------------------
|178 | Bryce           |             |
-------------------------------------------
|179 | Justin          |             |
-------------------------------------------
|180 | Angie           |             |
-------------------------------------------
|181 | Christy         |             |
-------------------------------------------
|182 | Pinky           |             |
-------------------------------------------
|183 | MrBuba          |             |
-------------------------------------------
|184 | MrGordon        |             |
-------------------------------------------
|185 | MrsLisburn      |             |
-------------------------------------------
|186 | Fatty           |             |
-------------------------------------------
|187 | Betty           |             |
-------------------------------------------
|188 | Lightning       |             |
-------------------------------------------
|189 | Zeke            |             |
-------------------------------------------
|190 | Alfred          |             |
-------------------------------------------
|191 | Paris           |             |
-------------------------------------------
|192 | Courtney        |             |
-------------------------------------------
|193 | Delilah         |             |
-------------------------------------------
|194 | Drew            |             |
-------------------------------------------
|195 | Castillo        |             |
-------------------------------------------
|196 | Edgar           |             |
-------------------------------------------
|197 | Gurney          |             |
-------------------------------------------
|198 | Jerry           |             |
-------------------------------------------
|199 | Leon            |             |
-------------------------------------------
|200 | Hal             |             |
-------------------------------------------
|201 | Norton          |             |
-------------------------------------------
|202 | Peanut          |             |
-------------------------------------------
|203 | Vance           |             |
-------------------------------------------
|204 | Bo              |             |
-------------------------------------------
|205 | Damon           |             |
-------------------------------------------
|206 | Juri            |             |
-------------------------------------------
|207 | Kirby           |             |
-------------------------------------------
|208 | Algernon        |             |
-------------------------------------------
|209 | Bucky           |             |
-------------------------------------------
|210 | Thad            |             |
-------------------------------------------
|211 | Parker          |             |
-------------------------------------------
|212 | Justin          |             |
-------------------------------------------
|213 | Tad             |             |
-------------------------------------------
|214 | Gord            |             |
-------------------------------------------
|215 | Earnest         |             |
-------------------------------------------
|216 | Ted             |             |
-------------------------------------------
|217 | Johnny          |             |
-------------------------------------------
|218 | Darby           |             |
-------------------------------------------
|219 | Pitbull         |             |
-------------------------------------------
|220 | Pitbull         |             |
-------------------------------------------
|221 | Edna            |             |
-------------------------------------------
|222 | McInnis         |             |
-------------------------------------------
|223 | Johnson         |             |
-------------------------------------------
|224 | Thad            |             |
-------------------------------------------
|225 | Sheldon         |             |
-------------------------------------------
|226 | Pedro           |             |
-------------------------------------------
|227 | Ivan            |             |
-------------------------------------------
|228 | Trevor          |             |
-------------------------------------------
|229 | MrBurton        |             |
-------------------------------------------
|230 | Mandy           |             |
-------------------------------------------
|231 | Bo              |             |
-------------------------------------------
|232 | Casey           |             |
-------------------------------------------
|233 | PunchBag        |             |
-------------------------------------------
|234 | OfficerMonson   |             |
-------------------------------------------
|235 | Constantinos    |             |
-------------------------------------------
|236 | McInnis         |             |
-------------------------------------------
|237 | McInnis         |             |
-------------------------------------------
|238 | OfficerWilliams |             |
-------------------------------------------
|239 | Bryce           |   Boxing    |
-------------------------------------------
|240 | Bryce           |   Boxing    |
-------------------------------------------
|241 | Chad            |   Boxing    |
-------------------------------------------
|242 | Chad            |   Boxing    |
-------------------------------------------
|243 | Bif             |   Boxing    |
-------------------------------------------
|244 | Justin          |   Boxing    |
-------------------------------------------
|245 | Justin          |   Boxing    |
-------------------------------------------
|246 | Parker          |   Boxing    |
-------------------------------------------
|247 | Parker          |   Boxing    |
-------------------------------------------
|248 | Geography Teacher|           |
-------------------------------------------
|249 |    Music Teacher |             |
-------------------------------------------
|250 | X-Mas Elf #1    |             |
-------------------------------------------
|251 |    X-Mas Elf #2  |             |
-------------------------------------------
|252 |    Hobo Santa    |             |
-------------------------------------------
|253 |    Fake Santa    |             |
-------------------------------------------
|254 |    Fake Santa    | Unknown     |
-------------------------------------------
|255 | Peter           |  NutCracker |
-------------------------------------------
|256 | Eunice          |  Halloween  |
-------------------------------------------
|257 | Melody          |  Halloween  |
-------------------------------------------
|258 | Pedro           |  Halloween  |
List Provided by MadmaN

PlayerSetHealth(200) -
Will set the players health. 200 = Full Health

PedSetHealth(PedName, 200)
This command will set the Ped's health.
Replace Pedname with your Ped's name.
Replace the 200 with how much health you want him to have.


PedSetActionTree(Johnny, "/Global/G_Johnny", "Act/Anim/G_Johnny.act") -
This command will give the selected ped a fighting style.
After you setted the peds local in the start of the script you need to write his local name in there
I have marked where you write the peds local name in red :
 PedSetActionTree(Johnny, "/Global/G_Johnny", "Act/Anim/G_Johnny.act") Make sure that the fighting styles that are written after the /Global and the Act/Anim are the same fighting style to avoid bugs or glitches.
Remember to put this command after the spawn command of the ped
Also do not remove the " " or the command wont work.
This command may also need the loading animation function and load this animation inside the main = function() section


PedRecruitAlly(gplayer, Johnny) -
This command is the bodyguard command.
I have marked the bodyguard in Red and Who is being guarded in Brown
PedRecruitAlly(gplayer, Johnny)
Remember to put this command after the spawn command of the guard.


PedSetAllyAutoEngage(PedName,true) -
This command makes your bodyguard to help you in a fight, when you get into one. In the command you need to place your bodyguards local name  and set it to true to active it :
PedSetAllyAutoEngage(Johnny,true)


PedSetTypeToTypeAttitude(0, 0, 0) -
This command sets reletionships between cliques, or between a clique to the player.
PedSetTypeToTypeAttitude(5, 13, 0) (5 and 13 are the 2 cliques or clique and player. 5 = Preps. 13 = player. The last number is the behaviour. 0 = Abhor (Hate). As soon as I learn more about this I will update.

 
Code: [Select]
Faction ID list


Faction            ID
--------------------
Nerd                1
______________
Jock                2
______________
DropOut             3
______________
Greaser             4
______________
Preppy              5
______________
Student             6
______________
Cop                 7
______________
Teacher             8
______________
TownPerson          9
______________
ShopKeep           10
______________
Bully              11
______________
Player2            14
______________
Player             13
______________   
     

Code: [Select]
Reletionship ID's

Reletionship              ID
-----------------------------
Abhor(Hate)              0
_____________________
Averse                   1
____________________
Dispassionate(Ignores)   2
____________________
Dig                      3
____________________
Adore(Is your friend)    4
____________________
   

PickupCreateXYZ(ID, X, Y, Z) -
This command creates a pickup of your choice where that you want it.
Replace the ID with the Items ID, for example 362 is soda can, if you will do this :
PickupCreateXYZ(362, l_1_0, l_1_1, l_1_2) will spawn a soda can where you setted up the local coords at.
The Weapon ID list down below can be used with this command to.


PedAttack(Darby, gPlayer,1) -
This command will make the selected Ped attack the Player or the other selected Ped.
Example :
PedAttack(Attackingped, Target,1)
AttackingPed = Write the Ped you want to attack here.
Target = Write the Ped(or Player) you want to get attacked here.
About the number "1" in the end of the command.
When setted to 1 the Ped will attack normally, but when he will get hit by the player or by another Ped, he will stop to attack the Target and attack the one who hit him.
There are also levels 2 and 3, but I dont know much about them, the only thing I know that they both make the Ped ignore all the Peds and attack the Target untill he dies.


SoundPlayStream("MS_FightingJohnnyVincentBossFight.rsm", 0.69999998807907) -
This command Plays music.
How to use : Inside the "" You put the song you want it to play (Dont forget always write .srm after the songs name)
There is a list of all the song names in bully down below (Except testing songs, that have crappy quality)
The 0.6999999 and all of those numbers is the volume the song will be played.
Dont put it higher then 2 or 3 cuz it will be SUPER loud.

Code: [Select]
Song name ID list

Arc_FlyingSquirrelGameMx01
Arc_FlyingSquirrelGameMx02
Arc_FlyingSquirrelGameMx03
Arc_MonkeyFlingGame01
Arc_MonkeyFlingGame02
Arc_MonkeyFlingGame03
Arc_SUMO_Game01
ArcRaceMXmidi02Drive01
ArcRaceMXmidi02Drive02
ArcRaceMXmidi02Drive03
MS_3B_JohhnyV_NIS
MS_6B_EndlessSummerCreditsNIS
MS_ActionHigh
MS_ActionHigh_NISReturn
MS_ActionLow
MS_ActionMid
MS_ArtClass
MS_BikeActionHigh
MS_BikeActionMid
MS_BikeChaseHigh
MS_BikeChaseLow
MS_BikeChaseMid
MS_BikeDay
MS_BikeFastHigh
MS_BikeFastLow
MS_BikeFunHigh
MS_BikeFastMid
MS_BikeFunLow
MS_BikeFunMid
MS_BikePractice
MS_BikeRace01
MS_BikeRace02
MS_BiologyClass
MS_BoxingBossFight
MS_BoxingReg
MS_Candidate
MS_Carnival01
MS_Carnival02
MS_CarnivalFunhouseAmbient
MS_CarnivalFunhouseMaze
MS_CarnivalFunhouseMiner
MS_ChasePrefect
MS_ChaseHigh
MS_ChaseLow
MS_ChaseMid
MS_ChasePolice
MS_ChemistryClass
MS_DestructionVandalismHigh
MS_DestructionVandalismMid
MS_DishonorableFight
MS_EnglishClass
MS_EpicConfrantation_NIS
MS_EpicConfrontationHigh
MS_EpicConfrontationHighPart2
MS_EpicConfrontationLow
MS_EpicConfrontationMid
MS_FearTensionMid
MS_FightingBullies
MS_FightingDropouts
MS_FightingGeneric
MS_FightingGreasers
MS_FightingJocks
MS_FightingJohnnyVincentBikeRide
MS_FightingJohnnyVincentBossFight
MS_FightingJohnnyVincentFight
MS_FightingNerds
MS_FightingPreps
MS_FightingPrepsLow
MS_FinalShowdown03High
MS_FinalShowdown03Low
MS_FinalShowdown03Mid
MS_FinalShowdownHigh
MS_FinalShowdownLow
MS_FinalShowdownMid
MS_FootStealthHigh
MS_FootStealthLow
MS_FootStealthMid
MS_FriendshipAllyHigh
MS_FriendshipAllyLow
MS_FriendshipAllyMid
MS_FunHigh
MS_FunLow
MS_FunMid
MS_GeographyClass
MS_Gobble
MS_GoKart 01
MS_GoKart02
MS_GoKarts02
MS_GymClass
MS_HalloweenHigh
MS_HalloweenLow
MS_HalloweenMid
MS_InTroubleHigh
MS_InTroubleLow
MS_JockBossBattle
MS_KidsPlay
MS_LockPicking
MS_MathClass
MS_MisbehavingHigh
MS_MisbehavingHigh_NIS01
MS_MisbehavingHigh_NIS02
MS_MisbehavingHigh_NIS03
MS_MisbehavingLow
MS_MisbehavingMid
MS_MovieTixRomance
MS_MusicClass_Carols01
MS_MusicClass_Coming
MS_MusicClass_Liberty
MS_MusicClass_MasterP
MS_MusicClass_Turkey
MS_MusicClass_Washing
MS_PhotographyClass
MS_RomanceHigh
MS_RomanceLow
MS_RomanceMid
MS_RunningFight-2 MIX TR
MS_RunningHigh
MS_RunningLow
MS_RunningLow02
MS_RunningMid
MS_RussellInTheHole
MS_SearchingHigh
MS_SearchingLow
MS_SearchingMid
MS_ShopClass
MS_ShowdownAtThePlantHigh
MS_ShowdownAtThePlantLow
MS_SneakDate_Romantic
MS_SneakDate_SexyGirl
MS_StealthHigh
MS_StealthLow
MS_StealthMid
MS_StealthMidA
MS_StreetFightLargeHigh_Boxing
MS_StreetFightLargeLow_Boxing
MS_StreetFightLargeMid_Boxing
MS_TenementsHigh
MS_TenementsLow
MS_TenementsMid
MS_TensionBuilder01
MS_Tired
MS_WIldstyleHigh
MS_WIldstyleLow
MS_WIldstyleMid
MS_XmasBellsRudyHigh
MS_XmasBellsRudylow
MS_XmasBellsRudyMid
MS_XmasComeRudyHigh
MS_XmasComeRudyLow
MS_XmasComeRudyMid
MS_XmasFavoriteBallsHigh
MS_XmasFavoriteBallsLow
MS_XmasFavoriteBallsMed
MS_XmasJingleMiracle
MS_XmasJingleMiracleHigh
MS_XmasJingleMiracleLow
MS_XmasJingleMiracleMid

AddBlipForChar(PedID, 6, 2, 2) -
Okey so, this command basicly is the command you use to create arrows above a ped or add his vision range in the mini map. My knowledge in this command is VERY limited.
All I know is this : Change the PedID with the local name of the Ped you choose.
To make a Arrow above the ped's name Keep the 2, 2.
The Arrow's color will change depends on the ped's actions.
If the ped will attack the player and then you will place an arrow above him it will be red.
If you put the arrow above the ped but he dosn't attack the player it will be blue, ect...
To add his vision rate in the mini map (Like the prefects have when u have trouble meter)
do this : Change the 2 ,2  to 3, 3.
Ignore the 6 for now, cuz I dont know what it does.


PedShowHealthBar(PedID, true, "N_PedName", true) -
This command will pop up a Health meter on the top of the screen which will represent the PedID you write.
My knowledge about this command is VERY limited.
Keep the N_ the PedName u can change to the name you want to be on top of the health bar..


PedLoadAITree(PedID"/Global/RusselAI", "Act/AI/AI_RUSSEL_1_B.act") -
This command will load the Ped's ID, Its kind of hard to explain what this is, but...
Anyway In boss styles, u may need to load these AI Tree's to make them work.
I do not know much AI's but If u want Russell's AI then Take a look at the command


CreatePersistentEntity("ToolBox", -778, -128, 7.407071114, 0, 8 ) - (Delete the space between the 8 and the ) )
This command basicly creates Objects in diffrent places. Inside the "" you write the object.
The -778, -128 and the 7.407 and all of those numbers are the coords, and I dont know what are the 0 and the 8.
I do not know any other objects currectly, but when I will, I will provide a list..


ClockSet(8, 30) -
This command sets the time in your script. The 8 is the hour and the 30 is the minutes.

ClockSetTickRate(0.0060000000521541)
This command sets the speed that the clock will run.
The higher the numbers are the faster time will run


 DATLoad("1_B.DAT", 2)
 DATInit() -
Basicly when putting these 2 commands together, you can load diffrent Interors.
Inside the "" you write the interor's ID (I will provide a list of interor ID's later on)
I dont know what the 2 presents so ignore it for now.


AreaTransitionPoint(8, POINTLIST._1_B_PLAYER)
So, This command teleports the player to a selected point inside Trigger.img
The 8 is the area code.
Area code is a code that is set for each interor in the game. You MUST write the area code of the interor that you want to go to or it WONT work.
Anyway, The point I used in this command is the hole.
Meaning it will teleport you to the hole if u will put this command after you load the hole.


PedAttackPlayer(PedID) -
This command makes the Ped selected in the PedID to attack the player.
Use this command if the command PedAttack(PedID, gPlayer) bugs.
Or just use it for safety reasons.


PedSetWeapon(PedID, WeaponID) -
This command gives the selected Ped a weapon of your choice.
I will provide a Weapon ID list soon.


Code: [Select]
Weapon ID list

ID  |     MODEL NAME      | TRIGGER NAME    |
-----------------------------------------------
|       |
-----------------------------------------------
| 299 | yardstick           | W_Stick   |
-----------------------------------------------
| 300 | bat        | W_BBallBat   |
-----------------------------------------------
| 301 | cherryb           | W_CherryBomb    |
-----------------------------------------------
| 302 | baseball         | W_BBall   |
-----------------------------------------------
| 303 | slingshot         | W_Slingshot   |
-----------------------------------------------
| 304 | marble         |    NONE         |
-----------------------------------------------
| 305 | spudg         | W_Brocket       |
-----------------------------------------------
| 306 | supersling     | W_Slingshot     |
-----------------------------------------------
| 307 | brocketlauncher     | W_Brocket       |
-----------------------------------------------
| 308 | brocket         |    NONE         |
-----------------------------------------------
| 309 | stinkbomb     | W_Thrown        |
-----------------------------------------------
| 310 | apple         | W_Thrown        |
-----------------------------------------------
| 311 | brick         | W_Thrown        |
-----------------------------------------------
| 312 | eggproj         | W_Thrown        |
-----------------------------------------------
| 313 | snowball     | W_Snowball      |
-----------------------------------------------
| 314 | yardstick_DMG     | W_Stick       |
-----------------------------------------------
| 315 | lid             | W_Lid           |
-----------------------------------------------
| 316 | potato         |    NONE         |
-----------------------------------------------
| 317 | bat_DMG         | W_BBallBat      |
-----------------------------------------------
| 318 | dodgeball     | W_Thrown       |
-----------------------------------------------
| 319 | W_Circuit     |    NONE         |
-----------------------------------------------
| 320 | newsroll     | W_Thrown       |
-----------------------------------------------
| 321 | spraycan     | W_SprayCan   |
-----------------------------------------------
| 322 | supermarble     |    NONE         |
-----------------------------------------------
| 323 | twobyfour     | W_BBallBat   |
-----------------------------------------------
| 324 | sledgehammer     |    NONE         |
-----------------------------------------------
| 325 | RBandBall     |    NONE         |
-----------------------------------------------
| 326 | fireexting     |    NONE         |
-----------------------------------------------
| 327 | bbagbottle     | W_Stick         |
-----------------------------------------------
| 328 | WCamera         | W_Camera       |
-----------------------------------------------
| 329 | SocBall         | W_Thrown       |
-----------------------------------------------
| 330 | SnwBallB     | W_Thrown   |
-----------------------------------------------
| 331 | Wftball         | W_Thrown       |
-----------------------------------------------
| 332 | Wmallet         |    NONE         |
-----------------------------------------------
| 333 | W_Comicbk         |    NONE         |
-----------------------------------------------
| 334 | WBball         | W_Thrown   |
-----------------------------------------------
| 335 | Wfrisbee         |    NONE         |
-----------------------------------------------
| 336 | cricket_DMG     | W_BBallBat   |
-----------------------------------------------
| 337 | chemical     |    NONE         |
-----------------------------------------------
| 338 | Wdish             |    NONE         |
-----------------------------------------------
| 339 | Cigarette         |    NONE         |
-----------------------------------------------
| 340 | W_bunchofpanties    |    NONE         |
-----------------------------------------------
| 341 | pompom             |    NONE         |
-----------------------------------------------
| 342 | wtrpipe         | W_wtrpipe   |
-----------------------------------------------
| 343 | garbpick         |    NONE         |
-----------------------------------------------
| 344 | W_Crab             |    NONE         |
-----------------------------------------------
| 345 | WHatSVase         |    NONE         |
-----------------------------------------------
| 346 | W_DeadRat         |    NONE         |
-----------------------------------------------
| 347 | superglue         |    NONE         |
-----------------------------------------------
| 348 | Wtray     |    NONE         |
-----------------------------------------------
| 349 | BagMrbls         |    NONE         |
-----------------------------------------------
| 350 | flask             |    NONE         |
-----------------------------------------------
| 351 | chem_stir         |    NONE         |
-----------------------------------------------
| 352 | Eyedrop             |    NONE         |
-----------------------------------------------
| 353 | PlantPot         |    NONE         |
-----------------------------------------------
| 354 | pVase_proj         |    NONE         |
-----------------------------------------------
| 355 | dec_plate         |    NONE         |
-----------------------------------------------
| 356 | pPlant_proj         |    NONE         |
-----------------------------------------------
| 357 | cricket             |    NONE         |
-----------------------------------------------
| 358 | Banana             |    NONE         |
-----------------------------------------------
| 359 | Flowerbund         |    NONE         |
-----------------------------------------------
| 360 | Psheild             |    NONE         |
-----------------------------------------------
| 361 | W_bunchofphotos     |    NONE         |
-----------------------------------------------
| 362 | FraffyCan         |    NONE         |
-----------------------------------------------
| 363 | teddybear         |    NONE         |
-----------------------------------------------
| 364 | SnowShwl     | W_snowshwl   |
-----------------------------------------------
| 365 | Grab_Beaker         |    NONE         |
-----------------------------------------------
| 366 | Grab_Testtube_Right |    NONE         |
-----------------------------------------------
| 367 | Grab_Canister     |    NONE         |
-----------------------------------------------
| 368 | Grab_Eyedrop     |    NONE         |
-----------------------------------------------
| 369 | Grab_Testtube_Left |    NONE         |
-----------------------------------------------
| 370 | W_package         |    NONE         |
-----------------------------------------------
| 371 | ChknLeg             |    NONE         |
-----------------------------------------------
| 372 | kickme             |    NONE         |
-----------------------------------------------
| 373 | oilcan             |    NONE         |
-----------------------------------------------
| 374 | ratchet             |    NONE         |
-----------------------------------------------
| 375 | torch             |    NONE         |
-----------------------------------------------
| 376 | wrench             |    NONE         |
-----------------------------------------------
| 377 | JBroom             |    NONE         |
-----------------------------------------------
| 378 | AniFooty         |    NONE         |
-----------------------------------------------
| 379 | W_Radio             |    NONE         |
-----------------------------------------------
| 380 | barrel             |    NONE         |
-----------------------------------------------
| 381 | ANIBBALL         |    NONE         |
-----------------------------------------------
| 382 | cement             |    NONE         |
-----------------------------------------------
| 383 | WBalloon         |    NONE         |
-----------------------------------------------
| 384 | wtrpipeD         |    NONE         |
-----------------------------------------------
| 385 | trophy             |    NONE         |
-----------------------------------------------
| 386 | Boxcard01         |    NONE         |
-----------------------------------------------
| 387 | CHShieldA         |    NONE         |
-----------------------------------------------
| 388 | CHShieldB         |    NONE         |
-----------------------------------------------
| 389 | CHShieldC         |    NONE         |
-----------------------------------------------
| 390 | WHatVase         |    NONE         |
-----------------------------------------------
| 391 | bbgun             |    NONE         |
-----------------------------------------------
| 392 | W_charSheet         |    NONE         |
-----------------------------------------------
| 393 | W_Candy             |    NONE         |
-----------------------------------------------
| 394 | W_Itch             |    NONE         |
-----------------------------------------------
| 395 | W_PGun             |    NONE         |
-----------------------------------------------
| 396 | SuperSpudG         |    NONE         |
-----------------------------------------------
| 397 | W_Fountain         |    NONE         |
-----------------------------------------------
| 398 | W_Money             |    NONE         |
-----------------------------------------------
| 399 | PooBag         | W_PooBag   |
-----------------------------------------------
| 400 | WFtBomb WFtBomb     |    NONE         |
-----------------------------------------------
| 401 | wtrpipeC         |    NONE         |
-----------------------------------------------
| 402 | wtrpipeB         |    NONE         |
-----------------------------------------------
| 403 | W_TPRoll         |    NONE         |
-----------------------------------------------
| 404 | Umbrella         |    NONE         |
-----------------------------------------------
| 405 | NerdBooks         |    NONE         |
-----------------------------------------------
| 406 | W_Cane             |    NONE         |
-----------------------------------------------
| 407 | W_Nacho             |    NONE         |
-----------------------------------------------
| 408 | GOG_Player         |    NONE         |
-----------------------------------------------
| 409 | DevilFork         |    NONE         |
-----------------------------------------------
| 410 | PinkyWand         |    NONE         |
-----------------------------------------------
| 411 | SSWhip             |    NONE         |
-----------------------------------------------
| 412 | BoltCutters         |    NONE         |
-----------------------------------------------
| 413 | NerdBooksB         |    NONE         |
-----------------------------------------------
| 414 | NerdBooksC         |    NONE         |
-----------------------------------------------
| 415 | NerdBooksD         |    NONE         |
-----------------------------------------------
| 416 | NerdBooksE         |    NONE         |
-----------------------------------------------
| 417 | Detonator         |    NONE         |
-----------------------------------------------
| 418 | leadpipe         |    NONE         |
-----------------------------------------------
| 419 | Tbone             |    NONE         |
-----------------------------------------------
| 420 | W_Flashlight     |    NONE         |
-----------------------------------------------
| 421 | AlgieJacCS         |    NONE         |
-----------------------------------------------
| 422 | JBroom_DMG         |    NONE         |
-----------------------------------------------
| 423 | W_JPhoto         |    NONE         |
-----------------------------------------------
| 424 | ammo_scatter     |    NONE         |
-----------------------------------------------
| 425 | Wgascan             |    NONE         |
-----------------------------------------------
| 426 | WDigCam             |    NONE         |
-----------------------------------------------
| 427 | fire_inv         |    NONE         |
-----------------------------------------------
| 428 | W_Mug             |    NONE         |
-----------------------------------------------
| 429 | Jimmy_Panties     |    NONE         |
-----------------------------------------------
| 430 | PeanutUndie         |    NONE         |
-----------------------------------------------
| 431 | W_ChocBox         |    NONE         |
-----------------------------------------------
| 432 | W_diary             |    NONE         |
-----------------------------------------------
| 433 | Stwins_bad         |    NONE         |
-----------------------------------------------
| 434 | W_LabNotes         |    NONE         |
-----------------------------------------------
| 435 | twobyfour_DMG     |    NONE         |
-----------------------------------------------
| 436 | xmasgift         |    NONE         |
-----------------------------------------------
| 437 | SK8Board         |    NONE         |
-----------------------------------------------
| 438 | W_DrugBttl         |    NONE         |
-----------------------------------------------
| 439 | drumstick         |    NONE         |
-----------------------------------------------
| 440 | maracas         |    NONE         |
-----------------------------------------------
| 441 | matchbox         |    NONE         |
-----------------------------------------------
| 442 | matchstick         |    NONE         |
-----------------------------------------------
| 443 | timstick         |    NONE         |
-----------------------------------------------
| 444 | xylostick         |    NONE         |
-----------------------------------------------
List provided by MadmaN

PedWander(PedName, true) -
This command makes the Ped walk around like all Ped's spawned in Trigger.
Can be used to make realistic missions ect...


PedSetInfiniteSprint(PedName, true/False) -
This code gives a Ped the ability to sprint without taking a break, just like the player.
To active delete the false part inside the code including the /


DisablePunishmentSystem(true) -
This command allows you to disable or enable the trouble meter.
False is disable, True is enable
Take note that if you are using the command with action nodes (pressing a button in game) and you already have trouble meter on it WILL NOT empty your trouble meter, only once it is empty by itself the command will start working.


VehicleCreateXYZ(VehicleID,X,Y,Z)-
Use the list below to see vehicle id's.
X,Y,Z are the coords to spawn the vehicle at.


Code: [Select]
---------------------------
| Id  | MODEL NAME | TYPE |
---------------------------
|                         |
---------------------------
| 272 | bmxrace    | bike |
---------------------------
| 273 | retro    | bike |
---------------------------
| 274 | crapbmx    | bike |
---------------------------
| 275 | bikecop    | bike |
---------------------------
| 276 | Scooter    | bike |
---------------------------
| 277 | bike    | bike |
---------------------------
| 278 | custombike | bike |
---------------------------
| 279 | banbike    | bike |
---------------------------
| 280 | mtnbike    | bike |
---------------------------
| 281 | oladbike   | bike |
---------------------------
| 282 | racer    | bike |
---------------------------
| 283 | aquabike   | bike |
---------------------------
| 284 | Mower    | car  |
---------------------------
| 285 | Arc_3    | car  |
---------------------------
| 286 | taxicab    | car  |
---------------------------
| 287 | Arc_2    | car  |
---------------------------
| 288 | Dozer    | car  |
---------------------------
| 289 | GoCart    | car  |
---------------------------
| 290 | Limo    | car  |
---------------------------
| 291 | Dlvtruck   | car  |
---------------------------
| 292 | Foreign    | car  |
---------------------------
| 293 | cargreen   | car  |
---------------------------
| 294 | 70wagon    | car  |
---------------------------
| 295 | policecar  | car  |
---------------------------
| 296 | domestic   | car  |
---------------------------
| 297 | Truck    | car  |
---------------------------
| 298 | Arc_1    | car  |
---------------------------

List provided by MadmaN.

PedSetEmotionTowardsPed(PED,PED,EmotionID) -
This command will set how the ped will react when he see's the other ped, works on player aswell.
If set to scare, then the ped will be scared from the other ped.
Emotion list provided below :


Code: [Select]
   Emotion    Description
  -------------------------
  |0       |   AGGRESSIVE |
  -------------------------
  |1       |      ANNOYED |
  -------------------------
  |2       |   UNFRIENDLY |
  -------------------------
  |3       |   DISMISSIVE |
  -------------------------
  |4       |  VERY SCARED |
  -------------------------
  |5       |       SCARED |
  -------------------------
  |6       |  INTIMIDATED |
  -------------------------
  |7       |     FRIENDLY |
  -------------------------
  |8       |VERY FRIENDLY |
  ----------------------------
  |To Lock an emotion, change|
  |ELock to true. False will |
  |unlock the emotion.|-------
  ---------------------
 

List provided by MadmaN.



This section is not finished. There are MANY MANY more commands which I will add later.


Compling Scripts

After saving your script do the following :
Put all the filles inside the Luac (Lua compiler) in one folder with the ArcRace1.lur that you extract from the Scripts file using IMGtool. Put your script together with all of those files.

1. click on Window's "Start" button, Search for : "cmd"
2. Open it up
3. Type in "Color a" (without the " ") and press enter (You dont have to, but it will change the color and make it easier to understand)
4. do the following command : cd C:/Folder(Replace the Folder with the Folder you saved the Luac, the ArcRace1.lur and your script.)
5. Write the following command : Luac -o ArcRace1.lur ScriptName.lua
Replace ScriptName with your script's name.
6. Open up the scripts file inside C:/Rockstar Games/Bully scholarship edition/Scripts with IMGtool.
7. Delete the ArcRace1.lur inside the scripts file
8. Add the ArcRace1.lur inside the folder with the Luac files.
9. Rebuild Archive with IMGtool
10. Open bully, go to the arcade machine in the boys dorm, use it, and your script will start to work.

Errors

This section devides into 2 sections.
1. Errors u get on the CMD
2. Errors u make before u try to compile.
---------------------------------------------------------------------------------------------------------
luac: Test.lua:3225: `end' expected (to close `function' at line 2158) near `<eo
f>'


Basicly, if this shows up, you forgot to put an end that finishes your function or LUA rule of some sort.
Tip : Check the lines at the sides for the function's define,

luac: Test.lua:2269: <eof> expected near `end'

Basicly, if you get this error when it says <eof> expected near 'end' is pretty much confusing.
It basicly says that an end(eof = End of function also known as : "end") needs to be placed BUT it actully means, that you have an end which is not binded to any function for example :

Code: [Select]
Line
1      Chicken = function()
2     Chick = PedCreateXYZ(....)
3     Chock = PedCreateXYZ(....)
4     end
5    [color=orange] end[/color]6
7
8

The end marked in orange is basicly the end which is not binded in any function. you dont need it so you can delete it.
Tip : Check the lines at the side of the function (When u set the language to LUA).
The lines basicly mark the functions for you if I will create a function like

Bomb = function()

The line will appear all over the function, but if I wont put an end it will consider the whole script under the function as 1 function, so make sure to put ends.

Advance LUA commands

This section devides into a few sections :

1. Basic understanding of the advanced commands.
2. creating a menu
3. Special commands that can be only used with LUA rules
_____________________________________________________________________________

Basic understanding :

if - This one is very usefull. basicly you write
Code: [Select]
if PedGetHealth(Ped) <= 0 thenThat means that if the ped you chose has 0 health the next LUA line you will write under it will be trigged and will be active.

then - Basicly you put it after u finish the if command or elseif. Example :
Code: [Select]
if PedIsInTrigger(TRIGGER._triggerid)then
elseif - Basicly if you already got an "if blahblah then" line, you use elseif to basicly add another LUA advance commandExample :
Code: [Select]
if PlayerGetHealth(50) then
CODES
elseif PlayerGetHealth(10) then
CODES
end
end

while - basicly it says while a certain command is active something else is active as well example :
Code: [Select]
while F_Load() do
PedCreateXYZ...

do - A command that you need to put in the end of a while line in order to active the next LUA command or function

repeat - Now this one is a nice touch by the ones who invented LUA. It gives you the ability to repeat commands easy by just adding a wait command under the repeat one and putting the commands you want to repeat BETWEEN the repeat and the wait.
Tip : If you want it to repeat instantly set the wait to 0, if you want it every once in a while or every few seconds then set it to a diffrent number.
Example :


Code: [Select]
repeat
TextPrintString("Sup?", 4, 2)
wait(0)

until - This is the command that closes the repeat line but it has its own line.
Example :


Code: [Select]
repeat
F_SpawnPickup()
wait(0)
until not Alive

2. Creating a LUA menu

As it may seem a headach creating a LUA menu is quite easy after you grasp the basic of LUA rules and variables (locals).

In order to create a LUA menu there must be 2 functions that define it :

The setting function and the action function.

Setting function is the one that defines the menu system.

The Action function is the one that does the chosen action (LUA codes) after you confirm your choice.

Lets take a look at this small example of a basic menu I have created :

Code: [Select]
ImportScript("2_B.lua")

MissionSetup = function()
l_0_0 = 1
PlayerSetHealth(200)
AreaTransitionXYZ(0, 270,-110 ,7)
DisablePunishmentSystem(true)
end

Action = function()
if IsButtonBeingReleased(2,0) and l_0_0 == 1 then
TextPrintString("Chicken", 4, 2)
elseif IsButtonBeingReleased(2,0) and l_0_0 == 2 then
TextPrintString("Potato", 4, 2)
elseif IsButtonBeingReleased(2,0) and l_0_0 == 3 then
TextPrintString("Modder", 4, 2)
elseif IsButtonBeingReleased(2,0) and l_0_0 == 4 then
TextPrintString("Well done mate", 4, 2)
end
end

Settings = function()
if IsButtonBeingReleased(0,0) and l_0_0 == 1 then
l_0_0 = 2
TextPrintString("Setted to 2", 4, 2)
elseif IsButtonBeingReleased(0,0) and l_0_0 == 2 then
l_0_0 = 3
TextPrintString("Setted to 3", 4, 2)
elseif IsButtonBeingReleased(0,0) and l_0_0 == 3 then
l_0_0 = 4
TextPrintString("Setted to 4", 4, 2)
elseif IsButtonBeingReleased(0,0) and l_0_0 == 4 then
l_0_0 = 1
TextPrintString("Setted to 1", 4, 2)
end
end

main = function()
repeat
Action()
Settings()
Wait(0)
until not Alive
 end

If you still dont understand how its done here we go:

First thing you do is create a variable, but do NOT use local, just write the variable like this : l_0_0 = 1

I recommand to put it in the mission setup.
Now, create a new function and this will be the settings function.
To create a new function just write this : FUNCTIONNAME = function()
Replace functionname with the function's name.
After thats done time to write the code :
Basicly you set that every time that you press a certain button the l_0_0's vaule changes.

if ButtonIsBeingReleased(2,0) and l_0_0 == 1 then
TextPrintString("Setted to 2", 4, 2)
l_0_0 = 2

Then to create the next option choocing you basicly do the same thing BUT you change the l_0_0 == 1 part from == 1 to == 2 and again write under this line l_0_0 = 3 and you need to go on and on until infinite numbers.

Now for the action function.

Once again create a new function and this is pretty much the easy part.

All you have to do is to add a button bind (a diffrent one then the one in the settings function) and then add the l_0_0 = 1/2/3/4 to the condition meaning that

if IsButtonBeingReleased(0,0) and l_0_0 = 2 then
TextPrintString("Good work", 4, 2)

Sorry if this was a bit confusing, I am working on making it a bit more easy to understand.

3. Special commands, can be only used with LUA Rules



Creating a mission
This is something a lot of people want to know, so I decided to make a special section for it.
Now, in order to make missions, you will need 2 things :

Objectives, and Triggers

(MAKING AN EXAMPLE MISSION, WILL COUNTINUE SOON)


Tables

The following section contains the following sub sections :

1. Arrays
2. Table creating & Storing
3. Table using
4. Creating a Table menu.

MAKE SURE YOU UNDERSTAND ALL SECTIONS BEFORE TRYING CREATING A TABLE MENU

_____________________________________________________________________________________

Arrays

An Array is basicly a variable which has a few values.
Here's an example of a Array :

Code: [Select]
cool = {}
cool[1] = 5
cool[2] = 10
cool[3] = 56

To create an Array you write : NAME = {}
To add a new value to the Array write : NAME[NUMBER] = VALUE
You can use it in many functions.
For example :

Code: [Select]
cool = {}
cool[1] = 324
cool[2] = 310
cool[3] = 351

PedSetWeapon(gPlayer, cool[1])

You can also use it to make a fighting style, weapon or anything else change like :

Code: [Select]

  cool = {}
cool[1] = "/Global/P_Grappler_A"
cool[2] = "/Global/G_Johnny"
cool[3] = "/Global/P_Striker_A"
pool = {}
pool[1] = "Act/Anim/P_Grappler_A.act"
pool[2] = "Act/Anim/G_Johnny.act"
pool[3] = "Act/Anim/P_Striker_A.act"
a = 0
repeat
a = a + 1
PedSetActionTree(gPlayer,cool[a],pool[a])
Wait(5000)
until a == 3


Basicly we have 3 variables here :

cool which is an Array
pool which is also an Array
and "a" which is a normal variable.
First off, I filled in the fighting style in the "cool" Array
Then I filled in the fighting style's location in the "pool" Array
and then I made a variable named "a" which will be the variable that will make the styles switch.
Then in the repeat I made "a" grow each time by 1 : a = a + 1
and then I placed the command :

PedSetActionTree(gPlayer,cool[a],pool[a])

the command switches cool[a] and pool[a] with the fighting style we stored in the Arrays :

Code: [Select]
 
cool = {}
cool[1] = "/Global/P_Grappler_A"
cool[2] = "/Global/G_Johnny"
cool[3] = "/Global/P_Striker_A"
pool = {}
pool[1] = "Act/Anim/P_Grappler_A.act"
pool[2] = "Act/Anim/G_Johnny.act"
pool[3] = "Act/Anim/P_Striker_A.act"

That means that when "a" will be vauled 2 the player will get the style : "G_Johnny".
Take notice that the repeat function repeats itself every 3000 so make sure not to write :

repeat
CODES
Wait(0)

As 0 will make the script to repeat itself without waiting and it will propebly crash.

Table creating & Storing

Tables are propebly 1 of the most usefull things in LUA. Tables like Array's, but unlike Array's they can store a few variables inside each Array{x].
Here is an example of a fighting style table that me and DaBOSS made a while ago :

Code: [Select]
Styles = {}
table.insert(Styles,{Style = "/Global/Player",StyleLocation = "Act/Player.act",Name = "Player"})
table.insert(Styles,{Style = "/Global/Authority",StyleLocation = "Act/Anim/Authority.act",Name = "Authority"})
table.insert(Styles,{Style = "/Global/N_Striker_A",StyleLocation = "Act/Anim/N_Striker_A.act",Name = "N_Striker_A"})
table.insert(Styles,{Style = "/Global/N_Striker_B",StyleLocation = "Act/Anim/N_Striker_B.act",Name = "N_Striker_B"})
table.insert(Styles,{Style = "/Global/N_Ranged_A",StyleLocation = "Act/Anim/N_Ranged_A.act",Name = "N_Ranged_A"})
table.insert(Styles,{Style = "/Global/B_Striker_A",StyleLocation = "Act/Anim/B_Striker_A.act",Name = "B_Striker_A"})
table.insert(Styles,{Style = "/Global/J_Striker_A",StyleLocation = "Act/Anim/J_Striker_A.act",Name = "J_Striker_A"})
table.insert(Styles,{Style = "/Global/J_Melee_A",StyleLocation = "Act/Anim/J_Melee_A.act",Name = "J_Melee_A"})
table.insert(Styles,{Style = "/Global/J_Grappler_A",StyleLocation = "Act/Anim/J_Grappler_A.act",Name = "J_Grappler_A"})
table.insert(Styles,{Style = "/Global/J_Mascot",StyleLocation = "Act/Anim/J_Mascot.act",Name = "J_Mascot"})
table.insert(Styles,{Style = "/Global/G_Striker_A",StyleLocation = "Act/Anim/G_Striker_A.act",Name = "G_Striker_A"})
table.insert(Styles,{Style = "/Global/G_Melee_A",StyleLocation = "Act/Anim/G_Melee_A.act",Name = "G_Melee_A"})
table.insert(Styles,{Style = "/Global/G_Grappler_A",StyleLocation = "Act/Anim/G_Grappler_A.act",Name = "G_Grappler_A"})
table.insert(Styles,{Style = "/Global/P_Striker_A",StyleLocation = "Act/Anim/P_Striker_A.act",Name = "P_Striker_A"})
table.insert(Styles,{Style = "/Global/P_Striker_B",StyleLocation = "Act/Anim/P_Striker_B.act",Name = "P_Striker_B"})
table.insert(Styles,{Style = "/Global/P_Grappler_A",StyleLocation = "Act/Anim/P_Grappler_A.act",Name = "P_Grappler_A"})
table.insert(Styles,{Style = "/Global/DO_Striker_A",StyleLocation = "Act/Anim/DO_Striker_A.act",Name = "DO_Striker_A"})
table.insert(Styles,{Style = "/Global/DO_Grappler_A",StyleLocation = "Act/Anim/DO_Grappler_A.act",Name = "DO_Grappler_A"})
table.insert(Styles,{Style = "/Global/CV_Male_A",StyleLocation = "Act/Anim/CV_Male_A.act",Name = "CV_Male_A"})
table.insert(Styles,{Style = "/Global/CV_Female_A",StyleLocation = "Act/Anim/CV_Female_A.act",Name = "CV_Female_A"})
table.insert(Styles,{Style = "/Global/CV_OLD",StyleLocation = "Act/Anim/CV_OLD.act",Name = "CV_OLD"})
table.insert(Styles,{Style = "/Global/GS_Male_A",StyleLocation = "Act/Anim/GS_Male_A.act",Name = "GS_Male_A"})
table.insert(Styles,{Style = "/Global/GS_Female_A",StyleLocation = "Act/Anim/GS_Female_A.act",Name = "GS_Female_A"})
table.insert(Styles,{Style = "/Global/GS_Fat_A",StyleLocation = "Act/Anim/GS_Fat_A.act",Name = "GS_Fat_A"})
table.insert(Styles,{Style = "/Global/LE_Orderly_A",StyleLocation = "Act/Anim/LE_Orderly_A.act",Name = "LE_Orderly_A"})
table.insert(Styles,{Style = "/Global/TE_Female_A",StyleLocation = "Act/Anim/TE_Female_A.act",Name = "TE_Female_A"})
table.insert(Styles,{Style = "/Global/AN_RAT",StyleLocation = "Act/Anim/AN_RAT.act",Name = "AN_RAT"})
table.insert(Styles,{Style = "/Global/AN_DOG",StyleLocation = "Act/Anim/AN_DOG.act",Name = "AN_DOG"})
table.insert(Styles,{Style = "/Global/G_Johnny",StyleLocation = "Act/Anim/G_Johnny.act",Name = "G_Johnny"})
table.insert(Styles,{Style = "/Global/BOSS_Darby",StyleLocation = "Act/Anim/BOSS_Darby.act",Name = "BOSS_Darby"})
table.insert(Styles,{Style = "/Global/BOSS_Russell",StyleLocation = "Act/Anim/BOSS_Russell.act",Name = "BOSS_Russell"})
table.insert(Styles,{Style = "/Global/J_Ted",StyleLocation = "Act/Anim/J_Ted.act",Name = "J_Ted"})
table.insert(Styles,{Style = "/Global/DO_Edgar",StyleLocation = "Act/Anim/DO_Edgar.act",Name = "DO_Edgar"})

As you can see, I have created the table : Styles = {}
Then I store the variables and their values in the table :

Code: [Select]
table.insert(Styles,{Style = "/Global/Player",StyleLocation = "Act/Player.act",Name = "Player"})
table.insert is the command to store Array[number]'s inside the table with the rest of its values.

Each of those lines are a value to the table, while the Array[8]'s have their own variable values inside.
It goes like this :

table.insert(Styles,{Style = "/Global/Player",StyleLocation = "Act/Player.act",Name = "Player"})
table.insert(TableArray,{Variable = X....})

Table using

Using a table is quite easy, it dosn't require much.
It pretty much works the same as Arrays.
How to use the table :

Code: [Select]

TextPrintString(Styles[Select].Name,2.5,2)


Styles[select] is basicly like in the Array : NAME[NUMBER].
But, Unlike Arrays we dont line them up like this :

Code: [Select]
cool = {}
cool[1] = 2
cool[2] = 3
cool[3] = 362

So how do we use it then?
Well, In tables you may not list the numbers of each value, but that dosn't mean that the game dosn't count them as 1, 2, 3, 4.
So the first "table.insert" line in the table is basicly 1
the second line is 2
and so on.














Thank to



Red Blaster - Some commands, Helped and teached once in a while.
Rise to Honor - Many of the commands I use I got from him
Madman - Giving me my first lua script that I can learn from. Made a ID list that I am gonna use quite soon.
Walter - Gave me some Id lists, Commands, and keep supporting
Lemon - Teaching me some commands, supporting and such.
SWEGTA - For sticking this topic and also helping me once in a while
DaBOSS - Some commands and a bit of help

Thank you all guys.
For now this tutorial is no where to be finished.
But by time, It will be finished.
Tables, Commands,  Function, Id lists, Everything will be here in this very own topic.
« Last Edit: October 19, 2016, 04:24:32 PM by c00ld0c26 »

Offline Red Blaster

  • The BB Arab
  • More Than Halfway There
  • *****
  • Posts: 5,649
  • Gender: Male
  • Hi
    • View Profile
Re: c00ld0c26's Lua Bible
« Reply #1 on: June 16, 2013, 07:11:36 AM »
As per our xfire discussion, the main and MissionSetup descriptions are off.

Offline c00ld0c26

  • The D0c
  • Can't Get Enough
  • *****
  • Posts: 5,137
  • Gender: Male
  • Just a dood doing dood things.
    • View Profile
    • My channel.
Re: c00ld0c26's Lua Bible
« Reply #2 on: June 16, 2013, 07:15:15 AM »
Got it fixed :D
Its now back on

Offline WhenLifeGivesYouLemons

  • xfire: 1emonthatsme
  • Sr. Member
  • ***
  • Posts: 971
  • Gender: Male
  • 波動バースト
    • View Profile
Re: c00ld0c26 Presents : Extreamly Detailed Lua Tutorial
« Reply #3 on: June 16, 2013, 01:46:07 PM »
Great man you are learning a lot.  8)

Offline c00ld0c26

  • The D0c
  • Can't Get Enough
  • *****
  • Posts: 5,137
  • Gender: Male
  • Just a dood doing dood things.
    • View Profile
    • My channel.
Re: c00ld0c26 Presents : Extreamly Detailed Lua Tutorial
« Reply #4 on: June 16, 2013, 02:05:46 PM »
And Teaching :D

Offline c00ld0c26

  • The D0c
  • Can't Get Enough
  • *****
  • Posts: 5,137
  • Gender: Male
  • Just a dood doing dood things.
    • View Profile
    • My channel.
Re: c00ld0c26 Presents : Extreamly Detailed Lua Tutorial
« Reply #5 on: June 16, 2013, 04:16:57 PM »
Update : Added compiling scripts
Edited the Basic lua commands
Edited Lua orginization.

Offline Walter20210

  • Hero Member
  • ****
  • Posts: 1,102
  • Gender: Male
  • I keep loving the old things :P
    • View Profile
    • YouTube Account
Re: c00ld0c26 Presents : Extreamly Detailed Lua Tutorial
« Reply #6 on: June 17, 2013, 10:56:05 PM »
Actually there is more cool people.

But just they are not posting things here. :P

So keep your eyes open.

There Is more Good modders in the community. :D

Offline c00ld0c26

  • The D0c
  • Can't Get Enough
  • *****
  • Posts: 5,137
  • Gender: Male
  • Just a dood doing dood things.
    • View Profile
    • My channel.
Re: c00ld0c26 Presents : Extreamly Detailed Lua Tutorial
« Reply #7 on: June 18, 2013, 01:32:57 AM »
Thanks romeos.
Even though I am NOT as good as Red or SWEGTA

Offline Evolution

  • Elitist
  • *********
  • Posts: 13,574
  • Gender: Male
    • View Profile
Re: c00ld0c26 Presents : Extreamly Detailed Lua Tutorial
« Reply #8 on: June 18, 2013, 05:41:42 AM »
Thanks romeos.
Even though I am NOT as good as Red or SWEGTA

No, you're not. But I totally   am.  :cool: 


Offline Red Blaster

  • The BB Arab
  • More Than Halfway There
  • *****
  • Posts: 5,649
  • Gender: Male
  • Hi
    • View Profile
Re: c00ld0c26 Presents : Extreamly Detailed Lua Tutorial
« Reply #9 on: June 18, 2013, 11:05:22 AM »
Thanks romeos.
Even though I am NOT as good as Red or SWEGTA

Well, Swegta did learn a lot from me (and in a couple of cases, I learned something from him). He's come a long way in Bully lua scripting.

But, I think you should give Rise to Honor and MadmaN more credit than I in lua scripting, haha. WAY more credit.
« Last Edit: June 18, 2013, 12:44:20 PM by Admiral Red »

Offline Walter20210

  • Hero Member
  • ****
  • Posts: 1,102
  • Gender: Male
  • I keep loving the old things :P
    • View Profile
    • YouTube Account
Re: c00ld0c26 Presents : Extreamly Detailed Lua Tutorial
« Reply #10 on: June 18, 2013, 12:40:24 PM »
Can i make jimmy has good standing with the townperson?

If you mean make the people dont disrespect jimmy and being Good with im. (Probably even help you :P)

This will work :

Code: [Select]
PedSetTypeToTypeAttitude(9, 13, 4)

Offline c00ld0c26

  • The D0c
  • Can't Get Enough
  • *****
  • Posts: 5,137
  • Gender: Male
  • Just a dood doing dood things.
    • View Profile
    • My channel.
Re: c00ld0c26 Presents : Extreamly Detailed Lua Tutorial
« Reply #11 on: June 18, 2013, 02:18:45 PM »
Thanks romeos.
Even though I am NOT as good as Red or SWEGTA

Well, Swegta did learn a lot from me (and in a couple of cases, I learned something from him). He's come a long way in Bully lua scripting.

But, I think you should give Rise to Honor and MadmaN more credit than I in lua scripting, haha. WAY more credit.

Of course, but he just mentioned u and SWEGTA so I didn't mention them.
They made a LOT of HUGH breakthroughts in bully modding.

Offline c00ld0c26

  • The D0c
  • Can't Get Enough
  • *****
  • Posts: 5,137
  • Gender: Male
  • Just a dood doing dood things.
    • View Profile
    • My channel.
Re: c00ld0c26 Presents : Extreamly Detailed Lua Tutorial
« Reply #12 on: June 24, 2013, 09:55:56 AM »
Can i make jimmy has good standing with the townperson?

Im not sure if its possible in lua, cuz I dont know if the townpersons are considered a faction...

Offline Walter20210

  • Hero Member
  • ****
  • Posts: 1,102
  • Gender: Male
  • I keep loving the old things :P
    • View Profile
    • YouTube Account
Re: c00ld0c26 Presents : Extreamly Detailed Lua Tutorial
« Reply #13 on: June 24, 2013, 10:32:40 AM »
Can i make jimmy has good standing with the townperson?

Im not sure if its possible in lua, cuz I dont know if the townpersons are considered a faction...

They are a faction and this should make them be good with you, and even help you if i remember fine.

Code: [Select]
PedSetTypeToTypeAttitude(9, 13, 4)

Offline c00ld0c26

  • The D0c
  • Can't Get Enough
  • *****
  • Posts: 5,137
  • Gender: Male
  • Just a dood doing dood things.
    • View Profile
    • My channel.
Re: c00ld0c26 Presents : Extreamly Detailed Lua Tutorial
« Reply #14 on: June 24, 2013, 10:34:03 AM »
They are considered a faction? Thats good, and now I know their ID is 9 :D
I will be making a id list for this command next time.