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


Author Topic: Enable Fighting Prefects  (Read 2552 times)

0 Members and 1 Guest are viewing this topic.

Offline Unknownsoldier

  • Hero Member
  • ****
  • Posts: 2,773
    • View Profile
Enable Fighting Prefects
« on: January 29, 2015, 07:20:50 PM »
This function will allow you the attack prefects, not get red meter, and also be able to have the prefects FIGHT back at the player(instead of busting), when the player is attacking:

Code: [Select]
function F_CantBeBusted(F_CantBeBusted_max001, F_CantBeBusted_isRunning001)
   Wait(0)
  repeat
    local pedG = PedGetGrappleTargetPed(gPlayer)
    if PedGetFaction(PedGetGrappleTargetPed(gPlayer)) == 0 or PedGetFaction(PedGetGrappleTargetPed(gPlayer)) == 7 or PedGetFaction(PedGetGrappleTargetPed(gPlayer)) == 8 or PedGetFaction(PedGetGrappleTargetPed(gPlayer)) == 9 or PedGetFaction(PedGetGrappleTargetPed(gPlayer)) == 10 then
PedSetActionNode(PedGetGrappleTargetPed(gPlayer), "/Global/1_02/ShortIdle", "Act/Conv/1_02.act")
PedSetActionNode(gPlayer, "/Global/1_02/ShortIdle", "Act/Conv/1_02.act")
PedSetFaction(PedGetGrappleTargetPed(gPlayer),6)
Wait(1)
PedSetActionNode(gPlayer,"/Global/Player","Act/Player.act")
  elseif PlayerGetPunishmentPoints() > F_CantBeBusted_max001then
    PlayerSetPunishmentPoints(F_CantBeBusted_max001)
  end
  Wait(0)
  until not F_CantBeBusted_isRunning001
end 

Here is how to make it work in your mod:

This function should only be called once in your script instead of repeating.

Simply, Copy&Paste the function into an empty space in your script, then, in a function that only runs once(eg. MissionSetup, main, F_MissionSetup etc.), use these perimeters:

F_CantBeBusted(Max_Trouble_Points, true)

Replace "Max_Trouble_Points" with the highest amount of points YOU want it to go to. Here is an example of it being used in a script:

Code: [Select]
function MissionSetup()
  AreaTransitionXYZ(0, 270, -110, 7)
  PlayerSetHealth(500)
end

function MissionCleanup()
  collectgarbage()
end

function main()
 
  F_CantBeBusted(200, true)
 
  gMissionRunning = true
  while gMissionRunning do
    Wait(0)
  end
end

function F_CantBeBusted(F_CantBeBusted_max001, F_CantBeBusted_isRunning001)
   Wait(0)
  repeat
    local pedG = PedGetGrappleTargetPed(gPlayer)
    if PedGetFaction(PedGetGrappleTargetPed(gPlayer)) == 0 or PedGetFaction(PedGetGrappleTargetPed(gPlayer)) == 7 or PedGetFaction(PedGetGrappleTargetPed(gPlayer)) == 8 or PedGetFaction(PedGetGrappleTargetPed(gPlayer)) == 9 or PedGetFaction(PedGetGrappleTargetPed(gPlayer)) == 10 then
PedSetActionNode(PedGetGrappleTargetPed(gPlayer), "/Global/1_02/ShortIdle", "Act/Conv/1_02.act")
PedSetActionNode(gPlayer, "/Global/1_02/ShortIdle", "Act/Conv/1_02.act")
PedSetFaction(PedGetGrappleTargetPed(gPlayer),6)
Wait(1)
PedSetActionNode(gPlayer,"/Global/Player","Act/Player.act")
  elseif PlayerGetPunishmentPoints() > F_CantBeBusted_max001then
    PlayerSetPunishmentPoints(F_CantBeBusted_max001)
  end
  Wait(0)
  until not F_CantBeBusted_isRunning001
end 

Note that I used "200" as max, because 200 points is RIGHT before red.

Offline DaBOSS54320

  • Hero Member
  • ****
  • Posts: 3,398
  • Gender: Female
    • View Profile
Re: Enable Fighting Prefects
« Reply #1 on: January 31, 2015, 12:58:01 PM »
You should make it run on it's own thread, so it won't hold up the rest of the script.

Offline GamerLover98

  • Jr. Member
  • **
  • Posts: 6
  • I LOVE PLAYIN GAMES LIKE BULLY!!! XD
    • View Profile
Re: Enable Fighting Prefects
« Reply #2 on: May 05, 2015, 06:09:39 PM »
What file is this and what tool did you use?

Offline DahCobra33

  • Decepticon
  • Hero Member
  • ****
  • Posts: 3,057
  • Gender: Male
  • I don't deal with psychos,I put em' away...
    • View Profile
Re: Enable Fighting Prefects
« Reply #3 on: May 05, 2015, 09:28:30 PM »
As far as I know,LUA can be done through NotePad(or more advanced programs like it)I think C+++ as well
If I'm wrong correct me please

Offline Unknownsoldier

  • Hero Member
  • ****
  • Posts: 2,773
    • View Profile
Re: Enable Fighting Prefects
« Reply #4 on: May 05, 2015, 10:38:43 PM »
What file is this and what tool did you use?
STimeCycle



As far as I know,LUA can be done through NotePad(or more advanced programs like it)I think C+++ as well
If I'm wrong correct me please
Most modders here(along with myself) use Notepad++.

Offline DahCobra33

  • Decepticon
  • Hero Member
  • ****
  • Posts: 3,057
  • Gender: Male
  • I don't deal with psychos,I put em' away...
    • View Profile
Re: Enable Fighting Prefects
« Reply #5 on: May 06, 2015, 05:52:50 PM »
Close enough.

Offline Unknownsoldier

  • Hero Member
  • ****
  • Posts: 2,773
    • View Profile
Re: Enable Fighting Prefects
« Reply #6 on: May 06, 2015, 05:59:28 PM »

Offline denizthebest

  • Jr. Member
  • **
  • Posts: 85
  • Half way there.
    • View Profile
Re: Enable Fighting Prefects
« Reply #7 on: July 14, 2015, 11:43:53 AM »
İ will use it in future

Offline Unknownsoldier

  • Hero Member
  • ****
  • Posts: 2,773
    • View Profile
Re: Enable Fighting Prefects
« Reply #8 on: July 14, 2015, 05:36:20 PM »
You should make it run on it's own thread, so it won't hold up the rest of the script.
I dunno how to call a thread with arguments/perimeters.  :blank: