Make the peds move even they are not within_brain_activation_range
-
Hello everyone,
Do you know how you can CREATE_PED and let this ped TASK_GO_TO_COORD even if this ped is far from you? For example, the distance between you and the target ped could be from Fort Zancudo to Los Santos International Airport.
The possible reason for the ped not moving at all could be this ped object is out of the brain activation range (using IS_OBJECT_WITHIN_BRAIN_ACTIVATION_RANGE to check) even it already exists in the world. Due to my limited knowledge, the decompiled scripts did not give me enough ideas on how to let this ped move from this long distance.
So is there any way to get this work?
Thanks!
-
@specialDude Interesting question. Can I ask what you are trying to do and why? Also, how would you check the peds progress? It could be a long wait if you just wait at the ped's destination and if you watch the ped by helicopter for example, well in that case you're in "brain activation" range and could trigger the task without anyone knowing ped had started much further away.
-
@specialDude What you might want to do first is to see what is the maximum distance at which you can activate the ped. I did a quick test by putting the ped in a plane, driving off a certain distance, telling the ped they can take off and land.
You could put the ped further away - as far as you want to test - and then take a plane yourself and follow the same route to see if they took off or do a notification i guess although you might get the message with the ped inactive.Anyway in my quick test, I was surprised the ped responded. Distance was pretty far.
-
@JohnFromGWN Here is another quick test. This time I went to UCLA (ULSA) and triggered the event from there. Again no issues at that particular distance.
-
Vehicle based tasks work at a much greater range from the player than a ped on foot. I suspect this is something to do with the nav map, maybe using movement tasks that ignore pathing could be a thing? I know i have seen such a parameter for one of the natives. Also there are ways to load distant regions of the map, might be something to look into.
Personally i would just fake it, have a position that moves over time to simulate the ped going somewhere, and then placing that ped on a path/ground near that position and start the movment task when the player is within range for the movement task to actually work. Then faking it again when the player is out of range.
-
Have not tried a ped on foot, but here is proof that you can trigger a ped to fly from LS Airport - with the trigger coming from Fort Z. Next attempt would be to trigger the ped in GTA V from GTA IV......just kidding.
-
@JohnFromGWN One more test. There are 2 peds playing follow the player. One ped is on foot and I trigger the script at a pretty fair distance and she responds immediately. The other ped, just for dramatic effect, is in a helicopter.
Don't know what the magic distance is, but for practical purposes (and LOD reasons) you can trigger a ped, at least for a follow player, from the limit of your visual field.
-
yeah visual range is about the limit for movment based tasks on foot. You can spawn a car in sandy and have it drive to the player in LS, but doing the same with a ped on foot will result in the ped doing nothing.
-
@mcal9909 Makes sense. Gets back to what does the OP want to do. Like you said, it can be faked if necessary.
-
@JohnFromGWN Oh thanks for your timely comment:D Sorry for the late reply as I have been working on a mod throughout the whole week...
So what I want to do is reach a mechanism like the Sims 3, so the peds could do their own works regardless of the player's position.
-
@JohnFromGWN Nice try! This test looks amazing
.
However, what confuses me so much is if this pilot and plane were created far from you (like from the other side of the map), they might not even do any tasks. I tried to stand on the westside beach and spawn a taxi from the north part of the city (Downtown Cab Co.), but it never moves until I fly nearby.
-
@mcal9909 This seems to be the best solution for now, I realised maybe the ped / vehicle is not even initialised if you create it far from you. It only gets initialised when you are close to it enough and then could do the movement. Thank you for this great idea!
-
@specialDude Alot of game like the sims would also fake it, give all tasks a time to complete, keep track of the last time the sim on screen and what that sim was doing, what that sim needs to do, then when they are next on screen. Use the information you have to put that sim where it should be by quickly simulating the time that has passed.
This way nothing is updated when it doesn't need to be on distant sims thus enabling you to handle alot more sims than having all sims running through all there tasks all the time.
This is also how games like terraria handle there map tile updates.
-
@mcal9909 Thank you for this inspiring breakdown of the simulation! A dedicated thread could probably simulate all these far-distance events. Another thread can then be responsible for choosing whether to let the object have real behaviour based on its distance from the player.