Skip to main content

Respawning Pickups

See the Following Page Before Proceeding

For all idProp_2 Entities...

  • Set networkReplicated = true;
  • Set thinkComponentDecl = NULL; or remove from inheritance (if it exists)
  • Add within the edit branch pair isLootDrop = true;
  • Target the an idTarget_Timeline entity to add a respawn timer

Required Entities

There are 5 required entities to make sure the pickup respawn process functions correctly for all players. They are...

This is an example of a respawning Mega Health entity.

1st Timeline

entity {
	entityDef deathmatch_pickup_mega_health_1_respawn_timeline {
	inherit = "target/timeline";
	class = "idTarget_Timeline";
	expandInheritance = false;
	poolCount = 0;
	poolGranularity = 2;
	networkReplicated = true; // Must be true
	disableAIPooling = false;
	edit = {
		flags = {
			noFlood = true;
		}
		networkSerializeTransforms = false;
		count = 1; // Activates on one count
		spawnPosition = { // Spawn position is not important
			x = 1;
			y = 1;
			z = 1;
		}
		componentTimeLine = {
			entityEvents = {
				num = 1;
				item[0] = {
					entity = "deathmatch_pickup_mega_health_1_respawn_relay"; // Activates first relay
					events = {
						num = 1;
						item[0] = {
							eventTime = 15000; // 15 seconds until respawn
							eventCall = {
								eventDef = "activate";
								args = {
									num = 1;
									item[0] = {
										entity = "";
									}
								}
							}
						}
					}
				}
			}
		}
		repeat = true; // Can activate again
		allowClientsToStart = true; // Must be true
	}
}
}

Relay to Target 2nd Timeline

entity {
	entityDef deathmatch_pickup_mega_health_1_respawn_relay {
	inherit = "target/relay";
	class = "idTarget_Count";
	expandInheritance = false;
	poolCount = 0;
	poolGranularity = 2;
	networkReplicated = false; // Must be false
	disableAIPooling = false;
	edit = {
		flags = {
			noFlood = true;
		}
		networkSerializeTransforms = false;
		count = 1; // Activates on one count
		spawnPosition = { // Spawn position is not important
			x = 1;
			y = 1;
			z = 1;
		}
		targets = {
			num = 1;
			item[0] = "deathmatch_pickup_mega_health_1_respawn_timeline_2"; // Activates 2nd timeline
		}
		repeat = true; // Can activate again
	}
}
}

2nd Timeline

Yes, you need to activate a 2nd timeline so the respawning entity does not crash the game for clients. Do not ask...

entity {
	entityDef deathmatch_pickup_mega_health_1_respawn_timeline_2 {
	inherit = "target/timeline";
	class = "idTarget_Timeline";
	expandInheritance = false;
	poolCount = 0;
	poolGranularity = 2;
	networkReplicated = true; // Must be true
	disableAIPooling = false;
	edit = {
		flags = {
			noFlood = true;
		}
		networkSerializeTransforms = false;
		count = 1; // Activates on one count
		spawnPosition = { // Spawn position is not important
			x = 1;
			y = 1;
			z = 1;
		}
		componentTimeLine = {
			entityEvents = {
				num = 1;
				item[0] = {
					entity = "deathmatch_pickup_mega_health_1_respawn"; // Activates target spawn
					events = {
						num = 1;
						item[0] = {
							eventTime = 100; // 0.1 second for reliable activation
							eventCall = {
								eventDef = "activate";
								args = {
									num = 1;
									item[0] = {
										entity = "";
									}
								}
							}
						}
					}
				}
			}
		}
		repeat = true; // Can activate again
		allowClientsToStart = true; // Must be set to true
	}
}
}

Target Spawn

