May 09, 2021, 06:28:00 pm

The Gang Garrison 2 Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

NOTICE: Due to a rise in bot activity, new posters need to be approved before posting.

Join the community Discord server!

Pages: [1]

Author Topic: [Request](This is my third one!) Play a sound when I kill someone.  (Read 2521 times)

Catman

  • The Argumental
  • Veteran Member
  • ******
  • Karma: 18
  • Offline Offline
  • Posts: 4381
  • Take on me
    • Yuki Yuki Yuki

In the same way Damage Indicator plays a sound on hitting someone, i'd like a sound to be played when I kill someone.

It would also be interesting if this could be linked to the type of kill and even more so linked to Lorgan's Killstreaks for alternate sounds to be played at each count.
Logged
My style is the best...
...so I challenge you!

Catman

  • The Argumental
  • Veteran Member
  • ******
  • Karma: 18
  • Offline Offline
  • Posts: 4381
  • Take on me
    • Yuki Yuki Yuki
Re: [Request](This is my third one!) Play a sound when I kill someone.
« Reply #1 on: August 23, 2012, 11:54:48 am »

Code: [Select]
if file_exists("Plugins/Resources/killmade.wav")
{
global.killmade_sound = sound_add("Plugins/Resources/killmade.wav",0,1)
};

{
doEventPlayerDeath(
if killer == global.myself
{
sound_play(global.killmade_sound)
}
)
};

This gives me the error:

COMPILATION ERROR in file to be executed
Error in code at line 8:
      if killer == global.myself
   ^
at position 2: Unexpected symbol in expression.

What do?
(It's also worth noting that I have no idea what i'm doing)
Logged
My style is the best...
...so I challenge you!

Lorgan

  • Retired Randomizer Mod Developer
  • Resident Miku
  • *****
  • Karma: 27
  • Offline Offline
  • Posts: 3657
    • My own website
Re: [Request](This is my third one!) Play a sound when I kill someone.
« Reply #2 on: August 23, 2012, 12:16:21 pm »

your code makes absolutely no sense lol

This plugin is somewhat hard to make properly since the "right" data that is sent by the server all gets executed in scrips which you can't edit with a plugin. The easiest way is just checking clientside (desynced) deaths.

then the part that plays the sound could be something like this:

object_event_add(Character,ev_destroy,0,"
    if lastDamageDealer == global.myself playsound(x,y,global.killmade_sound);
");


Also just so you know I didn't test this and I often make broken code :p
Logged
Unfortunately, turning a section into a communist oppressive regime is not against the forum rules, so there is really nothing we can do.
Quote from: steam
21:08 - Hullusorsa: lorgan, when will you buy us the keys?
21:09 - Lorgan: i'm waiting for greece to collapse so the value of the euro drops
21:09 - Lorgan: not even joking

Catman

  • The Argumental
  • Veteran Member
  • ******
  • Karma: 18
  • Offline Offline
  • Posts: 4381
  • Take on me
    • Yuki Yuki Yuki
Re: [Request](This is my third one!) Play a sound when I kill someone.
« Reply #3 on: August 23, 2012, 12:50:31 pm »

I often make broken code :p
All of your plugins are excellent what are you on about!

I'll try that code you put, hopefully it'll actually work...

[Edit]: It works! Albeit strangely... The sound will play from where the victim was and will not change if you get closer to where the body is. It also doesn't trigger on assists but hey it's a good start!
« Last Edit: August 23, 2012, 12:59:27 pm by killercrusher232 »
Logged
My style is the best...
...so I challenge you!

Lorgan

  • Retired Randomizer Mod Developer
  • Resident Miku
  • *****
  • Karma: 27
  • Offline Offline
  • Posts: 3657
    • My own website
Re: [Request](This is my third one!) Play a sound when I kill someone.
« Reply #4 on: August 23, 2012, 01:32:12 pm »

if your code would have worked it would also only play a sound for kills, not for assists


this probably makes a sound for kills and assist and it won't be panned.
object_event_add(Character,ev_destroy,0,"
    if lastDamageDealer == global.myself or secondToLastDamageDealer == global.myself sound_play(global.killmade_sound);
");
Logged
Unfortunately, turning a section into a communist oppressive regime is not against the forum rules, so there is really nothing we can do.
Quote from: steam
21:08 - Hullusorsa: lorgan, when will you buy us the keys?
21:09 - Lorgan: i'm waiting for greece to collapse so the value of the euro drops
21:09 - Lorgan: not even joking

Catman

  • The Argumental
  • Veteran Member
  • ******
  • Karma: 18
  • Offline Offline
  • Posts: 4381
  • Take on me
    • Yuki Yuki Yuki
Re: [Request](This is my third one!) Play a sound when I kill someone.
« Reply #5 on: August 23, 2012, 02:24:09 pm »

if your code would have worked it would also only play a sound for kills, not for assists


this probably makes a sound for kills and assist and it won't be panned.
object_event_add(Character,ev_destroy,0,"
    if lastDamageDealer == global.myself or secondToLastDamageDealer == global.myself sound_play(global.killmade_sound);
");

This works perfectly, sometimes it still doesn't play but that's most likely due to lag or too many sfx at the same time. Now I just need a quieter sound, lol.
Logged
My style is the best...
...so I challenge you!

Catman

  • The Argumental
  • Veteran Member
  • ******
  • Karma: 18
  • Offline Offline
  • Posts: 4381
  • Take on me
    • Yuki Yuki Yuki
Re: [Request](This is my third one!) Play a sound when I kill someone.
« Reply #6 on: April 01, 2013, 03:23:14 pm »

This is the only result for the search: killstreaks
So I'm going to put this here.

The Killstreak plugin is broken now
___________________________________________
ERROR in
action number 2
of  Step Event
for object Character:

Error in code at line 2:
       if player.id == global.myself && player.stats[KILLS] > currentStreak && player.stats[KILLS] - currentStreak != killStreak {
                                                             ^
at position 60: Unknown variable currentStreak
Logged
My style is the best...
...so I challenge you!

Lorgan

  • Retired Randomizer Mod Developer
  • Resident Miku
  • *****
  • Karma: 27
  • Offline Offline
  • Posts: 3657
    • My own website
Re: [Request](This is my third one!) Play a sound when I kill someone.
« Reply #7 on: April 02, 2013, 06:19:13 am »

God damn this update broke like all my plugins
Fixed killstreak (i hope)
Logged
Unfortunately, turning a section into a communist oppressive regime is not against the forum rules, so there is really nothing we can do.
Quote from: steam
21:08 - Hullusorsa: lorgan, when will you buy us the keys?
21:09 - Lorgan: i'm waiting for greece to collapse so the value of the euro drops
21:09 - Lorgan: not even joking

Phantom Brave

  • All Hail Classicwell
  • Moderator
  • *****
  • Karma: 70
  • Offline Offline
  • Posts: 12701
  • Another one --
Re: [Request](This is my third one!) Play a sound when I kill someone.
« Reply #8 on: April 02, 2013, 03:13:59 pm »

If you need help updating any of them I'll voulenteer
Logged

http://steamcommunity.com/id/wareya/
ladies and gentlemen i would like to announce that the fact of the matter is up that the fact of the matter is a fact and it matters
Pages: [1]
 

Page created in 0.034 seconds with 51 queries.