Repeatedly spawning an entity

Tutorial collection, comprehensive listings on main site.

Repeatedly spawning an entity

Postby Tutorial on Mon Mar 07, 2005 6:06 pm

This technique can be used to spawn any entity that moves. NPC's, physics objects, and items the player can pick up can be spawned at a location when the entity, 'env_entity_maker' is fired.

1) Create the entity to be spawned (the spawnee)

Simple as that. Create and set up the entity that you want to be spawned. For this example we'll use a prop_physics with the model "models/props_c17/oildrum001.mdl". Not surprisingly, it should look like an oil drum (After you hit 'Apply'). Name it something like "barrel01". It doesn't matter where in the map you put it, as long as it's in the map. It will be removed, because it will be used as a template.

2) Make the spawnee a Template

Place a "point_template" entity somehwere inside your map, near the drum. It doesn't have to be near the drum, but it will make it easier on more complex maps. Name the point_template something like "barrel01_template". Under the field, "Template 1", put the name of the spawnee, in this case 'barrel01'.

3) Create the Spawner

Place an "env_entity_maker" exactly where you want the spawnee to be reproduced. Set it's name to something like "barrel01_spawner". Under the field "Point_template to spawn", put the name of the point_template, in this case "barrel01_template". Go to the 'Flags' tab. Here you can enable AutoSpawn, and change settings for that, or you can set the conditions under which a ForceSpawn will be allowed. I suggest only ticking one-"ForceSpawn: Only if there's room".

Now all you have to do is trigger it via a button or any other object capable of an ouput. On the 'Outputs' tab of the object that triggers a spawn, set the 'Via this input' field to "ForceSpawn"

Compile and test it. If all was done well, a barrel should appear out of nowhere at the env_entity_maker. If all was not done well, tell me your problems in the forums.

Good luck.

Serever
- Don't send PM's to this user -
Tutorial
Not A Real User
 
Joined: Sun Mar 06, 2005 11:00 pm

Postby Revon on Thu Jul 27, 2006 5:51 pm

thanks for this man... great for my map where i have 20 ragdolls and low grav on....now i only need one =)
User avatar
Revon
Dumpling
Dumpling
 
Joined: Thu Jul 27, 2006 5:40 pm

Postby hP on Thu Jul 27, 2006 7:22 pm

Usefull as always... ;-) great job.
I would be lost without Interloopers tuts! xD
Carpe Noctem
User avatar
hP
Member
Member
 
Joined: Sun Apr 09, 2006 8:22 pm
Location: Portugal

Return to Tutorials

Who is online

Users browsing this forum: No registered users