SpawnItem

From The KillerJim Mod Wiki

Gamemode::SpawnItem

SpawnItem.png

Server Only Function - This is an function executes only on the server.

Description

This function will spawn a named item (weapon, tool, etc.) and return back the actor.

All items are spawned on the server and replicated to the connected clients; the game-mode itself will own the item until such times as something else claims ownership (such as a player picking up a gun, etc.)

This actor can then be modified (change physics, visibility, etc.) but remember to ensure that any changes are done on both server and client sides (i.e. server changes may not be replicated if the author of the item did not set-up, or correctly set-up, replication of components)

Care should also be taken to ensure for replication delays; items are instantly spawned on the server but may take a while (given a client's latency) to replicate to the remote clients. You may wish to create a RepNotify variable and set it to the actor, then remote clients would be notified when the actor was available for them to use.

Arguments
1 String ItemToSpawn
The named item to spawn; KJMod will automatically search all available items (weapons, tools, etc.) looking for the item (this is CASE-sensitive)
Return Value(s)
1 Actor SpawnedActor
The spawned actor.

Playing

Developers

Developer Reference