I search for solutions in this order: Past Code, Unreal Source, Wiki, BUF, groups.yahoo, google, screaming at monitor. – RegularX
This is a quick and dirty tutorial on how to create basic Landmines in UT, which explode when you 'step' on them.
For the Landmine you'll need to add several new actors to your level. I'm assuming you know the basics of all of these actors – you may want to browse the class spec pages before you start.
- ExplosionChain: This is going to take care of the visual aspect of the Landmine.
- SpecialEvent: This will damage the player.
- Trigger: This will activate the Landmine.
Let's get to work
I added one ExplosionChain to my level.
Once placed in the level, open their properties and make sure these settings are as stated.
- bOnlyTriggerable: True
- Tag: Landmine
- Damage: 100.0000000 (you might also remove or decrease this, because the SpecialEvent will also inflict damage).
- DelayTime: 0.10000000
- MomentumTransfer: 100000.000000
- Size: 4
I also added one SpecialEvent to my level with these properties.
- Tag: Landmine
- InitialState: DamageInstigator (or KillInstigator if you want to kill the player).
- Damage: 80
One Trigger is needed to make this Landmine work. Add it to your level at the position where your Landmine is supposed to be. Also make sure that the ExplosionChain is very close to the Trigger. It doesn't matter where the SpecialEvent is though.
Open the Trigger's properties and verify these settings.
- CollisionHeight: 16 (*)
- CollisionRadius: 32 (*)
- Event: Landmine
- bTriggerOnceOnly: True
(*): Make sure these settings are rather small. I used 16 and 32, but you might wanna make it even smaller. Landmines are usually not that big. Use the Actor's Radii View to see the actual radius.
For more Realism: an extra Mover
Also for more 'realism' you can carve out a rough piece out of the floor (so it looks blown up) and add in a Mover. Then have this Mover's keyframe 1 to somewhere outside the level. Some other properties to take care of are
- Tag: Landmine
- bTriggerOnlyOnce: True
- bUseTriggered: True
- MoverEncroachType: IgnoreWhenEncroach
- MoveTime: 0.0000
- StayOpenTime: 0.0000 (equals: stays open infinitely)
- InitialState: TriggerOpenedTimed
You're basically done :) Boot your level and be carefull where you walk ;).
I did not take care of any sound related effect in this tutorial. The sound effect (Landmine exploding) can simply be added by adding another SpecialEvent with a InitialState set to PlaySoundEffect. Then giving it the same tag as the other SpecialEvent will trigger this one as well. Perhaps you can also do it with TriggeredAmbientSounds.
The ExplosionChain can only be fired once. See the ExplosionChain class page for a custom script which allows the explosion to be repeatable.
Tarquin: Cool tute, G.o.a.T. :D I've put in some backlinks on the class pages.
the G.o.a.T: Tnx :) I'm planning on adding some others as well, but I'm still working them out a bit. Stay tuned. ;)
VitalOverdose: I dont see anything on replication anywhere. Does any of this this work online?
UArch: take a look at the actors used, triggers, specialevents and an explosion chain, very commonly used actors..be kinda pointless if they didnt work online, half the maps ever made would possibly be broken!
SuperApe: It should be noted that this tutorial is for UT, as UT2004 (3?) has Triggers -> LandMine.