Which is the better method? -
m4karow - 11.08.2018
Hey
Which is the better method to detect that the player is near to a dumpster. I have about 250 positions and i want to check when the player comes to it.
Method one: Create dynamic areas to all of the dumpsters and use the area callbacks (OnPlayerEnter..., OnPlayerLeave...)
Method two: Use a fast (about 500-700ms) per player timer and check with IsPlayerRangeOfPoint...
I don't want to check if the player is in any vehicle and whenever a player is running too fast.
I think i have to use the second method, becouse whenever a player is in a vehicle i cant use OnPlayerEnterDynamicArea, becouse when the player leaves the vehicle, it's still in the dynamic area.
Sorry for my bad english.
I need your advices,
Thanks
Re: Which is the better method? -
Dennis12 - 11.08.2018
Method one is better than method two, but if you have 100-200 players you can use method two ( one second timer )
Re: Which is the better method? -
denNorske - 11.08.2018
I would recommend method 1. Create areas around the dumpsters (so they are dynamic)
Arent the dynamic area callbacks called when you're in a car aswell?
If not, do what jlalt said - check under "OnPlayerStateChange" to ensure the area is / isn't what you want.
Alternatively you could check whenever the cars(dumpsters) stream in for the player, and then proceed with the code. No sure what you want to do with the checks btw.
This way you do not need a timer. Personally I don't like having timers for these types of things.
Re: Which is the better method? -
m4karow - 11.08.2018
I solved it using OnPlayerStateChange so it working as i want.
Quote:
Originally Posted by denNorske
This way you do not need a timer. Personally I don't like having timers for these types of things.
|
I don't like using timers for checking theese type of things, but im afraid of using a lot of dynamic area.
For example this kind of system (just the dumpster) use about 250 dynamic area and my other object interact system (food vendors, sprunk machines etc) about 400-600 and it's almost 1000 dynamic areas.
Which is the number of dynamic area's when I shouldn't use more?
Re: Which is the better method? -
iLearner - 11.08.2018
As long as your dynamic areas are not very close to each other it shouldn't be a problem IMO as they are 'dynamic', just like objects.
Re: Which is the better method? -
Pottus - 11.08.2018
Quote:
Originally Posted by m4karow
I solved it using OnPlayerStateChange so it working as i want.
I don't like using timers for checking theese type of things, but im afraid of using a lot of dynamic area.
For example this kind of system (just the dumpster) use about 250 dynamic area and my other object interact system (food vendors, sprunk machines etc) about 400-600 and it's almost 1000 dynamic areas.
Which is the number of dynamic area's when I shouldn't use more?
|
That is nothing really the streamer has no problem dealing with a measly 1000 dynamic areas.
Re: Which is the better method? -
NaS - 11.08.2018
Quote:
Originally Posted by m4karow
Which is the number of dynamic area's when I shouldn't use more?
|
One of my old scripts uses about 30k areas (of all sizes and forms), and it's working perfectly fine. The way the Streamer Plugin processes them is WAY more efficient than you can achieve with PAWN or even C when using natives only (at a comparable scale).
Re: Which is the better method? -
m4karow - 11.08.2018
Okay thanks guys
I'll use dynamic areas