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


Author Topic: LUA Command  (Read 7055 times)

0 Members and 3 Guests are viewing this topic.

Offline Black Norton

  • Keep Calm
  • Jr. Member
  • **
  • Posts: 86
  • Gender: Male
  • Peace For Respect
    • View Profile
LUA Command
« on: December 04, 2013, 05:19:33 AM »
now i want to try make mission in lua,so can everyone give me a command for :
-make symbol to get ped to the target (like X Symbol in map)
-Make ped to run to the target
-make health ped in top screen like BOSS Fight
-if mission end,back to the normal game

i think only this
thanks  :happy:

deadpoolXYZ

  • Guest
Re: LUA Command
« Reply #1 on: December 04, 2013, 09:23:18 AM »
C00ldoc explained how to do this in another thread. Ask him he knows.

Offline c00ld0c26

  • The D0c
  • Can't Get Enough
  • *****
  • Posts: 5,137
  • Gender: Male
  • Just a dood doing dood things.
    • View Profile
    • My channel.
Re: LUA Command
« Reply #2 on: December 04, 2013, 11:43:17 AM »
Make symbol to get ped to the target  :

NAMEOFBLIP = BlipAddXYZ(X,Y,Z,IDOFTHESYMBOL)

The ID for the X is 29

Ped run to target :

PedMoveToXYZ(PEDNAME,SPEED,X,Y,Z)

Speed = 0 is walk, 1 is jog, 2 is run, 3 is run very very fast

Make health ped in top screen like BOSS fight :

PedShowHealthBar(PEDNAME, true, "N_NAME", true)

if Mission end, back to the normal game :


Put this in the main = function() :

  repeat
    Wait(0)
  until l_0_0 ~= false
  MissionSucceed()

Offline GaryHarrington

  • A Guy Who Likes Open World and FPS Games
  • Sr. Member
  • ***
  • Posts: 515
  • Gender: Male
  • Just Love Bully and GTA ...Nothing Interested
    • View Profile
Re: LUA Command
« Reply #3 on: December 06, 2013, 01:10:00 AM »
Make symbol to get ped to the target  :

NAMEOFBLIP = BlipAddXYZ(X,Y,Z,IDOFTHESYMBOL)

The ID for the X is 29

Ped run to target :

PedMoveToXYZ(PEDNAME,SPEED,X,Y,Z)

Speed = 0 is walk, 1 is jog, 2 is run, 3 is run very very fast

Make health ped in top screen like BOSS fight :

PedShowHealthBar(PEDNAME, true, "N_NAME", true)

if Mission end, back to the normal game :


Put this in the main = function() :

  repeat
    Wait(0)
  until l_0_0 ~= false
  MissionSucceed()

3 is run very fast?like davis in "The Setup"?

Offline c00ld0c26

  • The D0c
  • Can't Get Enough
  • *****
  • Posts: 5,137
  • Gender: Male
  • Just a dood doing dood things.
    • View Profile
    • My channel.
Re: LUA Command
« Reply #4 on: December 06, 2013, 04:09:09 AM »
Idk if the same speed but its faster then Jimmy.

Offline Black Norton

  • Keep Calm
  • Jr. Member
  • **
  • Posts: 86
  • Gender: Male
  • Peace For Respect
    • View Profile
Re: LUA Command
« Reply #5 on: December 06, 2013, 05:34:48 AM »
c00ld i'm getting problem
i write in mission settup like this :

Darby = PedCreateXYZ(37,l_1_0 + 1,l_1_1 + 1,l_1_2 + 1)
PedMoveToXYZ(Darby ,3 ,515,504,19.60971009)

but darby isn't run to the XYZ.he only stay and stand.

and why in PedShowHealthBar,the health isn't decrease??
can you fix it??

Offline c00ld0c26

  • The D0c
  • Can't Get Enough
  • *****
  • Posts: 5,137
  • Gender: Male
  • Just a dood doing dood things.
    • View Profile
    • My channel.
