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


Author Topic: Run like other peds (SOURCE)  (Read 4592 times)

0 Members and 1 Guest are viewing this topic.

Offline Goatth

  • Count Grishnackh
  • Jr. Member
  • **
  • Posts: 27
  • Gender: Male
    • View Profile
Run like other peds (SOURCE)
« on: February 13, 2015, 10:33:02 AM »
i made one code to run like the other peds, just press the punch button while is moving(and ped is not valid). But you can change the way you want.

 here it is:
Code: [Select]
elseif IsButtonBeingPressed(6, 0) and IsMoving() and not IsRunning and not (PedIsValid(PedGetGrappleTargetPed(gPlayer)) or PedIsValid(PedGetTargetPed())) then
     ExecuteActionNode(gPlayer, "/Global/STYLE HERE/Default_KEY/ExecuteNodes/Free/RunBasic", "Act/Anim/STYLE HERE.act")
IsRunning = true
 elseif PedIsPlaying(gPlayer, "/Global/STYLE HERE/Default_KEY/ExecuteNodes/Free/RunBasic", "Act/Anim/STYLE HERE.act") and IsRunning and not IsMoving() then
     PedSetActionTree(gPlayer,"/Global/STYLE HERE", "Act/Anim/STYLE HERE.act")
     IsRunning = false
 elseif IsMoving() and not PedIsPlaying(gPlayer, "/Global/STYLE HERE/Default_KEY/ExecuteNodes/Free/RunBasic", "Act/Anim/STYLE HERE.act") then
     IsRunning = false

Don't forget to change the "STYLE HERE" for the style you're using

Offline GreenOmnitrix

  • XFire: jedijosh920
  • Full Member
  • ***
  • Posts: 292
  • Gender: Male
  • 欺負改裝是真棒
    • View Profile
    • YouTube Channel
Re: Run like other peds (SOURCE)
« Reply #1 on: February 13, 2015, 11:47:21 AM »
Good job, but where are the IsRunning and IsMoving functions that you called? Also if you had a controller and used a fighting style and use the sprint button and move the controller stick lightly, you could jog like NPCs, but this is helpful for keyboard users.
« Last Edit: February 13, 2015, 11:53:39 AM by GreenOmnitrix »

Offline Goatth

  • Count Grishnackh
  • Jr. Member
  • **
  • Posts: 27
  • Gender: Male
    • View Profile
Re: Run like other peds (SOURCE)
« Reply #2 on: February 13, 2015, 12:08:51 PM »
Yes, is for the keyboard users. And i forget about the is moving, just add this into the repeat/while loop:
Code: [Select]
function IsMoving()
  local s = 0.08 -- sensitivity
  return GetStickValue(16,c) > s or GetStickValue(16,c) < -s or GetStickValue(17,c) > s or GetStickValue(17,c) < -s
end


 And the "IsRunning" is not a function i just use to avoid conflicts with other action nodes
« Last Edit: February 13, 2015, 12:13:59 PM by Goatth »

Offline Goatth

  • Count Grishnackh
  • Jr. Member
  • **
  • Posts: 27
  • Gender: Male
    • View Profile
Re: Run like other peds (SOURCE)
« Reply #3 on: February 13, 2015, 12:12:01 PM »
And i'm not "kami".

Offline GreenOmnitrix

  • XFire: jedijosh920
  • Full Member
  • ***
  • Posts: 292
  • Gender: Male
  • 欺負改裝是真棒
    • View Profile
    • YouTube Channel
Re: Run like other peds (SOURCE)
« Reply #4 on: February 13, 2015, 12:30:04 PM »
And i'm not "kami".

Well, sorry for accusing you, I just got mad and turned into a "credit whore" like some other people on this board, but I truly apologize.

Offline Goatth

  • Count Grishnackh
  • Jr. Member
  • **
  • Posts: 27
  • Gender: Male
    • View Profile
Re: Run like other peds (SOURCE)
« Reply #5 on: February 13, 2015, 12:56:52 PM »
it's okay. i'll add your skype again

Offline Unknownsoldier

  • Hero Member
  • ****
  • Posts: 2,773
    • View Profile
Re: Run like other peds (SOURCE)
« Reply #6 on: February 13, 2015, 02:19:15 PM »
Nice work!  :D

And i'm not "kami".

Well, sorry for accusing you, I just got mad and turned into a "credit whore" like some other people on this board, but I truly apologize.
dont worry be happy thanck !

Offline Goatth

  • Count Grishnackh
  • Jr. Member
  • **
  • Posts: 27
  • Gender: Male
    • View Profile
Re: Run like other peds (SOURCE)
« Reply #7 on: February 13, 2015, 02:49:28 PM »
Nice work!  :D

And i'm not "kami".

Well, sorry for accusing you, I just got mad and turned into a "credit whore" like some other people on this board, but I truly apologize.
dont worry be happy thanck !

lel

Offline SWEGTA

  • Da Forum Luffs Me!
  • *****
  • Posts: 6,423
  • Gender: Male
  • Swee Gee Tee Ayy
    • View Profile
    • Bully & GTA videos
Re: Run like other peds (SOURCE)
« Reply #8 on: February 13, 2015, 03:41:00 PM »
Everybody Gay!
(gay=happy)

Offline Goatth

  • Count Grishnackh
  • Jr. Member
  • **
  • Posts: 27
  • Gender: Male
    • View Profile
Re: Run like other peds (SOURCE)
« Reply #9 on: February 13, 2015, 04:18:25 PM »
w0t the lel