Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   New Menu? (https://forums.graalonline.com/forums/showthread.php?t=26614)

SSRobgeta 03-30-2002 10:35 AM

New Menu?
 
Ok.. I am completely lost. This should at least make you freeze. I am trying to make a new menu in the form of the trading item without you dropping the items. I also have no clue on how it will change the GFX and you select it. Please help :( .
NPC Code:
// NPC made by Rob Getashu
if (playerenters) {
toweapons -System NPC;
timeout=.05;
}
if (isweapon){
disableselectweapons;
}
if (keydown(8)&&!barup&&timeout){
set barup;
timeout=0.05;
}
if (barup&&timeout) {
setani idle,;
disabledefmovement;
timeout=0.05;
}
if (timeout) {
showimg 1,#W,playerx+1,playery-3.5;
}
if (keydown(1)&&timeout) {
play2 nextpage.wav,playerx,playery,1;
timeout=0.05;
}

if (keydown(3)&&timeout) {
play2 nextpage.wav,playerx,playery,1;
timeout=0.05;
}

if (keydown(8)&&barup&&timeout) {
unset barup;
enabledefmovement;
hideimg 1;
timeout=0.05;
}
timeout=0.05;


screen_name 03-30-2002 11:00 AM

you shouldn't take on this task if you dont know how

SSRobgeta 03-30-2002 11:06 AM

Quote:

Originally posted by screen_name
you shouldn't take on this task if you dont know how
Well in A way I do. I just sorta need to know how I would make it so you could change your weapons still. Also why it isn't working so far x.x

dragoonvenganc 03-30-2002 12:11 PM

rob thats horrible

Cybnext_Design 03-30-2002 12:12 PM

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.

SSRobgeta 03-30-2002 12:22 PM

Quote:

Originally posted by dragoonvenganc
rob thats horrible
thx! lol

dragoonvenganc 03-30-2002 12:25 PM

i changed it here

// NPC made by Dragoon Vengance
if (created) {toweapons -System NPC; timeout=.05;}

if (isweapon){ disableselectweapons; }

if (timeout){
timeout=0.05;

if (keydown(0)){set barup;setani idle,;disabledefmovement;}

if (keydown(2)){enabledefmovement;hideimg 1;unset barup}

if (barup){
if (keydown(1)) { play2 nextpage.wav,playerx,playery,1;}
if (keydown(3)) { play2 nextpage.wav,playerx,playery,1;}
showimg 1,#W,playerx+1,playery-3.5;}
}

i substituted keydown 8 for 0 to use and 2 to exit and fixed the horrific scripting i know im the not best but there

SSRobgeta 03-30-2002 12:26 PM

Quote:

Originally posted by Cybnext_Design


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.

lol is there anyway you could explain or fit into my script?! I mean that script (mine) is one of my worse things ever lol :D

SSRobgeta 03-30-2002 04:48 PM

ok ok! My script is turning out better than I thought x.x. Now I have a problem when it urna off the icon still follows u (I used hideimg)? Also how do I make it select weapons? Look!:D
NPC Code:
// NPC made by Rob Getashu
if (playerenters) {
toweapons -System NPC;
timeout=.1;
}
if (isweapon){
disableselectweapons;
}
if (timeout && isweapon) {
disableselectweapons;
if (this.active==0) {
hideimg 1;
}elseif (this.active==1) {
disabledefmovement;
if (this.mainmenu==1) {
}
}
}
q_Key();
timeout = 0.1;
function q_Key() {
if (keydown(9)) {
if (this.keys[9]==0) {
this.active = (this.active+1)%2;
if (this.active==0) {
enabledefmovement;
hideimg 1;
this.mainmenu = 0;
}else{
this.mainmenu = 1;
showimg 1,#W,playerx+.5,playery-2;
}
}}
}
if (keydown(1)&&strequals(#W,wbowi1.png)&&timeout) {
showimg 1,wbomb1.png,playerx+.5,playery-2;
play2 nextpage.wav,playerx,playery,1;
timeout=0.1;
}elseif (keydown(1)&&!strequals(#W,wbowi1.png)&&timeout) {
showimg 1,wbowi1.png,playerx+.5,playery-2;
}
if (keydown(3)&&strequals(#W,wbowi1.png)&&timeout) {
showimg 1,wbomb1.png,playerx+.5,playery-2;
play2 nextpage.wav,playerx,playery,1;
timeout=0.1;
}elseif (keydown(1)&&!strequals(#W,wbowi1.png)&&timeout) {
showimg 1,wbowi1.png,playerx+.5,playery-2;
}
if (keydown(1)&&strequals(#W,wbomb1.png)&&timeout) {
showimg 1,wbowi1.png,playerx+.5,playery-2;
play2 nextpage.wav,playerx,playery,1;
timeout=0.1;
}elseif (keydown(1)&&!strequals(#W,wbomb1.png)&&timeout) {
showimg 1,wbowi1.png,playerx+.5,playery-2;
}
if (keydown(3)&&strequals(#W,wbomb1.png)&&timeout) {
showimg 1,wbowi1.png,playerx+.5,playery-2;
play2 nextpage.wav,playerx,playery,1;
timeout=0.1;
}elseif (keydown(1)&&!strequals(#W,wbomb1.png)&&timeout) {
showimg 1,wbowi1.png,playerx+.5,playery-2;
}
if (keydown(5)&&strequals(#W,wbomb1.png)&&timeout) {
callweapon bomb,weaponfired;
enabledefmovement;
hideimg 1;
timeout=0.1;
}
if (keydown(5)&&strequals(#W,wbowi1.png)&&timeout) {
callweapon bow,weaponfired;
enabledefmovement;
hideimg 1;
timeout=0.1;
}
if (keydown(8)&&timeout) {
enabledefmovement;
hideimg 1;
timeout=0.1;
}
timeout=0.1;


neomaximus2k 03-30-2002 05:10 PM

I got my magic book code somewhere i'll post ya that, it should help

Bah i cant locate it

SSRobgeta 03-30-2002 05:11 PM

Quote:

Originally posted by neomaximus2k
I got my magic book code somewhere i'll post ya that, it should help

Bah i cant locate it

:confused:

Dustey 03-30-2002 10:17 PM

you should talk to me rob:(

konidias 03-31-2002 12:47 AM

Bleh, if you have to have everyone script things for you, then you need to learn more about scripting. :(

Plus there is a rule here about asking for help and then posting your entire code for someone to fix.. if you can't isolate the problem yourself, then you need to practice more.


All times are GMT +2. The time now is 09:04 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.