Re: LUA Command
« Reply #6 on: December 06, 2013, 08:44:45 AM »
c00ld i'm getting problem
i write in mission settup like this :

Darby = PedCreateXYZ(37,l_1_0 + 1,l_1_1 + 1,l_1_2 + 1)
PedMoveToXYZ(Darby ,3 ,515,504,19.60971009)

but darby isn't run to the XYZ.he only stay and stand.

and why in PedShowHealthBar,the health isn't decrease??
can you fix it??

PedMoveToXYX - You didn't put the Z coords.
Its like this (PED,SPEED,X,Y,Z)
You all placed the PED,SPEED,X,Y but you didn't wrte the Z (look in the code)
And about PedShowHealthBar make sure you selected the ped you want to see he's health.
Example :

Darby = PedCreateXYZ(ID,X,Y,Z)
PedShowHealthBar(Darby, true, "N_Darby", true)

Offline Black Norton

  • Keep Calm
  • Jr. Member
  • **
  • Posts: 86
  • Gender: Male
  • Peace For Respect
    • View Profile
Re: LUA Command
« Reply #7 on: December 07, 2013, 06:13:31 AM »
Quote
PedMoveToXYX - You didn't put the Z coords.
Its like this (PED,SPEED,X,Y,Z)
You all placed the PED,SPEED,X,Y but you didn't wrte the Z (look in the code)
And about PedShowHealthBar make sure you selected the ped you want to see he's health.
Example :

Darby = PedCreateXYZ(ID,X,Y,Z)
PedShowHealthBar(Darby, true, "N_Darby", true)

Ok,PedShowHealthBar fixed
but PedMoveToXYZ
I write like this PedMoveToXYZ(Darby,3,515,504,19.60971009)

look the
X = 515
Y = 504
Z = 19.60971009

I put the XYZ Coord but why didn't work??  :wacko:

Offline c00ld0c26

  • The D0c
  • Can't Get Enough
  • *****
  • Posts: 5,137
  • Gender: Male
  • Just a dood doing dood things.
    • View Profile
    • My channel.
Re: LUA Command
« Reply #8 on: December 07, 2013, 10:07:03 AM »
Well it may be the following :

