Warning: Division by zero in /home/g/gronnevik/gronnevik/gronnevik.se/www/rjukan/index.php on line 785

Warning: Division by zero in /home/g/gronnevik/gronnevik/gronnevik.se/www/rjukan/index.php on line 785

Warning: Division by zero in /home/g/gronnevik/gronnevik/gronnevik.se/www/rjukan/index.php on line 785

Warning: Division by zero in /home/g/gronnevik/gronnevik/gronnevik.se/www/rjukan/index.php on line 785
The Rjukan Project - Main - TriggerableFlak88

Menu

Wiki usage

Creative Commons License
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License.
Edit Sidebar
Main > TriggerableFlak88

Creating a triggerable Flak88 in a multiplayer map, tutorial

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...

Create a Flak88

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:

KeyValueExplanation
targetnameflak88A name used by other entities to target this entity.

Place the turret on top of the base. We want this to look good.

Done.

Give it a trigger

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 ) :

KeyValueExplanation
setthreadfire_flak88This 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.

Fire the gun

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

Blow up the spot where it hits

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.

Think about extending this

There are some things missing... the Flak88 is a bit boring, isn't it?

Fire sound

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.

Aiming the Flak88

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.

Reloading the Flak88

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?

Fully automatic Flak88

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 )?

Player controlled Flak88

Maybe you can glue the player to the Flak88 and make it act in the same way as an MG42 machine gun?

Hunt players with a Flak88

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.

Dont use aFlak88 at all

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.

Flying Flak88

Maybe we should stop here...

Can I do this only by scripting?

Yes you can. Check out the Spawning stuff from the script tutorial.

- Bjarne

Recent Changes Printable View Page History Edit Page [Attributes] [Printable View] [WikiHelp]
Page last modified on February 03, 2005, at 12:46 AM