June 08, 2023, 02:14:42 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] Mark Death Location {request}  (Read 2639 times)

PrOF

  • Heroic Member
  • ****
  • Karma: 43
  • Offline Offline
  • Posts: 600
  • Sometimes a dev. Only sometimes
Re: [Request] Mark Death Location
« Reply #15 on: March 04, 2018, 02:25:55 am »

I used this bit of code in my inGameClock plugin, it's specifically made to remain consistent with text scaling, if you need
Code: [Select]
        shadowFactor = global.showClock_size;
draw_set_color(c_black);
draw_text_transformed(view_xview[0]+global.showClock_xPos + shadowFactor, view_yview[0]+global.showClock_yPos + shadowFactor, drawnString, global.showClock_size, global.showClock_size, 0);
draw_set_color(c_white);
draw_text_transformed(view_xview[0]+global.showClock_xPos, view_yview[0]+global.showClock_yPos, drawnString, global.showClock_size, global.showClock_size, 0);
Logged

Spazz

  • Seasoned Member
  • *****
  • Karma: 44
  • Offline Offline
  • Posts: 1933
  • Almost too much seasoning.
Re: [Request] Mark Death Location
« Reply #16 on: March 04, 2018, 11:42:12 am »

Thanks, though the visual effect I was going for was simply a slightly larger skull to outline the white, but would only get the image below with the code a little farther.
Code: [Select]
    draw_sprite_ext(sprite_index, image_index, x-0.8, y, 1.3, 1.3, 0, c_black, 1);
No matter the change, the skull was deformed. So remembering some previous experience before I just added more sprites without scaling and adjusted position which worked out perfectly except for the three bonus sprites.

Though I will say, the results are rather fascinating and do help with map design.

If you look to the far right, second from the bottom. There's an example of what I don't understand at the moment.
Logged

<3 Bustatunez

Derpduck

  • 2011 Haxxy Finalist
  • *
  • Karma: 42
  • Offline Offline
  • Posts: 5770
Re: [Request] Mark Death Location
« Reply #17 on: March 04, 2018, 01:59:22 pm »



Just a rendering bug I think, Game Maker's fault.
« Last Edit: March 04, 2018, 01:59:33 pm by Derpduck [LORD] »
Logged

Saniblues

  • Onion Knight
  • Administrator
  • *****
  • Karma: -1305
  • Offline Offline
  • Posts: 12409
Re: [Request] Mark Death Location
« Reply #18 on: March 04, 2018, 03:34:35 pm »

>x - 0.8
>1.3x scaled image
>subpixel placement
>surprised when image is distorted
spazz you useless jackass, use whole numbers

anyway, you're just trying to make it outlined? that much is simple. also, did you want them to persist permanently until the player approaches them, or did you want only the latest version of the instance to spawn?
« Last Edit: March 04, 2018, 03:47:46 pm by Saniblues »
Logged
Quote from: mop
Quote from: MR MAGN3TIC
I don't like it.  :nah:
Oh, well, you might as well pack up and stop now, because he doesn't like it
I'm bored out of my skull, Lets play a different game!
Lets take a visit down below And cast the world in flames!

Saniblues

  • Onion Knight
  • Administrator
  • *****
  • Karma: -1305
  • Offline Offline
  • Posts: 12409
Re: [Request] Mark Death Location
« Reply #19 on: March 04, 2018, 03:47:06 pm »



Here's what I can offer you with the code that I've written.
Code: [Select]
global.DeathObject = object_add();

