Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function onActionServerside(params)
- {
- switch (params[0])
- {
- case "showStats":
- player.showFloat(params[1]);
- break;
- case "removeShuriken":
- player.removeitem(229, 1);
- break;
- }
- }
- join("weapongun");
- //#CLIENTSIDE
- function onWeaponFired()
- {
- if (player.level.name.starts("era_event")) return;
- if (player.level.name.starts("era_fist")) return;
- if (clientr.isInEventLevel) return;
- if (player.onLadder) return;
- if (playerfreezesecs > 0) return;
- //player.clientr.swiftfoot = true;
- if (this.out) {
- this.doAttack();
- } else {
- sheathBlade();
- meleedisabled = true;
- }
- }
- function onTimeout()
- {
- if (clientr.isInEventLevel) {
- sheathBlade();
- //player.clientr.swiftfoot = false;
- meleedisabled = true;
- }
- //handles block duration and countdown - redundant in live
- switch (this.timeinc)
- {
- case 10:
- blockanis(false);
- triggerserver("gui", name, "showStats", "Block down!");
- client.DamageBlock = false;
- this.timeinc++;
- break;
- case 25:
- triggerserver("gui", name, "showStats", "Block ready!");
- this.cooldown = false;
- return;
- break;
- default:
- this.timeinc++;
- }
- setTimer(this.cycletime);
- }
- function blockAnis(state)
- {
- temp.skinName = player.clientr.("gunSkins_Samurai Sword_selected");
- if(temp.skinName != null) {
- temp.ext = ((temp.skinName in serverr.GIFSkins) ? ".gif" : ".png");
- player.attr[12] = "era_skin_samuraisword-" @ temp.skinName.lower() @ temp.ext;
- }
- //handles block anis - redundant in live
- if (state)
- {
- if (temp.skinName != null){
- client.replaceani = {"walk", "era_gun_template_samuraisword-block",
- "idle", "era_gun_template_samuraisword-block",
- "sit", "era_gun_template_samuraisword-block"};
- (@"-MoveSystem").trigger("ReplaceAni", "");
- setani("era_gun_template_samuraisword-block", "");
- } else {
- client.replaceani = {"walk", "ct_katanablock-daisetsu",
- "idle", "ct_katanablock-daisetsu",
- "sit", "ct_katanablock-daisetsu"};
- (@"-MoveSystem").trigger("ReplaceAni", "");
- setani("ct_katanablock-daisetsu", "");
- }
- } else {
- if (temp.skinName != null){
- client.replaceani = {"walk", "era_gun_template_samuraisword-walkunsheath",
- "idle", "era_gun_template_samuraisword-ready",
- "sit", "era_gun_template_samuraisword-situnsheath"};
- setani("era_gun_template_samuraisword-unsheath", "");
- (@"-MoveSystem").trigger("ReplaceAni", "");
- } else{
- client.replaceani = {"walk", "ct_katanawalkunsheath-daisetsu",
- "idle", "ct_katanaready-daisetsu",
- "sit", "ct_katanasitunsheath-daisetsu"};
- setani("ct_katanaunsheath-daisetsu", "");
- (@"-MoveSystem").trigger("ReplaceAni", "");
- }
- }
- }
- function resetWepState()
- {
- //used to reset weapon status on unequip
- this.cooldown = false;
- this.cycletime = 0;
- this.timeinc = 0;
- this.out = false;
- client.DamageBlock = false;
- meleedisabled = false;
- }
- //function swordBlock()
- {
- //block disabled in live weapon
- // if (!(this.out)) return;
- // if (this.cooldown)
- {
- // triggerserver("gui", name, "showStats", "On Cooldown!");
- // return;
- // } else {
- // triggerserver("gui", name, "showStats","Block!");
- // client.DamageBlock = true;
- // blockanis(true);
- // this.cooldown = true;
- // this.timeinc = 0;
- // this.cycletime = 1;
- // setTimer(this.cycletime);
- }
- }
- function sheathBlade()
- {
- temp.skinName = player.clientr.("gunSkins_Samurai Sword_selected");
- if(temp.skinName != null) {
- temp.ext = ((temp.skinName in serverr.GIFSkins) ? ".gif" : ".png");
- player.attr[12] = "era_skin_samuraisword-" @ temp.skinName.lower() @ temp.ext;
- }
- this.shuristate = true;
- //sheath the fuckin blade
- if (this.out)
- {
- if (temp.skinName != null){
- client.replaceani = {"walk", "era_gun_template_samuraisword-walksheath",
- "idle", "era_gun_template_samuraisword-idle2",
- "sit", "era_gun_template_samuraisword-sitsheath"};
- setani("era_gun_template_samuraisword-sheath", "");
- } else{
- client.replaceani = {"walk", "ct_katanawalksheath-daisetsu",
- "idle", "ct_katanaidle2-daisetsu",
- "sit", "ct_katanasitsheath-daisetsu"};
- setani("ct_katanasheath-daisetsu", "");
- }
- (@"-MoveSystem").trigger("ReplaceAni", "");
- this.out = false;
- meleedisabled = false;
- playerfreezesecs += 0.4;
- } else {
- if(temp.skinName != null){
- client.replaceani = {"walk", "era_gun_template_samuraisword-walkunsheath",
- "idle", "era_gun_template_samuraisword-ready",
- "sit", "era_gun_template_samuraisword-situnsheath"};
- setani("era_gun_template_samuraisword-unsheath", "");
- } else{
- //unsheath the fuckin blade
- client.replaceani = {"walk", "ct_katanawalkunsheath-daisetsu",
- "idle", "ct_katanaready-daisetsu",
- "sit", "ct_katanasitunsheath-daisetsu"};
- setani("ct_katanaunsheath-daisetsu", "");
- }
- (@"-MoveSystem").trigger("ReplaceAni", "");
- this.out = true;
- meleedisabled = true;
- playerfreezesecs += 0.4;
- }
- }
- function throwShuriken()
- {
- temp.skinName = player.clientr.("gunSkins_Samurai Sword_selected");
- if(temp.skinName != null) {
- temp.ext = ((temp.skinName in serverr.GIFSkins) ? ".gif" : ".png");
- player.attr[12] = "era_skin_samuraisword-" @ temp.skinName.lower() @ temp.ext;
- }
- if (onwater(player.x + 1.5, player.y + 2))
- return;
- if (clientr.(@ "itemc229")[0] < 1)
- return;
- if (player.clientr.dead || player.clientr.hp <= 0) {
- return ;
- }
- //throws a goddamn shuriken
- if (timevar2-this.lastfreeze => 0.25)
- {
- if (temp.skinName != null){
- setAni("era_gun_template_samuraisword-shurikenthrow", "");
- } else{
- setAni("era_chain-katana-shuriken", "");
- }
- playerfreezesecs += 0.1;
- temp.angle = player.dir == 3?0:(player.dir + 1) * 1.57;
- setshootparams(62, 25, player.account, player.guild);
- eshoot(player.x + random(-0.5, 0.5), player.y + random(-0.5, 0.5), player.z + random(-0.5, 0.5), temp.angle, 0.3, 0, "era_shuriken", "");
- this.lastfreeze = timevar2;
- triggerserver("gui", name, "removeshuriken","");
- } else {
- return;
- }
- }
- function doAttack(mode)
- {
- temp.skinName = player.clientr.("gunSkins_Samurai Sword_selected");
- if(temp.skinName != null) {
- temp.ext = ((temp.skinName in serverr.GIFSkins) ? ".gif" : ".png");
- player.attr[12] = "era_skin_samuraisword-" @ temp.skinName.lower() @ temp.ext;
- }
- if (timevar2-this.lastslash < .20) return;
- //handles the crunk ass attacking shit
- if (!onwater(player.x+1.5, player.y+2)) {
- playerfreezesecs += (0.15 + (mode? 0.1: 0));
- this.range = 2.4;
- if (temp.skinName != null) {
- setAni("era_gun_template_samuraisword-attack1", "");
- } else {
- setAni("ct_katanaattack1-daisetsu", "");
- }
- temp.xy = {player.x + 1 + vecx(player.dir) * 2,
- player.y + 1.5 + vecy(player.dir) * 2};
- //triggeraction(temp.xy[0], temp.xy[1], "serverCustomMeleeAttack", 30, 2.5, "physical", player.account);
- triggeraction(temp.xy[0],temp.xy[1],"servermeleeattack","Samurai Sword",37,true,"none",player.account, this.range);//meleename,damage,bleed,effect,account
- this.lastslash = timevar2;
- //player.client.slowMovement = {3, .82};
- //triggeraction(temp.xy[0],temp.xy[1],"servermeleeattack","Samurai Sword",30,true,"none",player.account);//meleename,damage,bleed,effect,account
- /*if (mode == true) {
- for (temp.i = 0; temp.i < 7; temp.i++) {
- temp.xy = {xy[0] + vecx(player.dir), xy[1] + vecy(player.dir)};
- if (onwall2(xy[0], xy[1], 2, 2)) break;
- showani(1, xy[0], xy[1], 0, "era_shuriken", "", "wood_crush.wav", "era_explodedebris2.png");
- triggeraction(temp.xy[0], temp.xy[1], "CustomAttackXY", 25, player.account, player.guild, "physical");
- sleep(0.05);
- }
- showani(1,0,0,0,"","","","");
- }*/
- }
- }
- function onKeyPressed(code, key) {
- if (this.out == false) return;
- if (player.weapon.name != this.name)
- {
- (@"-MoveSystem").trigger("DefAnis", "");
- //player.clientr.swiftfoot = false;
- resetWepState();
- return;
- }
- if (playerfreezesecs > 0) return;
- if (key == "f" && this.shuristate)
- {
- this.throwShuriken();
- this.shuristate = false;
- }
- if (key == "y") this.sheathBlade();
- }
- function doDash()
- {
- if (timevar2-this.lastdash < 1 || !this.out || playerfreezesecs > 0)
- return;
- this.tilespersec = 3; //dash travel speed in tiles/s
- this.dashdistance = 12; //dash distance
- if (onwater(player.x+1.5, player.y+2)) return;
- if (vecx(player.dir) == "1" || vecx(player.dir) == "-1")
- {
- temp.xy = {int(player.x + 1.5 + this.dashdistance * vecx(player.dir)), player.y};
- }
- else
- {
- temp.xy = {player.x, int(player.y + 2 + this.dashdistance * vecy(player.dir))};
- }
- triggerserver("gui", name, "showBlur");
- player.attr[9] = "global_motionblur.gani";
- setAni("ct_katanawalkunsheath-daisetsu", "");
- playerfreezesecs += 1;
- temp.ganicount = 0;
- temp.iterator = 0;
- while (!(player.x in |temp.xy[0]-2, temp.xy[0]+2|) || !(player.y in |temp.xy[1]-2, temp.xy[1]+2|))
- {
- if (onwall2(player.x + 1.5 + this.tilespersec * vecx(player.dir), player.y + 2 + this.tilespersec * vecy(player.dir), 1.25, 1.25)) break;
- if (onwater(player.x + 1.5 + this.tilespersec-1 * vecx(player.dir), player.y + 2 + this.tilespersec-1 * vecy(player.dir))) break;
- if (player.x < temp.xy[0]) player.x += this.tilespersec;
- if (player.y < temp.xy[1]) player.y += this.tilespersec;
- if (player.x > temp.xy[0]) player.x -= this.tilespersec;
- if (player.y > temp.xy[1]) player.y -= this.tilespersec;
- //player.chat = format("destination: %s, %s | current: %s, %s", temp.xy[0], temp.xy[1], player.x, player.y);
- setAni("ct_katanawalkunsheath-daisetsu["@temp.ganicount@"]", "");
- if (temp.iterator => 1)
- {
- temp.ganicount++;
- temp.iterator = 0;
- }
- temp.iterator++;
- //playerfreezesecs += .05;
- clientr.freeze = true;
- sleep(.05);
- }
- clientr.freeze = false;
- //playerfreezesecs += .05;
- player.attr[9] = "era_invis.gani";
- triggerserver("gui", name, "hideBlur");
- this.lastdash = timevar2;
- showAni(199, player.x, player.y, 2, "era_serverside_SFX", "era_katana-dash.wav");
- this.playsound = 1.23;
- hudbars.AddBar("Dash", 1, { 1, 0.65, 0.1 });
- doAttack();
- }
- function dashCD()
- {
- triggerserver("gui", name, "showStats","Dash now ready!");
- }
- function GraalControl.onKeyUp(code, key) {
- if (key == "f" && !(this.shuristate)) this.shuristate = true;
- }
- function onTurnOff() {
- (@"-MoveSystem").trigger("DefAnis", "");
- this.out = false;
- setAni("idle", "");
- }
Advertisement
Add Comment
Please, Sign In to add comment