Warning: include(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/ai_mg42spotter.php on line 3
Warning: include(http://map.planetmedalofhonor.gamespy.com/mohaa/poll/poll_cookie.php): failed to open stream: no suitable wrapper could be found in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/ai_mg42spotter.php on line 3
Warning: include(): Failed opening 'http://map.planetmedalofhonor.gamespy.com/mohaa/poll/poll_cookie.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/ai_mg42spotter.php on line 3 .map :: Mapping for MoHAA
Warning: include(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/ai_mg42spotter.php on line 57
Warning: include(http://map.planetmedalofhonor.gamespy.com/mohaa/leftindex.php): failed to open stream: no suitable wrapper could be found in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/ai_mg42spotter.php on line 57
Warning: include(): Failed opening 'http://map.planetmedalofhonor.gamespy.com/mohaa/leftindex.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/ai_mg42spotter.php on line 57
Ai : Mg42 Gunner and Spotter
:: Pip
-------------------------------------------------------------------------------
In this tutorial I will explain how to set up enemy
machinegunners, for SP games, that will respawn a given
number of times. It's also possible to spawn spotters.
They point out the target to the machinegunner and will
attack you when you've shot the machinegunner. Very
little scripting is needed, but some basic scripting
and mapping knowledge is assumed.
-------------------------------------------------------------------------------
Part 1 : Setting up enemy machinegunners
-------------------------------------------------------------------------------
Let's get started with the map. Open your map or create
a basic room with light and playerstart. Make sure the
playerstart is behind a wall or something if you don't
want to get shot at once.
1. Now place a mg42 base with a mg42 on top of it somewhere
in your map (See Surgeon's spotlight
tutorial for indepth instructions of how to do this).
Give the mg42 a key/value
of $targetname / mg42.
2. Now we're going to setup the spot where the machine
gunner will be standing. Add an info_pathnode behind
the machinegun. Give it a $targetname
/ mg42_gunner_path.
3. Next thing to do is to put an info_pathnode where
you want the enemy to spawn. They will appear here and
then run to the machinegun, so make sure that you place
in a place that the player can't see. Give it a $targetname
/ mg42_spawner_gunner. Make sure it's pretty
close to the machinegun otherwise your gunner can't
find it.
4. To set the number of times you want the machinegunner
to re-appear give the mg42 a key
/ value of $spawn
/ 2. In this case the gunner will respawn 1 time
after being shot the first time. You can change this
to whatever you want.
That's it for the mapping part. That's easy right?
Let's get into the scripting.
To get the AI to work we need to add the following
line to the script:
exec global/ai.scr
And to set up the mg42 we need to add this line after
"level waittill spawn":
$mg42 thread global/mg42_active.scr::mg42
My map is called test.bsp and the script is test.scr.
It looks like this:
Allright. Save your map and script. Compile it and
your ready.
-------------------------------------------------------------------------------
Part 2 : Adding Spotters
-------------------------------------------------------------------------------
You got the machinegunners working? Let's add some
spotters. The spotter doesn't really have a function,
it's just another guy for you to shoot at. He will tap
the machinegunner on the head and will point in your
direction, as if he's telling the gunner where to shoot.
Let's get to it.
1. Add an info_pathnode to your map. You want the spotter
to stand next to the gunner so place it next to the
mg42_gunner_path. Give it a key/value
of $targetname / mg42_spotter_path.
2. Now place an info_pathnode where you want the spotter
to spawn. Just like with the gunner. e.g. place it next
to mg42_spawner_gunner. Give it a key/value
of $targetname / mg42_spawner_spotter.
That's all. You don't have to change anything in your
script. When both your gunner and spotter die a new
couple will be spawned.
-------------------------------------------------------------------------------
Part 3 : More MG42's
-------------------------------------------------------------------------------
You can have as many mg42 as you like. It's all about
the targetnames.
When you set up a new mg42 do NOT give it the same name
as the first one. All mg42s must have different names.
Suppose I added a second mg42, I would name it for example
$targetname / mg42b. Every
mg42 needs it own spawner and path nodes. So create
another info_pathnode and name it: $targetname
/ mg42b_gunner_path and another one with $targetname
/ mg42b_spawner_path. Same goes for the spotter
path and spawnpoints. Of course this mg42 also needs
a $spawn
value.
Tips :
Info_pathnodes are added as follows: right mouseboutton
> info > pathnodes
Quite a few different models are spawned and you need
to precache them in your precache_test.scr. Take a look
at the console to find out which models to precache.
-------------------------------------------------------------------------------
Part 4: Some more about the mg42_active.scr
-------------------------------------------------------------------------------
Although there's only one script line referring to
this script, it is doing a lot of work in the mg42 setup.
It can even do more then I've already shown you. Here's
how to finetune your mg42s.
Except for the $spawn variable you don't have to set
anything, it's all done by the script, but you can set
some stuff that doesn't get overwritten. Here's a list
with things you can set and the standard value the script
applies.
First of all you can set a maximum range for the mg42.
Instead of calling the script like this:
$mg42 thread global/mg42_active.scr::mg42
do this:
$mg42 thread global/mg42_active.scr::mg42
1024
In this case 1024 would be your range. The default
range is 2400.
The following settings can also be set in the mg42s
entity window:
I think it's all pretty self-explanatory. Take a look
at the g_allclasses.html in your MOHRadianr docs directory
if you want to know more about the Weapon and Turret
settings.
Next is the AI's appearance. When the AI is spawned
they are assigned this model:
german_wehrmact_grenadier
You can easily change this by giving the mg42_spawner_gunner
and/or mg42_spawner_spotter a key/value
of $ai_model / modelname.
For example: key = $ai_model and value = german_afrika_private
That's it. If you want to make even more changes, you
should start hacking the mg42_active.scr. Unpack it,
place in a dir. Eg. main/maps and make sure your script
points to your own mg42_active script, like this:
Warning: include(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/ai_mg42spotter.php on line 288
Warning: include(http://map.planetmedalofhonor.gamespy.com/mohaa/rightindex.php): failed to open stream: no suitable wrapper could be found in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/ai_mg42spotter.php on line 288
Warning: include(): Failed opening 'http://map.planetmedalofhonor.gamespy.com/mohaa/rightindex.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/ai_mg42spotter.php on line 288
Warning: require(): open_basedir restriction in effect. File(/home/map/cgi-bin/mohaa/poll/include/config.inc.php) is not within the allowed path(s): (/var/www/vhosts/own3mall/mohaaaa.co.uk:/usr/share/php:/usr/share/pear) in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/ai_mg42spotter.php on line 299
Warning: require(/home/map/cgi-bin/mohaa/poll/include/config.inc.php): failed to open stream: Operation not permitted in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/ai_mg42spotter.php on line 299
Fatal error: require(): Failed opening required '/home/map/cgi-bin/mohaa/poll/include/config.inc.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/ai_mg42spotter.php on line 299