Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-28-2002, 05:14 AM
relenakat relenakat is offline
Registered User
Join Date: Feb 2002
Posts: 36
relenakat is on a distinguished road
Shop say2 confusion

Grrr I figured this error out once in another script but now I can't figure out why it won't show the second say2 and skips to the third one!!!:grrr:
NPC Code:

if(playertouchsme){
this.t = 0;
this.bombs = 0;
this.arrows = 0;
this.hearts = 0;
sleep .1;
say2 .;
}
if (keydown(3)&&playerendsreading&&this.t==1) {
this.bombs = this.bombs+5;
say2 >Bombs #v(this.bombs) #b
Arrows #v(this.arrows) #b
Hearts #v(this.hearts);
this.t=0;
}
if (keydown(2)&&playerendsreading){
if(this.t==0) {
say2 >Bombs #v(this.bombs) #b
Arrows #v(this.arrows) #b
Hearts #v(this.hearts);
this.t = 1;
}
if(this.t==1) {
say2 Bombs #v(this.bombs) #b
>Arrows #v(this.arrows) #b
Hearts #v(this.hearts);
this.t = 2;
}
if(this.t==2) {
say2 Bombs #v(this.bombs) #b
Arrows #v(this.arrows) #b
>Hearts #v(this.hearts);
this.t = 0;
}
}
if(keydown(5)&&playerendsreading){
say2 Have a nice day!;
this.t = 0;
}

Reply With Quote
  #2  
Old 02-28-2002, 07:50 AM
Phenom1K Phenom1K is offline
Registered User
Join Date: Dec 2001
Location: Somewhereoffthecoastof, Paradise
Posts: 138
Phenom1K is on a distinguished road
Send a message via AIM to Phenom1K Send a message via Yahoo to Phenom1K
Because it sets the other this. variable automatically.
__________________
The following is a message brought to you in part by JR

The procedding was a message brought to you in part by JR
Reply With Quote
  #3  
Old 02-28-2002, 07:54 AM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
Put a sleep right before setting the this.var
Reply With Quote
  #4  
Old 02-28-2002, 09:02 AM
relenakat relenakat is offline
Registered User
Join Date: Feb 2002
Posts: 36
relenakat is on a distinguished road
Thanks I think that might be the problem.
Reply With Quote
  #5  
Old 02-28-2002, 10:07 AM
relenakat relenakat is offline
Registered User
Join Date: Feb 2002
Posts: 36
relenakat is on a distinguished road
Ok...I did that but now it doesn't go down
NPC Code:

}
if(playertouchsme){
this.t = 0;
this.bombs = 0;
this.arrows = 0;
this.hearts = 0;
say2 A to cancel and S to buy;
}
if (keydown(3)&&playerendsreading&&this.t==0) {
this.bombs = this.bombs+5;
say2 >Bombs #v(this.bombs) #b
Arrows #v(this.arrows) #b
Hearts #v(this.hearts);
}
if (keydown(2)&&playerendsreading&&this.t==0){
say2 >Bombs #v(this.bombs) #b
Arrows #v(this.arrows) #b
Hearts #v(this.hearts);
sleep .5;
this.t = 1;
}
if(keydown(2)&&playerendsreading&&this.t==1) {
say2 Bombs #v(this.bombs) #b
>Arrows #v(this.arrows) #b
Hearts #v(this.hearts);
sleep .5;
this.t = 2;
}
if(keydown(2)&&playerendsreading&&this.t==2) {
say2 Bombs #v(this.bombs) #b
Arrows #v(this.arrows) #b
>Hearts #v(this.hearts);
sleep .5;
this.t = 0;
}
if(keydown(5)&&playerendsreading){
say2 Have a nice day!;
this.t = 0;
}

__________________
Quote:
Boredem is like a headache and/or yawn, they are very contagious!
Website deleted x.o If I really need one again, I'll buy it. Thank you very much... and yes, I use x.o o.x x.x o.o and X.o Freqently. Deal with it >:O
Reply With Quote
  #6  
