Name: Hookshot
Type: Weapon
Author: Shadow Knight
Description: Classic Hookshot. Pulls player to stakes and signs. Pulls droppable items. Damages players.
Notes: Required images attached.
function hook_properties() {
this.max_range=20; //The range range of the hookshot DEFAULT:20
this.player_damage=1; //The damage it causes a player DEFAULT:1
this.baddie_damage=2; //The damage it causes a baddie DEFAULT:2
this.npc_damage=0; //The damage it causes a npc DEFAULT:0
this.takeitem=1; //If you want it to be able to pick up items make it equal 1 DEFAULT:1
this.takebomb=0; //If you want to be able to pull bombs toward the player DEFAULT:0
//make it equal 1
this.stakepull=1; //If you want it to pull you toward a stake make it equal 1 DEFAULT:1
this.playerpull=0; //If you want it to pull you toward a player make it equal 1 DEFAULT:0
this.baddiepull=0; //If you want it to pull you toward a baddie make it equal 1 DEFAULT:0
this.npcpull=0; //If you want it to pull you toward a npc make it equal 1 DEFAULT:0
this.hitreturn_baddie=0; //If you want the Hookshot to return when it hits a DEFAULT:0
//baddie make it equal 1
this.hitreturn_player=0; //If you want the Hookshot to return when it hits a DEFAULT:0
//player make it equal 1
this.hitreturn_npc=0; //If you want the Hookshot to return when it hits a DEFAULT:0
//npc make it equal 1
this.hitreturn_item=1; //If you want the Hookshot to return when it hits a DEFAULT:1
//item make it equal 1
this.hitreturn_bomb=0; //If you want the Hookshot to return when it hits a DEFAULT:0
//bomb (must have a bomb option active) make it equal 1
this.explodebomb=0; //If you want to explode a bomb when hit make it equal 1 DEFAULT:0
this.laybomb=0; //If you want to be able to lay the bomb that you picked up DEFAULT:0
//with the hookshot before it bring it back to you
//(by pressing the "d" button) make it equal 1
//EDIT ABOVE HERE
//
//FOR MORE DETAIL ON HOW TO EDIT THIS OR WHAT THE PROPRTIES DO READ THE TEXT FILE
//THIS CAME ALONG WITH THIS.
//
check_level();
}
if (created) {
x+=.5;
y+=.5;
}
//
//DO NOT CHANGE ANY THING BELOW THIS LINE
//
if (playertouchsme) {
toweapons Hookshot;
}
if (weaponfired) {
if (disablehookshot==1) {
setplayerprop #c,Sorry the Hookshot is disabled here.;
}
if (! disablehookshot==1) {
hook_properties();
this.putx=0;
this.puty=0;
this.mode=1;
this.hook=1;
this.range=0;
this.img=11;
this.rope=10;
if(playerdir==0){
this.ropex=playerx+.5;
this.ropey=playery-.5;
this.flyx=playerx+.5;
this.flyy=playery-1.5;
this.dir=0;
}
if(playerdir==1){
this.ropex=playerx-.5;
this.ropey=playery+1.5;
this.flyx=playerx-1.5;
this.flyy=playery+1.5;
this.dir=1;
}
if(playerdir==2){
this.ropex=playerx+1.25;
this.ropey=playery+2.5;
this.flyx=playerx+1.25;
this.flyy=playery+3.5;
this.dir=2;
}
if(playerdir==3){
this.ropex=playerx+2.75;
this.ropey=playery+1.5;
this.flyx=playerx+3.75;
this.flyy=playery+1.5;
this.dir=3;
}
timeout=.05;
}}
if (this.mode>0) {
if (! this.mode==4) {
if (playerhurt||playerdies) {
this.mode=0;
}}
if (timeout) {
freezeplayer .1;
setani shoot,hook.gif;
checkoutside();
if (!this.hasbomb==1) {
hideimg 1;
}
if (this.hasbomb==1) {
if (this.laybomb==1) {
if (keydown(4)) {
this.hasbomb=0;
this.mode=2;
this.hook=1;
putbomb this.bombpower,this.flyx,this.flyy;
}}
showimg 1,ss_bomb.gif,this.flyx,this.flyy;
if (this.bombpower==1) {
changeimgpart 1,0,0,35,33;
}
if (this.bombpower==2) {
changeimgpart 1,0,33,35,33;
}
if (this.bombpower==3) {
changeimgpart 1,0,66,35,33;
}
}
if (this.mode==1) {
this.range ++;
this.rope ++;
rope_options();
detect_bomb();
grapple();
explodebomb();
if (this.range>=this.max_range+1) {
this.mode=2;
}}
if (this.mode==2) {
hideimg this.rope+2;
this.range --;
this.rope --;
if (this.range<=0) {
hideimg this.rope+1;
hideimg this.rope+2;
this.mode=0;
}}
if (this.mode==4) {
hideimg 10;
hideimg this.img;
this.img ++;
}
if (this.dir==0) {
if (this.hook==1) {
showimg 0,hookupunhit.gif,this.flyx,this.flyy;
}
if (this.hook==2) {
showimg 0,hookuphit.gif,this.flyx,this.flyy;
}
if (this.mode==1) {
showimg this.rope,vrope.gif,this.ropex,this.ropey;
this.ropey --;
this.flyy --;
this.putx=this.flyx;
this.puty=this.flyy;
}
if (this.mode==2) {
this.ropey ++;
this.flyy ++;
}
if (this.mode==4) {
if (playery>this.movey+1.2) {
playery --;
}
if (playery<=this.movey+1.2) {
this.mode=0;
}}
}
if (this.dir==1) {
if (this.hook==1) {
showimg 0,hookleftunhit.gif,this.flyx,this.flyy;
}
if (this.hook==2) {
showimg 0,hooklefthit.gif,this.flyx,this.flyy;
}
if (this.mode==1) {
showimg this.rope,rope.gif,this.ropex,this.ropey;
this.ropex --;
this.flyx --;
this.putx=this.flyx;
this.puty=this.flyy;
}
if (this.mode==2) {
this.ropex ++;
this.flyx ++;
}
if (this.mode==4) {
if (playerx>this.movex+1.5) {
playerx --;
}
if (playerx<=this.movex+1.5) {
this.mode=0;
}}
}
if (this.dir==2) {
if (this.hook==1) {
showimg 0,hookdownunhit.gif,this.flyx,this.flyy;
}
if (this.hook==2) {
showimg 0,hookdownhit.gif,this.flyx,this.flyy;
}
if (this.mode==1) {
showimg this.rope,vrope.gif,this.ropex,this.ropey;
this.ropey ++;
this.flyy ++;
this.putx=this.flyx;
this.puty=this.flyy;
}
if (this.mode==2) {
this.ropey --;
this.flyy --;
}
if (this.mode==4) {
if (playery<this.movey-3.5) {
playery ++;
}
if (playery>=this.movey-3.5) {
this.mode=0;
}}
}
if (this.dir==3) {
if (this.hook==1) {
showimg 0,hookrightunhit.gif,this.flyx,this.flyy;
}
if (this.hook==2) {
showimg 0,hookrighthit.gif,this.flyx,this.flyy;
}
if (this.mode==1) {
showimg this.rope,rope.gif,this.ropex,this.ropey;
this.ropex ++;
this.flyx ++;
this.putx=this.flyx;
this.puty=this.flyy;
}
if (this.mode==2) {
this.ropex --;
this.flyx --;
}
if (this.mode==4) {
showimg this.rope+1,rope.gif,this.ropex,this.ropey;
if (playerx<this.movex-3.5) {
playerx ++;
}
if (playerx>=this.movex-3.5) {
this.mode=0;
}}
}
}
timeout=.05;
if (this.mode==0) {
hideimg 0;
hideimg 1;
hideimg this.rope+1;
while (this.rope>9) {
hideimg this.rope;
this.rope --;
}
while (this.bombs>0) {
this.bombs --;
playerbombs ++;
}
while (this.darts>0) {
this.darts --;
playerdarts ++;
}
while (this.hearts>0) {
this.hearts --;
playerhearts ++;
}
while (this.rupees>0) {
this.rupees --;
playerrupees ++;
}
if (this.hasbomb==1) {
putbomb this.bombpower,this.flyx,this.flyy;
this.hasbomb=0;
}}
}
function rope_options() {
for (this.compu=0; this.compu<compuscount; this.compu++) {
if (abs(this.flyx-compus[this.compu].x)<=1 &&
abs(this.flyy-(compus[this.compu].y-0.5))<=1.5 &&
compus[this.compu].mode!=3) {
hitcompu this.compu,this.baddie_damage,this.flyx+0.5,this.flyy+0.5;
if (this.hitreturn_baddie==1) {
this.mode=2;
}
if (this.baddiepull==1) {
this.movex=this.flyx;
this.movey=this.flyy;
this.hook=2;
this.mode=4;
}
}}
for (this.player=1; this.player<playerscount; this.player++) {
if (abs((this.flyx+0.7)-(players[this.player].x+1.5))<=1 &&
abs((this.flyy+0.5)-(players[this.player].y+1.5))<=1.5){
hitplayer this.player,this.player_damage,players[this.player].x,players[this.player].y;
if (this.hitreturn_player==1) {
this.mode=2;
}
if (this.playerpull==1) {
this.movex=this.flyx;
this.movey=this.flyy;
this.hook=2;
this.mode=4;
}
}}
for (this.npc=1; this.npc<npcscount; this.npc++) {
if (abs((this.flyx+0.7)-(npcs[this.npc].x+1.5))<=1 &&
abs((this.flyy+0.5)-(npcs[this.npc].y+1.5))<=1.5){
hitnpc this.npc,this.npc_damage,npcs[this.npc].x,npcs[this.npc].y;
if (this.hitreturn_npc==1) {
this.mode=2;
}
if (this.npcpull==1) {
this.movex=this.flyx;
this.movey=this.flyy;
this.hook=2;
this.mode=4;
}
}}
if (this.takeitem==1) {
for (this.item=0; this.item<itemscount; this.item++) {
if (abs((this.flyx+0.7)-(items[this.item].x+1.5))<=1 &&
abs((this.flyy+0.5)-(items[this.item].y+1.5))<=1.5){
if (items[this.item].type==0) {
this.rupees+=1;
}
if (items[this.item].type==1) {
this.rupees+=5;
}
if (items[this.item].type==2) {
this.rupees+=30;
}
if (items[this.item].type==3) {
this.bombs+=5;
}
if (items[this.item].type==4) {
this.darts+=5;
}
if (items[this.item].type==5) {
this.hearts+=5;
}
if (items[this.item].type==19) {
this.rupees+=100;
}
if (this.hitreturn_item==1) {
this.mode=2;
}
take2 this.item;
}}}
}
function grapple() {
if (this.stakepull==1) {
this.putx = int(this.putx);
this.puty = int(this.puty);
set is_stake;
for (this.i=0; this.i<2; this.i++) for (this.j=0; this.j<2; this.j++) {
this.b = board[this.putx+this.i+64*(this.puty+this.j)];
this.bx = this.b % 16;
this.by = int(this.b / 16);
if (!(this.bx==10+this.i&&(this.by==20+this.j||this.by==21+this.j
||this.by==180+this.j||this.by==181+this.j))&&
!(this.bx==0+this.i&&(this.by==126+this.j||this.by==127+this.j))&&
!(this.bx==4+this.i&&(this.by==103+this.j||this.by==104+this.j))&&
!(this.bx==0+this.i&&(this.by==32+this.j||this.by==33+this.j))&&
!(this.bx==12+this.i&&(this.by==42+this.j||this.by==43+this.j))&&
!(this.bx==2+this.i&&(this.by==197+this.j||this.by==198+this.j))&&
!(this.bx==11+this.i&&(this.by==126+this.j||this.by==127+this.j))&&
!(this.bx==8+this.i&&(this.by==86+this.j||this.by==87+this.j)))
unset is_stake;
}
if (is_stake) {
unset is_stake;
putleaps 3,this.flyx,this.flyy;
this.hook=2;
this.movex=this.flyx;
this.movey=this.flyy;
this.mode=4;
}}
}
function detect_bomb() {
if (this.takebomb==1&&!this.hasbomb==1) {
for (this.bomb=0; this.bomb<bombscount; this.bomb++) {
if (abs((this.flyx+0.7)-(bombs[this.bomb].x+1.5))<=1 &&
abs((this.flyy+0.5)-(bombs[this.bomb].y+1.5))<=1.5){
if (this.hitreturn_bomb==1) {
this.mode=2;
}
this.hook=2;
this.hasbomb=1;
this.bombpower=bombs[this.bomb].power;
removebomb this.bomb;
}}}
}
function explodebomb() {
if (this.explodebomb==1) {
for (this.bomb=0; this.bomb<bombscount; this.bomb++) {
if (abs((this.flyx+0.7)-(bombs[this.bomb].x+1.5))<=1 &&
abs((this.flyy+0.5)-(bombs[this.bomb].y+1.5))<=1.5){
if (this.hitreturn_bomb==1) {
this.mode=2;
}
explodebomb this.bomb;
}}}
}
function check_level() {
if (edithookshot==1) {
if (max_range>0) {
this.max_range=strtofloat(#v(max_range));
}
if (player_damage>0) {
this.player_damage=strtofloat(#v(player_damage));
}
if (baddie_damage>0) {
this.baddie_damage=strtofloat(#v(baddie_damage));
}
if (npc_damage>0) {
this.npc_damage=strtofloat(#v(npc_damage));
}
if (takeitem>0) {
this.takeitem=strtofloat(#v(takeitem));
}
if (takebomb>0) {
this.takebomb=strtofloat(#v(takebomb));
}
if (stakepull>0) {
this.stakepull=strtofloat(#v(stakepull));
}
if (playerpull>0) {
this.playerpull=strtofloat(#v(playerpull));
}
if (baddiepull>0) {
this.baddiepull=strtofloat(#v(baddiepull));
}
if (npcpull>0) {
this.npcpull=strtofloat(#v(npcpull));
}
if (hitreturn_baddie>0) {
this.hitreturn_baddie=strtofloat(#v(hitreturn_baddie));
}
if (hitreturn_player>0) {
this.hitreturn_player=strtofloat(#v(hitreturn_player));
}
if (hitreturn_npc>0) {
this.hitreturn_npc=strtofloat(#v(hitreturn_npc));
}
if (hitreturn_item>0) {
this.hitreturn_item=strtofloat(#v(hitreturn_item));
}
if (hitreturn_bomb>0) {
this.hitreturn_bomb=strtofloat(#v(hitreturn_bomb));
}
if (explodebomb>0) {
this.explodebomb=strtofloat(#v(explodebomb));
}
if (laybomb>0) {
this.laybomb=strtofloat(#v(laybomb));
}
}
}
function checkoutside() {
if (this.mode==1) {
if (this.dir==0&&this.flyy<=0||this.dir==1&&this.flyx<=0||this.dir==2&&this.flyy>=63||this.dir==3&&this.flyx>=63) {
this.mode=2;
}}
}
[attachment deleted by admin]