DeepRedCee 说:
插入代码块:
(0, 0, ti_once, [],
[
(multiplayer_is_server),
(call_script, "script_replace_scene_items_with_spawn_items_before_ms"),
(call_script, "script_replace_scene_items_with_spawn_items_after_ms"),
]),
The multiplayer_is_server operation is all that's needed to prevent clients running the code and causing a synchronization error; but those native scripts are almost certainly split up into before_ms and after_ms for a reason: the before_ms script should be called from a ti_before_mission_start mission template trigger, and the after_ms script should be called from a ti_before_mission_start trigger, or a (0, 0, ti_once one, as you have (compare with the Native tutorial usage).
How the scripts seem to work, basically: before mission start a global variable is set to point to pos8 (position register

, then all items are looped over and checked for any scene editor placed instances, if so the position is stored in the current position register pointed at by the global, the pos number stored in a list of item slots, then the global variable incremented to point at the next position register, until all item positions are saved, then the scene editor placed items are all replaced with spr_empty; after mission start, the other script goes through all item slots in the lists, spawning items at the position registers pointed at. This causes some limitations and potential problems: if any other trigger or script modifies position registers 8 or above between the two script calls it will mess up spawned item positions; and you can only have a maximum of 120 items of all types spawned this way: there are only 128 of each type of register (reg0 -> reg127, pos0 -> pos127, s0 -> s127, the higher numbers usable with those names if the python constants are defined), and the global pointer starts at pos8 and goes to pos127 (120 registers); if more are placed, 128 and above will probably truncate back to start from 0 again, overwriting positions of earlier item instances. You probably didn't care much about all that detail, but I just felt like investigating it.
It's possible that the method used by those scripts - for the Native tutorial - do not work in multiplayer; I'd try splitting up the calls as suggested above, and if that doesn't work you probably need to write and test your own feature.