object_event_add(global.DeathObject,ev_step,ev_step_begin, '
if instance_exists(global.myself.object){
y = ystart + (5 * sin(current_time / 200));
if distance_to_object(global.myself.object) <= 100{
image_alpha = 0.9 * distance_to_object(global.myself.object) / 100;
if image_alpha <= 0.05 instance_destroy();
}
}
');
object_event_add(global.DeathObject,ev_draw,0, '
var i, o;
draw_set_alpha(image_alpha);
for(i = -1;i<=1;i+=2){
for(o = -1;o<=1;o+=2){
draw_sprite_ext(sprite_index,image_index,x+i,y+o,1,1,0,col,image_alpha);
}
}
draw_sprite_ext(sprite_index,image_index,x,y,1,1,0,c_white,image_alpha);
draw_set_halign(fa_center);
draw_text(x,y - 16,string(name));
draw_set_alpha(1);
');

object_event_add(Character, ev_destroy, 0, '
if (player = global.myself){
/*
with(global.DeathObject){
if name = global.myself.name instance_destroy();
}
*/
with(instance_create(x,y,global.DeathObject)){
name = other.player.name;
if other.team = 0 col = c_red
else col = c_blue;
sprite_index = DeadS;
image_alpha = 1;
if name != global.myself.name instance_destroy();
}
}
');
It doesn't necessarily have to be team-based colors. All you gotta do is change one variable on-spawn to get whatever you desire.
Code: [Select]
var i, o;
draw_set_alpha(image_alpha);
for(i = -1;i<=1;i+=2){
for(o = -1;o<=1;o+=2){
draw_sprite_ext(sprite_index,image_index,x+i,y+o,1,1,0,col,image_alpha);
}
}[code]
This is the part that handles the outlining, also. You can use d3d_draw functions to achieve the same effect with any sprite via fog, but that wasn't necessary for a white sprites
« Last Edit: March 04, 2018, 03:49:03 pm by Saniblues »
Logged
Quote from: mop
Quote from: MR MAGN3TIC
I don't like it.  :nah:
Oh, well, you might as well pack up and stop now, because he doesn't like it
I'm bored out of my skull, Lets play a different game!
Lets take a visit down below And cast the world in flames!

Spazz

  • Seasoned Member
  • *****
  • Karma: 44
  • Offline Offline
  • Posts: 1933
  • Almost too much seasoning.
Re: [Request] Mark Death Location
« Reply #20 on: March 04, 2018, 09:52:28 pm »

>x - 0.8
>1.3x scaled image
>subpixel placement
>surprised when image is distorted
spazz you useless jackass, use whole numbers
Following the plebeian rules of common code sense was never my forte.

Was making a crack to YB (when he returns) who gave me x, y, 1.2, 1.2 and said have fun trying to scale it.
Hence the three sprite addition which was my terrible patch-up. Also was irritated because I'm use to working with 3D objects.




anyway, you're just trying to make it outlined? that much is simple. also, did you want them to persist permanently until the player approaches them, or did you want only the latest version of the instance to spawn?
Thanks for the extra code Sani, this has honestly turned into a rather large discussion for such a simple topic.

The full idea of Death Marker was to be used by moderators of any Elton comp to come. ([edit] though this can be used for individuals as well) This spawned from the last Elton and the sadistic snail map where the three farthest participants died in the same general location. From an outside perspective it was basically a stone-thrown guess, this aims to provide solid proof.

For self, it would be as it's already uploaded,
 - Client side plugin,
 - Marks self death location, regardless of how,
 - Places a white skull (DeadS sprite) at players origin on death event,
 - Destroys the event (sprite) when self comes into collision contact and not anyone else in the server,
This fulfills the request already, though there is a key issue of a white background, hence the shadow/outline effect.
That was fixed with a simple addition of,
Code: [Select]
object_event_add(DeathObject, ev_draw, 0, '
    draw_sprite_ext(sprite_index, image_index, x-1, y-1, 1, 1, 0, c_black, 1);
    draw_sprite_ext(sprite_index, image_index, x, y, 1, 1, 0, c_white, 1);
');
@PrOF Please do update the Death Marker upload to include this bit above.

Meanwhile removing this would provide what's needed for moderators of Elton,
Code: [Select]
if (player == global.myself)

Yet your code provides the possibility of server sided markers. (When I or another host jump maps)
 - Server sided
 - All players can see death markers of their own and another (include names and possibly team colour)
 - Only the player of the marker can destroy (on touch) the event
However I wouldn't float the skull itself, the name would be ok as there might be multiple deaths in one location.
Also, it probably be a smart idea to restrict it by map name to rj_/dj_



Anything below this would simply be a variant of the original that people can modify for themselves,

Anyone not wanting to destroy their death locations would remove,
Code: [Select]
object_event_add(DeathObject, ev_collision, Character, '
    if (other.player == owner)
        instance_destroy();
');

Anyone wanting the death location of all players would remove,
Code: [Select]
if (player == global.myself)
« Last Edit: March 04, 2018, 09:53:47 pm by Spazz »
Logged

<3 Bustatunez

Saniblues

  • Onion Knight
  • Administrator
  • *****
  • Karma: -1305
  • Offline Offline
  • Posts: 12409
Re: [Request] Mark Death Location
« Reply #21 on: March 04, 2018, 10:06:37 pm »

Mine wiggles, though, so mine is better. Use mine.
Logged
Quote from: mop
Quote from: MR MAGN3TIC
I don't like it.  :nah:
Oh, well, you might as well pack up and stop now, because he doesn't like it
I'm bored out of my skull, Lets play a different game!
Lets take a visit down below And cast the world in flames!

PrOF

  • Heroic Member
  • ****
  • Karma: 43
  • Offline Offline
  • Posts: 600
  • Sometimes a dev. Only sometimes
Re: [Request] Mark Death Location
« Reply #22 on: March 05, 2018, 12:36:58 pm »

Code: [Select]
object_event_add(DeathObject, ev_draw, 0, '
    draw_sprite_ext(sprite_index, image_index, x-1, y-1, 1, 1, 0, c_black, 1);
    draw_sprite_ext(sprite_index, image_index, x, y, 1, 1, 0, c_white, 1);
');
@PrOF Please do update the Death Marker upload to include this bit above.
I can't do that, the directory only saves links to downloads/code blocks. I'd suggest uploading the definitive version yourself (in the op)
Also be sure to actually destroy the instance after fading it completely to control ram usage. I'd also add a max timer to fade it after t seconds from death but I'm not sure it's needed. If you add it remember to deltatime it correctly:
Code: [Select]
frame += 1 * global.delta_factor;
if (frame >= t) dostuff();
or
Code: [Select]
frame += 1;
if (frame >= t/global.delta_factor) dostuff();
Logged

Spazz

  • Seasoned Member
  • *****
  • Karma: 44
  • Offline Offline
  • Posts: 1933
  • Almost too much seasoning.
Re: [Request] Mark Death Location
« Reply #23 on: March 05, 2018, 02:08:43 pm »

My understanding of the client plugin list you got is incorrect then. Sorry PrOF will get on that,
Is it able to handle more than one upload in the same link? Sani is making it real hard to pick.
[edit] Asking me to figure out adding deltatime, lol you madman

@Sani Useless jackass confirmed, was about to report an error when I opened my eyes a bit more,


Noticed something odd, when in Class menu the Name of the marker shifts Red, and in Team the Name shifts Black, for both team.

Anyways, personally will be using Sani's colour version once I modified the code to only float the text and not the skull.
Thanks guys, turned into quite the thing. Got to think of some kind of reward.
« Last Edit: March 06, 2018, 06:00:33 pm by Spazz »
Logged

<3 Bustatunez

PrOF

  • Heroic Member
  • ****
  • Karma: 43
  • Offline Offline
  • Posts: 600
  • Sometimes a dev. Only sometimes
Re: [Client-Side] Mark Death Location {request}
« Reply #24 on: March 05, 2018, 02:53:54 pm »

If there's more than one version it either links to the most recent/popular one or if it's hard to choose it'll just link to the topic so the users can choose for themselves
Logged

Spazz

  • Seasoned Member
  • *****
  • Karma: 44
  • Offline Offline
  • Posts: 1933
  • Almost too much seasoning.
Re: [Client-Side] Mark Death Location {request}
« Reply #25 on: March 05, 2018, 03:22:53 pm »

Added the +/- for that purpose anyways
Logged

<3 Bustatunez

Saniblues

  • Onion Knight
  • Administrator
  • *****
  • Karma: -1305
  • Offline Offline
  • Posts: 12409
Re: [Client-Side] Mark Death Location {request}
« Reply #26 on: March 06, 2018, 12:05:58 am »


Additional update to show death causes (Has unique causes for killboxes, fragboxes, pitfalls, changing characters, and suicide)
Logged
Quote from: mop
Quote from: MR MAGN3TIC
I don't like it.  :nah:
Oh, well, you might as well pack up and stop now, because he doesn't like it
I'm bored out of my skull, Lets play a different game!
Lets take a visit down below And cast the world in flames!

Spazz

  • Seasoned Member
  • *****
  • Karma: 44
  • Offline Offline
  • Posts: 1933
  • Almost too much seasoning.
Re: [Client-Side] Mark Death Location {request}
« Reply #27 on: March 06, 2018, 05:58:43 pm »

Logged

<3 Bustatunez
Pages: 1 [2]
 

Page created in 0.046 seconds with 36 queries.