We like to blow things up don't we? Yes we do. And what do we like to use? Indeed, the biggest gun we can get our hands on. So lets put our hands on a Flak88.
On this page...
First: create a Flak88 base ( with nothing selected, right click on the map grid and select turretweapon->german->88mmflakbase ).
Second: create a Flak88 ( with nothing selected, right click on the map grid and select turretweapon->German->88mmflakturret ).
Give the turret this key-value pair ( with the object selected, press 'n' and enter the key-value pairs at the bottom of the EntityDialog:
| Key | Value | Explanation |
| targetname | flak88 | A name used by other entities to target this entity. |
Place the turret on top of the base. We want this to look good.
Done.
Create a trigger_use ( with nothing selected, right click on the map grid and select trigger->use ).
Give it this key-value pair ( with the object selected, press 'n' and enter the key-value pairs at the bottom of the EntityDialog ) :
| Key | Value | Explanation |
| setthread | fire_flak88 | This tells the trigger to call the method "fire_flak88" in the map script file. |
Reposition the trigger so that it sits at a good place... back of the Flak88 perhaps? Done.
OK, now the scripting begins! Remember the setthread above? Well lets write that 'fire_flak88' method in the script:
// ARCHITECTURE: Bjarne Grönnevik // SCRIPTING: Bjarne Grönnevik fire_flak88: // Just a test target. Set it to what you // would like to destroy. local.target = ( 100.0 0.0 0.0 ) // Start the main gun fire animation. $flak88 anim fire_scripted // Wait to give time to the shell to get to the target. wait 1 // Set the animation back to idle ( else the fire // animation will not work the next fire ) $flak88 anim idle // Spawn the explosion animations. waitthread blow_a_place_up end
You saw the
waitthread blow_a_place_up
...above, right? Well, we need to actually blow it up, not just threaten to do it. So lets write the method that blows it up:
// ARCHITECTURE: Bjarne Grönnevik // SCRIPTING: Bjarne Grönnevik blow_a_place_up: // Just a test target. Set it to what you // would like to destroy. local.target = ( 100.0 0.0 0.0 ) // Spawn the explosion animations. local.Exp1 = spawn "fx/scriptbazookaexplosion.tik" local.Exp2 = spawn "animate/fx_mortar_dirt.tik" local.Exp3 = spawn "animate/fx_mortar_higgins.tik" // Shake the ground hard. exec global/earthquake.scr .23 4 0 0 // Get the animations going. local.Exp1.origin = local.target local.Exp1 anim start local.Exp2.origin = local.target local.Exp2 anim start local.Exp3.origin = local.target local.Exp3 anim start wait 1 // Remove the animations. local.Exp1 remove local.Exp2 remove local.Exp3 remove end
OK! What we have now is a Flak88 that we can fire by pressing a trigger.
There are some things missing... the Flak88 is a bit boring, isn't it?
The fire sound of the animation will not work in multiplayer games because of the fact that the ubersound.scr does not have an alias named flak_snd_fire that is configured for multiplayer games. Solve this by using jv_map's new ubersound workaround at .MAP to be able to hear it in multiplayer as well.
This example uses a static location to fire at. There is no need for this. You can fire the Flak88 at any target. You can also realign the Flak88 to point at the target... something like this:
$flak88 setaimtarget local.target
Or maybe a system of switches that lets you control the angle and elevation of the Flak88 to create a guess-fire-calibrate-fire-calibrate-fire-BOOM! scenario.
As it is now, you can fire the Flak88 as fast as you can trigger it... not very realistic. So maybe add a delay before it can be fired again? Maybe it only has a limited amount of shells available? Maybe remove a shell-model from a nearby ammunitions crate each time a reload is started?
Maybe the trigger is only used to start a complex behavior where the Flak88 ( or maybe a series of Flak88:s ) start to randomly carpet bomb an area ( The omaha beach perhaps )?
Maybe you can glue the player to the Flak88 and make it act in the same way as an MG42 machine gun?
Nemesis has a singleplayer tutorial on how to make an "automated" Flak88 fire at a player. The scripts should be easy to adapt to multiplayer.
You don't have to use a Flak88. You can use any weapon. You can build your own weapons if you like. But the Flak88 is the only gun ( that I know of ) that contains the firing animations from scratch. But there is no reason why you can't spawn a muzzle flash, the same way you spawn the other FX in these examples.
Maybe we should stop here...
Yes you can. Check out the Spawning stuff from the script tutorial.
- Bjarne