Bully-Board

Bully Modding Section => Script Modding => Topic started by: Unknownsoldier on January 29, 2015, 07:20:50 PM

Title: Enable Fighting Prefects
Post by: Unknownsoldier 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.
Title: Re: Enable Fighting Prefects
Post by: DaBOSS54320 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.
Title: Re: Enable Fighting Prefects
Post by: GamerLover98 on May 05, 2015, 06:09:39 PM
What file is this and what tool did you use?
Title: Re: Enable Fighting Prefects
Post by: DahCobra33 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
Title: Re: Enable Fighting Prefects
Post by: Unknownsoldier 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++.
Title: Re: Enable Fighting Prefects
Post by: DahCobra33 on May 06, 2015, 05:52:50 PM
Close enough.
Title: Re: Enable Fighting Prefects
Post by: Unknownsoldier on May 06, 2015, 05:59:28 PM
Close enough.
yea lol
Title: Re: Enable Fighting Prefects
Post by: denizthebest on July 14, 2015, 11:43:53 AM
İ will use it in future
Title: Re: Enable Fighting Prefects
Post by: Unknownsoldier 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: