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 10-21-2001, 10:13 PM
freddyfox freddyfox is offline
Banned
freddyfox's Avatar
Join Date: Mar 2001
Posts: 6,705
freddyfox is on a distinguished road
Help me with script, etc.

Here's my basic menu item buying script. And yes, I DO realize how long it is:

NPC Code:

if(playertouchsme){
disabledefmovement;
this.buymode = 1;
this.startbuy = 1;
timeout = 0.05;
}
if(timeout&&this.buymode=1){
if(this.buymode = 1&&this.startbuy = 1){
playersprite = 0;
showimg 200,standardsword.gif,30,40;
showimg 201,standardsword.gif,30,45;
showimg 202,standardsword.gif,30,50;
this.select = 1;
this.startbuy = 0;
}
if(keydown(0)){
this.select --;
}
if(keydown(2)){
this.select ++;
}
if(this.select = 1){
message Short Bronze Blade / 200 GP;
showimg 203,cursor.gif,35,35+5*this.select;
sleep 0.1;
}
if(this.select = 2){
message Long Bronze Blade / 700 GP;
showimg 203,cursor.gif,35,35+5*this.select;
sleep 0.1;
}
if(this.select = 3){
message Bronze Longsword / 3549 GP ;
showimg 203,cursor.gif,35,35+5*this.select;
sleep 0.1;
}
if(this.select = 4){
this.select --;
}
timeout = 0.05;
}
if(this.select = -1){
this.select ++;
}

//--BUYING--

if(keydown(4)&&this.select=1){
if(playerrupees >= 200){
play success.wav;
message Thank you!;
playerrupees -= 200;
setsword broadgoldsword.gif,1;
timeout = 0.5;
}
}
if(keydown(4)&&this.select=2){
if(playerrupees >= 700){
play success.wav;
message Thank you!;
playerrupees -= 700;
setsword broadgoldsword.gif,2;
timeout = 0.5;
}
}
if(keydown(4)&&this.select=3){
if(playerrupees >= 3549){
play success.wav;
message Thank you!;
playerrupees -= 3549;
setsword broadgoldsword.gif,3;
timeout = 0.5;
}
}

//---Not Enough Rupees---

if(keydown(4)&&this.select=1){
if(playerrupees <= 199){
play error.wav;
message Not enough money!;
timeout = 0.5;
}
}
if(keydown(4)&&this.select=2){
if(playerrupees <= 699){
play error.wav;
message Not enough money!;
timeout = 0.5;
}
}
if(keydown(4)&&this.select=3){
if(playerrupees <= 3548){
play error.wav;
message Not enough money!;
timeout = 0.5;
}
}
if(keydown(5)&&this.buymode=1){
message ;
this.buymode = 0
enabledefmovement;
hideimg 200;
hideimg 201;
hideimg 202;
hideimg 203;
hideimg 204;
}
if(this.buymode=0){
enabledefmovement;
}




Okay, looks fine and stuff. Only problem is, if I have two merchants with this script in the same level, the script malfunctions and ceases to freeze the player.

How can I remedy this?
Reply With Quote
  #2  
Old 10-21-2001, 11:42 PM
Xaviar Xaviar is offline
Registered User
Join Date: Aug 2001
Location: Fairyland
Posts: 463
Xaviar is on a distinguished road
Send a message via ICQ to Xaviar Send a message via AIM to Xaviar
Re: Help me with script, etc.

Quote:
Originally posted by freddyfox

if(this.buymode=0){
enabledefmovement;
}
Didn't really look that hard, but if I'm not mistaken, it's this sucker thats doing it.
__________________
One by one, the penguins steal my sanity.

*cookie for Xaviar* --Originally posted by Tyhm

--Xaviar

A m e r i c a
Reply With Quote
  #3  
Old 10-21-2001, 11:46 PM
Hulk Hogan Hulk Hogan is offline
Legendary Red Fish
Hulk Hogan's Avatar
Join Date: Mar 2001
Location: Western PA
Posts: 2,384
Hulk Hogan is on a distinguished road
Send a message via ICQ to Hulk Hogan Send a message via AIM to Hulk Hogan
maybe add a

