Snarkpit Articles


Spawn stuff Button



Spawn stuff Button. (Simplifyed Reading)


Ok, lets say you want to build a little house made of barrels or whatever, BUT WAIT, not enough barrels in the map? well make them (on your new map).


This is a tutorial for how to spawn objects with a press of a button.


1. Make the shape of what you want to spawn with the block tool
(for this tutorial I will use a barrel.)

2. Right click on your thing and click tie to entity

3. Pick "func_physbox" and name it whatever you want (barrel)
You can put other stuff on it if you like.

4. Pick the entity thing on the sidebar above the block tool, make "env_entity_maker" and put it inside your object, just stick it in. Name it something (Barrel_maker) Then click the "Point Template to Spawn" below "pitch yaw row". Put in a name. (barrel_ temp)

5. Pick entity button again, make a "Point_template" also inside your object. Put in the name of your env_entity_maker's "Point template to spawn". (barrel_temp) Go down and pick "template 1". Type in the name of your "func_physbox" (barrel)

6. Now make a button, which is a little box with "func_button" tied to it, with tie to entity. Name your button if you want, It doesn't matter for this tutorial (barrel_button).
Click the "outputs" tab by "class info". Click add...
1) For "My output name" Pick onpress
2) For "Target entities named" type in the name of your "env_entity_maker" (barrel_maker)
3)For "Via this input" Pick forcespawn
Now go to Flags tab and check "use activates".


Now go in game and spawn the things like crazy if you want.


How this works:

1.Every time you press that button, the button sends a message to the "env_entity_maker" (barrel_maker)

2.Then the "env_entity_maker" reads your "Point_template to spawn" and sees, oh <name of point_template> (barrel_temp) and sends a message to your "Point_template"

3. Then you "Point_template" reads your "template 1" and it sees <name of object> (barrel) So it finds your object, and makes one.


And all that happens in like... 1 second or less.


Post ReplyView Topic
Discussion
0 starsPosted by Stadric on Thu Jan 5th 2006 at 2:57am

Doc, this could easily be used to make batteries, or some other kind of key, just in case someone accidentally loses one or something
0 starsPosted by DrGlass on Tue Jan 3rd 2006 at 10:59pm

I didn't like the flow of information of this tutorial, maybe I'm distracted or maybe it could be written better. Also a few examples of how this could be used in game would help this out a bit.
0 starsPosted by Biological Component on Wed Dec 14th 2005 at 1:58am

G1, forgot what your own tut looked like? It can't be THAT good then...
[author]
Posted by SharpShot on Sun Dec 11th 2005 at 12:48am

Looks like a nice tut, it works, ty.
Oh wait, I wrote this, didn't even recongise it, its been 5 months since I wrote this tut.
0 starsPosted by Vix on Fri Dec 9th 2005 at 10:40pm

Nice tut, i didn't tried it yet. But it's very very interestin smiley
Post ReplyView Topic