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


Author Topic: Changing Faction Respect w/ Lua  (Read 9836 times)

0 Members and 4 Guests are viewing this topic.

Offline thedotman

  • Newbie
  • *
  • Posts: 0
    • View Profile
Changing Faction Respect w/ Lua
« on: April 25, 2013, 07:44:36 PM »
I need help. My goal is to change the faction's respect towards Jimmy. I know for a fact this cannot be done in the attitudes.dat or the pedstats.dat. I 've found what I think is the correct code on some other posts, (pedsettypetotypeattitude .(1, 13, 0)), but i dont understand some things.

What does the last number, 0, represent? The repect percentage, maybe?
I tried putting this in notepad + + as luascript.lua, and i sucessfully compiled it to ArcRace1.lur, but all i got was an infinite loading screen.

I dont understand lua well. All i did was put in the above code, add (setfactionrespect (1, 0)) beneath it, pressed enter, and repeated for most other factions and saved it.

My question is, is there more code i need to put into it? Or maybe i should compile it into a different type of script? Or maybe I'm going about this all wrong? Please help.

Offline Walter20210

  • Hero Member
  • ****
  • Posts: 1,102
  • Gender: Male
  • I keep loving the old things :P
    • View Profile
    • YouTube Account
Re: Changing Faction Respect w/ Lua
« Reply #1 on: April 25, 2013, 08:53:03 PM »
Ok to change a faction you have to put this :

PedSetFaction(gPlayer, 11)
This will change the player faction to bully

All the factions are in the attitude file
I will show you all of them

Code: [Select]
Prefect = 0
Nerd = 1
Jock = 2
Dropout =3
Greaser =4
Preppy = 5
Student = 6
Cop = 7
Teacher = 8
Townsperson = 9
ShopKeep = 10
Bully = 11
Player2 = 12
Player = 13

And the code to make a faction hate another faction is this :

PedSetTypeToTypeAttitude(2, 13, 11)

The first number is the faction who will change is attitude at the other faction
The second is the faction who the first faction will hate,ignore etc..
And the third one is the Respect they have for example if you put 1 will hate you
Here is all the numbers :

Code: [Select]
0 = Abhor
1 = Averse
2 = Dispassionate
3 = Dig
4 = Adore

I think this will help you ;)

Offline thedotman

  • Newbie
  • *
  • Posts: 0
    • View Profile
Re: Changing Faction Respect w/ Lua
« Reply #2 on: April 25, 2013, 09:33:33 PM »
Okay, I think I understand.

So, for the sake of clarity, let me give an example. If I wanted everyone to be, more or less, indifferent to Jimmy, the code that goes into Notepad++ would look like this:
Code: [Select]
PedSetFaction(gPlayer, 11)

PedSetTypeToTypeAttitude(2, 13, 2)

PedSetTypeToTypeAttitude(1, 13, 2)

PedSetTypeToTypeAttitude(4, 13, 2)

PedSetTypeToTypeAttitude(5, 13, 2)

PedSetTypeToTypeAttitude(6, 13, 3)

PedSetTypeToTypeAttitude(11, 13, 2)

Right? And then all I would have to do is compile it into the ArcRace1.lur file, and then use the arcade machine in the Boys Dorm to activate it's effects, correct? Is that how it's done?

Offline Walter20210

  • Hero Member
  • ****
  • Posts: 1,102
  • Gender: Male
  • I keep loving the old things :P
    • View Profile
    • YouTube Account
Re: Changing Faction Respect w/ Lua
« Reply #3 on: April 25, 2013, 09:38:00 PM »
Yeah and you dont need to use the PedSetfaction

I should think you will know it will be like this

Code: [Select]
MissionSetup = function()
  local l_1_0 = 270
  local l_1_1 = -110
  local l_1_2 = 6.4000000953674
  AreaTransitionXYZ(0, l_1_0, l_1_1, l_1_2)
  PedSetTypeToTypeAttitude(2, 13, 2)
  PedSetTypeToTypeAttitude(1, 13, 2)
  PedSetTypeToTypeAttitude(4, 13, 2)
  PedSetTypeToTypeAttitude(5, 13, 2)
  PedSetTypeToTypeAttitude(6, 13, 3)
  PedSetTypeToTypeAttitude(11, 13, 2)
end

MissionCleanup = function()
  EnablePOI()
  gMissionRunning = false
end

Offline thedotman

  • Newbie
  • *
  • Posts: 0
    • View Profile
Re: Changing Faction Respect w/ Lua
« Reply #4 on: April 25, 2013, 09:45:01 PM »
Ohhhh, THAT'S why. . .that's what. . .ohhhhhhh  :o

It all makes sense now. That's why you need the mission coding, 'cause when you use the arcade machine, it starts the mission, and you need the coding in order to end it, and return to the game. . . .ohhhhhh. See, I thought mission coding was SOLELY for the sake of creating a mission, and not for manipulating in-game scripts. But I get it now!

THANK YOU SO MUCH! I finally understand, more or less, how Lua coding works. THANK YOU A MILLION TIMES!  :D

Offline MadmaN

  • Bully-Board Admin Team
  • Newbie
  • *
  • Posts: 0
  • Gender: Male
  • Biblio-Techa Mods (retired)
    • View Profile
Re: Changing Faction Respect w/ Lua
« Reply #5 on: April 25, 2013, 10:02:57 PM »
If you need further help just post and one of us will help you out.

Glad to see you catching on to lua code pretty quickly. Means there is hope yet for this community to go further then the gta community did.

I would have helped you as soon as you posted but have been very busy on a mod everyone has wanted since time started....hehe.

I will be making a official announcement with screenshots about this real real soon.
« Last Edit: April 25, 2013, 10:05:09 PM by |XF|-MadmaN[AR] »

