So the next trap I'm looking into is one I've tried to use before in A Score to Settle, though not exactly with the results I wanted. Hopefully we can come up with a better method by sharing ideas.
Description: This trap triggers a thrusting weapon that hits the player from an unseen location, like a spike or spear that thrusts out from a wall. It does not use projectiles, so it has a limited range.
1. The weapon needs to move rapidly when the trap is triggered. Ideally, the weapon should retract after being triggered.
2. The weapon needs to cause damage to the player (and AI) if it hits him when triggered. It should not cause damage if the player simply touches it.
In my experiences trying to make these kinds of traps, I've run into the following hurdles:
I've tried putting Damage Stims on the spike, but they affect only the player, not AI. Also, I can't figure out how to make a damage stim only fire once when the spike thrusts forward.
trigger_hurt entities send a damage stim every X seconds. I've tried binding one to the head of the spike, but as above, I don't know how to turn them on and off. They will continue to damage the player as long as they stand touching the spike. If there was a way to spawn the trigger_hurt, let it fire once, and then remove it, that would be great, but that would have to happen each time the trap is triggered.
I thought about trying to tie the damage to velocity, so the spike could damage the player on first thrust but not if the player just touches it afterwards. But as far as I can tell only projectiles have a minVelocity property. (Actually, that must not be true--we have code that handles movables that have to reach a certain velocity before causing damage. But I don't know how that is handled or whether it could be applied here.)
Anyone else have other ideas or experience with the above?
edit: final video and link to prefab here: http://forums.thedar...-trap/?p=425869