Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Initial migration from previous code - #14

Draft
phoenixpinpoint wants to merge 2 commits into
FivePRS:mainfrom
phoenixpinpoint:dynamic-foot-pursuits
Draft

phoenixpinpoint wants to merge 2 commits into
FivePRS:mainfrom
phoenixpinpoint:dynamic-foot-pursuits

Conversation

@phoenixpinpoint

Copy link
Copy Markdown
Contributor

No description provided.

@phoenixpinpoint phoenixpinpoint changed the title Initial migration form previous code Initial migration from previous code Nov 29, 2026
added second wind chance
@phoenixpinpoint

Copy link
Copy Markdown
Contributor Author

Foot pursuit pacing

FootPursuitPace controls a fleeing suspect's maximum movement blend ratio and tells its caller when the suspect gives up from exhaustion. The caller assigns the flee task, decides when to put the suspect's hands up, and handles arrest and escape.

How the suspect slows down

When a pursuit creates a pacing instance, it records the game time, rolls a motivation value from 1 to 10, and picks an initial pace offset of up to ±0.4. The offset comes from subtracting two random draws, so smaller offsets are more common.

Time since the pacing instance started Maximum movement blend ratio
First 12 seconds 2.6 plus the random offset, roughly 2.2–3.0
12 to 16 seconds Decreases linearly from the starting cap to 1.6
From 16 seconds onward 1.6 between bursts

The module reapplies the cap every frame while the suspect exists and is alive. The ratio limits the ped's movement blend. Actual running speed can vary. Disposing the pacing instance stops the frame loop and restores the cap to 3.0 if the suspect still exists.

Second wind

The first time the player closes from beyond 15 m to within 15 m during the run phase, the suspect gets one 10% chance at a second wind. On success, the blend cap rises to 2.3 for a random 5 to 8 seconds, then returns to 1.6. Exhaustion rolls pause during the burst, and the callout's catch distance still applies.

How exhaustion surrender works

The caller invokes Update() to check for surrender. The first roll becomes available at 20 seconds and stays available until the player is within 15 m. Each actual roll starts a new 10-second cooldown. For example, if the player first closes the gap at 27 seconds, the next opportunity is at 37 seconds.

Elapsed pursuit time at the roll Surrender chance
20 to under 30 seconds 11–20%
30 to under 40 seconds 21–30%
40 to under 50 seconds 31–35%
50 seconds and later 35%

At 20 seconds, motivation 10 gives an 11% surrender chance and motivation 1 gives a 20% chance. Each full 10 seconds of pursuit after that adds 10 percentage points, up to 35%, even while the player is out of range. A successful roll makes Update() return true.

Callouts that use it

All three callouts use CalloutBase.FootPursuitAsync. That helper assigns the flee task, starts pacing, and polls every 400 ms. A suspect who comes within the catch distance or passes the exhaustion roll puts their hands up, and the callout waits for the player to arrest them. The callout fails if the suspect moves beyond the escape distance. A suspect already in custody, dead, or missing ends the pursuit as complete.

Callout When foot pacing begins Catch distance Escape distance
Shoplifting After the player spots the suspect near the store. 3.0 m 300 m
Traffic Stop During the fleeing-driver outcome, when the suspect vehicle is missing, the driver is out of it, or the driver is still seated when the vehicle nearly stops close to the player and the callout orders them out. 3.0 m 300 m
Vehicle Pursuit When the suspect vehicle is missing, the driver is out of it, or the driver bails after failing the separate vehicle surrender roll. 3.5 m 280 m

Player-initiated traffic stops

TrafficStop also creates a pacing instance directly when a stopped suspect flees on foot or when a fleeing driver is detected out of the car. TrafficStopManager updates the foot pursuit and uses a 150 m foot escape distance measured from the player to the fleeing suspect. This path uses the same exhaustion roll, with no automatic hands-up trigger based on catch distance. A successful roll disposes the pacing instance, puts the suspect's hands up, and prompts the player to arrest them. Holding or ending the stop also disposes any active pacing instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant