Quote:
Originally posted by screen_name
you shouldn't take on this task if you dont know how
|
I totally agree with you on this. But since I am feeling a bit generous right now, so I'm gonna post the weapon list script I made for Frolic. You can use this but please give the credit where it is needed.
NPC Code:
function find_wpns() {
this.wpnnum = 0;
setarray this.weapons,weaponscount;
for (i=0;i<arraylen(this.weapons);i++) {
if (!startswith(-,#w(i))) {
this.weapons[this.wpnnum] = i;
this.wpnnum++;
}
}
}
function draw_wpnlist() {
showimg 221,it_#s(client.skin)_bg.gif,(screenwidth/2)-(176/2),(screenheight/2)-(192/2);
changeimgpart 221,0,336,176,192;
changeimgvis 221,5;
this.maxpages = int(this.wpnnum/16);
if (this.wpncursory>=4 && this.wpnpage<this.maxpages) {
this.wpnpage++;
hide_cur_wpn();
this.wpncursory = 0;
}elseif (this.wpncursory>=4 && !this.wpnpage<this.maxpages) {
this.wpncursory = 3;
}
if (this.wpncursory<0&&this.wpnpage>0) {
this.wpnpage--;
hide_cur_wpn();
this.wpncursory = 3;
}elseif (this.wpncursory<0 && !this.wpnpage>0) {
this.wpncursory = 0;
}
find_wpns();
this.start_wpn = ((this.wpnpage)*16);
this.maxshown = this.wpnnum-((this.wpnpage)*16);
if (this.maxshown>16) {
this.maxshown = 16;
}
for (i=this.start_wpn;i<this.start_wpn+this.maxshown;i ++) {
showimg 222+i,#W(this.weapons[i]),((screenwidth/2)-(176/2)+16)+((i%16)%4)*32,((screenheight/2)-(192/2)+16)+(int((i%16)/4))*32;
changeimgpart 222+i,0,0,32,32;
changeimgvis 222+i,7;
}
showimg 500,it_#s(client.skin).gif,((screenwidth/2)-(176/2)+16)+(this.wpncursorx)*32,((screenheight/2)-(192/2)+16)+(this.wpncursory)*32;
changeimgpart 500,0,80,32,32;
changeimgvis 500,8;
if (this.wpnnum>16 && this.start_wpn>=0) {
showimg 501,it_#s(client.skin).gif,(screenwidth/2)-(176/2)+144,(screenheight/2)-(192/2)+128;
changeimgpart 501,32,48,16,16;
changeimgvis 501,7;
}
if (this.wpnnum>16 && this.start_wpn>0) {
showimg 502,it_#s(client.skin).gif,(screenwidth/2)-(176/2)+144,(screenheight/2)-(192/2)+16;
changeimgpart 502,32,32,16,16;
changeimgvis 502,7;
}
if (this.wpnpage==this.maxpages) {
hideimg 501;
}
if (this.start_wpn==0) {
hideimg 502;
}
//Show Current Weapon Name
if ((this.wpncursory*4)+(this.wpncursorx)+(this.wpnpa ge)*16<this.wpnnum) {
showimg 503,@Tempus Sans ITC@c@Weapon: #e(0,15,#w(this.wpn)),(screenwidth/2)-(176/2)+86,(screenheight/2)-(192/2)+154;
changeimgvis 503,9;
changeimgzoom 503,0.7;
}else{
showimg 503,@Tempus Sans ITC@c@Weapon: None,(screenwidth/2)-(176/2)+86,(screenheight/2)-(192/2)+154;
changeimgvis 503,9;
changeimgzoom 503,0.7;
}
}
function wpnmenu_keys() {
if (keydown(0)) {
if (this.keys[0]==0 || this.keys[0]>=4) {
if (this.wpncursory==0 && this.wpnpage==0) {
return;
}else
this.wpncursory--;
}
this.keys[0]++;
}else
this.keys[0] = 0;
if (keydown(2)) {
if (this.keys[2]==0 || this.keys[2]>=4) {
if (this.wpncursory==3 && this.wpnpage==this.maxpages) {
return;
}else
this.wpncursory++;
}
this.keys[2]++;
}else
this.keys[2] = 0;
if (keydown(1)) {
if (this.keys[1]==0 || this.keys[1]>=4) {
this.wpncursorx = (this.wpncursorx-1)%4;
}
this.keys[1]++;
}else
this.keys[1] = 0;
if (keydown(3)) {
if (this.keys[3]==0 || this.keys[3]>=4) {
this.wpncursorx = (this.wpncursorx+1)%4;
}
this.keys[3]++;
}else
this.keys[3] = 0;
if (keydown(5)) {
if (this.keys[5]==0) {
if ((this.wpncursory*4)+(this.wpncursorx)+(this.wpnpa ge)*16<this.wpnnum) {
hide_cmpl_wpn();
this.selectedweapon = ((this.wpncursory*4)+(this.wpncursorx)+(this.wpnpa ge)*16);
selectedweapon = this.weapons[this.selectedweapon];
hide_all_submenu();
this.mainmenuactive = 1;
this.wpnmenuactive = 0;
}
}
this.keys[5]++;
}else
this.keys[5] = 0;
if (keydown(6)) {
if (this.keys[6]==0 || this.keys[6]>=4) {
callweapon this.wpn,cust_action_rmvwpn;
hide_cur_wpn();
sleep .05;
}
this.keys[6]++;
}else
this.keys[6] = 0;
this.wpn = this.weapons[(this.wpncursory*4)+(this.wpncursorx)+(this.wpnpag e)*16];
this.wpnpos = (this.wpncursory*4)+(this.wpncursorx)+(this.wpnpag e)*16;
}
function hide_cur_wpn() {
for (i=this.start_wpn;i<this.start_wpn+this.maxshown;i ++)
hideimg 222+i;
}
function hide_cmpl_wpn() {
hide_cur_wpn();
for (i=0;i<4;i++)
hideimg 500+i;
hideimg 221;
}
Might not be the nicest script but it works pretty good.