AFAIK Lua has no item_touch event. That would be the most convenient way if Lua supported that. Basically there should be possibilities, but i haven’t checked them. My approach would be to go for a full-fleged mod instead of Lua, but with Lua scripting it might be possible as well.
To be clear, here is the game-mode description:
Search and Destroy, often abbreviated as S&D or SnD, is an elimination-based game mode that has been featured throughout the Call of Duty series. A one-sided game mode, the goal is for an attacking side to either eliminate the defending team or detonate either one of two bomb sites. Players only get one life per round, with most versions of the mode going to a best-of-seven rounds (first to four rounds wins). There is an intermission/half when two or three rounds are completed.
So you need:
- dynamite item spawning which is carryable, should spawn in the map somewhere at map start
- no player should spawn with dynamite and pliers
- player picks up item -> player gets dynamite + pliers
- player dies and tabs out -> item is thrown out of his body on the nearby ground for others to pick up
I haven’t picked up Lua in ages, but here is what i would do to check if its possible with Lua:
For 1): check “G_SpawnGEntityFromSpawnVars” (http://wolfwiki.anime.net/index.php/ETPro:Lua_Mod_API#entities). You should be able to spawn in such an item at map start. If this fails, the whole approach fails.
For 2): check et_ClientSpawn (http://wolfwiki.anime.net/index.php/ETPro:Lua_Mod_API#qagame_execution). If player spawns, make sure you reset his pliers and dynamite flag. Not sure if the field is supported, but i think it is. Fields are here (http://wolfwiki.anime.net/index.php/Fieldname)
For 3): this can’t be done a normal way, you must use et_RunFrame (http://wolfwiki.anime.net/index.php/ETPro:Lua_Mod_API#qagame_execution) and on each frame check if the player picked up an item. Not sure if this is possible either, again, you must check the fields and see if you can get the info there, and then set the dynamite and plier flags.
For 4): the item should be thrown automatically. Flags should be reset by what you did in 3. If other player picks up item again, 3) should handle this as well.
Hope that helps. It could entirely be that it doesn’t work. But that is what i would check right now, if i had the time. Otherwise, i would make a mod. I am 99% certain that this is possible with a mod.