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


Author Topic: Making something happen when the player gets to a certain area  (Read 11328 times)

0 Members and 1 Guest are viewing this topic.

Offline AWiseMelon

  • Jr. Member
  • **
  • Posts: 42
  • Gender: Male
    • View Profile
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)

Offline Shrimp

  • Sr. Member
  • ***
  • Posts: 514
  • Gender: Male
  • your official b-b's chav. wag wan.
    • View Profile
Re: Making something happen when the player gets to a certain area
« Reply #1 on: April 03, 2016, 07:40:13 PM »
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()
« Last Edit: April 03, 2016, 07:41:49 PM by Shrimp »

Offline AWiseMelon

  • Jr. Member
  • **
  • Posts: 42
  • Gender: Male
    • View Profile
Re: Making something happen when the player gets to a certain area
« Reply #2 on: April 03, 2016, 08:20:32 PM »
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
« Last Edit: April 03, 2016, 08:23:28 PM by AWiseMelon »

Offline Shrimp

  • Sr. Member
  • ***
  • Posts: 514
  • Gender: Male
  • your official b-b's chav. wag wan.
    • View Profile
Re: Making something happen when the player gets to a certain area
« Reply #3 on: April 03, 2016, 08:26:50 PM »
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.

Offline AWiseMelon

  • Jr. Member
  • **
  • Posts: 42
  • Gender: Male
    • View Profile
Re: Making something happen when the player gets to a certain area
« Reply #4 on: April 03, 2016, 08:35:01 PM »
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?

Offline Shrimp

  • Sr. Member
  • ***
  • Posts: 514
  • Gender: Male
  • your official b-b's chav. wag wan.
    • View Profile
Re: Making something happen when the player gets to a certain area
« Reply #5 on: April 03, 2016, 08:57:02 PM »
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()

Offline AWiseMelon

  • Jr. Member
  • **
  • Posts: 42
  • Gender: Male
    • View Profile
Re: Making something happen when the player gets to a certain area
« Reply #6 on: April 03, 2016, 09:21:23 PM »
How do I use it? PedFaceXYZ(Norton,..........) then what?

Offline Shrimp

  • Sr. Member
  • ***
  • Posts: 514
  • Gender: Male
  • your official b-b's chav. wag wan.
    • View Profile
Re: Making something happen when the player gets to a certain area
« Reply #7 on: April 03, 2016, 10:42:41 PM »
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.

Offline AWiseMelon

  • Jr. Member
  • **
  • Posts: 42
  • Gender: Male
    • View Profile
Re: Making something happen when the player gets to a certain area
« Reply #8 on: April 04, 2016, 02:54:13 AM »
Wait, is that to GET their direction or to SET it?

Offline UltimateGamer9

  • Full Member
  • ***
  • Posts: 190
  • Gender: Male
    • View Profile
Re: Making something happen when the player gets to a certain area
« Reply #9 on: April 04, 2016, 11:29:49 AM »
Wait, is that to GET their direction or to SET it?
set

Offline AWiseMelon

  • Jr. Member
  • **
  • Posts: 42
  • Gender: Male
    • View Profile
Re: Making something happen when the player gets to a certain area
« Reply #10 on: April 04, 2016, 01:56:04 PM »
Can I write "gPlayer" in the () instead of co-ords?

Offline Shrimp

  • Sr. Member
  • ***
  • Posts: 514
  • Gender: Male
  • your official b-b's chav. wag wan.
    • View Profile
Re: Making something happen when the player gets to a certain area
« Reply #11 on: April 04, 2016, 03:27:19 PM »
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.

Offline AWiseMelon

  • Jr. Member
  • **
  • Posts: 42
  • Gender: Male
    • View Profile
Re: Making something happen when the player gets to a certain area
« Reply #12 on: April 04, 2016, 03:34:07 PM »
Nah, it doesn't work unfortunately :(

Offline UltimateGamer9

  • Full Member
  • ***
  • Posts: 190
  • Gender: Male
    • View Profile
Re: Making something happen when the player gets to a certain area
« Reply #13 on: April 04, 2016, 10:21:17 PM »
PedFaceXYZ is one of the simplest code dude. it's just like this PedFaceXYZ(ped,X,Y,Z) that's it

Offline Shrimp

  • Sr. Member
  • ***
  • Posts: 514
  • Gender: Male
  • your official b-b's chav. wag wan.
    • View Profile
Re: Making something happen when the player gets to a certain area
« Reply #14 on: April 04, 2016, 11:23:28 PM »
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.