May 09, 2021, 12:07: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] 2

Author Topic: [Client-side] Auto z4 on hit  (Read 1590 times)

[FR]YB

  • 2013 Haxxy Award Winner
  • *
  • Karma: 28
  • Offline Offline
  • Posts: 642
  • There are 11 people playing holy sh
[Client-side] Auto z4 on hit
« on: October 11, 2017, 05:21:34 am »

Automatically pops a :z4: when you get hit by something

Download one of the attached .gml files and put it into your Plugins folder


Download auto_z4_on_hit to display z4 for every hit you take, including yours.
Download auto_z4_on_hit_not_self to display z4 for every hit you take from other damage sources only.

Code: (Plugin source code (including self)) [Select]
global.dealDamageFunction += "
if (global.myself.object != -1) {
if (argument1 == global.myself.object) {
write_ubyte(global.serverSocket, CHAT_BUBBLE);
write_ubyte(global.serverSocket, 23);
}
}
";

Code: (Plugin source code (not self)) [Select]
global.dealDamageFunction += "
if (global.myself.object != -1) {
if (argument1 == global.myself.object and argument0 != global.myself) {
write_ubyte(global.serverSocket, CHAT_BUBBLE);
write_ubyte(global.serverSocket, 23);
}
}
";

(Uses the global dealDamageFunction script. Damage API, yay)
« Last Edit: October 12, 2017, 07:19:56 am by [FR]YB »
Logged

Kevin Kuntz

  • Heroic Member
  • ****
  • Karma: -58
  • Offline Offline
  • Posts: 712
  • panda took the kids
    • Rav And Kill Bill
Re: Auto z4 on hit
« Reply #1 on: October 11, 2017, 05:26:42 am »

so that's why you seemed paniced
Logged
I PEAKED
I PEAKED

PrOF

  • Full Member
  • ***
  • Karma: 43
  • Offline Offline
  • Posts: 594
  • Sometimes a dev. Only sometimes
Re: [Client-side] Auto z4 on hit
« Reply #2 on: October 11, 2017, 07:07:44 am »

Nice. That also game me an idea
BTW is there a reason why it's not just
Code: [Select]
with BubbleMenuZ {
    bubbleimage = 23;
    event_user(0);
}
?
Logged

Kevin Kuntz

  • Heroic Member
  • ****
  • Karma: -58
  • Offline Offline
  • Posts: 712
  • panda took the kids
    • Rav And Kill Bill
Re: [Client-side] Auto z4 on hit
« Reply #3 on: October 11, 2017, 07:16:55 am »

Code is always Complicated, gg2 uses images for sprite modding yee but
Coding is Gonna Stay that way
Logged
I PEAKED
I PEAKED

Derpduck

  • 2011 Haxxy Finalist
  • *
  • Karma: 42
  • Offline Offline
  • Posts: 5770
Re: [Client-side] Auto z4 on hit
« Reply #4 on: October 11, 2017, 07:22:16 am »

Nice. That also game me an idea
BTW is there a reason why it's not just
Code: [Select]
with BubbleMenuZ {
    bubbleimage = 23;
    event_user(0);
}
?
Have you looked at what the event does?

PrOF

  • Full Member
  • ***
  • Karma: 43
  • Offline Offline
  • Posts: 594
  • Sometimes a dev. Only sometimes
Re: [Client-side] Auto z4 on hit
« Reply #5 on: October 11, 2017, 07:47:11 am »

Have you looked at what the event does?
I'd say yes but it's probably the wrong answer.
For what I can tell it the bubble is seen by everyone but the player
 :z4:
Logged

[FR]YB

  • 2013 Haxxy Award Winner
  • *
  • Karma: 28
  • Offline Offline
  • Posts: 642
  • There are 11 people playing holy sh
Re: [Client-side] Auto z4 on hit
« Reply #6 on: October 11, 2017, 07:51:37 am »

It makes the client send the bubble command to the server
And then the server sends back "this player says z4" to all players, including the one sending it

That's why when you get laggy (or d/c) you don't see your speech bubble appear right away

Derpduck

  • 2011 Haxxy Finalist
  • *
  • Karma: 42
  • Offline Offline
  • Posts: 5770
Re: [Client-side] Auto z4 on hit
« Reply #7 on: October 11, 2017, 08:22:45 am »

Have you looked at what the event does?
I'd say yes but it's probably the wrong answer.
For what I can tell it the bubble is seen by everyone but the player
 :z4:
It's exactly what the plugin already does. Your way just adds an extra step.

Pasiv01

  • Full Member
  • ***
  • Karma: 15
  • Offline Offline
  • Posts: 332
  • A
Re: [Client-side] Auto z4 on hit
« Reply #8 on: October 11, 2017, 09:56:24 am »

How do you change the  :z4: to a constant   :z9:? change the 23?
Logged
Afk for the next few months - studying

[FR]YB

  • 2013 Haxxy Award Winner
  • *
  • Karma: 28
  • Offline Offline
  • Posts: 642
  • There are 11 people playing holy sh
Re: [Client-side] Auto z4 on hit
« Reply #9 on: October 11, 2017, 09:58:17 am »

How do you change the  :z4: to a constant   :z9:? change the 23?
To 28, yeah

Phantom Brave

  • All Hail Classicwell
  • Moderator
  • *****
  • Karma: 70
  • Offline Offline
  • Posts: 12701
  • Another one --
Re: [Client-side] Auto z4 on hit
« Reply #10 on: October 11, 2017, 11:08:59 am »

upvote
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

Sparky

  • Seasoned Member
  • *****
  • Karma: 17
  • Offline Offline
  • Posts: 1484
  • ༼ つ ◕_◕ ༽つ༼ つ ◕_◕ ༽つ༼ つ ◕_◕ ༽つ
Re: [Client-side] Auto z4 on hit
« Reply #11 on: October 11, 2017, 04:13:31 pm »

OwO that's cool


also ye



you can change the 23 to w/e you want to get w/e bubble
Logged

Spazz

  • Seasoned Member
  • *****
  • Karma: 44
  • Offline Offline
  • Posts: 1933
  • Almost too much seasoning.
Re: [Client-side] Auto z4 on hit
« Reply #12 on: October 11, 2017, 09:13:00 pm »

Self damage counts in this, is there a way to not count self damage yet count third party damage?
Logged

<3 Bustatunez

von toucan

  • New Member
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 14
Re: [Client-side] Auto z4 on hit
« Reply #13 on: October 11, 2017, 09:53:23 pm »

OwO that's cool


also ye



you can change the 23 to w/e you want to get w/e bubble
Change it to 45 to become your local scout player.
Logged

PrOF

  • Full Member
  • ***
  • Karma: 43
  • Offline Offline
  • Posts: 594
  • Sometimes a dev. Only sometimes
Re: [Client-side] Auto z4 on hit
« Reply #14 on: October 11, 2017, 11:54:07 pm »

Self damage counts in this, is there a way to not count self damage yet count third party damage?
Probably
Code: [Select]
global.dealDamageFunction += "
if (global.myself.object != -1) {
if (argument1 == global.myself.object && argument2 != global.myself.object) {
write_ubyte(global.serverSocket, CHAT_BUBBLE);
write_ubyte(global.serverSocket, 23);
}
}
";
Didn't test though, sent from a phone
Logged
Pages: [1] 2
 

Page created in 0.027 seconds with 37 queries.