Skip to content

Instantly share code, notes, and snippets.

@Rumrusher
Forked from ZaSpai/RandomKillstreak.gml
Created March 13, 2014 14:34
Show Gist options
  • Select an option

  • Save Rumrusher/9529645 to your computer and use it in GitHub Desktop.

Select an option

Save Rumrusher/9529645 to your computer and use it in GitHub Desktop.
//combined RTD and Killstreak+BUFFS by Rumrusher/ZaSpai
//designed with partial Upgradeable Sentries (BassMakesPaste) compatibility
//original killstreak plugin by Lorgan (original idea by Vindicator)
//original rtd plugin by Lorgan
//edits the following: Sentry creation, begin and end steps, Sentry and N+B HUDs, numerous Character events, StabMask collision with Sentry and Character. Adds alarm[8] to Sentry and Character
//uses global.SerializeBuffer to sync new data. WILL CAUSE A HANG AND CRASH if you forget to take this plugin out when you join another server as client!!!
//known issues: incorrect new sentry build HP with respect to sentryBuffStats (IDK how to reference the Character object of the owner player of sentry). Haven't checked the sentry gibs issue thing (I may need to sync its bolt gain value)
//RTD mostly untouched apart from Rummy's inclusion of the Stomp attack for effect 16
object_event_add(Character,ev_create,0,"
killStreak = 0;
currentStreak = global.paramPlayer.stats[KILLS];
maxExtraNutsNBolts = 0;
extraNutsNBolts = 0;
sentryBuffStatus = 0;
stabbed = 0;
");
object_event_add(Character,ev_alarm,8,"
stabbed = 0;
");
object_event_add(Sentry,ev_create,0,"
buffed = 0;
extraHp = 0;
maxExtraHp = 0;
stabbed = 0;
");
object_event_add(Character,ev_step,ev_step_begin,"
if ((player.sentry) && (player.class == CLASS_ENGINEER)) {
player.sentry.buffed = self.sentryBuffStatus;
}
if (nutsNBolts == maxNutsNBolts) {
extraNutsNBolts = min(extraNutsNBolts+0.1, maxExtraNutsNBolts);
} else if ((nutsNBolts < maxNutsNBolts) && (extraNutsNBolts > 0)) {
if (nutsNBolts == 0) {
if (extraNutsNBolts >= 100) {
extraNutsNBolts -=100;
nutsNBolts = 100;
} else if (0 < extraNutsNBolts < 100) {
nutsNBolts = extraNutsNBolts;
extraNutsNBolts = 0;
}
} else {
extraNutsNBolts += nutsNBolts - 100;
nutsNBolts = 100;
}
}
if (extraNutsNBolts < 0) {extraNutsNBolts = 0};
");
object_event_clear(Sentry,ev_step,ev_step_end)
object_event_add(Sentry,ev_step,ev_step_end,"
if(global.isHost)
{
if(hp>maxHp) {hp=maxHp};
if(extraHp>maxExtraHp) {extraHp=maxExtraHp};
if ((hp < maxHp) && (extraHp > 0)) {
var overHeal;
overHeal = hp + extraHp - maxHp;
hp = maxHp;
extraHp = overHeal;
overHeal = 0;
}
if ((hp <= 0) && (extraHp > 0) && (extraHp >= maxHp)) {
hp = maxHp;
extraHp -= maxHp;
} else if ((hp <= 0) && (extraHp > 0) && (extraHp < maxHp)) {
hp = extraHp;
extraHp = 0;
} else if ((hp <= 0) && (extraHp <= 0)) {
var healer;
healer = noone;
with(lastDamageDealer)
if (object)
if (object.healer)
healer = object.healer;
sendEventDestruction(ownerPlayer, lastDamageDealer, healer, lastDamageSource);
doEventDestruction(ownerPlayer, lastDamageDealer, healer, lastDamageSource);
exit;
}
}
if (built == 1) {
if (idleTimer == true) {
playsound(x,y,SentryIdle);
alarm[5] = 90;
}
idleTimer = false;
}
");
object_event_add(Sentry,ev_step,ev_step_begin," //I will alter this and later code so sentries have a second health pool like the extra N+B
if (buffed == 2){
maxExtraHp = 150;
} else if (buffed == 1){
maxExtraHp = 50;
} else if (buffed == 0){
maxExtraHp = 0;
}
if ((extraHp < maxExtraHp) && (built == 0)) {
extraHp = maxExtraHp;
}
");
object_event_add(Sentry,ev_destroy,0,"
if (variable_local_exists('level') {
SentryGibs.boltFactor = level;
} else {
SentryGibs.boltFactor = 1 + floor(maxExtraHp/100);
}
");
object_event_clear(Character,ev_collision,SentryGibs);
object_event_add(Character,ev_collision,SentryGibs,"
if player.class == CLASS_ENGINEER {
var boltGibs;
boltGibs = 100*other.boltFactor - 50;
if ((nutsNBolts + boltGibs > 100) && (maxExtraNutsNBolts > 0)) {
extraNutsNBolts += nutsNBolts + boltGibs - 100;
nutsNBolts = 100;
} else {
nutsNBolts += boltGibs;
}
with other instance_destroy();
playsound(x,y,PickupSnd);
}
");
object_event_add(Sentry,ev_other,ev_user12,"
if(global.updateType == QUICK_UPDATE or global.updateType == FULL_UPDATE) {
write_ubyte(global.serializeBuffer, extraHp);
write_ubyte(global.serializeBuffer, maxExtraHp);
write_ubyte(global.serializeBuffer, buffed);
}
");
object_event_add(Sentry,ev_other,ev_user13,"
if(global.updateType == QUICK_UPDATE or global.updateType == FULL_UPDATE) {
receiveCompleteMessage(global.serverSocket, 3, global.deserializeBuffer);
extraHp = read_ubyte(global.deserializeBuffer);
maxExtraHp = read_ubyte(global.deserializeBuffer);
buffed = read_ubyte(global.deserializeBuffer);
}
");
//this bugs the game up client side as it's not expecting this extra buffering
object_event_add(Character,ev_other,ev_user12,"
if(global.updateType == FULL_UPDATE){
//class specific syncs
switch(player.class)
{
case CLASS_ENGINEER:
write_ubyte(global.serializeBuffer, extraNutsNBolts);
write_ubyte(global.serializeBuffer, maxExtraNutsNBolts);
break;
default:
write_ubyte(global.serializeBuffer, 0);
write_ubyte(global.serializeBuffer, 0);
}
}
");
object_event_add(Character,ev_other,ev_user13,"
if(global.updateType == FULL_UPDATE){
receiveCompleteMessage(global.serverSocket, 2, global.deserializeBuffer);
//class specific syncs
switch(player.class)
{
case CLASS_ENGINEER:
extraNutsNBolts = read_ubyte(global.deserializeBuffer);
maxExtraNutsNBolts = read_ubyte(global.deserializeBuffer);
break;
default:
read_ubyte(global.deserializeBuffer);
read_ubyte(global.deserializeBuffer);
}
}
");
object_event_clear(NutsNBoltsHud,ev_draw,0);
object_event_add(NutsNBoltsHud,ev_draw,0,"
var xoffset, yoffset, xsize, ysize;
xoffset = view_xview[0];
yoffset = view_yview[0];
xsize = view_wview[0];
ysize = view_hview[0];
if global.myself.team == TEAM_BLUE offset=1;
else offset = 0;
if global.myself.object == -1 || global.myself.class!=CLASS_ENGINEER exit;
draw_set_valign(fa_center);
draw_set_halign(fa_right);
draw_set_alpha(1);
draw_set_color(c_white);
draw_sprite_ext(sprite_index,offset,xoffset+730,yoffset+515,2,2,0,c_white,1);
draw_text_transformed_color(xoffset+732,yoffset+519,string(floor(global.myself.object.nutsNBolts + global.myself.object.extraNutsNBolts)),1.5,1.5,0,c_white,c_white,c_white,c_white,1);
");
object_event_clear(SentryHealthHud,ev_draw,0);
object_event_add(SentryHealthHud,ev_draw,0,"
if(global.myself.team == TEAM_BLUE) {
image_index = 1;
} else {
image_index = 0;
}
if((global.myself.object == -1) || (global.myself.class!=CLASS_ENGINEER)) {
instance_destroy();
exit;
}
if(global.myself.sentry) {
drawHealth(45, 477, global.myself.sentry.hp + global.myself.sentry.extraHp, global.myself.sentry.maxHp + global.myself.sentry.maxExtraHp);
draw_sprite_ext(sprite_index, image_index, view_xview[0]+5, view_yview[0]+455, 2, 2, 0, c_white, 1);
}
");
object_event_add(Sentry,ev_alarm,8,"
stabbed = 0;
");
object_event_clear(StabMask,ev_collision,Sentry)
object_event_clear(StabMask,ev_collision,Character)
object_event_add(StabMask,ev_collision,Sentry,"
if(other.team != team)
{
if(!collision_line(x,y-12,other.x,other.y,Obstacle,true,true)) and (!collision_line(x,y-12,other.x,other.y,TeamGate,true,true) and (!collision_line(x,y-12,other.x,other.y,BulletWall,true,true))) and (other.stabbed != 1)
{
other.hp -= hitDamage;
other.lastDamageDealer = ownerPlayer;
other.lastDamageSource = weapon;
other.stabbed = 1;
other.alarm[8] = alarm[0];
if numKills >= maxKills
instance_destroy();
}
else
alarm[0] = 1;
}
");
object_event_add(StabMask,ev_collision,Character,"
if(other.id != ownerPlayer.object and other.team != team and other.hp > 0 and !other.ubered)
{
if(!collision_line(x,y-12,other.x,other.y,Obstacle,true,true)) and (!collision_line(x,y-12,other.x,other.y,TeamGate,true,true) and (!collision_line(x,y-12,other.x,other.y,BulletWall,true,true))) and (other.stabbed != 1)
{
other.hp -= hitDamage;
other.timeUnscathed = 0;
if (other.lastDamageDealer != ownerPlayer && other.lastDamageDealer != other.player)
{
other.secondToLastDamageDealer = other.lastDamageDealer;
other.alarm[4] = other.alarm[3]
}
other.alarm[3] = ASSIST_TIME;
other.lastDamageDealer = ownerPlayer;
other.stabbed = 1;
other.alarm[8] = alarm[0];
if sign(other.image_xscale) == sign(image_xscale)
other.lastDamageSource = WEAPON_BACKSTAB;
else
other.lastDamageSource = WEAPON_KNIFE;
var blood;
if(global.gibLevel > 0)
{
repeat(70)
{
blood = instance_create(x,y,Blood);
blood.direction = direction-180;
}
}
numKills += 1;
if numKills >= maxKills
instance_destroy();
}
else
alarm[0] = 1;
}
");
object_event_add(Character,ev_step,ev_step_normal,"
if (!global.isHost) exit;
if (player.stats[KILLS] > currentStreak && player.stats[KILLS] - currentStreak != killStreak) {
var killStreakText;
killStreakText = '';
killStreak = player.stats[KILLS] - currentStreak;
var resetTimer;
resetTimer = 0;
if (killStreak == 2) {
nutsNBolts += 50;
hp += maxHp/10; //changing to percent HP recovery
currentWeapon.maxAmmo*=2;
currentWeapon.alarm[5] = 1;//-1 stops the alarm from counting down, hence not triggering the reload I assume you wanted?
currentWeapon.ammoCount = currentWeapon.maxAmmo;
killStreakText = ' got a double kill! x2 ammo';
resetTimer = 1;
}else if (killStreak == 3) {
killStreakText = ' got a triple kill! autogun repaired';
nutsNBolts += 50;
//currentWeapon.maxAmmo*=2; you're buffing your own weapon again
if (player.sentry) {
with(player.sentry) {
hp += maxHp/2; //changed to be a half repair
if hp > maxHp {hp = maxHp;} //don't want sentries with over max at this stage
}
}
currentWeapon.alarm[5] = -7; // I don't think the turret has an alarm[5] plus negative setting stops the alarm
//currentWeapon.ammoCount = currentWeapon.maxAmmo; same deal
resetTimer = 1;
}else if (killStreak == 4){
killStreakText = ' got a mega kill! x2 ammo, health, N+B'; //added N+B to message
maxHp*=2;
currentWeapon.maxAmmo*=2;
maxExtraNutsNBolts = 100;
nutsNBolts = 100;
extraNutsNBolts = 100;
//if hp <= 100 {hp += 100} else {hp += 20}; //did you want to do this like the sentries?
hp += maxHp/5; //changing to percent HP recovery
currentWeapon.alarm[5] = 1;
currentWeapon.ammoCount = currentWeapon.maxAmmo;
resetTimer = 1;
}else if (killStreak == 5){
killStreakText = ' got an ultra kill! x2 ammo';
if (nutsNBolts + 50 > maxNutsNBolts && maxExtraNutsNBolts > 0) { //50 N+B until 6-streak
extraNutsNBolts = (nutsNBolts + 50) - maxNutsNBolts;
nutsNBolts = 100;
} else {
nutsNBolts += 50;
}
//with(Character) if lastDamageDealer == other.player && timeUnscathed <= 1 hp = -50; ???
//if hp < maxHp hp += 10;
currentWeapon.maxAmmo*=2;
currentWeapon.ammoCount = currentWeapon.maxAmmo;
resetTimer = 1;
}else if (killStreak == 6){
killStreakText = ' got a M-M-M-Monster kill! x2 ammo, N+B';
hp += maxHp/4; //changing to percent HP recovery
maxExtraNutsNBolts = 300;
nutsNBolts = 100;
extraNutsNBolts = 300;
currentWeapon.maxAmmo*=2;
currentWeapon.ammoCount = currentWeapon.maxAmmo;
resetTimer = 1;
}else if (killStreak == 9){
killStreakText = ' got a ludicrous kill! Sentry health buffed!';
if (nutsNBolts + 100 > maxNutsNBolts && maxExtraNutsNBolts > 0) {
extraNutsNBolts = (nutsNBolts + 100) - maxNutsNBolts;
nutsNBolts = 100;
} else {
nutsNBolts += 100;
}
sentryBuffStatus = 1;
//currentWeapon.alarm[5] = 1;
//currentWeapon.ammoCount = currentWeapon.maxAmmo;
if (player.sentry) {
with(player.sentry) {
buffed = 1;
maxExtraHp += buffed*50; //buff by 50HP - I know if you haven't built a sentry yet it will default to 100, I'll look at the sentry stuff down the bottom
hp = maxHp;
extraHp = maxExtraHp; //heal it now imo
}
}
resetTimer = 1;
}else if (killStreak == 10){
killStreakText = ' RTD active (taunt to roll)! x2 ammo x2 health';
if (nutsNBolts + 200 > maxNutsNBolts && maxExtraNutsNBolts > 0) {
extraNutsNBolts = (nutsNBolts + 200) - maxNutsNBolts;
nutsNBolts = 100;
} else {
nutsNBolts += 200;
}
currentWeapon.maxAmmo*=2;
maxHp*=2;
currentWeapon.ammoCount = currentWeapon.maxAmmo;
hp += maxHp/4; //changing to percent HP recovery
resetTimer = 1;
}else if (killStreak == 12){
killStreakText = ' is merciless! x2 N+B';
maxExtraNutsNBolts = 700;
nutsNBolts = 100;
extraNutsNBolts = 700;
currentWeapon.alarm[5] = 50;
//currentWeapon.ammoCount = currentWeapon.maxAmmo; ??? why reload ammo now?
resetTimer = 1;
}else if (killStreak == 15){
killStreakText = ' is unstoppable! x2 health, Sentry health buffed!';
if (nutsNBolts + 300 > maxNutsNBolts && maxExtraNutsNBolts > 0) {
extraNutsNBolts = (nutsNBolts + 300) - maxNutsNBolts;
nutsNBolts = 100;
} else {
nutsNBolts += 300;
}
maxHp*=2;
hp += maxHp/4; //changing to percent HP recovery
sentryBuffStatus = 2;
currentWeapon.alarm[5] = 50;
if (player.sentry) {
with(player.sentry) {
buffed = 2;
maxExtraHp += buffed*50; //buff by 1000HP - I know if you haven't built a sentry yet it will default to 100, I'll look at the sentry stuff down the bottom
hp = maxHp;
extraHp = maxExtraHp; //heal it now imo
}
}
//currentWeapon.ammoCount = currentWeapon.maxAmmo; ??? why reload ammo now?
resetTimer = 1;
}else if (killStreak == 20){
killStreakText = ' is GODLIKE! 777 health'; //this is a debuff for all classes now
if (nutsNBolts + 400 > maxNutsNBolts && maxExtraNutsNBolts > 0) {
extraNutsNBolts = (nutsNBolts + 400) - maxNutsNBolts;
nutsNBolts = 100;
} else {
nutsNBolts += 400;
}
maxHp = 777;
hp = maxHp;
currentWeapon.alarm[5] = 300;
//currentWeapon.ammoCount = currentWeapon.maxAmmo; ??? why reload ammo now?
resetTimer = 1;
}else if (killStreak == 25){
killStreakText = ' is a 1337 |-|4><0|2!';
if (nutsNBolts + 500 > maxNutsNBolts && maxExtraNutsNBolts > 0) {
extraNutsNBolts = (nutsNBolts + 500) - maxNutsNBolts;
nutsNBolts = 100;
} else {
nutsNBolts += 500;
}
currentWeapon.alarm[5] = 50;
//currentWeapon.ammoCount = currentWeapon.maxAmmo; ??? why reload ammo now?
resetTimer = 1;
}else if (killStreak == 30) {
killStreakText = ' exploded! They should stop playing this game!';
if (player.sentry) {
sentryBuffStatus = 0;
with(player.sentry) {
buffed = 0;
maxExtraHp = 0;
extraHp = 0;
}
}
effect = 0;
}if (resetTimer >= 1) {
//send to chat if possible
if (variable_global_exists('chatLog')) {
if (string_count('v3',ds_list_find_value(global.chatLog,0)) == 1) {
with(global.chatWindow) {
_message = 'O' + other.player.name + killStreakText;
_team = 0;
event_user(2);
event_user(4);
}
} else if (string_count('v5',ds_list_find_value(global.chatLog,0)) == 1) {
with(global.chatWindow) {
playerId = 254;
_message = 'O' + other.player.name + killStreakText;
_team = 0;
event_user(2);
event_user(4);
}
event_user(4);
}
}
//send to the default message thingy
var message;
message = other.player.name + killStreakText;
ServerMessageString(message,global.sendBuffer);
with NoticeO instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = message;
}
}
");
global.canRoll = true;
global.effects = 28;
global.effect[0] = " Exploded!";
global.effect[1] = " Turned into a timebomb! Detonation in 10 seconds!"
global.effect[2] = " froze for 10 seconds!";
global.effect[3] = " Lost health!"
global.effect[4] = " can't jump for 20 seconds!";
global.effect[5] = " has less gravity for 20 seconds!";
global.effect[6] = " has infinite ammo for 10 seconds!";
global.effect[7] = " became invincible for 10 seconds!";
global.effect[8] = " has instakill for 10 seconds!";
global.effect[9] = " can fly for 20 seconds!"
global.effect[10] = " has hyperspeed for 60 seconds!"
global.effect[11] = " healed!";
global.effect[12] = " became confused for 20 seconds!"
global.effect[13] = " Talks about his feelings for 20 seconds!";
global.effect[14] = " lost ammo!";
global.effect[15] = " got full ammo";
global.effect[16] = " Stomped!";
global.effect[17] = " is poisoned for 10 seconds!";
global.effect[18] = " has instant refire for 10 seconds!";
global.effect[19] = " has health regen for 20 seconds!";
global.effect[20] = " released the spies! All autoguns are sapped!";
global.effect[21] = " is a disguised spy! Kill him before he kills you!";
global.effect[22] = " is slowed for 20 seconds!";
global.effect[23] = " has built an autogun!";
global.effect[24] = " is marked for death for 20 seconds!";
global.effect[25] = " is a pacifist for 10 seconds!";
global.effect[26] = " gunspins for 20 seconds!";
global.effect[27] = " has double clip size for 20 seconds!";
object_event_add(PlayerControl,ev_create,0,"
alarm[0] = 300;
");
object_event_add(Player,ev_create,0,"iCanRoll = true;");
object_event_add(Player,ev_alarm,10,"iCanRoll = true;");
object_event_add(Character,ev_create,0,"
effect = noone;
");
object_event_add(Character,ev_destroy,0,"
if global.isHost {
if effect == 16 {
ServerMessageString(player.name + ' died attempting to kick!',global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' died attempting to kick!';
global.canRoll = true;
}
/* if player.sentry != noone {
if effect == 23 && player.sentry.special {
sendEventDestruction(player, noone, noone, 0);
doEventDestruction(player, noone, noone, 0);
}
}
*/
if (player.sentry) {
sentryBuffStatus = 0;
with(player.sentry) {
buffed = 0;
maxExtraHp = 0;
extraHp = 0;
}
}
}
");
object_event_add(Character,ev_step,ev_step_normal,"
if global.isHost {
if effect != noone {
switch(effect) {
case 1:
RTDtimer -= 1;
if RTDtimer mod 30 == 0 && RTDtimer <= 90 {
ServerMessageString('Detonation in '+string(RTDtimer/30) ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = 'Detonation in '+string(RTDtimer/30);
}
if RTDtimer <= 0 {
global.canRoll = true;
effect = noone;
with(Character) {
if point_distance(x,y,other.x,other.y) < 64 {
if team != other.team or id == other.id {
lastDamageDealer = other.player;
lastDamageSource = FINISHED_OFF_GIB;
hp = -999;
}
}
}
}
break;
case 2:
RTDtimer -= 1;
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' is no longer frozen.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' is no longer frozen.';
}
break;
case 4:
RTDtimer -= 1;
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' can jump again.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' can jump again.';
}
break;
case 5:
if(place_free(x,y+1)) vspeed -= 0.3;
RTDtimer -= 1;
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' has normal gravity again.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' has normal gravity again.';
}
break;
case 6:
currentWeapon.ammoCount = currentWeapon.maxAmmo;
RTDtimer -= 1;
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' has normal ammo again.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' has normal ammo again.';
}
break;
case 7:
hp = 255;
RTDtimer -= 1;
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' is no longer invincible.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' is no longer invincible.';
hp = hpBkp;
}
break;
case 8:
with(Character) if lastDamageDealer == other.player && timeUnscathed <= 1 hp = -999;
RTDtimer -= 1;
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' no longer has instakill.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' no longer has instakill.';
}
break;
case 9:
doublejumpUsed = false;
RTDtimer -= 1;
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' can no longer fly.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' can no longer fly.';
if player.class != CLASS_SCOUT canDoublejump = false;
}
break;
case 10:
RTDtimer -= 1;
runBkp = runPower;
runPower = runPower*3;
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' no longer has hyperspeed.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' no longer has hyperspeed.';
runPower = min(runBkp,runPower/3);
}
break;
case 12:
RTDtimer -= 1;
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' is no longer confused.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' is no longer confused.';
}
break;
case 17:
RTDtimer -= 1;
hp -= 0.2;
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' is no longer poisoned.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' is no longer poisoned.';
}
break;
case 18:
RTDtimer -= 1;
if player.class != CLASS_PYRO && player.class != CLASS_HEAVY
if currentWeapon.refireTime > 5 currentWeapon.refireTime = 5;
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' no longer has instant reload.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' no longer has instant reload.';
}
break;
case 19:
RTDtimer -= 1;
if hp < maxHp hp += 1;
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' no longer has health regen.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' no longer has health regen.';
}
break;
case 13:
RTDtimer -= 1;
if RTDtimer mod 7 == 0 {
var feeling;
feeling = floor(random(7))
write_ubyte(global.sendBuffer, CHAT_BUBBLE);
write_ubyte(global.sendBuffer, ds_list_find_index(global.players,player));
write_ubyte(global.sendBuffer, 22+feeling);
setChatBubble(player, 22+feeling);
}
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' has calmed down.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' has calmed down.';
}
break;
case 22:
RTDtimer -= 1;
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' is no longer slowed.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' is no longer slowed.';
}
break;
case 23:
RTDtimer -= 1;
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
if player.sentry != noone {
if player.sentry.special == true {
sendEventDestruction(player, noone, noone, 0);
doEventDestruction(player, noone, noone, 0);
}
}
}
break;
case 24:
RTDtimer -= 1;
if RTDtimer mod 7 == 0 {
write_ubyte(global.sendBuffer, CHAT_BUBBLE);
write_ubyte(global.sendBuffer, ds_list_find_index(global.players,player));
write_ubyte(global.sendBuffer, 49);
setChatBubble(player, 49);
}
if _hpBkp > hp {
hp -= (_hpBkp-hp)*0.3;
_hpBkp = hp;
}
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' is no longer marked for death.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' is no longer marked for death.';
}
break;
case 25:
RTDtimer -= 1;
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' is no longer a pacifist.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' is no longer a pacifist.';
}
break;
case 26:
RTDtimer -= 1;
if RTDtimer <= 0 {
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' stopped gunspinning.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' stopped gunspinning.';
}
break;
case 27:
RTDtimer -= 1;
if RTDtimer <= 0 {
currentWeapon.maxAmmo/=2;
currentWeapon.ammo = min(currentWeapon.ammoCount, currentWeapon.maxAmmo);
effect = noone;
global.canRoll = true;
ServerMessageString(player.name + ' no longer has double clip size.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + ' no longer has double clip size.';
}
break;
default:
effect = noone;
}
}
//all we had to do is slap on a restriction to taunting to check if they met the killstreak requirements
if taunting && killStreak >= 10 {
if tauntindex == 0 or tauntindex == tauntlength {
if player.iCanRoll && global.canRoll {
//if effect == 23 effect = 16;
effect = floor(random(global.effects));
ServerMessageString(player.name + global.effect[effect],global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = player.name + global.effect[effect];
player.iCanRoll = false;
player.alarm[10] = 1;
switch(effect) {
case 0:
effect = noone;
with(Character) {
if point_distance(x,y,other.x,other.y) < 64 {
if team != other.team or id == other.id {
lastDamageDealer = other.player;
lastDamageSource = FINISHED_OFF_GIB;
hp = -999;
}
}
}
break;
case 1:
case 2:
case 6:
case 8:
case 17:
case 18:
case 25:
global.canRoll = true;
RTDtimer = 10*30;
break;
case 3:
hp = 1;
effect = noone;
break;
case 4:
case 5:
case 12:
case 13:
case 19:
case 22:
global.canRoll = true;
RTDtimer = 20*30;
break;
case 7:
global.canRoll = false;
RTDtimer = 10*30;
hpBkp = hp;
break;
case 9:
global.canRoll = false;
RTDtimer = 20*30;
canDoublejump = true;
break;
case 10:
global.canRoll = true;
RTDtimer = 10*60;
runBkp = runPower;
runPower = runPower*3;
break;
case 11:
effect = noone;
hp = maxHp;
case 14:
effect = noone;
currentWeapon.ammoCount = 0;
currentWeapon.alarm[5] = 50;
break;
case 15:
effect = noone;
currentWeapon.ammoCount = currentWeapon.maxAmmo;
currentWeapon.alarm[5] = -1;
break;
case 16:
effect = noone;
vspeed = 15;
moveStatus = 1;
case 20:
effect = noone;
with(Sentry) {
if hp > 25 hp = 25;
else hp = -999;
built = 0;
}
break;
case 21:
if team == TEAM_RED team = TEAM_BLUE;
else team = TEAM_RED;
break;
case 23:
global.canRoll = true;
RTDtimer = 20*30;
if (!(player.class = CLASS_ENGINEER))
{
if player.sentry != noone {
sendEventDestruction(player, noone, noone, 0);
doEventDestruction(player, noone, noone, 0);
}
nutsNBolts += 100;
buildSentry(player,x,y,image_xscale);
player.sentry.special = true;
write_ubyte(global.sendBuffer, BUILD_SENTRY);
write_ubyte(global.sendBuffer, ds_list_find_index(global.players,player));
write_ushort(global.sendBuffer, round(x*5));
write_ushort(global.sendBuffer, round(y*5));
write_byte(global.sendBuffer, image_xscale);
}
break;
case 24:
_hpBkp = hp;
global.canRoll = false;
RTDtimer = 20*30;
break;
case 26:
_aimBkp = aimDirection;
global.canRoll = false;
RTDtimer = 20*30;
break;
case 27:
currentWeapon.maxAmmo*=2;
if currentWeapon.alarm[5] == -1 currentWeapon.alarm[5] = currentWeapon.reloadTime;
global.canRoll = true;
RTDtimer = 20*30;
break;
}
} else {
write_ubyte(global.sendBuffer, CHAT_BUBBLE);
write_ubyte(global.sendBuffer, ds_list_find_index(global.players,player));
write_ubyte(global.sendBuffer, 44);
setChatBubble(player, 44);
}
}
}
}
");
//super haxxing of the keybytes so clients don't spazz as much on some effects :)
object_event_clear(Character,ev_other,ev_user1);
object_event_add(Character,ev_other,ev_user1,"
switch(effect) {
case 12:
if (keyState & $20 != 0) {
keyState &= $DF;
keyState |= $40;
} else if (keyState & $40 != 0) {
keyState &= $BF;
keyState |= $20;
}
break;
case 2:
keyState &= $1F;
break;
case 4:
keyState &= $7F;
break;
case 22:
if random(1) < 0.5 keyState &= $9F;
break;
case 25:
keyState &= $E7;
break;
case 26:
aimDirection = _aimBkp + 30;
if aimDirection > 360 aimDirection -= 360;
netAimDirection = aimDirection*65536/360;
_aimBkp = aimDirection;
break;
}
pressedKeys |= keyState & ~lastKeyState;
releasedKeys |= ~keyState & lastKeyState;
lastKeyState = keyState;
");
//sentry requires a whole bunch of changes to work
object_event_add(Sentry,ev_create,0,"special = false;");
object_event_clear(Sentry,ev_step,ev_step_begin);
object_event_add(Sentry,ev_step,ev_step_begin,"
if (global.isHost and (ownerPlayer.class != CLASS_ENGINEER || team != ownerPlayer.team || collision_circle(x,y+10,25,Sentry,false,true)>=0))
{
var bad;
bad = false;
if !instance_exists(ownerPlayer.object) or ownerPlayer.object == -1 bad = true;
else if ownerPlayer.object.effect != 23 bad = true;
if bad {
sendEventDestruction(ownerPlayer, noone, noone, 0);
doEventDestruction(ownerPlayer, noone, noone, 0);
exit;
}
}
if built == 0 && vspeed == 0 {
if hp < maxHp hp+=1;
else built = 1;
image_index = floor(hp/maxHp*10);
if landed == 0 {
landed = 1;
playsound(x,y,SentryFloorSnd);
playsound(x,y,SentryBuildSnd);
}
}
if (built == 1 && currentWeapon == -1){
image_index=11;
image_speed=0;
hp=maxHp;
currentWeapon = instance_create(x,y,weapons[0]);
currentWeapon.ownerPlayer=ownerPlayer;
currentWeapon.team=team;
currentWeapon.startDirection=startDirection;
with(currentWeapon) {
event_user(0);
}
}
if (humiliated == 1 && built == 1 && currentWeapon != -1) {
event_user(1);
}
if(place_free(x,y+1)) {
vspeed += 0.6;
}
if(vspeed>10) {
vspeed=10;
}
if(abs(oldVspeed)!=0 and vspeed==0 and global.isHost)
{
write_ubyte(global.sendBuffer, SENTRY_POSITION);
write_ubyte(global.sendBuffer, ds_list_find_index(global.players, ownerPlayer));
write_ushort(global.sendBuffer, round(x*5));
write_ushort(global.sendBuffer, round(y*5));
}
oldVspeed = vspeed;
");
object_event_add(Sentry,ev_destroy,0,"
if special {
var quote;
quote = chr(39);
ownerPlayer.object.effect = noone;
ownerPlayer.object.RTDtimer = -1;
global.canRoll = true;
ServerMessageString(ownerPlayer.name + quote +'s RTD sentry was destroyed.' ,global.sendBuffer);
with(NoticeO) instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = ownerPlayer.name + quote +'s RTD sentry was destroyed.';
}
");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment