Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Closed Thread
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-30-2002, 10:35 AM
SSRobgeta SSRobgeta is offline
Ebil Cloud = l337 *kupo*
SSRobgeta's Avatar
Join Date: Aug 2001
Location: Monroeville, PA
Posts: 1,084
SSRobgeta is on a distinguished road
Send a message via AIM to SSRobgeta
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;

__________________
Rob Getashu
Anyone can show you the way, but the real adventure is finding it yourself..
  #2  
Old 03-30-2002, 11:00 AM
screen_name screen_name is offline
is watching you
Join Date: Mar 2002
Location: The 3rd Dimension
Posts: 2,160
screen_name is on a distinguished road
Send a message via AIM to screen_name Send a message via MSN to screen_name
you shouldn't take on this task if you dont know how
__________________
[signature]insert here[/signature]
  #3  
Old 03-30-2002, 11:06 AM
SSRobgeta SSRobgeta is offline
Ebil Cloud = l337 *kupo*
SSRobgeta's Avatar
Join Date: Aug 2001
Location: Monroeville, PA
Posts: 1,084
SSRobgeta is on a distinguished road
Send a message via AIM to SSRobgeta
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
__________________
Rob Getashu
Anyone can show you the way, but the real adventure is finding it yourself..
  #4  
Old 03-30-2002, 12:11 PM
dragoonvenganc dragoonvenganc is offline
Registered User
Join Date: Jul 2001
Location: USA
Posts: 331
dragoonvenganc is on a distinguished road
Send a message via ICQ to dragoonvenganc Send a message via AIM to dragoonvenganc
rob thats horrible
__________________
Dragoon Vengance
Owner of Pangea Relics of Time
P2P Rp server
For info or job
Email: [email protected]
aim: dragoonvengnc
  #5  
Old 03-30-2002, 12:12 PM
Cybnext_Design Cybnext_Design is offline
Registered User
Join Date: Jun 2001
Posts: 244
Cybnext_Design is on a distinguished road
Send a message via AIM to Cybnext_Design
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.
__________________
Graal2001 NPC Maker
Frolic Owner
Aim: C Y B N E X T
  #6  
Old 03-30-2002, 12:22 PM
SSRobgeta SSRobgeta is offline
Ebil Cloud = l337 *kupo*
SSRobgeta's Avatar
Join Date: Aug 2001
Location: Monroeville, PA
Posts: 1,084
SSRobgeta is on a distinguished road
Send a message via AIM to SSRobgeta
Quote:
Originally posted by dragoonvenganc
rob thats horrible
thx! lol
__________________
Rob Getashu
Anyone can show you the way, but the real adventure is finding it yourself..
  #7  
Old 03-30-2002, 12:25 PM
dragoonvenganc dragoonvenganc is offline
Registered User
Join Date: Jul 2001
Location: USA
Posts: 331
dragoonvenganc is on a distinguished road
Send a message via ICQ to dragoonvenganc Send a message via AIM to dragoonvenganc
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
__________________
Dragoon Vengance
Owner of Pangea Relics of Time
P2P Rp server
For info or job
Email: [email protected]
aim: dragoonvengnc
  #8  
Old 03-30-2002, 12:26 PM
SSRobgeta SSRobgeta is offline
Ebil Cloud = l337 *kupo*
SSRobgeta's Avatar
Join Date: Aug 2001
Location: Monroeville, PA
Posts: 1,084
SSRobgeta is on a distinguished road
Send a message via AIM to SSRobgeta
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
__________________
Rob Getashu
Anyone can show you the way, but the real adventure is finding it yourself..
  #9  
Old 03-30-2002, 04:48 PM
SSRobgeta SSRobgeta is offline
Ebil Cloud = l337 *kupo*
SSRobgeta's Avatar
Join Date: Aug 2001
Location: Monroeville, PA
Posts: 1,084
SSRobgeta is on a distinguished road
Send a message via AIM to SSRobgeta
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!
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;

__________________
Rob Getashu
Anyone can show you the way, but the real adventure is finding it yourself..
  #10  
Old 03-30-2002, 05:10 PM
neomaximus2k neomaximus2k is offline
Registered User
Join Date: Feb 2002
Location: UK
Posts: 324
neomaximus2k is on a distinguished road
Send a message via ICQ to neomaximus2k
I got my magic book code somewhere i'll post ya that, it should help

Bah i cant locate it
__________________
Beware of thy Inner self
NPC Code:

_.,.__
((o\\o\))
.-. ` \\``
__( )___.o"".,___
=== ~~~~~~~~
==
= Neo

  #11  
Old 03-30-2002, 05:11 PM
SSRobgeta SSRobgeta is offline
Ebil Cloud = l337 *kupo*
SSRobgeta's Avatar
Join Date: Aug 2001
Location: Monroeville, PA
Posts: 1,084
SSRobgeta is on a distinguished road
Send a message via AIM to SSRobgeta
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
__________________
Rob Getashu
Anyone can show you the way, but the real adventure is finding it yourself..
  #12  
Old 03-30-2002, 10:17 PM
Dustey Dustey is offline
Registered User
Join Date: Nov 2001
Location: Do You Think I Know?
Posts: 193
Dustey is on a distinguished road
Send a message via AIM to Dustey
you should talk to me rob
__________________
And Yes I work For.... Renegade
  #13  
Old 03-31-2002, 12:47 AM
konidias konidias is offline
Old Bee
konidias's Avatar
Join Date: Jul 2001
Location: Orlando, FL
Posts: 7,222
konidias will become famous soon enough
Send a message via AIM to konidias
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.
__________________

Put this image in your sig if you support Bomy Island! (g2k1 revision)
play bomberman while you wait!


Closed Thread


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 11:12 PM.


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