Old 02-28-2002, 10:32 AM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
Say2 is a really bad way of doing that, I just made this a few minuets ago, learn from this, add the buying stuff yourself
*thinks hes going to get flamed for posting this =/*
// NPC made by Jagen
if (playertouchsme) {
this.select=1;
this.bombs=0;
this.hearts=0;
this.arrows=0;
disabledefmovement;
timeout=.05;
}
if (timeout&&this.select==1)
{
showimg 500,@-----> Hearts: #v(this.hearts),screenwidth-200,120;
showimg 501,@Bombs: #v(this.bombs),screenwidth-200,150;
showimg 502,@Arrows: #v(this.arrows),screenwidth-200,180;
changeimgvis 500,4;
changeimgvis 501,4;
changeimgvis 502,4;
timeout=.05;
}
if (timeout&&this.select==2)
{
showimg 500,@Hearts: #v(this.hearts),screenwidth-200,120;
showimg 501,@-----> Bombs: #v(this.bombs),screenwidth-200,150;
showimg 502,@Arrows: #v(this.arrows),screenwidth-200,180;
changeimgvis 500,4;
changeimgvis 501,4;
changeimgvis 502,4;
timeout=.05;
}
if (timeout&&this.select==3)
{
showimg 500,@Hearts: #v(this.hearts),screenwidth-200,120;
showimg 501,@Bombs: #v(this.bombs),screenwidth-200,150;
showimg 502,@-----> Arrows: #v(this.arrows),screenwidth-200,180;
changeimgvis 500,4;
changeimgvis 501,4;
changeimgvis 502,4;
timeout=.05;
}

if (timeout&&this.select==4)
{
this.select=1;
timeout=.05;
}
if (timeout&&this.select==0)
{
this.select=3;
timeout=.05;}
if (timeout&&keydown(0))
{sleep .5;
this.select-=1;
timeout=.05;
}
if (timeout&&keydown(2))
{sleep .5;
this.select+=1;
timeout=.05;
}
if (timeout&&keydown(3)&&this.select==1)
{sleep .5;
this.hearts++;
timeout=.05;
}

if (timeout&&keydown(3)&&this.select==2)
{sleep .5;
this.bombs++;
timeout=.05;
}
if (timeout&&keydown(3)&&this.select==3)
{sleep .5;
this.arrows++;
timeout=.05;
}
if (timeout&&keydown(1)&&this.select==1)
{sleep .5;
this.hearts--;
timeout=.05;
}

if (timeout&&keydown(1)&&this.select==2)
{sleep .5;
this.bombs--;
timeout=.05;
}
if (timeout&&keydown(1)&&this.select==3)
{sleep .5;
this.arrows--;
timeout=.05;
}


if (timeout)
{timeout=.05;}
Reply With Quote
  #7  
Old 02-28-2002, 12:23 PM
relenakat relenakat is offline
Registered User
Join Date: Feb 2002
Posts: 36
relenakat is on a distinguished road
Thanks the thing is why I use say2 is because I'm more used to it no offense
__________________
Quote:
Boredem is like a headache and/or yawn, they are very contagious!
Website deleted x.o If I really need one again, I'll buy it. Thank you very much... and yes, I use x.o o.x x.x o.o and X.o Freqently. Deal with it >:O
Reply With Quote
  #8  
Old 02-28-2002, 02:37 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
Quote:
Originally posted by relenakat
Thanks the thing is why I use say2 is because I'm more used to it no offense
I agree Say2 is only really good for NPC's talking on a level or within a weapon when you fire it, the erst i would use showimg for as well just because i am aukward muwhahhaha
__________________
Beware of thy Inner self
NPC Code:

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

Reply With Quote
  #9  
Old 02-28-2002, 05:42 PM
TDO2000 TDO2000 is offline
Registered User
TDO2000's Avatar
Join Date: Jul 2001
Location: Germany
Posts: 655
TDO2000 is on a distinguished road
NPC Code:

if (playerenters || created) {
timereverywhere;
tokenize "Number1""Number2""Number3""Number4""Number5";
this.maxposes = tokenscount;
this.active=0;
this.pos=0;
this.oldkey=(-1);
}
if (playertouchsme) {
setani idle,;
this.active=1;
timeout=.05;
}
if (timeout) {
if (this.active==1) {
freezeplayer .05;
draw();
cursor();
timeout=.05;
}
else hideimgs();
}

function draw() {
for (i=0;i<this.maxposes;i++) {
showimg i,@#t(i),screenwidth/2-100,screenheight/2-(this.maxposes*15)+(i*15);
changeimgvis i,4;
if (this.pos==i) changeimgcolors i,1,0,0,0;
else changeimgcolors i,1,1,1,0;
}
}

function cursor() {
if (!keydown(this.oldkey)) this.oldkey=(-1);
for (i=0;i<4;i++) {
if(keydown(i) && i in {0,2} && !this.oldkey==i) {
if (i==0 && this.pos > 0) this.pos--;
if (i==2 && this.pos < this.maxposes-1) this.pos++;
this.oldkey=i;
}
}
if (keydown(4)) select();
if (keydown(5)) this.active=0;
}

function select() {
//Doing what the pos says
if (this.pos==0) setplayerprop #c,Number 1;
if (this.pos==1) setplayerprop #c,Number 2;
if (this.pos==2) setplayerprop #c,Number 3;
if (this.pos==3) setplayerprop #c,Number 4;
if (this.pos==4) setplayerprop #c,Number 5;
}

function hideimgs() {
for (i=0;i<this.maxposes;i++) hideimg i;
}



^-- should be easy to edit it ^_^
for new poses in the menu just add them in the tokenize-part
to do something with them just add it in the
if (this.pos==<number>) code;
part
__________________
No Webhost at the moment
Reply With Quote
Reply


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 03:01 AM.


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