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 06-16-2002, 11:20 PM
BLOOD_kane BLOOD_kane is offline
Registered User
Join Date: Jun 2002
Location: Stephenville, TX, USA
Posts: 190
BLOOD_kane is on a distinguished road
Send a message via AIM to BLOOD_kane
Angry Little scripting problem

Ok I have this NPC that asks you a riddle. Before you talk to him if you say the correct answer nothing happens (i got this down) after you speak with him if you answer anything else BUT the right answer he dissapears and a baddy appears. if you kill the baddy he will re-appear like nothing happened and you have to ask him again, if you answer correctly he drops a gold rupee, my problem is while you are still saying the answer if you touch him he drops more rupees, and everytime after that if you say the answer he drops rupees BUT says You already answered (which i made him say if you got the right answer) It involvs alot of flags and im gonna post what i have of the script here (its kinda unorganized and messy and unfinished but its what i have so far)
I need help to where if you answer right, you cannot do the riddle ever again.

if (playerenters) {set riddle1;}
if (riddle1&&playersays(an address)) {say2 ;}
if (playertouchsme) {say 4;set riddle2;}
if (riddle2&&playersays(an address)){lay goldrupee;say2 Haha! Right!;set hasrupee;}
if (playertouchsme&&hasrupee) {say2 You've already answered!;}
if (riddle2&&playerchats&&!hasrupee) {say2 Wrong!;shootball;hide;putnewcomp lizardon,20.5,49,baddylizardon.png,10;}
if (compusdied) {say2 Let's try again;show;set riddle1;}

cant figure it all out...
Reply With Quote
  #2  
Old 06-17-2002, 10:47 AM
BLOOD_kane BLOOD_kane is offline
Registered User
Join Date: Jun 2002
Location: Stephenville, TX, USA
Posts: 190
BLOOD_kane is on a distinguished road
Send a message via AIM to BLOOD_kane
please help, Tyhm obviously couldnt
__________________

I’ve been evicted, erase me from the face of the planet
Cause your world got my outlook damaged. My minds stuck inside a cycle of depression. The reflection Can you feel me?
Look in the mirror, tell me do you see clearly?
They have it shattered and cracked, it’s so crazy
My minds stuck inside a cycle of depression. The reflection
Reply With Quote
  #3  
Old 06-17-2002, 11:52 AM
nyghtGT nyghtGT is offline
Banned
nyghtGT's Avatar
Join Date: Jun 2001
Posts: 3,993
nyghtGT is on a distinguished road
Send a message via AIM to nyghtGT
Here is some usefull info:

Try using varaibles instead of so many flags...

Use 'strequals(#c,stuff)'...

Try learning how to format your scripts better...
Reply With Quote
  #4  
Old 06-17-2002, 08:45 PM
Projectshifter Projectshifter is offline
The David
Projectshifter's Avatar
Join Date: Apr 2002
Location: USA
Posts: 912
Projectshifter is an unknown quantity at this point
Send a message via ICQ to Projectshifter Send a message via AIM to Projectshifter Send a message via MSN to Projectshifter Send a message via Yahoo to Projectshifter
[code]
if (playerenters) {this.riddle=1;}
if (this.riddle==1&&playerchats&&strequals(#c,an address)) {say2 ;}
if (playertouchsme) {say 4; ;this.riddle=2;}
if (this.riddle==2&&playerchats&&strequals(#c,an address)){lay goldrupee;say2 Haha! Right!;this.riddle=3;;}
if (playertouchsme&&this.riddle==3) {say2 You've already answered!;}
if (this.riddle==2&&playerchats&&!strequals(#c,an address)) {say2 Wrong!;shootball;hide;putnewcomp lizardon,20.5,49,baddylizardon.png,10;}
if (compusdied) {say2 Let's try again;show;this.riddle=1;}

=D That should be of some help. But you have some problems. YOu have it if they say an address when it equals 1, then it doesn't really do anything, but then if it equals 2 and they say it they lay a rupee... I hope this helps
---Shifter
__________________
Who has time for life these days?
Reply With Quote
  #5  
Old 06-18-2002, 12:26 AM
BLOOD_kane BLOOD_kane is offline
Registered User
Join Date: Jun 2002
Location: Stephenville, TX, USA
Posts: 190
BLOOD_kane is on a distinguished road
Send a message via AIM to BLOOD_kane
Wow thanks! It all works except the part where he says "Youv'e already answered" I need to make it to where its a permanent fixture to where if you already answered then you cannot answer it again. Kina like chests with rupees in it you know? You can only get them once unless your account is reset
__________________

I’ve been evicted, erase me from the face of the planet
Cause your world got my outlook damaged. My minds stuck inside a cycle of depression. The reflection Can you feel me?
Look in the mirror, tell me do you see clearly?
They have it shattered and cracked, it’s so crazy
My minds stuck inside a cycle of depression. The reflection
Reply With Quote
  #6  
Old 06-18-2002, 01:53 AM
user13-xo user13-xo is offline
Registered User
Join Date: Nov 2001
Location: California
Posts: 297
user13-xo is on a distinguished road
Send a message via AIM to user13-xo
if (playerenters) this.riddle=1;
if (playerchats) {
if (this.riddle==1) {
if (strequals(#c,an address)) {
say2 ;
this.riddle=2;
}
}
if (this.riddle==2) {
if (!gotgold) {
if (strequals(#c,an address)) {
lay goldrupee;
set gotgold;
say2 Haha! Right!;
} else {
say2 Wrong!;
shootball;
hide;
putnewcomp lizardon,20.5,49,baddylizardon.png,10;
}
} else if(gotgold) {
say2 You've already answered!;
}
}
}
if (compusdied) {
say2 Let's try again;
show;
this.riddle=1;
}

This might help as well
Reply With Quote
  #7  
Old 06-18-2002, 02:28 AM
Dustey4Ever Dustey4Ever is offline
Registered User
Join Date: Apr 2002
Posts: 348
Dustey4Ever is on a distinguished road
Send a message via AIM to Dustey4Ever
in npc that you just want something temporary like what anwer your on, use variables, they work better most time, use flags only if you hae to go from one place to another and keep something stored
__________________
Dustey, Rob Getashu, Van?
Van- I use this acct because mine dun work.....
Rob- Same
Reply With Quote
  #8  
Old 06-18-2002, 06:33 AM
BLOOD_kane BLOOD_kane is offline
Registered User
Join Date: Jun 2002
Location: Stephenville, TX, USA
Posts: 190
BLOOD_kane is on a distinguished road
Send a message via AIM to BLOOD_kane
thanks i got it to work now!
__________________

I’ve been evicted, erase me from the face of the planet
Cause your world got my outlook damaged. My minds stuck inside a cycle of depression. The reflection Can you feel me?
Look in the mirror, tell me do you see clearly?
They have it shattered and cracked, it’s so crazy
My minds stuck inside a cycle of depression. The reflection
Reply With Quote
  #9  
Old 06-18-2002, 10:53 AM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam


Somebody please teach these savages to format thier code.

and use the code tags.
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #10  
Old 06-18-2002, 12:22 PM
user13-xo user13-xo is offline
Registered User
Join Date: Nov 2001
Location: California
Posts: 297
user13-xo is on a distinguished road
Send a message via AIM to user13-xo
i forgot the code tags what are they again
Reply With Quote
  #11  
Old 06-18-2002, 12:27 PM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
Quote:
Originally posted by user13-xo
i forgot the code tags what are they again


"{code}" "{/code}" replace { } with [ ]
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #12  
Old 06-18-2002, 04:02 PM
Dragona2002 Dragona2002 is offline
Registered User
Join Date: May 2002
Location: The Netherlands
Posts: 105
Dragona2002 is on a distinguished road
Send a message via AIM to Dragona2002 Send a message via Yahoo to Dragona2002
srry im at scool now but try to let it see correct i mean (it wont reconize ride1= .......
it has to need a value...)
__________________

Quote:
The Dark Nemesis begins.......
Reply With Quote
  #13  
Old 06-18-2002, 10:43 PM
BLOOD_kane BLOOD_kane is offline
Registered User
Join Date: Jun 2002
Location: Stephenville, TX, USA
Posts: 190
BLOOD_kane is on a distinguished road
Send a message via AIM to BLOOD_kane
another problem

Well Everything works perfect EXCEPT! If you say the answer "an address" even after youve answered the first time, he keeps dropping rupees! You have to keep on saying it but he will not say that ive already answered unless i (playertouchsme)

here is the code:

if (playerenters) {this.riddle=1;}
if (this.riddle==1&&playerchats&&strequals(#c,an address)) {say2 ;}
if (playertouchsme) {say 4;this.riddle=2;}
if (this.riddle==2&&playerchats&&strequals(#c,an address)){lay bluerupee;say2 Haha! Right!;set hasrupee;}
if (playertouchsme&&hasrupee) {say2 You've already answered!;}
if (this.riddle==2&&playerchats&&!strequals(#c,an address)) {say2 Wrong!;putexplosion 2.5,playerx+0.25,playery+1;
hide;putnewcomp lizardon,20.5,39,baddylizardon.png,10;}
if (compusdied) {say2 Let's try again;show;this.riddle=1;}

---------------------------------

if (playertouchsme&&hasrupee) {say2 You've already answered!;}

I need somthing in here to where if you say the right answer he wont drop any rupees anymore. I know it is simple probably but everything i try wont work.
__________________

I’ve been evicted, erase me from the face of the planet
Cause your world got my outlook damaged. My minds stuck inside a cycle of depression. The reflection Can you feel me?
Look in the mirror, tell me do you see clearly?
They have it shattered and cracked, it’s so crazy
My minds stuck inside a cycle of depression. The reflection
Reply With Quote
  #14  
Old 06-18-2002, 11:00 PM
GrowlZ1010 GrowlZ1010 is offline
defunct
Join Date: May 2002
Posts: 187
GrowlZ1010 is on a distinguished road
PLEASE, format your code! It makes it easier to read, easier to understand, and easier for other people to help out with. >.>

Now I'm not going to just hand you the solution, because that would be baaaaad (and would probably get the post deleted), so I'm going to teach you what the problem is. The problem is you're not checking for the hasrupee flag on the playerchats event. See?
NPC Code:
if (this.riddle==2&&playerchats&&strequals(#c,an address)){


Do you see "&&!hasrupee" in there anywhere? Because I sure don't.
Reply With Quote
  #15  
Old 06-18-2002, 11:28 PM
BLOOD_kane BLOOD_kane is offline
Registered User
Join Date: Jun 2002
Location: Stephenville, TX, USA
Posts: 190
BLOOD_kane is on a distinguished road
Send a message via AIM to BLOOD_kane
Quote:
Originally posted by GrowlZ1010
PLEASE, format your code! It makes it easier to read, easier to understand, and easier for other people to help out with. >.>

Now I'm not going to just hand you the solution, because that would be baaaaad (and would probably get the post deleted), so I'm going to teach you what the problem is. The problem is you're not checking for the hasrupee flag on the playerchats event. See?
NPC Code:
if (this.riddle==2&&playerchats&&strequals(#c,an address)){


Do you see "&&!hasrupee" in there anywhere? Because I sure don't.

well hell im still fairly new to scripting (actually i was fairly good but then i quit graal over a year and didnt do anything like scripting for that period) all I need to know is how to make it to where if you say the answer he wont give you anymore rupees.
__________________

I’ve been evicted, erase me from the face of the planet
Cause your world got my outlook damaged. My minds stuck inside a cycle of depression. The reflection Can you feel me?
Look in the mirror, tell me do you see clearly?
They have it shattered and cracked, it’s so crazy
My minds stuck inside a cycle of depression. The reflection
Reply With Quote
  #16  
Old 06-18-2002, 11:47 PM
BLOOD_kane BLOOD_kane is offline
Registered User
Join Date: Jun 2002
Location: Stephenville, TX, USA
Posts: 190
BLOOD_kane is on a distinguished road
Send a message via AIM to BLOOD_kane
Grrr now if you get it right then say somthing it says WRONG and puts the explosion only once after you get it right, then it resets to riddle==1 thus they can still get rupees.
__________________

I’ve been evicted, erase me from the face of the planet
Cause your world got my outlook damaged. My minds stuck inside a cycle of depression. The reflection Can you feel me?
Look in the mirror, tell me do you see clearly?
They have it shattered and cracked, it’s so crazy
My minds stuck inside a cycle of depression. The reflection
Reply With Quote
  #17  
Old 06-19-2002, 06:40 AM
Sparker3000 Sparker3000 is offline
Registered User
Join Date: Apr 2002
Location: Brazil
Posts: 160
Sparker3000 is on a distinguished road
Send a message via ICQ to Sparker3000 Send a message via AIM to Sparker3000
dont use playersays anymore
use playerchats&&strequals(#c,text)
Reply With Quote
  #18  
Old 06-19-2002, 07:41 AM
BLOOD_kane BLOOD_kane is offline
Registered User
Join Date: Jun 2002
Location: Stephenville, TX, USA
Posts: 190
BLOOD_kane is on a distinguished road
Send a message via AIM to BLOOD_kane
well now I got it to ALL WORKING but the only prob i still have is once you answered he wont give you anymore rupees BUT if you say anything (even a blank space) he will say WRONG and put the explosion on you...but only once, after that you can say anything and it wont happen and walk up to him and he will say you already answered. heres the script:


NPC Code:
if (playerenters) {this.riddle=1;}
if (this.riddle==1&&playerchats&&strequals(#c,an address)) {say2 ;}
if (playertouchsme) {say 4;this.riddle=2;}
if (this.riddle==2&&playerchats&&strequals(#c,an address)&&!hasrupee;){lay bluerupee;say2 Haha! Right!;set hasrupee;}
if (playertouchsme&&hasrupee) {say2 You've already answered!;}
if (this.riddle==2&&playerchats&&!strequals(#c,an address)) {say2 Wrong!;putexplosion 2.5,playerx+0.25,playery+1;this.riddle=1;}

__________________

I’ve been evicted, erase me from the face of the planet
Cause your world got my outlook damaged. My minds stuck inside a cycle of depression. The reflection Can you feel me?
Look in the mirror, tell me do you see clearly?
They have it shattered and cracked, it’s so crazy
My minds stuck inside a cycle of depression. The reflection
Reply With Quote
  #19  
Old 06-19-2002, 01:16 PM
user13-xo user13-xo is offline
Registered User
Join Date: Nov 2001
Location: California
Posts: 297
user13-xo is on a distinguished road
Send a message via AIM to user13-xo
Was there something wrong with my script?
Did you even look at it?
Reply With Quote
  #20  
Old 06-19-2002, 11:05 PM
BLOOD_kane BLOOD_kane is offline
Registered User
Join Date: Jun 2002
Location: Stephenville, TX, USA
Posts: 190
BLOOD_kane is on a distinguished road
Send a message via AIM to BLOOD_kane
he wont even talk on yours
__________________

I’ve been evicted, erase me from the face of the planet
Cause your world got my outlook damaged. My minds stuck inside a cycle of depression. The reflection Can you feel me?
Look in the mirror, tell me do you see clearly?
They have it shattered and cracked, it’s so crazy
My minds stuck inside a cycle of depression. The reflection
Reply With Quote
  #21  
Old 06-19-2002, 11:08 PM
BLOOD_kane BLOOD_kane is offline
Registered User
Join Date: Jun 2002
Location: Stephenville, TX, USA
Posts: 190
BLOOD_kane is on a distinguished road
Send a message via AIM to BLOOD_kane
Plus after you get the rupee he still lets you answer the quest again thus...infinite rupees.
__________________

I’ve been evicted, erase me from the face of the planet
Cause your world got my outlook damaged. My minds stuck inside a cycle of depression. The reflection Can you feel me?
Look in the mirror, tell me do you see clearly?
They have it shattered and cracked, it’s so crazy
My minds stuck inside a cycle of depression. The reflection
Reply With Quote
  #22  
Old 06-21-2002, 10:34 AM
BLOOD_kane BLOOD_kane is offline
Registered User
Join Date: Jun 2002
Location: Stephenville, TX, USA
Posts: 190
BLOOD_kane is on a distinguished road
Send a message via AIM to BLOOD_kane
please
__________________

I’ve been evicted, erase me from the face of the planet
Cause your world got my outlook damaged. My minds stuck inside a cycle of depression. The reflection Can you feel me?
Look in the mirror, tell me do you see clearly?
They have it shattered and cracked, it’s so crazy
My minds stuck inside a cycle of depression. The reflection
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 02:01 AM.


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