Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Super Sniper
- * save as SuperSniper.gml
- * by iLegend
- * blow up rockets and mines by shooting them.
- * the true test of sniping
- */
- object_event_clear(Rifle, ev_other, ev_user3);
- object_event_add(Rifle, ev_other, ev_user3, "
- playsound(x,y,SniperSnd);
- shot=true;
- justShot=true;
- readyToShoot = false;
- alarm[0] = reloadTime + 20*owner.zoomed;
- // for drawing:
- tracerAlpha = 0.8;
- shotx = x;
- shoty = y;
- var hit;
- var x1,y1,xm,ym, len;
- var hitline;
- len=2000;
- x1=x;
- y1=y;
- x2=x+lengthdir_x(len,owner.aimDirection);
- y2=y+lengthdir_y(len,owner.aimDirection);
- alarm[6] = alarm[0];
- while(len>1) {
- xm=(x1+x2)/2;
- ym=(y1+y2)/2;
- hitline = false;
- with(owner) {
- if (collision_line(x1,y1,xm,ym,Generator,true,true)>=0) {
- hitline = true;
- if instance_nearest(x1,y1,Generator).team == team hitline = false;
- }
- if(collision_line(x1,y1,xm,ym,Obstacle,true,true)>=0) {
- hitline = true;
- } else if (collision_line(x1,y1,xm,ym,Character,true,true)>=0) {
- hitline = true;
- } else if (collision_line(x1,y1,xm,ym,Sentry,true,false)>=0) {
- hitline = true;
- } else if (collision_line(x1,y1,xm,ym,TeamGate,true,true)>=0) {
- hitline = true;
- } else if (collision_line(x1,y1,xm,ym,IntelGate,true,true)>=0) {
- hitline = true;
- } else if (collision_line(x1,y1,xm,ym,ControlPointSetupGate,true,true)>=0) {
- if ControlPointSetupGate.solid == true hitline = true;
- } else if (collision_line(x1,y1,xm,ym,BulletWall,true,true)>=0) {
- hitline = true;
- } else if (collision_line(x1,y1,xm,ym,Mine,true,true)>=0) {
- hitline = true;
- } else if (collision_line(x1,y1,xm,ym,Rocket,true,true)>=0) {
- hitline = true;
- }
- }
- if(hitline) {
- x2=xm;
- y2=ym;
- } else {
- x1=xm;
- y1=ym;
- }
- len/=2;
- }
- with(Player) {
- if(id != other.ownerPlayer and team != other.owner.team and object != -1) {
- if(collision_line(other.x,other.y,other.x2,other.y2,object,true,false)>=0) && object.ubered == 0 {
- object.hp -= other.hitDamage;
- object.timeUnscathed = 0;
- if (object.lastDamageDealer != other.ownerPlayer && object.lastDamageDealer != object.player){
- object.secondToLastDamageDealer = object.lastDamageDealer;
- object.alarm[4] = object.alarm[3]
- }
- object.alarm[3] = ASSIST_TIME;
- object.lastDamageDealer = other.ownerPlayer;
- object.cloakAlpha = max(object.cloakAlpha, 0.3);
- object.cloakFlicker = true;
- object.alarm[7] = 3;
- if(global.gibLevel > 0){
- blood = instance_create(object.x,object.y,Blood);
- blood.direction = other.owner.aimDirection-180;
- }
- if (!other.owner.zoomed)
- object.lastDamageSource = WEAPON_RIFLE;
- else
- object.lastDamageSource = WEAPON_RIFLE_CHARGED;
- exit;
- }
- }
- }
- with(Rocket) {
- if(team != other.owner.team) {
- if(collision_line(other.x,other.y,other.x2,other.y2,id,false,false)>=0) {
- event_user(5);
- }
- }
- }
- with(Mine) {
- if(team != other.owner.team) {
- if(collision_line(other.x,other.y,other.x2,other.y2,id,false,false)>=0) {
- event_user(2);
- }
- }
- }
- with(Sentry) {
- if(team != other.owner.team) {
- if(collision_line(other.x,other.y,other.x2,other.y2,id,false,false)>=0) {
- hp -= other.hitDamage;
- lastDamageDealer = other.ownerPlayer;
- if (!other.owner.zoomed)
- lastDamageSource = WEAPON_RIFLE;
- else
- lastDamageSource = WEAPON_RIFLE_CHARGED;
- exit;
- }
- }
- }
- with(Generator) {
- if(team != other.owner.team) {
- if(collision_line(other.x,other.y,other.x2,other.y2,id,true,false)>=0) {
- alarm[0] = regenerationBuffer;
- isShieldRegenerating = false;
- //allow overkill to be applied directly to the target
- if (other.hitDamage > shieldHp) {
- hp -= other.hitDamage - shieldHp;
- hp -= shieldHp * shieldResistance;
- shieldHp = 0;
- }
- else
- {
- hp -= other.hitDamage * shieldResistance;
- shieldHp -= other.hitDamage;
- }
- exit;
- }
- }
- }
- ");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement