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 74174 times)

0 Members and 1 Guest are viewing this topic.

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 #45 on: December 27, 2012, 09:54:21 PM »
If you are referring to my multi bodyguard script it is here http://www.bully-board.com/index.php?topic=17595.0

scroll down to Red's message because he posted the fixed version of the script since the version I posted has a couple minor errors that prevent it from working that I never spotted due to not having touched this script in quite some time...since I am going in a different direction with multiple bodyguards for a mod.

This mod was really more of a learning curve for me to nail down a lot of the bully specific scripting so I could get a really good feel for how the script structure had to be done for bully itself rather then as a generic lua script that can run on its own.

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 #46 on: December 28, 2012, 01:09:37 AM »
It's in another thread within this section.

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 #47 on: December 28, 2012, 01:11:13 AM »
Change "4" to "2", then when the script starts, press the up arrow. If that doesn't work...something is wrong.

Quote
Well... that's the entire code.
The problem is that I don't know what is missing.

Well, for one: You need the main = function()

It's like this:

MissionSetup = function()

^ That's where you add the stuff like where Jimmy spawns and any text if you want.

Then there's the F_SetupMission = function() part you posted.

Afterwards, you add the main = function() part.

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

  end -- End Statement
end

I get a text saying:

"=" expected near 'gMissionRunning'

There is already a =.
I doubt it should go next to the other 'gMissionRunning'

EDIT:




Probs because I forgot the () in F_MissionSetup().

Anyways, congrats on fixing it.  ;)

Offline xXxNarumi

  • Apprehended (Captured)
  • Hero Member
  • ****
  • Posts: 2,641
  • Gender: Male
  • xNarumi wont be missed.
    • View Profile
Re: *RELEASE* - Bully LUA Script Sources (just a few)
« Reply #48 on: December 28, 2012, 05:35:22 AM »
This sorta reminds me of Packet Editor.

deadpoolXYZ

  • Guest
Re: *RELEASE* - Bully LUA Script Sources (just a few)
« Reply #49 on: December 28, 2012, 06:38:17 PM »
When I spawn Gary as a bodyguard, he just hold hands with Jimmy like in the carnival date mission with Pinky.
By the way, Gary has his boss AI in the ide.img. Is this the problem?




Bro fist! xD

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 #50 on: December 29, 2012, 03:35:19 AM »
Remove , true from the PedRecruitAlly line. Having , true will cause the spawned ped to hold hands with the player.

deadpoolXYZ

  • Guest
Re: *RELEASE* - Bully LUA Script Sources (just a few)
« Reply #51 on: December 29, 2012, 07:09:03 PM »
Im having a problem giving fighting styles. When I start the arcade machine the game crashes.
This is the code:

Code: [Select]
MissionSetup = function()
local l_1_0 = 270
local l_1_1 = -110
local l_1_2 = 5.009
PlayerSetHealth(200)
AreaTransitionXYZ(0, l_1_0, l_1_1, l_1_2)
PedCreateXYZ(112, 271, -109, 5.009)
PedSetActionTree(112, "/Global/J_Grappler_A", "Act/Anim/J_Grappler_A.act")
end

In the bully magazine you used the “” in the actiontree code part while I used "". If I try to use “”
then the compilator shows me this: "luac: test.lua:8 unexpected symbol near `ô'"

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 #52 on: December 29, 2012, 11:42:49 PM »
Well first off, why are you using PedSetActionTree(112, etc.)? Using the ped ID won't change his or her style. To do that, you have to spawn a ped and have the ped referenced by a local. Then you use that local in place of the ped ID.

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 #53 on: December 30, 2012, 12:29:19 AM »
I think the text got screwed up on the magazine a little bit with the "" marks since I did initially use "" marks and not the other ones that you say are in there.....I will have to check into that and maybe release a fixed issue.....also may be the custom font I am using too.

Red is right on this...you have to reference the ped using locals since assigning the action trees to a simple number will simply confuse the lua interpreter inside bully and it won't know what to make of it. I will give you a example maybe tomorrow if I have time that will hopefully help you with understanding how to assign locals for peds...it also makes the code easier to maintain too in the long run.

deadpoolXYZ

  • Guest
Re: *RELEASE* - Bully LUA Script Sources (just a few)
« Reply #54 on: December 30, 2012, 11:56:52 AM »
I think the text got screwed up on the magazine a little bit with the "" marks since I did initially use "" marks and not the other ones that you say are in there.....I will have to check into that and maybe release a fixed issue.....also may be the custom font I am using too.

Red is right on this...you have to reference the ped using locals since assigning the action trees to a simple number will simply confuse the lua interpreter inside bully and it won't know what to make of it. I will give you a example maybe tomorrow if I have time that will hopefully help you with understanding how to assign locals for peds...it also makes the code easier to maintain too in the long run.

Don't bother to make an example, I fixed it using the locals that Red said.

EDIT:

This is exactly the same code that Madman used for his bodyguard mod with the exception that I removed the part that makes the ped a bodyguard and gave the fighting style to the ped instead of Jimmy. I used the locals but it still crashes.
If I give the fighting style to the player (gPlayer) instead of the ped it doesn't crash but I want the ped to have that fighting style.

Code: [Select]
ImportScript("\\Library\\LibTable.lua")
ImportScript("\\Library\\LibPed.lua")
local l_0_0 = false

MissionSetup = function()
local l_1_0 = 270
local l_1_1 = -110
local l_1_2 = 6.4000000953674
PlayerSetHealth(200)
AreaTransitionXYZ(0, l_1_0, l_1_1, l_1_2)
local l_1_3 = 216
local l_1_4, l_1_5, l_1_6 = PedGetPosXYZ(gPlayer)
local l_1_7 = PedCreateXYZ(l_1_3, l_1_4 + 1, l_1_5 + 1, l_1_6)
PedSetActionTree(l_1_3, "/Global/J_Ted", "Act/Anim/J_Ted")
end

MissionCleanup = function()
end

main = function()
repeat
Wait(0)
until l_0_0 ~= false
Wait(3000)
MissionSucceed()
end
« Last Edit: December 30, 2012, 01:03:46 PM by Ω¢яιмѕση_ƒυяуΩ »

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 #55 on: December 30, 2012, 01:35:38 PM »
I'll get to you tomorrow about this.

Offline JmTsHaW

  • Jr. Member
  • **
  • Posts: 79
  • Gender: Male
    • View Profile
Re: *RELEASE* - Bully LUA Script Sources (just a few)
« Reply #56 on: December 30, 2012, 03:04:06 PM »
Code: [Select]
ImportScript("\\Library\\LibTable.lua")
ImportScript("\\Library\\LibPed.lua")
local l_0_0 = false

MissionSetup = function()
local l_1_0 = 270
local l_1_1 = -110
local l_1_2 = 6.4000000953674
PlayerSetHealth(200)
AreaTransitionXYZ(0, l_1_0, l_1_1, l_1_2)
local l_1_3 = 216
local l_1_4, l_1_5, l_1_6 = PedGetPosXYZ(gPlayer)
local l_1_7 = PedCreateXYZ(l_1_3, l_1_4 + 1, l_1_5 + 1, l_1_6)
PedSetActionTree(l_1_3, "/Global/J_Ted", "Act/Anim/J_Ted")
end

MissionCleanup = function()
end

main = function()
repeat
Wait(0)
until l_0_0 ~= false
Wait(3000)
MissionSucceed()
end

Try changing
PedSetActionTree(l_1_3, "/Global/J_Ted", "Act/Anim/J_Ted")
to
PedSetActionTree(l_1_7, "/Global/J_Ted", "Act/Anim/J_Ted")

It worked for me when I modified the original script to spawn two bodyguards instead of one.
« Last Edit: December 30, 2012, 03:34:06 PM by JmTsHaW »

deadpoolXYZ

  • Guest
Re: *RELEASE* - Bully LUA Script Sources (just a few)
« Reply #57 on: December 30, 2012, 03:43:22 PM »
Thanks it worked.

deadpoolXYZ

  • Guest
Re: *RELEASE* - Bully LUA Script Sources (just a few)
« Reply #58 on: December 30, 2012, 07:29:32 PM »
I figured out (or at least I hope  :P) that SoundPlayInteractiveStream controls the background music and SoundSetHighIntensityStream controls the fighting/bike theme. The problem is that I don't know how to use it properly.

This is what I tried:

Code: [Select]
MissionSetup = function()
local l_1_0 = 270
local l_1_1 = -110
local l_1_2 = 6.4000000953674
PlayerSetHealth(200)
AreaTransitionXYZ(0, l_1_0, l_1_1, l_1_2)
SoundPlayInteractiveStream("MS_TenementsLow.rsm")
SoundSetHighIntensityStream("MS_TenementsMid.rsm")
end

When I start the arcade machine there is no background music nor fighting music.

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 #59 on: December 30, 2012, 10:59:07 PM »
That's because you're forgetting to set the volume level at the end. Add a comma after the rsm" part, then write MUSIC_DEFAULT_VOLUME. Or, you can also add a number (For example, 0.60000002384186, 500, 0).

Also, you're wrong.

SoundSetMidIntensityStream is for bike. High is for fighting.