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


Author Topic: Local Multiplayer Tutorial  (Read 10789 times)

0 Members and 1 Guest are viewing this topic.

Offline DaBOSS54320

  • Hero Member
  • ****
  • Posts: 3,398
  • Gender: Female
    • View Profile
Local Multiplayer Tutorial
« on: July 24, 2013, 02:52:58 AM »
This is actually a very easy thing to do. If you don't know, local is only on your device. I say device instead of computer because if you have a hacked console you can do this too.
It is actually very simple, but I still think it is cool. You can do it for multiple people to, but mind the camera is NOT split screen, it will focus on P1.
Here's how it works, only 2 things happen. You spawn a ped, and you assign control of him to another controller. FYI: If your on a computer, and using a gamepad, the keyboard is the 2nd controller.

Step 1) Learn basic Bully LUA script modding. There is a good number of tutorials out there, I recommend mine personally but whatever you think is best for you. SWEGTA has video tutorials too (Mine: http://www.bully-board.com/index.php?topic=18968.0)

Step 2) Learn how to make scripts run in free mode unless you want to only player multiplayer be activating another script (Such as Arcrace1.lur"). I'm unaware of any other tutorials on this other then mine: http://www.bully-board.com/index.php?topic=18886.0

Step 3) In the main function of your LUA script (Which is hopefully a copy of STimeCycle.lur with the modifications required to make it work, as explained in my tutorial. (The only modification you need to do is make Wait(1000) to Wait(0). If your making this in a different script (Like Arcrace1.lur, then ignore that. So in the main function, put code for spawning a ped.
Variable = PedCreateXYZ(#,x,y,z)
Replace Variable with a name for the second player, this can be anything you'd like. Even cheese-monster if you wanted to for whatever reason. This will come into play the next step.
Replace # with the model number. (List of all models in the "default.ide" file in Objects folder, or my player selector if you want to see a bit of a preview of the models to (http://www.bully-board.com/index.php?action=downloads;sa=view;down=128) you probably just need to go in the default.ide but if you don't know a name, check out my selector, it tells you all the models. Anyway, now replace x with the x co-ordinate. Same with y and z. You can use |XF|-MadmaN [AR]'s co-ord grabber mod to find them. If you want to spawn in front of boy's dorm (Because I have this code memorized) it is 270,-110,7
If you are in the STimeCycle.lur to run in free mode, put a Wait(1000) before the PedCreateXYZ()
Side note: This step should be in the main function BEFORE the repeat loop.

Step 4) Assign the ped the code for him being controlled from another controller.
PedSetControllerID(ped,#)
Replace ped with the variable assigned to PedCreateXYZ()
Replace # with the controller number.
Note: Controller 1 is actually 0, and the second is 1, third is 2, and so on.
Note: This also goes before the repeat function.

Optional Step 5) Make your ped have Jimmy's fighting style (Or any fighting style)
PedSetActionTree(ped,style,location)
Replace ped with the variable used for the second player
Replace style with the style (Found in default.ide)
Replace location with the location of the style (Found in default.ide)

Step 6) To make the ped/second player able to run/ride bikes, we need to give the ped player AI
Similar to fighting style, but with AI
PedSetAITree(ped,AI,location)
Replace ped with the variable used for the second player
Replace AI with the AI (Found in default.ide)
Replace location with the location of the AI (Found in default.ide)

Step 7) Do all the compiling things you need to do and PLAY!

Congratulations! You now have local multiplayer in Bully! That wasn't so hard was it?
Make sure to keep the other players near you, because the camera only focuses on player 1.
Have fun, message me any questions.

Oh, and if your wondering why Wait(1000) was put before spawning the ped and, it was because when in free-mode you can not INSTANTLY spawn things. I figured this out the hard way by many many failed attempts  >:(

I may make a bigger version of this with some more features for download, maybe not though... it'd have warping the players near player 1, and switching the camera, etc.

Oh, and tip: If you just followed the instructions on here, mind that the second play will NOT spawn right next to you, he will spawn at the co-ords you assigned him to! In my example, in front of the boy's dorm.

EXAMPLE (Using STimeCycle.lur/free mode method, but only showing the main function as the rest of the code stays the same)

Code: [Select]
main = function()
  SecondPlayer = PedCreateXYZ(12,270,-110,7)
  ThirdPlayer = PedCreateXYZ(75,270,-105,7)
 
  PedSetActionTree(SecondPlayer,"/Global/Player","Act/Player.act")
  PedSetActionTree(ThirdPlayer,"/Global/Player","Act/Player.act")

  PedSetAITree(SecondPlayer,"/Global/PlayerAI","Act/PlayerAI.act") 
  PedSetAITree(ThirdPlayer,"/Global/PlayerAI","Act/PlayerAI.act")

  PedSetControllerID(SecondPlayer,1)
  PedSetControllerID(ThirdPlayer,2)
 
  repeat
    Wait(0)
  until not Alive
end
« Last Edit: July 24, 2013, 04:10:40 AM by DaBOSS54320 »

Offline c00ld0c26

  • The D0c
  • Moderator
  • Can't Get Enough
  • *****
  • Posts: 5,137
  • Gender: Male
  • Just a dood doing dood things.
    • View Profile
    • My channel.
Re: Local Multiplayer Tutorial
« Reply #1 on: July 24, 2013, 02:57:02 AM »
Nice man.
Good job

Offline DaBOSS54320

  • Hero Member
  • ****
  • Posts: 3,398
  • Gender: Female
    • View Profile
Re: Local Multiplayer Tutorial
« Reply #2 on: July 24, 2013, 03:02:29 AM »
^ Thanks!

deadpoolXYZ

  • Guest
Re: Local Multiplayer Tutorial
« Reply #3 on: July 24, 2013, 11:30:54 AM »
I tried doing this when someone told me about PedSetControllerID(), but the only problem is that I don't have an xbox controller. :/

What is supposed to use the third player?

Offline Red Blaster

  • The BB Arab
  • More Than Halfway There
  • *****
  • Posts: 5,649
  • Gender: Male
  • Hi
    • View Profile
Re: Local Multiplayer Tutorial
« Reply #4 on: July 24, 2013, 03:50:42 PM »
I tried doing this when someone told me about PedSetControllerID(), but the only problem is that I don't have an xbox controller. :/

What is supposed to use the third player?

A second Xbox controller.

Offline Unstoppable12

  • Jr. Member
  • **
  • Posts: 15
  • Gender: Male
    • View Profile
Re: Local Multiplayer Tutorial
« Reply #5 on: August 10, 2013, 07:45:51 AM »
is there any video or picture?

Offline Al Arlington

  • 101A
  • Hero Member
  • ****
  • Posts: 3,179
  • Gender: Male
  • Money Handler
    • View Profile
    • My Official Youtube Channel
Re: Local Multiplayer Tutorial
« Reply #6 on: August 10, 2013, 08:11:34 AM »
I tried doing this when someone told me about PedSetControllerID(), but the only problem is that I don't have an xbox controller. :/
You can get very cheap Pre-Owned Xbox controllers for £5. Probably $10 in U.S money.
Be warned: They may have sticky buttons....

Offline DaBOSS54320

  • Hero Member
  • ****
  • Posts: 3,398
  • Gender: Female
    • View Profile
Re: Local Multiplayer Tutorial
« Reply #7 on: August 10, 2013, 10:23:16 AM »
Tip: PS3 controllers can be used for Bully via DS3 tool: http://www.motioninjoy.com/download
Bully-Board download for buttons: http://www.bully-board.com/index.php?action=downloads;sa=view;down=113
I use a PS3 controller for my Bully so I can confirm that it works just fine.

deadpoolXYZ

  • Guest
Re: Local Multiplayer Tutorial
« Reply #8 on: August 10, 2013, 01:48:00 PM »
I tried doing this when someone told me about PedSetControllerID(), but the only problem is that I don't have an xbox controller. :/
You can get very cheap Pre-Owned Xbox controllers for £5. Probably $10 in U.S money.
Be warned: They may have sticky buttons....

I know a friend who owns an xbox controller. I may borrow his controller for a day or 2 and try the multiplayer mod.

Offline Unstoppable12

  • Jr. Member
  • **
  • Posts: 15
  • Gender: Male
    • View Profile
Re: Local Multiplayer Tutorial
« Reply #9 on: August 11, 2013, 07:39:17 AM »
You can get very cheap Pre-Owned Xbox controllers for £5. Probably $10 in U.S money.
Be warned: They may have sticky buttons....
[/quote]

can i use xbox 360 slim controller? (black colour), i dont know how to connect it to my pc

Offline residenteviloutbreak

  • Go away.
  • Full Member
  • ***
  • Posts: 343
  • Gender: Male
  • "Did someone crap in your bed?"
    • View Profile
Re: Local Multiplayer Tutorial
« Reply #10 on: August 11, 2013, 07:58:00 AM »
If someone can somehow hack the game to allow people to follow a specific player, this would be epic. Too bad the developers of SA Multiplayer have no intention to help with this project. Which is a shame, considering that SA uses the same game engine and code as bully, it would seem that it SHOULD of been a walk in the park.

Offline Evolution

  • Elitist
  • *********
  • Posts: 13,574
  • Gender: Male
    • View Profile
Re: Local Multiplayer Tutorial
« Reply #11 on: August 11, 2013, 08:10:10 AM »
Pretty sure that the SA engine and Bully engine are completely different from one another.

Offline DaBOSS54320

  • Hero Member
  • ****
  • Posts: 3,398
  • Gender: Female
    • View Profile
Re: Local Multiplayer Tutorial
« Reply #12 on: August 11, 2013, 11:39:18 AM »
Quote
If someone can somehow hack the game to allow people to follow a specific player, this would be epic. Too bad the developers of SA Multiplayer have no intention to help with this project. Which is a shame, considering that SA uses the same game engine and code as bully, it would seem that it SHOULD of been a walk in the park.
Very easy to make the camera follow another ped. Just one function is needed.
Also I'm working on BAMP which is going not too bad.

deadpoolXYZ

  • Guest
Re: Local Multiplayer Tutorial
« Reply #13 on: August 11, 2013, 01:03:53 PM »
Daboss, you said change ai,etc.. At default.ide but nothing change i set edgar his ai nothing happen, i putted the right ai code nothing change

You can edit whatever you want in default.ide but it doesn't change anything in the game. Don't you mean ide.img?

Offline DaBOSS54320

  • Hero Member
  • ****
  • Posts: 3,398
  • Gender: Female
    • View Profile
Re: Local Multiplayer Tutorial
« Reply #14 on: August 11, 2013, 04:06:08 PM »
^ default.ide is a the source of a file inside of ide.img. If you hex edit ide.img you can see the compiled default.ide contents. Or if you wish extract the default.ide from the ide.img and then edit it, then put it back in. Both have the same effect.