Well, the first hitch is that a lot of these objects - can't have scripts attached to them. Things like tripwires or grenade clusters don't have any place to hang a script off of so you can do things during "onload".
The second hitch is that a "live" or "armed" mine is a different item from the 1hand mine item. The item under "1hand" mine is what you see when you'll find a few frag mines sitting on a shelf, ready to be picked up. Live mines, OTOH, are projectiles - and projectiles don't have a script attribute.
All is not completely lost though at this point - I was able to place a customized copy of the "1hand" mine type at a location. That item can have a script attached to it. Then, in the "onload" event for that custom copy of the frag mine, I do a GetRandomPercent and if it is 70 or greater, I spawn a "projectile" frag mine at the object's location. Then the placeholder mine calls "disable" and "markfordelete" to remove itself. What you're left with is an active, armed, mine that is ready to go boom when something comes close. The mines, like other traps, don't respawn at cell reset.
But there were a few issues:
- it works great on flat surfaces
- on slanted surfaces, you often can't disarm the mine if crouched as it will be slightly sunk into the ground (gotta be standing to disarm)
- a lot of hand-placed projectile mines have faction/ownership so that they don't go off due to NPCs
- because I'm calling "PlaceAtMe" to create the armed mine, I can't set ownership easily
All that being said... it almost works. The ownership of the spawned mine is an issue. The sinking into the ground could probably be fixed if I always put the placeholder mine 1-3 z-axis units above the terrain. Then the spawned mine can fall into place on the ground. I got around the ownership issue by keeping the new mine locations away from known NPC spawn points or patrol paths.
In terms of game-play... it definitely adds a bit of suspense to entering places like drainage chambers (nearly all of which ended up with at least 1 mine spawn). Instead of knowing exactly where the traps are from previous plays, now there's a 30% chance that there might be a nasty surprise laying somewhere in the clutter. Even when I wasn't cruel and kept the mines placed mostly visible (under a table, on a shelf, along the side of a corridor), it forced me to stop and look rather then rush in and loot the drainage chamber.
Some of the methods I used:
- mix in a live mine spawn with a pile of inactive mines, so 30% of the time you'd best be looking carefully to see if any of them are lit up in the pile
- placed an inactive mine along the side of a corridor
- live mines on shelves, presented to you just like you'd normally see inactive mine loot
- in a storeroom, put inactive mines on the shelves by the door, with a live one farther in
- added mines to the stairwells, bedrooms, and corridors in the Statesman Hotel and Our Lady of Hope
- adding them inside the various campers was interesting
- abandoned boats and the docks along the water, such as putting a mine on top of a pile
- additional mines in places that already had mines
- randomly placed mines besides shelters, garbage cans, phone booths, columns in outdoor locations