Skip to content

misc NPC natives and FCNPC parity#1206

Open
Knogle wants to merge 10 commits intoopenmultiplayer:masterfrom
Knogle:misc-npc-natives
Open

misc NPC natives and FCNPC parity#1206
Knogle wants to merge 10 commits intoopenmultiplayer:masterfrom
Knogle:misc-npc-natives

Conversation

@Knogle
Copy link

@Knogle Knogle commented Mar 12, 2026

This adds a batch of missing FCNPC NPC natives and callbacks on the server side.

Added callbacks:

- OnNPCUpdate
- OnNPCChangeHeightPos
- OnNPCStreamIn
- OnNPCStreamOut
- OnNPCVehicleEntryComplete
- OnNPCVehicleExitComplete
- OnNPCVehicleTakeDamage

Added functions:

- NPC_SetQuaternion
- NPC_GiveQuaternion
- NPC_GetQuaternion
- NPC_GivePos
- NPC_GiveFacingAngle
- NPC_GiveHealth
- NPC_GiveArmour
- NPC_GiveAmmo
- NPC_GiveAmmoInClip
- NPC_GiveVelocity
- NPC_GiveSurfingOffsets
- NPC_GetClosestEntityInBetween
- NPC_SetPlaybackPath
- NPC_GetPlaybackPath
- NPC_SetWeaponInfo
- NPC_GetWeaponInfo
- NPC_SetWeaponDefaultInfo
- NPC_GetWeaponDefaultInfo
- NPC_SetMoveMode
- NPC_GetMoveMode
- NPC_SetMinHeightPosCall
- NPC_GetMinHeightPosCall
- NPC_ShowInTabListForPlayer
- NPC_HideInTabListForPlayer

This also adds the matching SDK exposure and keeps move mode documented as compatibility surface only where a real MapAndreas / ColAndreas backed implementation does not exist yet. For this case we have to consider some way to natively have Z data available for the server.

I've done the testing using the NPC test gamemode from @itsneufox https://github.com/itsneufox/NPC-bare-test-omp-gamemode

