February 01, 2023, 07:08:04 am

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: Visible Double Jump  (Read 1745 times)

Derpduck

  • 2011 Haxxy Finalist
  • *
  • Karma: 42
  • Offline Offline
  • Posts: 5770
Visible Double Jump
« on: August 17, 2012, 07:58:15 pm »

You can now see if you can double jump as a scout.

Version: Works with anything so long as it doesn't change the character draw event.

Conflicts: Anything that changes the Character draw event.

Code: [Select]
//Allows the player to see if they can use the double jump as a scout by making the character have a green and red tint respectively.
//By Derpduck.


object_event_clear(Character,ev_draw,0);
object_event_add(Character,ev_draw,0,"
xoffset = view_xview[0];
yoffset = view_yview[0];
xsize = view_wview[0];
ysize = view_hview[0];
    
if distance_to_point(xoffset+xsize/2,yoffset+ysize/2) > 800 exit;

var xr, yr;
xr = round(x);
yr = round(y);

if global.myself == -1 && cloakAlpha==1{
    image_alpha = 1;
} else if((global.myself.object == id && cloakAlpha==1) || (global.myself.object == -1)) {
    image_alpha = 1;
} else if (!invisible) {
    image_alpha = cloakAlpha;
} else {
    exit;
}
  
if global.myself.team == team && cloakAlpha<0.5 {
    if currentWeapon.readyToStab==true{
        cloakAlpha=0.5;
        image_alpha=0.5;
    }
}
    
if team == global.myself.team && (id != global.myself.object.id || global.showHealthBar == 1){
    draw_set_alpha(1);
    draw_healthbar(xr-10, yr-30, xr+10, yr-25,hp*100/maxHp,c_black,c_red,c_green,0,true,true);
}    
if(distance_to_point(mouse_x, mouse_y)<25) {
    if cloak && team!=global.myself.team exit;
    draw_set_alpha(1);
    draw_set_halign(fa_center);
    draw_set_valign(fa_bottom);
    if(team==TEAM_RED) {
        draw_set_color(c_red);
    } else {
        draw_set_color(c_blue);
    }
draw_text(xr, yr-35, player.name);
}  

if class == CLASS_SCOUT{
    if !doublejumpUsed{
        draw_sprite_ext(sprite,floor(animationImage+animationOffset),xr,yr,image_xscale,image_yscale,image_angle,make_color_rgb(210,255,210),1);
    }else{
        draw_sprite_ext(sprite,floor(animationImage+animationOffset),xr,yr,image_xscale,image_yscale,image_angle,make_color_rgb(255,210,210),1);
    }
}
        

draw_set_alpha(1);
if team == TEAM_RED ubercolour = c_red;
if team == TEAM_BLUE ubercolour = c_blue;

var sprite;
if zoomed
{
    if team == TEAM_RED
    {
        sprite = SniperCrouchRedS
    }
    else
    {
        sprite = SniperCrouchBlueS
    }
}
else
{
    sprite = sprite_index
}
    
if omnomnomnom == true {
    draw_sprite_ext(OmnomnomnomS,omnomnomnomindex,xr,yr,image_xscale,image_yscale,image_angle,c_white,1);
    if ubered == 1 draw_sprite_ext(OmnomnomnomS,omnomnomnomindex,xr,yr,image_xscale,image_yscale,image_angle,ubercolour,0.7);
}
else if taunting == true{
    draw_sprite_ext(tauntsprite,tauntindex,xr,yr,image_xscale,image_yscale,image_angle,c_white,1);
    if ubered == 1 draw_sprite_ext(tauntsprite,tauntindex,xr,yr,image_xscale,image_yscale,image_angle,ubercolour,0.7);
}
else if player.humiliated {
    draw_sprite_ext(humiliationPoses,floor(animationImage)+humiliationOffset,xr,yr,image_xscale,image_yscale,image_angle,c_white,cloakAlpha);
}
else if taunting == false {
    if ubered == 0 draw_sprite_ext(sprite,floor(animationImage+animationOffset),xr,yr,image_xscale,image_yscale,image_angle,c_white,cloakAlpha);
    else if ubered == 1 {
        draw_sprite_ext(sprite,floor(animationImage+animationOffset),xr,yr,image_xscale,image_yscale,image_angle,c_white,1);
        draw_sprite_ext(sprite,floor(animationImage+animationOffset),xr,yr,image_xscale,image_yscale,image_angle,ubercolour,0.7);
    }
}
if (burnDuration > 0 or burnIntensity > 0) {
    for(i = 0; i < numFlames * burnIntensity / maxIntensity; i += 1)
    {
        draw_sprite_ext(FlameS, alarm[5] + i + random(2), x + flameArray_x[i], y + flameArray_y[i], 1, 1, 0, c_white, burnDuration / maxDuration * 0.71 + 0.35);
    }  
}
");

Fixed the spelling error in the title -Sani
« Last Edit: August 18, 2012, 01:34:33 pm by Derp(duck) [LORD] »
Logged

bullets (obviously)

  • Seasoned Member
  • *****
  • Karma: 40
  • Offline Offline
  • Posts: 1962
Re: Visable Double Jump
« Reply #1 on: August 17, 2012, 08:46:27 pm »

ERROR in
action number 2
of Draw Event
for object Character:

Error in code at line 47:
   if class == CLASS_SCOUT{
     ^
at position 4: Unknown variable class
Logged

Orpheon

  • Moderator
  • *****
  • Karma: 15
  • Offline Offline
  • Posts: 6426
  • Developer
Re: Visible Double Jump
« Reply #2 on: August 18, 2012, 03:37:56 am »


ERROR in
action number 2
of Draw Event
for object Character:

Error in code at line 47:
   if class == CLASS_SCOUT{
     ^
at position 4: Unknown variable class
Fixed.
Code: [Select]
//Allows the player to see if they can use the double jump as a scout by making the character have a green and red tint respectivly.
//By Derpduck.

object_event_add(Character,ev_draw,0,"
xoffset = view_xview[0];
yoffset = view_yview[0];
xsize = view_wview[0];
ysize = view_hview[0];
    
if distance_to_point(xoffset+xsize/2,yoffset+ysize/2) > 800 exit;

var xr, yr;
xr = round(x);
yr = round(y);

if global.myself == -1 && cloakAlpha==1{
    image_alpha = 1;
} else if((global.myself.object == id && cloakAlpha==1) || (global.myself.object == -1)) {
    image_alpha = 1;
} else if (!invisible) {
    image_alpha = cloakAlpha;
} else {
    exit;
}
  
if global.myself.team == team && cloakAlpha<0.5 {
    if currentWeapon.readyToStab==true{
        cloakAlpha=0.5;
        image_alpha=0.5;
    }
}
    
if team == global.myself.team && (id != global.myself.object.id || global.showHealthBar == 1){
    draw_set_alpha(1);
    draw_healthbar(xr-10, yr-30, xr+10, yr-25,hp*100/maxHp,c_black,c_red,c_green,0,true,true);
}    
if(distance_to_point(mouse_x, mouse_y)<25) {
    if cloak && team!=global.myself.team exit;
    draw_set_alpha(1);
    draw_set_halign(fa_center);
    draw_set_valign(fa_bottom);
    if(team==TEAM_RED) {
        draw_set_color(c_red);
    } else {
        draw_set_color(c_blue);
    }
draw_text(xr, yr-35, player.name);
}  

if player.class == CLASS_SCOUT{
    if !doublejumpUsed{
        draw_sprite_ext(sprite,floor(animationImage+animationOffset),xr,yr,image_xscale,image_yscale,image_angle,make_color_rgb(210,255,210),1);
    }else{
        draw_sprite_ext(sprite,floor(animationImage+animationOffset),xr,yr,image_xscale,image_yscale,image_angle,make_color_rgb(255,210,210),1);
    }
}
        

draw_set_alpha(1);
if team == TEAM_RED ubercolour = c_red;
if team == TEAM_BLUE ubercolour = c_blue;

var sprite;
if zoomed
{
    if team == TEAM_RED
    {
        sprite = SniperCrouchRedS
    }
    else
    {
        sprite = SniperCrouchBlueS
    }
}
else
{
    sprite = sprite_index
}
    
if omnomnomnom == true {
    draw_sprite_ext(OmnomnomnomS,omnomnomnomindex,xr,yr,image_xscale,image_yscale,image_angle,c_white,1);
    if ubered == 1 draw_sprite_ext(OmnomnomnomS,omnomnomnomindex,xr,yr,image_xscale,image_yscale,image_angle,ubercolour,0.7);
}
else if taunting == true{
    draw_sprite_ext(tauntsprite,tauntindex,xr,yr,image_xscale,image_yscale,image_angle,c_white,1);
    if ubered == 1 draw_sprite_ext(tauntsprite,tauntindex,xr,yr,image_xscale,image_yscale,image_angle,ubercolour,0.7);
}
else if player.humiliated {
    draw_sprite_ext(humiliationPoses,floor(animationImage)+humiliationOffset,xr,yr,image_xscale,image_yscale,image_angle,c_white,cloakAlpha);
}
else if taunting == false {
    if ubered == 0 draw_sprite_ext(sprite,floor(animationImage+animationOffset),xr,yr,image_xscale,image_yscale,image_angle,c_white,cloakAlpha);
    else if ubered == 1 {
        draw_sprite_ext(sprite,floor(animationImage+animationOffset),xr,yr,image_xscale,image_yscale,image_angle,c_white,1);
        draw_sprite_ext(sprite,floor(animationImage+animationOffset),xr,yr,image_xscale,image_yscale,image_angle,ubercolour,0.7);
    }
}
if (burnDuration > 0 or burnIntensity > 0) {
    for(i = 0; i < numFlames * burnIntensity / maxIntensity; i += 1)
    {
        draw_sprite_ext(FlameS, alarm[5] + i + random(2), x + flameArray_x[i], y + flameArray_y[i], 1, 1, 0, c_white, burnDuration / maxDuration * 0.71 + 0.35);
    }  
}
");
Logged

Dusty

  • 2012 Haxxy Award Winner
  • *
  • Karma: -78
  • Offline Offline
  • Posts: 11006
  • Dust in a box under a table
Re: Visible Double Jump
« Reply #3 on: August 18, 2012, 04:15:08 am »

Quick question, doesn't "object_event_add()" add on to the existing event?

Orpheon

  • Moderator
  • *****
  • Karma: 15
  • Offline Offline
  • Posts: 6426
  • Developer
Re: Visible Double Jump
« Reply #4 on: August 18, 2012, 04:26:36 am »

Quick question, doesn't "object_event_add()" add on to the existing event?
Yes, I didn't see that.

Derp, you forgot an object_event_delete().
Logged

Lorgan

  • Retired Randomizer Mod Developer
  • Resident Miku
  • *****
  • Karma: 28
  • Offline Offline
  • Posts: 3657
    • My own website
Re: Visible Double Jump
« Reply #5 on: August 18, 2012, 05:01:28 am »

you can make this plugin like 3 lines long by just making it draw a smoke puff when you doublejump...
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

Derpduck

  • 2011 Haxxy Finalist
  • *
  • Karma: 42
  • Offline Offline
  • Posts: 5770
Re: Visible Double Jump
« Reply #6 on: August 18, 2012, 05:30:43 am »

This shows when you can and can't, not when you double jump.

Should be fixed now.
« Last Edit: August 18, 2012, 05:35:05 am by Derp(duck) [LORD] »
Logged
Pages: [1]
 

Page created in 0.065 seconds with 51 queries.