if (playerchats && stequals(#c,Buy from merchat 1)) {
set buyingfrommerchat1;
}

and then at the begining of your script add this to the
"if (playertcouchsme)"

if (playertouchsme && buyingfrommerchat1) {

and then just add an "unset buyingfrommerchat1" at the end?

and then change it for each merchat or npc to buyingfrommerchat2 or whatever flag you want to use?
__________________

The infamous red fish is back.


-aim- |
Andrew5656
-email- | [email protected]
-quote- | "You dont need a weatherman to know which way the wind blows."
"Its funny. The end of time has just begun."-Bob Dylan
Reply With Quote
  #4  
Old 10-21-2001, 11:50 PM
Jerom Jerom is offline
Banned
Jerom's Avatar
Join Date: Mar 2001
Location: In a Trash Can
Posts: 3,708
Jerom is on a distinguished road
Send a message via AIM to Jerom
Quote:
Originally posted by Hulk Hogan
maybe add a

if (playerchats && stequals(#c,Buy from merchat 1)) {
set buyingfrommerchat1;
}

and then at the begining of your script add this to the
"if (playertcouchsme)"

if (playertouchsme && buyingfrommerchat1) {

and then just add an "unset buyingfrommerchat1" at the end?

and then change it for each merchat or npc to buyingfrommerchat2 or whatever flag you want to use?
Would require the merchants to wear numbers above their heads as well as giving them IDs, and it would be best to use tokenize with that.
Reply With Quote
  #5  
Old 10-21-2001, 11:53 PM
Hulk Hogan Hulk Hogan is offline
Legendary Red Fish
Hulk Hogan's Avatar
Join Date: Mar 2001
Location: Western PA
Posts: 2,384
Hulk Hogan is on a distinguished road
Send a message via ICQ to Hulk Hogan Send a message via AIM to Hulk Hogan
Quote:
Originally posted by Jerom

Would require the merchants to wear numbers above their heads as well as giving them IDs, and it would be best to use tokenize with that.
i just starting to learn to script
i know very little.....


maybe just add a name to the merchants then?
and a sign that says you have say the merchants name to buy from them??

i dont know about tokenize yet so maybe Jerom is right? I wouldn't know though
__________________

The infamous red fish is back.


-aim- |
Andrew5656
-email- | [email protected]
-quote- | "You dont need a weatherman to know which way the wind blows."
"Its funny. The end of time has just begun."-Bob Dylan
Reply With Quote
  #6  
Old 10-21-2001, 11:55 PM
Jerom Jerom is offline
Banned
Jerom's Avatar
Join Date: Mar 2001
Location: In a Trash Can
Posts: 3,708
Jerom is on a distinguished road
Send a message via AIM to Jerom
Quote:
Originally posted by Hulk Hogan


i just starting to learn to script
i know very little.....


maybe just add a name to the merchants then?
and a sign that says you have say the merchants name to buy from them??

i dont know about tokenize yet so maybe Jerom is right? I wouldn't know though
I'm just trying to give a more flexible feel to the NPCs.
And I'm still learning how to script too(isawk).
Reply With Quote
  #7  
Old 10-21-2001, 11:58 PM
TDO2000 TDO2000 is offline
Registered User
TDO2000's Avatar
Join Date: Jul 2001
Location: Germany
Posts: 655
TDO2000 is on a distinguished road
I think Xavier is right:

if(keydown(5)&&this.buymode=1){
message ;
this.buymode = 0
enabledefmovement;
hideimg 200;
hideimg 201;
hideimg 202;
hideimg 203;
hideimg 204;
}
if(this.buymode=0){
enabledefmovement;
}

take the last one because if u buy from the second merchant this buymode of the first one is 0 so u can move but number 2 siabled so you collaps

u have used enabledefmovent before so it should be enough...
__________________
No Webhost at the moment
Reply With Quote
  #8  
Old 10-22-2001, 01:46 AM
Xaviar Xaviar is offline
Registered User
Join Date: Aug 2001
Location: Fairyland
Posts: 463
Xaviar is on a distinguished road
Send a message via ICQ to Xaviar Send a message via AIM to Xaviar
Quote:
Originally posted by TDO2000
I think Xavier is right:

if(keydown(5)&&this.buymode=1){
message ;
this.buymode = 0
enabledefmovement;
hideimg 200;
hideimg 201;
hideimg 202;
hideimg 203;
hideimg 204;
}
if(this.buymode=0){
enabledefmovement;
}

take the last one because if u buy from the second merchant this buymode of the first one is 0 so u can move but number 2 siabled so you collaps

u have used enabledefmovent before so it should be enough...
First of all, thanks for agreeing with me, but its Xaviar.
Second of all, I don't know if I was the only person that had trouble following the wording and bad spelling of that, so here's my interpretation(sp?):
Delete the if (this.buymode==0) {enabledefmovement;}..You don't need it
__________________
One by one, the penguins steal my sanity.

*cookie for Xaviar* --Originally posted by Tyhm

--Xaviar

A m e r i c a
Reply With Quote
  #9  
Old 10-22-2001, 02:03 AM
TDO2000 TDO2000 is offline
Registered User
TDO2000's Avatar
Join Date: Jul 2001
Location: Germany
Posts: 655
TDO2000 is on a distinguished road
Hmmm to many thoughts (my english teacher has the same problems)
__________________
No Webhost at the moment
Reply With Quote
  #10  
Old 10-22-2001, 04:22 AM
freddyfox freddyfox is offline
Banned
freddyfox's Avatar
Join Date: Mar 2001
Posts: 6,705
freddyfox is on a distinguished road
Quote:
Originally posted by TDO2000
u have used enabledefmovent before so it should be enough...
It works, but now for some reason, the enabledefmovement doesn't go off and the player can't move, even when he's pressed the S key.
Reply With Quote
  #11  
Old 10-22-2001, 05:04 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
Amazing
__________________
Rob Getashu
Anyone can show you the way, but the real adventure is finding it yourself..
Reply With Quote
  #12  
Old 10-22-2001, 06:23 AM
Er1c Er1c is offline
Registered User
Er1c's Avatar
Join Date: Mar 2001
Location: Chicago, IL
Posts: 791
Er1c is on a distinguished road
dont use disable/enable movement in that script, instead just put a freezeplayer timeoutsecs; in the timeout loop, with timeoutsecs = to the length of the timeout

and make sure that when the player is not in the menu mode the timeout is not looping
__________________
Eric Kraft
Reply With Quote
  #13  
Old 10-22-2001, 08:39 AM
royce royce is offline
Banned
royce's Avatar
Join Date: Sep 2001
Location: Yakitinzen, China
Posts: 2,271
royce is on a distinguished road
Send a message via AIM to royce
name the first guy 'fingerme joe' and the second plain old 'bob mackey'
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 05:20 PM.


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