Mapping with Antlions

From Valve Developer Community
Revision as of 16:24, 14 November 2005 by Mxthe (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

By Mxthe

Ant Lions

In this Tutorial Im going to explain everything I know about Ant Lions, how they act, how to make them unburrow when walking on the sand, how to make them fly or how to make them follow a precise route.

The Ant Lions can't basically see, they hear thats why they are complicated to handle somtimes. In most cases they just run to you and kill you but you can make them do precise things too. Im going to start by the begining, the NPC itself.


Npc_Antlion

This ugly little beast from Starship Trooper is fast, it has 4 legs and it can fly!

KeyValues we can see a lot of things

Start Burrowed - If you want your ant lion to start under the ground and dig up when you want.

Alert Radius - Ant lion dont see, they listen, so when you are that near of him he can spot you, that is the distance where he can spot you.

Ignore Bugbait - If this Ant Lion will ignore the bugbait, so you can't control him, in most cases its NO, but if you want a scripted sequence put it to yes.


There is a help on the window describing each thing, so this window isnt very complicated lets skip to the FLAGS


Burrow When Eluded - It means that if the Ant Lion has no enemy anymore he will go back in the ground.

Use Ground Check, frankly, I never used this flag and I dont see what its for ^^

Gag (No Idle Sounds Till angry) all npc have this flag it means he will not make any sounds until he is angry, and he is angry when he finds an enemy, check this if you want the ant lion to surprise the player.

Template Npc (Used by npc_maker, will not spawn) for the ant lions this has to be checked because they aren't the type of enemy that appear rarely, hehe, better make hundreds of copy of this one, wich mean were gonna use a npc_maker or template maker or the antlion_template maker.

Npc_Template_Maker

In most cases won't use a simple npc_maker because its better to determine each options of the Ant Lion, is he going to start burrowed, his alert radius, his path corners and squad names, hint groups also.

So to make it work good and nice, check the Start Burrowed flag on the AntLion, configure the npc_template_maker normally with the AntLion in the template.

Then go in the outputs and do this

OnSpawnNpc Ant Lion Unburrow

That means that as soon as the Ant Lion spawns (Burrowed) he will Unburrowed and come out of the ground, instead of appearing from no were, that is better isn't it :)

Random Spawns

The great thing about theses ant lions its that they are made to be used with other litle tools to make them spawn a litle randomly when the hero walks on a specified material, can be sand or other!

So before all, make a map with sand, and rocks, what we will make here is that, if the player walks on the sand, ant lions come out near the player and attack, so he is forced to walk on the rocks. Its fun to make, and fun to play!

You need :

npc_antlion

env_shake

ambient_generic

npc_antlion_template_maker

2 logic_relay

env_player_surface_trigger

And a lot of info_node_hint

How to make this up.

Configure the Ant Lion name it AntLion and Starts Burrowed on yes

Name the Following like this:

env_player_surface_trigger : Surface Trigger

ambient_generic : sound_antlion_spawn

env_shake : shake_antlion_spawn

npc_antlion_template_maker : antlion_expanse_spawner

logic_relay 1 : relay_expanse_spawn

logic_relay 2 : relay_expanse_disablespawn

Lets Start with the env_shake.

Name : shake_antlion_spawn

Amplitude : 2

Effect Radius : 500

Duration : 3

Frequency : 100

Thats it, the env_shake is just to make the effect better.



Lets continue with the ambient_generic.

Name : sound_antlion_spawn

SoundName : Streetwar.d3_c17_10b_rumble1

Volume : 8

Fade In Time : 1.5

Fade Out Time : 2

Pitch : 120

Start Pitch : 90

Max Audible Distance : 1250

Thats it too, the sound is to make a diging sound when the ant lions are coming, it is nice and very stressing!



Lets continue with the env_player_surface_trigger, I call it a "material detector" , its to trigger inputs if the player is walking on the specified material, in GameMaterialToWatch, pick sand, then go in the out puts and put this :


My Output Target Entity Target Input

OnSurfaceChangedFromTarget relay_expanse_disablespawn Trigger

OnSurfaceChangedToTarget relay_expanse_spawn Trigger


What we just did here is that if the player starts walking on the surface we have chosen, it triggers the relay wich enables the template_maker, and that if it stops walking on it, it trigger the relay wich disables the spawning.


Lets continue with the npc_antlion_template_maker

In KeyValues :

StartDisabled : Yes, we do not want the template_maker to start spawning at the begining of the map.

Num. of NPCs : Not Really Matter because we will check Infinit Children in flags.

Frequency : 0.35 is a good speed for this operation

Max Live NCPs : How Many Ant Lions can live in same time, I generally put 8

Name Of Template NPC : AntLion, the name of the npc_antlion used

Spawn On HintGroup : I will explain later, write antlion_expanse_spawn_nodes

Spawn Radius : 1000, read the help for more details

Spawn Target : The target that the Ant Lions will attack, in this case, !player DONT FORGET THE ! Its not player, its !player

Ignore Bugbait : No

The rest of the keyvalues doesnt matter, now go in flags, the only flag that needs to be checked is Infinite Children.

Almost done, now go in outputs and write :

MyOutput Target Entity TargetInput Override Parameter Delay

OnAllSpawnedDead antlion_expanse_spawner SetMaxChildren 8 8.00

We just made that if all ant lions are dead it resets the number to 8 to provide any problems.




Lets continue with the logic_relay 1 : relay_expanse_spawn

Go in the outputs and put this :

My Output Target Entity Target Input Delay

OnTrigger sound_antlion_spawn PlaySound 0

OnTrigger relay_expanse_disablespawn CancelPending 0

OnTrigger shake_antlion_spawn StartShake 0.10

OnTrigger antlion_expanse_spawner Enable 1


What we just did here, we made that if this relay is triggered it plays the sound, the ground shakes and the template_maker enables 1 second after we walked on the ground, wich makes an effect like the ant lions are coming up and its very nice :)



