Author Topic: Help with modding Murder gamemode..  (Read 9689 times)

0 Members and 1 Guest are viewing this topic.

Offline VonTreece

  • Newbie
  • *
  • Posts: 25
  • Karma: 1
Help with modding Murder gamemode..
« on: February 03, 2014, 12:55:28 AM »
Well, I tried posting this on the Facepunch forums, but didn't get much help.
I don't know why, but i'm not a huge fan of the Facepunch community. They're not very welcoming to noobs.. /rant

Anyway, on point..

So I own a Murder server and it's relatively basic as far as addons and whatnot.

My goal is to make it so that whenever a Bystander kills another Bystander, they are instantly ignited via the ULX command "ulx ignite <player>" as punishment for killing an innocent.

Is this possible? If so, how might I go about it?

Please know that although I get the basic structuring of LUA, it is still very new territory for me. (Be gentle..)

IceMod from Facepunch reccomended I try something along these lines:
Code: [Select]
function IgniteBystander(victim,inflictor,attacker)

if victim:IsBystander() and attacker:IsBystander() then
attacker:Ignite()
end
end
hook.Add("PlayerDeath", "BystanderPunishment", IgniteBystander)

Would this work? Where exactly would this be added?

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: Help with modding Murder gamemode..
« Reply #1 on: February 03, 2014, 06:35:20 AM »
First of all, you need to modify Ignite. You need to specify the amount of seconds (read more about Entity/Ignite here: http://wiki.garrysmod.com/page/Entity/Ignite).
In this case it would pretty much only need this:
Code: [Select]
attacker:Ignite( 30 ).
Replace 30 with whatever amount of seconds you want.

Note that "Ignite" also uses a second parameter. In this case, I don't think it's necessary (if you only want to ignite the player and nothing around him), but you can read more about that on te wiki link.

Finally, save as "IgniteBystander.lua" (name before ".lua" can be anything, really) and put it inside <Garry's Mod server directory>/lua/autorun/server.
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

Offline VonTreece

  • Newbie
  • *
  • Posts: 25
  • Karma: 1
Re: Help with modding Murder gamemode..
« Reply #2 on: February 03, 2014, 06:39:36 AM »
Wouldn't that also affect the Murderer when he kills bystanders as well as the Bystander when they kill the murderer?

I only want it to affect the bystander who killed another innocent bystander.

Correct me if i'm wrong. (which I probably am) I just don't see any code that specifies anything other than just igniting anyone that kills another person.

But thank you for the reply! I appreciate any help.


EDIT: Just realised you were talking about adding that to the code shown on my original post.. Derp.. Sorry.. haha

Alright, so I just throw this into my server's lua autorun?

Code: [Select]
function IgniteBystander(victim,inflictor,attacker)

if victim:IsBystander() and attacker:IsBystander() then
attacker:Ignite(30)
end
end
hook.Add("PlayerDeath", "BystanderPunishment", IgniteBystander)

I'll give it a go and post results.. Thanks!


UPDATE:

Didn't work! I tried killing another bystander as a bystander and nothing happened. Any other ideas?
« Last Edit: February 03, 2014, 09:49:26 AM by VonTreece »

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: Help with modding Murder gamemode..
« Reply #3 on: February 03, 2014, 08:44:07 AM »
Is "IsBystander" even part of the Murder gamemode, is the question? If you're checking for a function that doesn't exist, that is a problem.
I have no experience with "Murder", so I really can't help with gamemode-specific things in this matter.
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

Offline VonTreece

  • Newbie
  • *
  • Posts: 25
  • Karma: 1
Re: Help with modding Murder gamemode..
« Reply #4 on: February 03, 2014, 08:48:07 AM »
So although it didn't work, it DID do something..

Now every time a Bystander kills an innocent, they keep the gun and the kill isn't broadcast.

I'm not sure if it's IsBystander or not, any idea where that information might be stored?

EDIT: Removed the script and things went back to normal, so it is for sure that script.
« Last Edit: February 03, 2014, 09:49:06 AM by VonTreece »

Offline Cobalt

  • Full Member
  • ***
  • Posts: 216
  • Karma: 44
  • http://steamcommunity.com/id/__yvl/
Re: Help with modding Murder gamemode..
« Reply #5 on: February 03, 2014, 09:15:35 AM »
Check the user's team with ent:Team() to do this.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Help with modding Murder gamemode..
« Reply #6 on: February 03, 2014, 09:23:51 AM »
Just to expand on Cobolt's suggestion:

replace
if victim:IsBystander() and attacker:IsBystander() then

with

if victim:Team() == attacker:Team() then

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: Help with modding Murder gamemode..
« Reply #7 on: February 03, 2014, 09:28:11 AM »
Check the user's team with ent:Team() to do this.
Didn't even think about this, to be honest.
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

Offline VonTreece

  • Newbie
  • *
  • Posts: 25
  • Karma: 1
Re: Help with modding Murder gamemode..
« Reply #8 on: February 03, 2014, 09:38:26 AM »
Alright, i'll try the following code and post back with details!

Code: [Select]
function IgniteBystander(victim,inflictor,attacker)

if victim:Team() == attacker:Team() then
attacker:Ignite(30)
end
end
hook.Add("PlayerDeath", "BystanderPunishment", IgniteBystander)

Thank you all for your replies!


UPDATE:

Didn't work. (kind of)

It DOES ignite players if they kill someone..
But every time the murderer kills someone, he ignites on fire as well..  /:

Any workaround?
« Last Edit: February 03, 2014, 11:57:43 AM by VonTreece »

Offline VonTreece

  • Newbie
  • *
  • Posts: 25
  • Karma: 1
Re: Help with modding Murder gamemode..
« Reply #9 on: February 03, 2014, 05:06:13 PM »
Bump~

Really need to figure this out. Getting a ton of complaints of RDM and I can't be on the server to moderate 24/7.  /:

Anyone have any ideas?

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Help with modding Murder gamemode..
« Reply #10 on: February 03, 2014, 05:57:19 PM »
It really depends on how this gamemode handles who is the murderer. It doesn't use teams or the script we helped you with would have worked. There is not much else we can do without more information on how it works.

I've never even heard of the gamemode you are running.

Offline VonTreece

  • Newbie
  • *
  • Posts: 25
  • Karma: 1
Re: Help with modding Murder gamemode..
« Reply #11 on: February 03, 2014, 06:32:44 PM »
I dug around in the Murder gamemode files and this lua script looks to be what we're looking for..

sv_player (pastebin)

I skimmed through it and it looks like from line #137 and on has a few functions that relate to player deaths.
« Last Edit: February 03, 2014, 06:39:33 PM by VonTreece »

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given