Bully-Board
Bully Modding Section => Modding Questions/Help => Modding Questions/Help Archives => Topic started by: Black Norton on December 28, 2013, 01:49:08 AM
-
Help
why this code not work
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) -- teleports the player to the sidewalk outside the boys dorm
end
F_Davis = function()
Davis = PedCreateXYZ(99, 301.498993, -72.504997, 6.003000)
DavisBlip = AddBlipForChar(Davis, 6, 2, 2)
end
F_Davis2 = function()
if PlayerIsInTrigger(TRIGGER._TSCHOOL_FRONTGATE) then
PedRecruitAlly(gplayer, Davis)
end
end
MissionCleanup = function()
collectgarbage()
end -- end statement
main = function()
F_Davis() -- Function Call
F_Davis2()
end
why davis didn't recruited??
-
Help
why this code not work
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) -- teleports the player to the sidewalk outside the boys dorm
end
F_Davis = function()
Davis = PedCreateXYZ(99, 301.498993, -72.504997, 6.003000)
DavisBlip = AddBlipForChar(Davis, 6, 2, 2)
end
F_Davis2 = function()
if PlayerIsInTrigger(TRIGGER._TSCHOOL_FRONTGATE) then
PedRecruitAlly(gplayer, Davis)
end
end
MissionCleanup = function()
collectgarbage()
end -- end statement
main = function()
F_Davis() -- Function Call
F_Davis2()
end
why davis didn't recruited??
You want davis is be your bodyguard?
-
You want davis is be your bodyguard?
No. . .
i mean if i reach the trigger davis will be recruited
-
Huh?? :blink:
nobody can fix my script?? :(
-
Use PedIsinRectangle() instead
Aswell you didn't repeat the function that says when the ped gets to the trigger.
-
But i don't understand about
PedIsinRectangle(Ped,X1,Y1,X2,Y2)
-
But i don't understand about PedIsinRectangle(Ped,X1,Y1,X2,Y2)
In Bully there are X, Y and Z coords.
X is a coord for straight and backward while facing North, Y is a coord for right and left while facing North, Z is for hight.
So basicly using the X and Y coords you can create an imaginary square that if the player or the ped will stand in it, the next commands will trigger.
Lets say I chooce :
X1 = 5
Y1 = 10
X2 = 20
Y2 = 4
I want the player to be the ped which needs to be in the imaginary square, so we get this :
if PedInRectangle(gPlayer, 5,10,20,4) then
CODES
Explanesion :
If the player stands between these coords, the next commands of LUA will be actived.
-
Not work
look
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) -- teleports the player to the sidewalk outside the boys dorm
end
F_Davis = function()
Davis = PedCreateXYZ(99, 301.498993, -72.504997, 6.003000)
DavisBlip = AddBlipForChar(Davis, 6, 2, 2)
end
F_Davis2 = function()
if PedInRectangle(gplayer, 326.8171387, -103.0250931, 323.7320557, -95.51804352) then
PedRecruitAlly(gplayer, Davis)
end
end
MissionCleanup = function()
collectgarbage()
end -- end statement
main = function()
F_Davis() -- Function Call
F_Davis2()
end
why?? :confused:
-
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) -- teleports the player to the sidewalk outside the boys dorm
end
F_Davis = function()
Davis = PedCreateXYZ(99, 301.498993, -72.504997, 6.003000)
DavisBlip = AddBlipForChar(Davis, 6, 2, 2)
end
F_Davis2 = function()
if PedInRectangle(gplayer, 326.8171387, -103.0250931, 323.7320557, -95.51804352) then
PedRecruitAlly(gplayer, Davis)
end
end
MissionCleanup = function()
collectgarbage()
end -- end statement
main = function()
F_Davis() -- Function Call
repeat
F_Davis2()
Wait(0)
until not Alive
end
There.
If it still dosn't work, then post here and I will show you a diffrent technique, as the technique I gave you now with the "if" for the PedInRectangle is buggy and may work in delay.
-
works. . .
thanks c00ld :D
can i ask some code again?