Lets continue with the logic_relay 2 : relay_expanse_disablespawn

Go in the outputs and put this :

My Output Target Entity Target Input Delay


OnTrigger sound_antlion_spawn StopSound 0

OnTrigger shake_antlion_spawn StopShake 0

OnTrigger antlion_expanse_spawner Disable 0.50

OnTrigger relay_expanse_spawn CancelPending 0.50


Here we made that if this relay is triggered, the sound stops, the shake stops and the template_maker disables.



And now, lets Finish with the info_node_hint Theses are to set where the ant lions can spawn, you must put one everywere that the ant lion can possibly spawn, and the npc_antlion_template_maker will pick the one nearest the player.

All you got to configure are this :

Hint : AntLion : Burrow Point

Hint Group : antlion_expanse_spawn_nodes



Precise Ways

The ant lions use info_node to navigate on the ground, and info_node_air to navigate while flying.

To make them follow a precise way, make manually a way with PathCorners and set it to the ant lion's path corner, and place info_node around the way so the ant lions can navigate trough them.

If there is a wall on their way, put some info_node_air up the wall about 10 units above it, the ant lions will use it to fly above the wall.

If you want the ant lions to run to a precise target, use aiscripted_schedule, name it, then :

Target Npc : Ant Lion

Search Radius : If there are more than one target, put 0.

All In Radius : If there are more than one target, put yes.

Ai State To Set : Put whatever you want.

Schedule to run : Pick one :)

Interruptability : You choose

Goal Entity : Is the target, it can be one precise or a classname, like npc_citizen...

Then at the npc_template_maker of the Ant Lion, go in output and put

OnSpawnNpc AiSchedule StartSchedule

And its good to go.

Example Map

I made a quick example map of this tutorial, if you are too tired to read all of it, just download the .vmf, copy and past the things I did.

http://www.pcgamemods.com/mod/15620.html