• [TTT] Any ideas for Detective weapons
    55 replies, posted
[QUOTE=Exho;44775428]I'm working on the heart monitor with a buddy of mine (who is better at lua).[/QUOTE] I did it ages ago
[QUOTE=Sm63;44773481]I did the Heart Monitor ages ago. The only issue you'll have is when youre checking on the players death is the victim has the equipment. As the function runs after that, the StripAll function removes all the equipment off the player before you can even check if they have it[/QUOTE] Couldn't you use PlayerHurt to see if they are about to die? [editline]11th May 2014[/editline] [QUOTE=zapha;44774655]If someone plants a bomb. And you have a device that can track the bomb entity. Is it possible to make a path to that entity in form of a trail? This is the spell Clairvoyance from Skyrim. Kind of what i mean. [/QUOTE] Yes you can [video=youtube;KBUwUk6BDb8]http://www.youtube.com/watch?v=KBUwUk6BDb8[/video] Not my video btw.
[QUOTE=Sm63;44776007]I did it ages ago[/QUOTE] Alright well would you be kind enough to release the code for it? Spare me an hour or two of work? I would be thankful
[QUOTE=Exho;44780590]Alright well would you be kind enough to release the code for it? Spare me an hour or two of work? I would be thankful[/QUOTE] Its not that big of a code and requires you to edit ONE core file. [code] EQUIP_MONITOR = 8 local function Init3() local equipitem3 = { id = EQUIP_MONITOR, loadout = false, type = "item_passive", material = "vgui/ttt/icon_monitor.png", name = "Heart Beat Monitor", desc = "Announces your death." } table.insert( EquipmentItems[ROLE_DETECTIVE], equipitem3 ) end hook.Add( "InitPostEntity", "LoadEquipItemMonitor", Init3 ) hook.Add("PlayerDeath", "Monitor", function(ply) for k,players in pairs(player.GetAll()) do if ply:HasEquipmentItem(EQUIP_MONITOR) then CustomMsg(players, ply:Nick() .. "'s death has been confirmed due to him having a heart beat monitor!", Color(255,0,0)) players:ConCommand("play play hl1/ambience/particle_suck1.wav") ply:SetNWBool("body_found", true) players:PrintMessage( HUD_PRINTTALK, ply:Nick() .. "'s death has been confirmed due to him having a heart beat monitor!") local dti = CORPSE.dti ply.server_ragdoll:SetDTBool(dti.BOOL_FOUND, true) else print("haha im false") end end end) [/code] Works shared
Alright so I put this in Autorun and change the equip_items_shd to have the EQUIP_MONITOR part? I tried it earlier and could not get it to work
[QUOTE=Exho;44810162]Alright so I put this in Autorun and change the equip_items_shd to have the EQUIP_MONITOR part? I tried it earlier and could not get it to work[/QUOTE] Dont change equip_items_shd at all.
[QUOTE=Sm63;44782409]Its not that big of a code and requires you to edit ONE core file. Works shared[/QUOTE] You should do the if statement to check the equipment before the for loop, just a nit pick, seems a bit silly to start a for loop when not necessary aswell as setting his bool to true for every player, it's unnecessary code, because it will loop through all players for no reason, also, DoPlayerDeath is called before PlayerDeath, so I would use this code, but this is just personally how I would do it; [CODE] EQUIP_MONITOR = 8 local function CreateHeartbeat() local heartbeatMonitor = { id = EQUIP_MONITOR, loadout = false, type = "item_passive", material = "vgui/ttt/icon_monitor.png", name = "Heart Beat Monitor", desc = "Announces your death." } table.insert( EquipmentItems[ROLE_DETECTIVE], heartbeatMonitor ) end hook.Add( "InitPostEntity", "LoadEquipItemMonitor", CreateHeartbeat ) hook.Add("DoPlayerDeath", "Monitor", function(ply) if ply:HasEquipmentItem(EQUIP_MONITOR) then for k,players in pairs(player.GetAll()) do CustomMsg(players, ply:Nick() .. "'s death has been confirmed due to him having a heart beat monitor!", Color(255,0,0)) players:ConCommand("play play hl1/ambience/particle_suck1.wav") end ply:SetNWBool("body_found", true) local dti = CORPSE.dti ply.server_ragdoll:SetDTBool(dti.BOOL_FOUND, true) PrintMessage( HUD_PRINTTALK, ply:Nick() .. "'s death has been confirmed due to him having a heart beat monitor!" ) end end) [/CODE] I don't really know what custom msg does, I assume it's a TTT function... Also, does that sound function even work? I haven't actually tested your code, it doesn't look like it would work, plus, there are better ways of handling playing a sound. I have never coded anything in TTT... I will make the weapons requested soon though. I'm just procrastinating right now.
[QUOTE=AnonTakesOver;44813845]You should do the if statement to check the equipment before the for loop, just a nit pick, seems a bit silly to start a for loop when not necessary aswell as setting his bool to true for every player, it's unnecessary code, because it will loop through all players for no reason, also, DoPlayerDeath is called before PlayerDeath, so I would use this code, but this is just personally how I would do it; [CODE] EQUIP_MONITOR = 8 local function CreateHeartbeat() local heartbeatMonitor = { id = EQUIP_MONITOR, loadout = false, type = "item_passive", material = "vgui/ttt/icon_monitor.png", name = "Heart Beat Monitor", desc = "Announces your death." } table.insert( EquipmentItems[ROLE_DETECTIVE], heartbeatMonitor ) end hook.Add( "InitPostEntity", "LoadEquipItemMonitor", Init3 ) hook.Add("DoPlayerDeath", "Monitor", function(ply) if ply:HasEquipmentItem(EQUIP_MONITOR) then for k,players in pairs(player.GetAll()) do CustomMsg(players, ply:Nick() .. "'s death has been confirmed due to him having a heart beat monitor!", Color(255,0,0)) players:ConCommand("play play hl1/ambience/particle_suck1.wav") end ply:SetNWBool("body_found", true) local dti = CORPSE.dti ply.server_ragdoll:SetDTBool(dti.BOOL_FOUND, true) PrintMessage( HUD_PRINTTALK, ply:Nick() .. "'s death has been confirmed due to him having a heart beat monitor!" ) end end) [/CODE] I don't really know what custom msg does, I assume it's a TTT function... Also, does that sound function even work? I haven't actually tested your code, it doesn't look like it would work, plus, there are better ways of handling playing a sound. I have never coded anything in TTT... I will make the weapons requested soon though. I'm just procrastinating right now.[/QUOTE] CustomMsg is like, the messages in the top right corner. First argument is who can see it, second is the text itll show, and the third is colour. The sound does work, and I do know there are better ways. Also, you forgot to change the function that hook will use from Init3 to CreateHeartbeat. This is what CustomMsg does with the right syntax [img]http://puu.sh/8N1gR.jpg[/img] Also, thanks for the info about DoPlayerDeath. Didnt even know the hook existed.
[QUOTE=Sm63;44814050] Also, you forgot to change the function that hook will use from Init3 to CreateHeartbeat. [/QUOTE] Thanks, updated it, Cheers for the CustomMsg info, I will snoop around the TTT website to see their functions and stuff..
[QUOTE=AnonTakesOver;44814083]Thanks, updated it, Cheers for the CustomMsg info, I will snoop around the TTT website to see their functions and stuff..[/QUOTE] Im pretty sure it isnt on their site. I got it from the entity for map makers. terrortown/entities/entities/ttt_game_text.lua
2 basic scripts: [url]http://www.mediafire.com/download/55nwu13bichytna/TTTSimpleScripts.zip[/url] First one is the heartbeat mentioned in the thread, second one is the tester mentioned, to add stuff for the player to say if they didn't kill someone, just open the weapon_ttt_portotester.lua and go to the bottom, you will see local stuff, which contains the texts, just add a comma then a string of whatever text. These are real simple scripts. You also have to set the material for when they press C to open the menu. I will make more when I can be bothered. Report any bugs, but there shouldn't be, I was only able to test on bots.
Heat Tracker: When you press N and have this, you'll block out all of your vision except some items. Players will be red. But if you marked them on the scoreboard with the tags, their colour will be the colour of the tag. Weapons will be blue C4s will be red.
[QUOTE=AnonTakesOver;44814525]2 basic scripts: [url]http://www.mediafire.com/download/55nwu13bichytna/TTTSimpleScripts.zip[/url] First one is the heartbeat mentioned in the thread, second one is the tester mentioned, to add stuff for the player to say if they didn't kill someone, just open the weapon_ttt_portotester.lua and go to the bottom, you will see local stuff, which contains the texts, just add a comma then a string of whatever text. These are real simple scripts. You also have to set the material for when they press C to open the menu. I will make more when I can be bothered. Report any bugs, but there shouldn't be, I was only able to test on bots.[/QUOTE] [CODE][ERROR] gamemodes/terrortown/entities/entities/ttt_heartbeat.lua:31: attempt to index field 'server_ragdoll' (a nil value) 1. fn - gamemodes/terrortown/entities/entities/ttt_heartbeat.lua:31 2. unknown - addons/ulib/lua/ulib/shared/hook.lua:183 3. DispatchTraceAttack - [C]:-1 4. StabKill - gamemodes/terrortown/entities/weapons/weapon_ttt_knife.lua:193 5. oldprimary - gamemodes/terrortown/entities/weapons/weapon_ttt_knife.lua:104 6. unknown - addons/damagelog-master/lua/sv_damageinfos.lua:34[/CODE] Server ragdoll? I have crashcatcher on my server, if it's relevant. EDIT: I should say it does work, just the errors come up. The message appears, the scream occurs (even when knifed, probably intentional on your part?), and the body disappears (again, intentional or not?).
[QUOTE=Dawnkiller;44815715][CODE][ERROR] gamemodes/terrortown/entities/entities/ttt_heartbeat.lua:31: attempt to index field 'server_ragdoll' (a nil value) 1. fn - gamemodes/terrortown/entities/entities/ttt_heartbeat.lua:31 2. unknown - addons/ulib/lua/ulib/shared/hook.lua:183 3. DispatchTraceAttack - [C]:-1 4. StabKill - gamemodes/terrortown/entities/weapons/weapon_ttt_knife.lua:193 5. oldprimary - gamemodes/terrortown/entities/weapons/weapon_ttt_knife.lua:104 6. unknown - addons/damagelog-master/lua/sv_damageinfos.lua:34[/CODE] Server ragdoll? I have crashcatcher on my server, if it's relevant. EDIT: I should say it does work, just the errors come up. The message appears, the scream occurs (even when knifed, probably intentional on your part?), and the body disappears (again, intentional or not?).[/QUOTE] Had the same problem. It only errors if using the DoPlayerDeath hook. If I use the regular PlayerDeath, then it works just fine. [editline]16th May 2014[/editline] Its erroring because its loaded before PlayerDeath hook. PlayerDeath in TTT makes the "server_ragdoll". DoPlayerDeath is called before it, so it doesnt exist hence, why its returning a nil value
Okay I swear, am I doing something wrong here? I cannot get either of the heart beat things to show up in the Detective menu for the life of me. I've got one of them with the number 16 and the other, 8. I have Anon's in garrysmod\addons\TTTSimpleScripts\gamemodes\terrortown\entities\entities And the other in GarrysMod\garrysmod\addons\Heartbeat\lua\autorun But it does print this when bots die, [code] ServerLog: 00:04.53 - KILL: <something/world> killed Bot07 [innocent] haha im false haha im false haha im false haha im false haha im false haha im false haha im false [/code]
[QUOTE=Dawnkiller;44815715][CODE][ERROR] gamemodes/terrortown/entities/entities/ttt_heartbeat.lua:31: attempt to index field 'server_ragdoll' (a nil value) 1. fn - gamemodes/terrortown/entities/entities/ttt_heartbeat.lua:31 2. unknown - addons/ulib/lua/ulib/shared/hook.lua:183 3. DispatchTraceAttack - [C]:-1 4. StabKill - gamemodes/terrortown/entities/weapons/weapon_ttt_knife.lua:193 5. oldprimary - gamemodes/terrortown/entities/weapons/weapon_ttt_knife.lua:104 6. unknown - addons/damagelog-master/lua/sv_damageinfos.lua:34[/CODE] Server ragdoll? I have crashcatcher on my server, if it's relevant. EDIT: I should say it does work, just the errors come up. The message appears, the scream occurs (even when knifed, probably intentional on your part?), and the body disappears (again, intentional or not?).[/QUOTE] Go to line 31 of the heartbeat.lua and remove ply.server_ragdoll:SetDTBool(dti.BOOL_FOUND, true) [editline]15th May 2014[/editline] [QUOTE=Exho;44818283]Okay I swear, am I doing something wrong here? I cannot get either of the heart beat things to show up in the Detective menu for the life of me. I've got one of them with the number 16 and the other, 8. I have Anon's in garrysmod\addons\TTTSimpleScripts\gamemodes\terrortown\entities\entities And the other in GarrysMod\garrysmod\addons\Heartbeat\lua\autorun But it does print this when bots die, [code] ServerLog: 00:04.53 - KILL: <something/world> killed Bot07 [innocent] haha im false [/code][/QUOTE] Your using his old code and mine, delete his.
My issue was I had it in addon format :/ Thank you very much
[QUOTE=AnonTakesOver;44818994]Go to line 31 of the heartbeat.lua and remove ply.server_ragdoll:SetDTBool(dti.BOOL_FOUND, true) [/QUOTE] The body wont be "id"d then. You could probably do a timer
[QUOTE=Sm63;44821831]The body wont be "id"d then. You could probably do a timer[/QUOTE] Hmmm, I'll update it. [editline]16th May 2014[/editline] [url]https://www.mediafire.com/?55nwu13bichytna[/url] [editline]16th May 2014[/editline] [QUOTE=Sm63;44815296]Heat Tracker: When you press N and have this, you'll block out all of your vision except some items. Players will be red. But if you marked them on the scoreboard with the tags, their colour will be the colour of the tag. Weapons will be blue C4s will be red.[/QUOTE] Hmmm, seems a bit OP don't ya think? I'll make it this weekend though.
[QUOTE=Sm63;44814050]CustomMsg is like, the messages in the top right corner. First argument is who can see it, second is the text itll show, and the third is colour. The sound does work, and I do know there are better ways. Also, you forgot to change the function that hook will use from Init3 to CreateHeartbeat. This is what CustomMsg does with the right syntax [img]http://puu.sh/8N1gR.jpg[/img] Also, thanks for the info about DoPlayerDeath. Didnt even know the hook existed.[/QUOTE] I had no idea such a function existed ( CustomMsg ) and just added my messages to the language. And I might work on something too, actually. [editline]16th May 2014[/editline] [QUOTE=AnonTakesOver;44822008] Hmmm, seems a bit OP don't ya think? I'll make it this weekend though.[/QUOTE] Would love to do something like that, but cba to learn stencils.
[QUOTE=AnonTakesOver;44822008] Hmmm, seems a bit OP don't ya think? I'll make it this weekend though.[/QUOTE] Maybe, also an idea to add on: If a T is disguised, they wont be seen
[QUOTE=Sm63;44815296]Heat Tracker: When you press N and have this, you'll block out all of your vision except some items. Players will be red.[B][I][U] But if you marked them on the scoreboard with the tags, their colour will be the colour of the tag.[/U][/I][/B] Weapons will be blue C4s will be red.[/QUOTE] Hmmm, you wouldn't happen to know the client lua script for this? Or any functions I could use for this would you? Everything else is easy, I'm just to lazy to go through the TTT lua's to see how to get the color of their tag. [editline]17th May 2014[/editline] Anyway, here it is: [url]http://www.mediafire.com/download/55nwu13bichytna/TTTSimpleScripts.zip[/url] Scoreboard tags aren't added, Players are Red C4 is Green and weapons are Blue. People disguised don't show.
[QUOTE=AnonTakesOver;44830522]Hmmm, you wouldn't happen to know the client lua script for this? Or any functions I could use for this would you? Everything else is easy, I'm just to lazy to go through the TTT lua's to see how to get the color of their tag. [editline]17th May 2014[/editline] Anyway, here it is: [url]http://www.mediafire.com/download/55nwu13bichytna/TTTSimpleScripts.zip[/url] Scoreboard tags aren't added, Players are Red C4 is Green and weapons are Blue. People disguised don't show.[/QUOTE] I didn't mean through walls :P. I meant an actual thermal goggles sort of things, but its nice
[QUOTE=Sm63;44835149]I didn't mean through walls :P. I meant an actual thermal goggles sort of things, but its nice[/QUOTE] Yeah, I was thinking it would be a bit op, here: [url]http://www.mediafire.com/download/55nwu13bichytna/TTTSimpleScripts.zip[/url] All you have to do is set ignoreZ to false in halo.Add.
Is it possible to make it so the player can only buy one item_passive? I've coded a couple that I dont think people should be able to buy at the same time
[QUOTE=Exho;44843471]Is it possible to make it so the player can only buy one item_passive? I've coded a couple that I dont think people should be able to buy at the same time[/QUOTE] What do you mean, do you the player can only have one current item_passive? Yes, that would be possible, I don't know much about TTT, but there might be a hook, otherwise you might need to edit the gamemode.
Sorry, you need to Log In to post a reply to this thread.