[2026-03-12T14:17:47+0100] [Info] [join] Knogle has joined the server (0:172.20.63.250)
[2026-03-12T14:17:53+0100] [Info] [NPC] NPC 99 has been created
[2026-03-12T14:17:53+0100] [Info] [connection] incoming connection: 127.0.0.1:50797 id: 99
[2026-03-12T14:17:53+0100] [Info] [npc:join] AutoBot_0 has joined the server (99:127.0.0.1)
[2026-03-12T14:17:53+0100] [Info] [NPC] NPC 99 has spawned
[2026-03-12T14:17:53+0100] [Info] [NPC-AUTO][player:0] Starting automated NPC parity test sequence.
[2026-03-12T14:17:54+0100] [Info] [NPC-AUTO][player:0] Step 0: sanity-checking spawn and update callback.
[2026-03-12T14:17:54+0100] [Info] [NPC-AUTO][player:0] [PASS] OnNPCUpdate fired for the tracked NPC.
[2026-03-12T14:17:55+0100] [Info] [NPC-AUTO][player:0] [PASS] Quaternion set/get/give matched expected values.
[2026-03-12T14:17:55+0100] [Info] [NPC-AUTO][player:0] [PASS] Position offset via NPC_GivePos verified.
[2026-03-12T14:17:55+0100] [Info] [NPC-AUTO][player:0] [PASS] Facing-angle offset via NPC_GiveFacingAngle verified.
[2026-03-12T14:17:55+0100] [Info] [NPC-AUTO][player:0] [PASS] Health and armour give-helpers verified.
[2026-03-12T14:17:56+0100] [Info] [NPC-AUTO][player:0] [PASS] Ammo and clip give-helpers verified.
[2026-03-12T14:17:56+0100] [Info] [NPC-AUTO][player:0] [PASS] Velocity give-helper verified.
[2026-03-12T14:17:56+0100] [Info] [NPC-AUTO][player:0] [PASS] Surfing-offset give-helper verified.
[2026-03-12T14:17:56+0100] [Info] [NPC-AUTO][player:0] [PASS] Move mode set/get surface verified.
[2026-03-12T14:17:57+0100] [Info] [NPC-AUTO][player:0] [PASS] Min-height callback threshold set/get verified.
[2026-03-12T14:17:57+0100] [Info] [NPC-AUTO][player:0] [PASS] Per-NPC weapon info set/get verified.
[2026-03-12T14:17:57+0100] [Info] [NPC-AUTO][player:0] [PASS] Default weapon info set/get verified.
[2026-03-12T14:17:57+0100] [Info] [NPC-AUTO][player:0] [PASS] Playback path set/get verified.
[2026-03-12T14:17:58+0100] [Info] [NPC-AUTO][player:0] [PASS] Closest-entity trace hit player 0 (type 1).
[2026-03-12T14:17:58+0100] [Info] [NPC-AUTO][player:0] Step 14: waiting for OnNPCChangeHeightPos.
[2026-03-12T14:17:59+0100] [Info] [NPC-AUTO][player:0] [PASS] OnNPCChangeHeightPos callback observed.
[2026-03-12T14:17:59+0100] [Info] [NPC-AUTO][player:0] Step 15: forcing NPC stream-out.
[2026-03-12T14:18:00+0100] [Info] [NPC-AUTO][player:0] [PASS] OnNPCStreamOut callback observed.
[2026-03-12T14:18:00+0100] [Info] [NPC-AUTO][player:0] Step 16: forcing NPC stream-in.
[2026-03-12T14:18:01+0100] [Info] [NPC-AUTO][player:0] [PASS] OnNPCStreamIn callback observed.
[2026-03-12T14:18:01+0100] [Info] [NPC-AUTO][player:0] Step 17: waiting for OnNPCVehicleEntryComplete.
[2026-03-12T14:18:05+0100] [Info] [NPC-AUTO][player:0] [PASS] Vehicle-entry callback and state verified.
[2026-03-12T14:18:05+0100] [Info] [NPC-AUTO][player:0] Step 18: shoot the NPC-driven car now to trigger OnNPCVehicleTakeDamage. Autotest will continue automatically.
[2026-03-12T14:18:06+0100] [Info] [NPC-AUTO][player:0] OnNPCVehicleTakeDamage callback observed. Continuing autotest.
[2026-03-12T14:18:06+0100] [Info] [NPC] NPC 99 vehicle 2 took 46.2 damage from player 0 (weapon: 24, hit: 2472.47 -1684.54 13.66)
[2026-03-12T14:18:07+0100] [Info] [NPC-AUTO][player:0] [PASS] Vehicle-damage callback verified.
[2026-03-12T14:18:07+0100] [Info] [NPC-AUTO][player:0] Step 19: waiting for OnNPCVehicleExitComplete.
[2026-03-12T14:18:09+0100] [Info] [NPC-AUTO][player:0] [PASS] Vehicle-exit callback verified.
[2026-03-12T14:18:09+0100] [Info] [NPC-AUTO][player:0] [PASS] Tab-list show/hide natives returned success.
[2026-03-12T14:18:09+0100] [Info] [NPC-AUTO][player:0] Autotest finished: 21 passed, 0 failed.

@NexiusTailer
Copy link
Contributor

NexiusTailer commented Mar 12, 2026

I compeletely don't understand the point in NPC_Give* functions. Why we should inflate main API with basically one-liner functions which could be done on Pawn side in some wrapper. The rest is kinda good for me 👍

@Knogle
Copy link
Author

Knogle commented Mar 12, 2026

I compeletely don't understand the point in NPC_Give* functions. Why we should inflate main API with basically one-liner functions which could be done on Pawn side in some wrapper. The rest is kinda good for me 👍

Ahoy, i've added those in order to match the function set provided by FCNPC, to be sort of a drop-in replacement.

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.

2 participants