Offline Walter20210

  • Hero Member
  • ****
  • Posts: 1,102
  • Gender: Male
  • I keep loving the old things :P
    • View Profile
    • YouTube Account
Re: Changing Faction Respect w/ Lua
« Reply #6 on: April 25, 2013, 10:23:51 PM »
Good to know that =D

@thedotman
No problem

Offline thedotman

  • Newbie
  • *
  • Posts: 0
    • View Profile
Re: Changing Faction Respect w/ Lua
« Reply #7 on: April 26, 2013, 12:10:42 AM »
I have another question. The code you (Walter20210) gave me:
Code: [Select]
MissionSetup = function()
  local l_1_0 = 270
  local l_1_1 = -110
  local l_1_2 = 6.4000000953674
  AreaTransitionXYZ(0, l_1_0, l_1_1, l_1_2)
  PedSetTypeToTypeAttitude(2, 13, 2)
  PedSetTypeToTypeAttitude(1, 13, 2)
  PedSetTypeToTypeAttitude(4, 13, 2)
  PedSetTypeToTypeAttitude(5, 13, 2)
  PedSetTypeToTypeAttitude(6, 13, 3)
  PedSetTypeToTypeAttitude(11, 13, 2)
end

MissionCleanup = function()
  EnablePOI()
  gMissionRunning = false
end
It works almost perfectly, but the only problem I have is that time, classes, and missions all disappear from the game completely. I'm guessing that I need a code to set the game, after using this modded mission, into a specific state in time in the story (i.e. Chapter 2 Mission 3) so that it can load all the other circumstances that come with that state in time, including being able to do missions and go to classes. I think the code is:
Code: [Select]
DATLoad("2_03.DAT", 2)Is that correct? And if so, does this belong under MissionSetup or MissionCleanUp? Or, is there something else to it?

Offline Red Blaster

  • The BB Arab
  • More Than Halfway There
  • *****
  • Posts: 5,649
  • Gender: Male
  • Hi
    • View Profile
Re: Changing Faction Respect w/ Lua
« Reply #8 on: April 26, 2013, 04:36:14 AM »
The reason is because you used the arcade machine. This is considered a "mission" script if you will...meaning all other mission scripts will be disabled.

And DATLoad just loads the Trigger file for mission script 2_03.lua (the trigger file is 2_03.dat). This makes it so you can use spawn points or load objects from that mission.

Offline thedotman

  • Newbie
  • *
  • Posts: 0
    • View Profile
Re: Changing Faction Respect w/ Lua
« Reply #9 on: April 26, 2013, 02:25:08 PM »
Okay. So, if I were to compile the the above code into a different script (one that does not stray from the free-roam type game-play, like how the arcade machine changes), would it work out that way?
Or, is it the code itself that is a "mission" script, and therefore will always disable other missions regardless of where it is compiled?
Or even, is there more code that can be inserted beneath MissionCleanup that will activate the other missions and classes again, like how the default script for the arcade machine brings the player back into free-roam with all the same circumstances as when they started playing the machine?

Offline Red Blaster

  • The BB Arab
  • More Than Halfway There
  • *****
  • Posts: 5,649
  • Gender: Male
  • Hi
    • View Profile
Re: Changing Faction Respect w/ Lua
« Reply #10 on: April 27, 2013, 02:15:30 PM »
I think the attitude you set in that script would be overridden even if you imported in another script that's always loaded.

Maybe unless you restart the game from the beginning.

Offline thedotman

  • Newbie
  • *
  • Posts: 0
    • View Profile
Re: Changing Faction Respect w/ Lua
« Reply #11 on: April 27, 2013, 07:18:13 PM »
Yeah, I think your right. I think that most, if not all, the faction changes are hardwired into each story mission, because nothing changes faction respect except story progression (which I personally hate, but whatever). So, in order to change faction levels while still allowing the game to take it's normal course would mean changing values in each story mission individually. (It almost seems like Rockstar was going to allow something like dynamic faction changing, since Attitude.dat allows from changes towards the player. Hmmmmm.)

And since all the script is almost impossible (for me) to read and manipulate, then I guess that's all a lost cause (for now, until I get the patience to try and decipher it).  :-\ Thanks for the replies though.  :)


Offline Mick3Mouse

  • Obam3mouse
  • Bullworth Junkie
  • ****
  • Posts: 4,343
  • Gender: Male
  • Major Mick3Mouse Algie Hunter
    • View Profile
    • My youtube
Re: Changing Faction Respect w/ Lua
« Reply #12 on: May 12, 2013, 04:35:28 PM »
So if i want the jocks to abhor prefects i put this code?

PedSetTypeToTypeAttitude(0, 2, 0)  ??????



Offline Red Blaster

  • The BB Arab
  • More Than Halfway There
  • *****
  • Posts: 5,649
  • Gender: Male
  • Hi
    • View Profile
Re: Changing Faction Respect w/ Lua
« Reply #13 on: May 13, 2013, 01:05:48 AM »
So if i want the jocks to abhor prefects i put this code?

PedSetTypeToTypeAttitude(0, 2, 0)  ??????

I'm not sure which number the prefect faction is, but it would be PedSetTypeToTypeAttitude(2, [prefect id], 0)

Offline Mick3Mouse

  • Obam3mouse
  • Bullworth Junkie
  • ****
  • Posts: 4,343
  • Gender: Male
  • Major Mick3Mouse Algie Hunter
    • View Profile
    • My youtube
Re: Changing Faction Respect w/ Lua
« Reply #14 on: May 13, 2013, 03:24:25 AM »
prefects faction number is 0 so that will be PedSetTypeToTypeAttitude(2, 0, 0)???


is that right