entity {
	entityDef deathmatch_pickup_mega_health_1_respawn {
	inherit = "target/spawn";
	class = "idTarget_Spawn";
	expandInheritance = false;
	poolCount = 0;
	poolGranularity = 2;
	networkReplicated = false; // Must be false
	disableAIPooling = false;
	edit = {
		flags = {
			noFlood = true;
		}
		spawnConditions = {
			maxCount = 0;
			reuseDelaySec = 0;
			doBoundsTest = false;
			boundsTestType = "BOUNDSTEST_NONE";
			fovCheck = 0;
			minDistance = 0;
			maxDistance = 0;
			neighborSpawnerDistance = -1;
			LOS_Test = "LOS_NONE";
			playerToTest = "PLAYER_SP";
			conditionProxy = "";
		}
		spawnEditableShared = {
			groupName = "";
			deathTrigger = "";
			coverRadius = 0;
			maxEnemyCoverDistance = 0;
		}
		entityDefs = {
		num = 1;
		item[0] = {
			name = "deathmatch_pickup_mega_health_1"; // Activate respawning pickup
		}
}
		conductorEntityAIType = "SPAWN_AI_TYPE_ANY";
		initialEntityDefs = {
			num = 0;
		}
		spawnEditable = {
			spawnAt = "";
			copyTargets = false;
			additionalTargets = {
				num = 0;
			}
			overwriteTraversalFlags = true;
			traversalClassFlags = "CLASS_A";
			combatHintClass = "CLASS_ALL";
			spawnAnim = "";
			aiStateOverride = "AIOVERRIDE_TELEPORT";
			initialTargetOverride = "";
		}
		portal = "";
		targetSpawnParent = "";
		disablePooling = false;
		spawnPosition = { // Be sure to set the spawn position
			x = -11.11;
			y = -11.11;
			z = -11.11;
		}
		spawnOrientation = { // Be sure to set the spawn orientation
			mat = {
				mat[0] = {
					x = -1;
					y = 0;
					z = 0;
				}
				mat[1] = {
					x = 0;
					y = -1;
					z = 0;
				}
			}
		}
	}
}
}

Respawning Pickup

There must be no thinkComponentDecl because it will prevent the pickup from respawning for clients.

entity {
	entityDef deathmatch_pickup_mega_health_1 {
	inherit = "pickup/health/large";
	class = "idProp2";
	expandInheritance = false;
	poolCount = 0;
	poolGranularity = 2;
	networkReplicated = true; // Must be true
	disableAIPooling = false;
	edit = {
		renderModelInfo = {
			model = "art/pickups/health/megaHealth_head_a.lwo";
			contributesToLightProbeGen = false;
			noAmbient = true;
			scale = {
				x = 1;
				y = 1;
				z = 1;
			}
			emissiveColor = {
				r = 0;
				g = 0.913725019;
			}
			emissiveScale = 3;
		}
		spawn_statIncreases = {
			num = 1;
			item[0] = {
				stat = "STAT_ITEMS_SPAWNED";
				increase = 1;
			}
		}
		equipOnPickup = true;
		lootStyle = "LOOT_TOUCH";
		triggerDef = "trigger/props/megahealth";
		isStatic = true;
		canBePossessed = true;
		fxDecl = "pickups/megahealth_head";
		useableComponentDecl = "mega_health";
		sound_spawn = "play_pickup_loop_05";
		sound_stop = "stop_pickup_loop_05";
		pickup_statIncreases = {
			num = 1;
			item[0] = {
				stat = "STAT_HEALTH_PICKUP";
				increase = 1;
			}
		}
		spawnPosition = { // Be sure to set the spawn position
			x = -11.11;
			y = -11.11;
			z = -11.11;
		}
		spawnOrientation = { // Be sure to set the spawn orientation
			mat = {
				mat[0] = {
					x = -1;
					y = 0;
					z = 0;
				}
				mat[1] = {
					x = 0;
					y = -1;
					z = 0;
				}
			}
		}
		targets = {
			num = 1;
			item[0] = "deathmatch_pickup_mega_health_1_respawn_timeline"; // Activates 1st timeline to start respawn process
		}
		isLootDrop = true; // Must be true
	}
}
}