Bully-Board
Bully Modding Section => Script Modding => LUA Scripting Help => Topic started by: AWiseMelon on April 03, 2016, 06:13:01 PM
-
I'm making a mission and I want a bit in it to be like this: The player goes to the autoshop and wwhen he gets there text appears and controls are disabled. I have this but nothing seems to happen:
if PedInRectangle(Player, 120, 46, 98, 24) then
PlayerSetControl(0)
TextPrintString("Jimmy: Norton! Where's that punk Johnny!?", 4, 1)
TextPrintString("Norton: Sorry, Hopkins, Johnny couldn't make it",4.5, 1)
TextPrintString("Jimmy: Well then I guess there'll be one more grease ball hurting after this!", 5, 1)
PedSetPedToTypeAttitude(Norton, 13, 0)
PlayerSetControl(1)
TextPrintString("Beat up Norton.", 3, 1)
-
The player isn't called Player, he's called gPlayer.
Try that, if that doesn't work then don't do PedInRectangle and try,
PedIsInAreaXYZ(gPlayer, coord's here)
Also, instead of PedSetPedToTypeAttitude,
try using the PedAttack()
-
Thanks, I got it worked out, It turns out I can also use the player's ID (0) and also I tried PedAttack but when they attacked me their hits didn't connect....EVER, this was because the save game that I'm using the Greasers are at 100% relationship with me and therefore they're obviously not supposed to be attacking me without being provoked, so I had to make them hate me. If you see also where i have the three pieces of text between Norton and Jimmy, I found out you have to actually put "Wait(How long you want)" for it to work or the text will go so fast it looks like the script skipped it :( also do you know how to make a ped face a certain direction when they're spawned because Norton is facing the complete wrong direction lmao
-
I forgot about the Wait thing, damn.
But you can see a ped relationship after you spawned it, (Right after the code) and then do pedattack
i find pedattack better cause it's directly attacking instead of it idle for a second, pointing, then attacking, delaying it for a few seconds.
am glad i helped.
-
Yeah, I used PedAttack for some other greasers earlier in the mission, but I have a problem where I have to run in front of Norton to get him to see me, therefore attack me, because he's facing the wrong direction. Is there any way I can get him to face a certain direction when I spawn him?
-
Yeah, I used PedAttack for some other greasers earlier in the mission, but I have a problem where I have to run in front of Norton to get him to see me, therefore attack me, because he's facing the wrong direction. Is there any way I can get him to face a certain direction when I spawn him?
Yes.
PedFaceXYZ()
-
How do I use it? PedFaceXYZ(Norton,..........) then what?
-
How do I use it? PedFaceXYZ(Norton,..........) then what?
The XYZ after seperated by ,
like X,Y,Z,
to find the gPlayer/ped facing XYZ...
well I only know how to get XYZ's of Ped facing from Daboss Supermod 5 which isn't released and I think I only have it sadly.
-
Wait, is that to GET their direction or to SET it?
-
Wait, is that to GET their direction or to SET it?
set
-
Can I write "gPlayer" in the () instead of co-ords?
-
Can I write "gPlayer" in the () instead of co-ords?
I don't think it'll work, it probably might, fuck know's I never tried it, but you can try it if you want.
-
Nah, it doesn't work unfortunately :(
-
PedFaceXYZ is one of the simplest code dude. it's just like this PedFaceXYZ(ped,X,Y,Z) that's it
-
PedFaceXYZ is one of the simplest code dude. it's just like this PedFaceXYZ(ped,X,Y,Z) that's it
His question was if he can use gPlayer, so the ped can face the player instead, he know's how to use the code.
-
PedFaceXYZ is one of the simplest code dude. it's just like this PedFaceXYZ(ped,X,Y,Z) that's it
His question was if he can use gPlayer, so the ped can face the player instead, he know's how to use the code.
that's even more simpler. code: PedFaceObject(Ped,Ped,3)
-
I didn't even know that was a function.
-
Check my tutorials for how to use certain functions and anything you want to do. http://www.bully-board.com/index.php?topic=22996.msg394002#msg394002 (http://www.bully-board.com/index.php?topic=22996.msg394002#msg394002)
MissionSetup = function()
-- (0) is the area code for the main map, all area codes are placed here.
PlayerSetHealth(800)
AreaTransitionXYZ(0, 477.5798, -107.3748, 16.6911)
PedSetUniqueModelStatus(29, -1)
SoundPlayInteractiveStream("MS_BikeFunLow.rsm", 0.5)
SoundSetMidIntensityStream("MS_BikeFunMid.rsm", 0.60000002384186)
SoundSetHighIntensityStream("MS_BikeFunHigh.rsm", 0.60000002384186)
Norton = PedCreateXYZ(29,120,46,98,)
PedSetAmbiet(Norton,true)
TestBlip = BlipAddXYZ(120,46,98,0) (0 is the small Yellow X appearing on the map) (The blip's location should always be the same as the objective location not any wear else. If you script the blip in another location you may mess up player's in finding certain things.)
TextPrintString("Follow the X on the map to go to the location!",4,1)
Wait(3000)
MissionObjective()
end
MissionObjective = function()
local x,y = 120,46 (Created by Daboss, can be used to make a certain instance.)
local r1 = x + 3.5
local r2 = y + 3.5
local r3 = x - 3.5
local r4 = y - 3.5
repeat
Wait(0)
until PedInRectangle(gPlayer,r1,r2,r3,r4)
BlipRemove(TestBlip)
TextPrintString("Jimmy: Norton! Where's that punk Johnny!?", 4, 1)
TextPrintString("Norton: Sorry, Hopkins, Johnny couldn't make it",4.5, 1)
TextPrintString("Jimmy: Well then I guess there'll be one more grease ball hurting after this!", 5, 1)
PedSetPedToTypeAttitude(Norton, 13, 0)
PlayerSetControl(1)
TextPrintString("Beat up Norton.", 3, 1)
IsNortonDead = false
end
MissionObjectiveFinal = function()
if PedIsDead(Norton) and IsNortonDead == false then
IsNortonDead = true
TextPrintString("Great you've defeated!",4,1)
Wait(3000)
SoundPlayMissionEndMusic(true, 8)
MissionSucceed(true, false, false)
CameraSetWidescreen(true)
Wait(4000)
CameraFade(500, 0)
AreaTransitionXYZ(14, -501.4, 316.11, 31.5)
Wait(500)
CameraAllowChange(true)
SoundSetAudioFocusPlayer()
CameraReturnToPlayer()
CameraReset()
CameraSetWidescreen(false)
PlayerSetControl(1)
end
F_PlayerFail = function()
if PedIsDead(gPlayer) then
SoundPlayMissionEndMusic(true, 6)
MissionFail(true, false, false)
Wait(4000)
CameraSetWidescreen(true)
CameraFade(700, 0)
AreaTransitionXYZ(14, -501.4, 316.11, 31.5)
Wait(500)
CameraAllowChange(true)
SoundSetAudioFocusPlayer()
CameraReturnToPlayer()
CameraReset()
CameraSetWidescreen(false)
PlayerSetControl(1)
end
F_LoadAnim = function()
LoadAnimationGroup("Cheer_Cool2")
LoadAnimationGroup("NPC_Adult")
LoadAnimationGroup("TSGate")
LoadAnimationGroup("SCgrdoor")
LoadAnimationGroup("Sbarels1")
LoadAnimationGroup("Area_School")
LoadAnimationGroup("Px_Rail")
LoadAnimationGroup("DO_Grap")
LoadAnimationGroup("1_07_SaveBucky")
LoadAnimationGroup("TSGate")
LoadAnimationGroup("F_Nerds")
LoadAnimationGroup("Hang_Jock")
LoadAnimationGroup("NPC_AggroTaunt")
LoadAnimationGroup("Hang_Talking")
LoadAnimationGroup("1_07_Sk8Board")
Load("Act/Conv/1_07.act")
LoadActionTree("Act/Props/SBarels1.act")
LoadActionTree("Act/Props/barrelLad.act")
LoadActionTree("Act/Conv/1_03.act")
LoadActionTree("Act/Anim/1_03_Davis.act")
end
F_CleanUpAnim = function() (Not necessary to use the mission will work either way.)
UnLoadAnimationGroup("Cheer_Cool2")
UnLoadAnimationGroup("NPC_Adult")
UnLoadAnimationGroup("TSGate")
UnLoadAnimationGroup("SCgrdoor")
UnLoadAnimationGroup("Sbarels1")
UnLoadAnimationGroup("Area_School")
UnLoadAnimationGroup("Px_Rail")
UnLoadAnimationGroup("DO_Grap")
UnLoadAnimationGroup("1_07_SaveBucky")
UnLoadAnimationGroup("TSGate")
UnLoadAnimationGroup("F_Nerds")
UnLoadAnimationGroup("Hang_Jock")
UnLoadAnimationGroup("NPC_AggroTaunt")
UnLoadAnimationGroup("Hang_Talking")
UnLoadAnimationGroup("1_07_Sk8Board")
collectgarbage()
end
main = function()
F_LoadAnim()
F_PlayerFail()
MissionObjectiveFinal()
repeat
Wait(0)
until not Alive
-
@Shrimp Can I actually finish scripting the mission Jesus Fucking Christ.
@AWiseMelson Fixed your spawn point the other one didn't show the first time.
[codeMissionSetup = function()
-- (0) is the area code for the main map, all area codes are placed here.
PlayerSetHealth(800)
AreaTransitionXYZ(0, 477.5798, -107.3748, 16.6911)
PedSetUniqueModelStatus(29, -1)
SoundPlayInteractiveStream("MS_BikeFunLow.rsm", 0.5)
SoundSetMidIntensityStream("MS_BikeFunMid.rsm", 0.60000002384186)
SoundSetHighIntensityStream("MS_BikeFunHigh.rsm", 0.60000002384186)
Norton = PedCreateXYZ(29,503.7057,-112.5930,5.1166)
TestBlip = BlipAddXYZ(503.7057,-112.5930,5.1166,0) --(0 is the small Yellow X appearing on the map) (The blip's location should always be the same as the objective location not any wear else. If you script the blip in another location you may mess up player's in finding certain things.)
TextPrintString("Follow the X on the map to go to the location!",4,1)
Wait(3000)
MissionObjective()
end
MissionObjective = function()
local x,y = 503,-112 --(Created by Daboss, can be used to make a certain instance.)
local r1 = x + 3.5
local r2 = y + 3.5
local r3 = x - 3.5
local r4 = y - 3.5
repeat
Wait(0)
until PedInRectangle(gPlayer,r1,r2,r3,r4)
BlipRemove(TestBlip)
TextPrintString("Jimmy: Norton! Where's that punk Johnny!?", 4, 1)
TextPrintString("Norton: Sorry, Hopkins, Johnny couldn't make it",4.5, 1)
TextPrintString("Jimmy: Well then I guess there'll be one more grease ball hurting after this!", 5, 1)
PedSetPedToTypeAttitude(Norton, 13, 0)
PlayerSetControl(1)
TextPrintString("Beat up Norton.", 3, 1)
IsNortonDead = false
end
MissionObjectiveFinal = function()
if PedIsDead(Norton) and IsNortonDead == false then
IsNortonDead = true
TextPrintString("Great you've defeated!",4,1)
Wait(3000)
SoundPlayMissionEndMusic(true, 8)
MissionSucceed(true, false, false)
CameraSetWidescreen(true)
Wait(4000)
CameraFade(500, 0)
AreaTransitionXYZ(14, -501.4, 316.11, 31.5)
Wait(500)
CameraAllowChange(true)
SoundSetAudioFocusPlayer()
CameraReturnToPlayer()
CameraReset()
CameraSetWidescreen(false)
PlayerSetControl(1)
end
if PedIsDead(Norton) and IsNortonDead == false then
IsNortonDead = true
TextPrintString("Great you've defeated!",4,1)
Wait(3000)
SoundPlayMissionEndMusic(true, 8)
MissionSucceed(true, false, false)
CameraSetWidescreen(true)
Wait(4000)
CameraFade(500, 0)
AreaTransitionXYZ(14, -501.4, 316.11, 31.5)
Wait(500)
CameraAllowChange(true)
SoundSetAudioFocusPlayer()
CameraReturnToPlayer()
CameraReset()
CameraSetWidescreen(false)
PlayerSetControl(1)
end
end
F_PlayerFail = function()
if PedIsDead(gPlayer) then
SoundPlayMissionEndMusic(true, 6)
MissionFail(true, false, false)
Wait(4000)
CameraSetWidescreen(true)
CameraFade(700, 0)
AreaTransitionXYZ(14, -501.4, 316.11, 31.5)
Wait(500)
CameraAllowChange(true)
SoundSetAudioFocusPlayer()
CameraReturnToPlayer()
CameraReset()
CameraSetWidescreen(false)
PlayerSetControl(1)
end
if PedIsDead(gPlayer) then
SoundPlayMissionEndMusic(true, 6)
MissionFail(true, false, false)
Wait(4000)
CameraSetWidescreen(true)
CameraFade(700, 0)
AreaTransitionXYZ(14, -501.4, 316.11, 31.5)
Wait(500)
CameraAllowChange(true)
SoundSetAudioFocusPlayer()
CameraReturnToPlayer()
CameraReset()
CameraSetWidescreen(false)
PlayerSetControl(1)
end
end
F_LoadAnim = function()
LoadAnimationGroup("Cheer_Cool2")
LoadAnimationGroup("NPC_Adult")
LoadAnimationGroup("TSGate")
LoadAnimationGroup("SCgrdoor")
LoadAnimationGroup("Sbarels1")
LoadAnimationGroup("Area_School")
LoadAnimationGroup("Px_Rail")
LoadAnimationGroup("DO_Grap")
LoadAnimationGroup("1_07_SaveBucky")
LoadAnimationGroup("TSGate")
LoadAnimationGroup("F_Nerds")
LoadAnimationGroup("Hang_Jock")
LoadAnimationGroup("NPC_AggroTaunt")
LoadAnimationGroup("Hang_Talking")
LoadAnimationGroup("1_07_Sk8Board")
Load("Act/Conv/1_07.act")
LoadActionTree("Act/Props/SBarels1.act")
LoadActionTree("Act/Props/barrelLad.act")
LoadActionTree("Act/Conv/1_03.act")
LoadActionTree("Act/Anim/1_03_Davis.act")
end
F_CleanUpAnim = function() --(Not necessary to use the mission will work either way.)
UnLoadAnimationGroup("Cheer_Cool2")
UnLoadAnimationGroup("NPC_Adult")
UnLoadAnimationGroup("TSGate")
UnLoadAnimationGroup("SCgrdoor")
UnLoadAnimationGroup("Sbarels1")
UnLoadAnimationGroup("Area_School")
UnLoadAnimationGroup("Px_Rail")
UnLoadAnimationGroup("DO_Grap")
UnLoadAnimationGroup("1_07_SaveBucky")
UnLoadAnimationGroup("TSGate")
UnLoadAnimationGroup("F_Nerds")
UnLoadAnimationGroup("Hang_Jock")
UnLoadAnimationGroup("NPC_AggroTaunt")
UnLoadAnimationGroup("Hang_Talking")
UnLoadAnimationGroup("1_07_Sk8Board")
collectgarbage()
end
main = function()
F_LoadAnim()
repeat
F_PlayerFail()
MissionObjectiveFinal()
Wait(0)
until not Alive
end]
-
shrimp is right.
alpha, that's just stupid coding, if you did not even type finish, why bother clicking on the post button?
-
shrimp is right.
alpha, that's just stupid coding, if you did not even type finish, why bother clicking on the post button?
Maybe he's desperate for post count? :jajaja: :jajaja: ;)
-
shrimp is right.
alpha, that's just stupid coding, if you did not even type finish, why bother clicking on the post button?
Maybe he's desperate for post count? :jajaja: :jajaja: ;)
he sure is.
-
Alpha and Shrimp, I will not stand members who insult eachother.
Behave please.
Posts deleted for now.
-
I indeed have returned from the dead.
As for this forum, Ima keep a close watch on it due to the latest behaviour of some members.
-
Woah when did d0c become Moderator long time no see