Closed Spawning items through SpawnWeaponWithNewEntity crashes the server

Users who are viewing this thread

Version number
1.2.9
Branch
Main
Modded/unmodded
Unmodded

Gotha

Adimi h.c.
Baron
Summary: When calling Mission.Current.SpawnWeaponWithNewEntity(....) the server crashes because the SpawnWeaponWithNewEntityAux method access the optional attachedMissionObject parameter which can be null.
C#:
GameNetwork.WriteMessage(new SpawnWeaponWithNewEntity(weapon, spawnFlags, firstScriptOfType.Id.Id, frame, attachedMissionObject.Id, isVisible: true, hasLifeTime));

// Should be:

GameNetwork.WriteMessage(new SpawnWeaponWithNewEntity(weapon, spawnFlags, firstScriptOfType.Id.Id, frame, attachedMissionObject != null ? attachedMissionObject.Id : MissionObjectId.Invalid, isVisible: true, hasLifeTime));

Thats also how it is done in the MissionNetworkComponent in the SendSpawnedMissionObjectsToPeer method.

How to Reproduce:
Just somehow try to spawn an item through the named function.
Scene Name (if related): Any
Media (Screenshots & Video): /
Computer Specs:
OS: W11
GPU: AMD 7900XTX
GPU Driver Version: Up to date
CPU: AMD 5900X
RAM: 32GB
Storage Device (HDD/SSD): SSD
 
Last edited:
Hey, thank you for letting us know. I have been informed that the line of code you are trying to use is a leftover code for SP gameplay and, even though it seemslike it, it is not compatible to the MP scenes. I have informed the devs about the issue and the necessary steps will be taken. Thank you for your time and sorry for the inconvenience.
 
Back
Top Bottom