Jump to content

Mapping Issue: Creating NPC Spawn Button


Recommended Posts

Posted

Hello!

I've been out of the game for a while now, and I've got quite a bit rusty as a result. I remember years ago having some luck with this, but I just can't quite get it to go now. Could someone give me the step by step to creating a functioning NPC spawn switch in a map? I've done it with vehicles before, but I'm not having much luck with regular npcs. 

Posted

Create a trigger_multiple for the button (Don't forget a wait key on it). Target it at an npc_spawner entity.

On the npc_spawner, I forget the key name that determines the NPC to be spawned, but i think it's npc_type. And you may need to set the count value to -1.

Posted

I think that's about what I tried out earlier, but just in case I tried again. The result was that the NPC was already spawned when I loaded the map and the button did not seem to spawn more. 

Posted

Are you sure you linked the trigger_multiple and the NPC_spawner? NPC_spawner entities with targetname don't spawn their NPCs, only when used. Select the trigger_multiple, then the NPC_spawner, then CTRL + K to connect them.

Posted

Also - make sure the trigger_multiple is set to trigger by the conditions you want. By default, a trigger_multiple will fire it's target whenever a player touches it. If you want players to have to press the "Use" button on the trigger, you'll need to set the player_use spawnflag.

If nothing works, post a link to your map file, and someone here can definitely tell you what's wrong.

MagSul likes this
Posted

Ah that did it! I knew the problem was probably something really simple. Thanks! My problem was that I was (probably) selecting the spawner FIRST, and then the trigger_multiple. Now for one more issue if you folks have the time: I also need a button that spawns multiple NPCs at once. I recall there being SOMETHING about a team function, but I just can't dig up the specifics. 

Posted

The team key is used for doors, to make them move together in sync. In case one door is blocked and reverses, all other doors on the team will do the same.

If you want more than one spawner to be fired by that button, just give the other spawner the same targetname as the first one. When a trigger is fired, it will fire every entity with a targetname that matches it's target.

The easiest way to do this is just to copy and paste your current npc_spawner - it will keep the targetname. Then you can change the other parameters however you need.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...