1. The coords you selected are inside a wall or a place the ped cant reach.
2. The coords are at a diffrent interor or Area Code then the ped is at (for example the ped is in the school's building but the coords are in the gym, so he cant reach it)

if not those two, please make sure to give me the full script here or on PM and say exactly where the ped is spawned and where the coords you have chosen are at.

Offline KING DP

  • Hero Member
  • ****
  • Posts: 2,212
  • Gender: Male
    • View Profile
Re: LUA Command
« Reply #9 on: December 07, 2013, 10:26:48 AM »
^lol jimmy stuck in a wall yes that all i wanna see

Offline Black Norton

  • Keep Calm
  • Jr. Member
  • **
  • Posts: 86
  • Gender: Male
  • Peace For Respect
    • View Profile
Re: LUA Command
« Reply #10 on: December 07, 2013, 09:22:54 PM »
Here :
Code: [Select]
ImportScript("\\Library\\LibTable.lua") -- imports the LibTable library
ImportScript("\\Library\\LibPed.lua") -- imports the LibPed library
local l_0_0 = false
 
MissionSetup = function() -- basic mission setup function which is used in almost all bully scripts
  local l_1_0 = 270 -- X coords
  local l_1_1 = -110 -- Y coords
  local l_1_2 = 6.4000000953674 -- Z coords
 
  PlayerSetHealth(200) -- gives the player 200 health
  AreaTransitionXYZ(0, l_1_0, l_1_1, l_1_2)

  Darby = PedCreateXYZ(37,l_1_0 + 1,l_1_1 + 1,l_1_2 + 1)
  PedMoveToXYZ(Darby,3, 515, 504, 19.60971009)
 
  end

F_MissionSetup = function()
ClockSet(9, 30)
ClockSetTickRate(0.0060000000521541)

end
 
MissionCleanup = function()
end -- end statement
 
main = function() -- Main mission function
F_MissionSetup()
gMissionRunning = false
while gMissionRunning do
if PedGetHealth(gplayer, 200) < 200 then
PedSetHealth(gplayer,200)

repeat
    Wait(0)
  until l_0_0 ~= false
  MissionSucceed()

end

    Wait(0)
  end
 
  end

the target is Old Bulworth Vale basket court.
the area has same area code (is 0)

Offline Black Norton

  • Keep Calm
  • Jr. Member
  • **
  • Posts: 86
  • Gender: Male
  • Peace For Respect
    • View Profile
Re: LUA Command
« Reply #11 on: December 09, 2013, 06:59:39 AM »
you cannot help me??   :-\

Offline c00ld0c26

  • The D0c
  • Can't Get Enough
  • *****
  • Posts: 5,137
  • Gender: Male
  • Just a dood doing dood things.
    • View Profile
    • My channel.
Re: LUA Command
« Reply #12 on: December 10, 2013, 01:20:05 AM »
I'm at school at the moment.
I'll help when I'm back.

Offline Black Norton

  • Keep Calm
  • Jr. Member
  • **
  • Posts: 86
  • Gender: Male
  • Peace For Respect
    • View Profile
Re: LUA Command
« Reply #13 on: December 10, 2013, 06:19:45 AM »
oh sorry
but how long you focus on school??

Offline MadmaN

  • Bully-Board Admin Team
  • Newbie
  • *
  • Posts: 0
  • Gender: Male
  • Biblio-Techa Mods (retired)
    • View Profile
Re: LUA Command
« Reply #14 on: December 11, 2013, 12:15:19 AM »
I decided to take a look at your script there m8.

Quite a few problems from what I can see unless pasting it here messed something up.

First off...the syntax is all wrong since there is way too much whitespace in the code....this will cause some minor problems with the lua interpreter in following all of the code.

There are a few ways to force a ped to move to a set xyz coord of their own power but personally...it would be far easier to just spawn them directly at the coords you wish to be spawned and either spawn there on your own at the same time or just add some code to make them permanent with a marker on the map to lead you to them and to let you know they are still in the game unless knocked out or something.

PedMoveToXYZ is a code I never really bothered using since while it does work...it is kinda a problematic code at times and I have found far easier methods to achieve moving a ped around.

Here is a cleaned and properly formatted version of your script. I fixed a couple typos so...see if this works now since from what I can see your code is pretty much correct.


Code: [Select]
ImportScript("\\Library\\LibTable.lua") -- imports the LibTable library
ImportScript("\\Library\\LibPed.lua") -- imports the LibPed library
local l_0_0 = false

MissionSetup = function() -- basic mission setup function which is used in almost all bully scripts
local l_1_0 = 270 -- X coords
local l_1_1 = -110 -- Y coords
local l_1_2 = 6.4000000953674 -- Z coords
PlayerSetHealth(200) -- gives the player 200 health
AreaTransitionXYZ(0, l_1_0, l_1_1, l_1_2)
Darby = PedCreateXYZ(37, l_1_0 + 1, l_1_1 + 1, l_1_2 + 1)
PedMoveToXYZ(Darby, 3, 515, 504, 19.60971009)
end

F_MissionSetup = function()
ClockSet(9, 30)
ClockSetTickRate(0.0060000000521541)
end

MissionCleanup = function()
end -- end statement

main = function() -- Main mission function
F_MissionSetup()
gMissionRunning = false
while gMissionRunning do
if PedGetHealth(gplayer, 200) < 200 then
PedSetHealth(gplayer,200)
repeat
Wait(0)
until l_0_0 ~= false
MissionSucceed()
end
Wait(0)
end
end