Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Bar Store Script (https://forums.graalonline.com/forums/showthread.php?t=16747)

SlayerOfDarkness 11-13-2001 04:57 AM

Bar Store Script
 
Hi I'm making a bar for my server. I made it so far except the part when the money goes in the chest. I'd greatly appreciate it if someone help me. Heres the system script of the bar:

// NPC made by heX (Owner)
if (playerenters) {

}
if (playertouchsme) {
say 0;
}
if (strequals(#g, Owner)&&(strequals(#c, Sell 1))) {
putnpc beer.gif,beer.txt,30,17;
}
if (strequals(#g, Owner)&&(strequals(#c, Sell 2))) {
putnpc beer.gif,beer.txt,30,21;
}
if (strequals(#g, Owner)&&(strequals(#c, Sell 3))) {
putnpc beer.gif,beer.txt,33,24;
}
if (strequals(#g, Owner)&&(strequals(#c, Sell 4))) {
putnpc beer.gif,beer.txt,41,24;
}
if (strequals(#g, Owner)&&(strequals(#c, Sell 5))) {
putnpc beer.gif,beer.txt,46,21;
}
if (strequals(#g, Owner)&&(strequals(#c, Sell 6))) {
putnpc beer.gif,beer.txt,46,17;
}
if (strequals(#g, GTManager)&&(strequals(#c, Sell 1))) {
putnpc beer.gif,beer.txt,30,17;
}
if (strequals(#g, GTManager)&&(strequals(#c, Sell 2))) {
putnpc beer.gif,beer.txt,30,21;
}
if (strequals(#g, GTManager)&&(strequals(#c, Sell 3))) {
putnpc beer.gif,beer.txt,33,24;
}
if (strequals(#g, GTManager)&&(strequals(#c, Sell 4))) {
putnpc beer.gif,beer.txt,41,24;
}
if (strequals(#g, GTManager)&&(strequals(#c, Sell 5))) {
putnpc beer.gif,beer.txt,46,21;
}
if (strequals(#g, GTManager)&&(strequals(#c, Sell 6))) {
putnpc beer.gif,beer.txt,46,17;
}
if (strequals(#g, GTStaff)&&(strequals(#c, Sell 1))) {
putnpc beer.gif,beer.txt,30,17;
}
if (strequals(#g, GTStaff)&&(strequals(#c, Sell 2))) {
putnpc beer.gif,beer.txt,30,21;
}
if (strequals(#g, GTStaff)&&(strequals(#c, Sell 3))) {
putnpc beer.gif,beer.txt,33,24;
}
if (strequals(#g, GTStaff)&&(strequals(#c, Sell 4))) {
putnpc beer.gif,beer.txt,41,24;
}
if (strequals(#g, GTStaff)&&(strequals(#c, Sell 5))) {
putnpc beer.gif,beer.txt,46,21;
}
if (strequals(#g, GTStaff)&&(strequals(#c, Sell 6))) {
putnpc beer.gif,beer.txt,46,17;
}

if (strequals(#g, Owner)&&(strequals(#c, Free Sell))) {
putnpc beer.gif,beerfree.txt,30,17;
putnpc beer.gif,beerfree.txt,30,21;
putnpc beer.gif,beerfree.txt,33,24;
putnpc beer.gif,beerfree.txt,41,24;
putnpc beer.gif,beerfree.txt,46,21;
putnpc beer.gif,beerfree.txt,46,17;
}
if (strequals(#g, Owner)&&(strequals(#c, Sell All))) {
putnpc beer.gif,beer.txt,30,17;
putnpc beer.gif,beer.txt,30,21;
putnpc beer.gif,beer.txt,33,24;
putnpc beer.gif,beer.txt,41,24;
putnpc beer.gif,beer.txt,46,21;
putnpc beer.gif,beer.txt,46,17;
}
if (strequals(#g, GTManager)&&(strequals(#c, Sell All))) {
putnpc beer.gif,beer.txt,30,17;
putnpc beer.gif,beer.txt,30,21;
putnpc beer.gif,beer.txt,33,24;
putnpc beer.gif,beer.txt,41,24;
putnpc beer.gif,beer.txt,46,21;
putnpc beer.gif,beer.txt,46,17;
}
if (strequals(#g, GTStaff)&&(strequals(#c, Sell All))) {
putnpc beer.gif,beer.txt,30,17;
putnpc beer.gif,beer.txt,30,21;
putnpc beer.gif,beer.txt,33,24;
putnpc beer.gif,beer.txt,41,24;
putnpc beer.gif,beer.txt,46,21;
putnpc beer.gif,beer.txt,46,17;
}
[B]
if (itemlayed) {
take greenrupee;take redrupee;take bluerupee;take goldrupee;
}
if(strequals(#g,Owner)&&strequals(#c,Take Donation)){playerrupees=playerrupees+rupees; rupees=0;}
if(strequals(#g,Owner)&&strequals(#c,See Donations)){message #v(rupees) Gralat; sleep2; message ;}

Im having a problem with the item layed part:

if (itemlayed) {
take greenrupee;take redrupee;take bluerupee;take goldrupee;
}

Here is the beer script (beer.txt):

if (playertouchsme&&(playerrupees>4))
{playerrupees-=5;
show;
setplayerprop #c, Ah! Fells good!;
lay2 bluerupee,0,0;
sleep .5;
putleaps 5,x+0.5,y+0;
hide;
playerhearts+=3;
}

Please someone I really need your help!
:confused:
Email it to me if you wish at [email protected]

Faheria_GP2 11-13-2001 05:22 AM

the event is "playerlaysitem" not "itemlayed"

Faheria_GP2 11-13-2001 05:23 AM

also, the putnpc has no "destroy" command (BAD! BAD! BAD!)

LiquidIce00 11-13-2001 05:25 AM

just do like on the chest
if (actionadd) {
rupees+=strtofloat(#p(0));
}
then on the beer.txt thing you want to put
if (playertouchsme ) {
... whatever here like heal the palyer blabla..
triggeraction xOfTheChest,yOfTheChest,add,CostOfBeer;
}

Faheria_GP2 11-13-2001 05:26 AM

hmm...wait, you might want to do it another way (since it's not the player that lays the item

if (playerenters) timeout=.05;
if (timeout) {
take greenrupee; take bluerupee; take redrupee; take goldrupee;
timeout=.05;
}

nyghtGT 11-13-2001 05:27 AM

that script is annoyingly long ....
use tokenizing or something ...

Mrmicro 11-13-2001 05:36 AM

Try this
 
Try doing this... Put a beer GFX at each spot where you want the beer to Appear. Add in there..

If (playerenters) hide;
if (strequals(#g, Owner)&&(strequals(#c, Sell 1))) {
show;
if (playertouchsme)
playerhearts+= 3;
hide;

And you can put these npcs in all the spots.

SlayerOfDarkness 11-13-2001 06:00 AM

? HELp!
 
I used liquids way cuz he knowz alot of thingz =)
but it didnt quite work maby i did something wrong
heres the system script:
// NPC made by heX
if (playerenters) {
x = 38;
y = 14;

}
if (playertouchsme) {
say 0;
}
if (strequals(#g, Owner)&&(strequals(#c, Sell 1))) {
putnpc beer.gif,beer.txt,30,17;
}
if (strequals(#g, Owner)&&(strequals(#c, Sell 2))) {
putnpc beer.gif,beer.txt,30,21;
}
if (strequals(#g, Owner)&&(strequals(#c, Sell 3))) {
putnpc beer.gif,beer.txt,33,24;
}
if (strequals(#g, Owner)&&(strequals(#c, Sell 4))) {
putnpc beer.gif,beer.txt,41,24;
}
if (strequals(#g, Owner)&&(strequals(#c, Sell 5))) {
putnpc beer.gif,beer.txt,46,21;
}
if (strequals(#g, Owner)&&(strequals(#c, Sell 6))) {
putnpc beer.gif,beer.txt,46,17;
}
if (strequals(#g, GTManager)&&(strequals(#c, Sell 1))) {
putnpc beer.gif,beer.txt,30,17;
}
if (strequals(#g, GTManager)&&(strequals(#c, Sell 2))) {
putnpc beer.gif,beer.txt,30,21;
}
if (strequals(#g, GTManager)&&(strequals(#c, Sell 3))) {
putnpc beer.gif,beer.txt,33,24;
}
if (strequals(#g, GTManager)&&(strequals(#c, Sell 4))) {
putnpc beer.gif,beer.txt,41,24;
}
if (strequals(#g, GTManager)&&(strequals(#c, Sell 5))) {
putnpc beer.gif,beer.txt,46,21;
}
if (strequals(#g, GTManager)&&(strequals(#c, Sell 6))) {
putnpc beer.gif,beer.txt,46,17;
}
if (strequals(#g, GTStaff)&&(strequals(#c, Sell 1))) {
putnpc beer.gif,beer.txt,30,17;
}
if (strequals(#g, GTStaff)&&(strequals(#c, Sell 2))) {
putnpc beer.gif,beer.txt,30,21;
}
if (strequals(#g, GTStaff)&&(strequals(#c, Sell 3))) {
putnpc beer.gif,beer.txt,33,24;
}
if (strequals(#g, GTStaff)&&(strequals(#c, Sell 4))) {
putnpc beer.gif,beer.txt,41,24;
}
if (strequals(#g, GTStaff)&&(strequals(#c, Sell 5))) {
putnpc beer.gif,beer.txt,46,21;
}
if (strequals(#g, GTStaff)&&(strequals(#c, Sell 6))) {
putnpc beer.gif,beer.txt,46,17;
}

if (strequals(#g, Owner)&&(strequals(#c, Free Sell))) {
putnpc beer.gif,beerfree.txt,30,17;
putnpc beer.gif,beerfree.txt,30,21;
putnpc beer.gif,beerfree.txt,33,24;
putnpc beer.gif,beerfree.txt,41,24;
putnpc beer.gif,beerfree.txt,46,21;
putnpc beer.gif,beerfree.txt,46,17;
}
if (strequals(#g, Owner)&&(strequals(#c, Sell All))) {
putnpc beer.gif,beer.txt,30,17;
putnpc beer.gif,beer.txt,30,21;
putnpc beer.gif,beer.txt,33,24;
putnpc beer.gif,beer.txt,41,24;
putnpc beer.gif,beer.txt,46,21;
putnpc beer.gif,beer.txt,46,17;
}
if (strequals(#g, GTManager)&&(strequals(#c, Sell All))) {
putnpc beer.gif,beer.txt,30,17;
putnpc beer.gif,beer.txt,30,21;
putnpc beer.gif,beer.txt,33,24;
putnpc beer.gif,beer.txt,41,24;
putnpc beer.gif,beer.txt,46,21;
putnpc beer.gif,beer.txt,46,17;
}
if (strequals(#g, GTStaff)&&(strequals(#c, Sell All))) {
putnpc beer.gif,beer.txt,30,17;
putnpc beer.gif,beer.txt,30,21;
putnpc beer.gif,beer.txt,33,24;
putnpc beer.gif,beer.txt,41,24;
putnpc beer.gif,beer.txt,46,21;
putnpc beer.gif,beer.txt,46,17;
}
if (actionadd) {
rupees+=strtofloat(#p(0));
}
if(strequals(#g,Owner)&&strequals(#c,Take Donation)){playerrupees=playerrupees+rupees; rupees=0;}
if(strequals(#g,Owner)&&strequals(#c,See Donations)){message #v(rupees) Gralat; sleep2; message ;}


heres the beer script :
if (playertouchsme&&(playerrupees>4))
{playerrupees-=5;
show;
setplayerprop #c, Ah! Fells good!;
sleep .5;
putleaps 5,x+0.5,y+0;
hide;
playerhearts+=3;
triggeraction 38,14,add,5;
}

LiquidIce00 11-13-2001 06:50 AM

the triggeraction x,y should be of the cash register chest.. and it should work
try doing this
rupees+=strtofloat(#s(#p(0)));
that might work

Xaviar 11-13-2001 08:13 AM

Re: ? HELp!
 
Quote:

Originally posted by SlayerOfDarkness
cuz he knowz alot of thingz =)

Do you mean "cause he knows alot of things"? I know the s key is right next to the z, but try not to get them messed up..It's really annoying...To me, at least

SlayerOfDarkness 11-14-2001 03:59 AM

im confused now...
 
I am extramly confused will someone help me out by liquids way?

entravial 11-15-2001 10:55 AM

~AlphaFlame~

I can't lower myself to Liquid's level, but here's some help... I'm not 100% sure it'll work since I'm not using the graal editor to check everything, but it should.

//The Main NPC
1- set an array of the x's you want
2- set an array of the y's you want
3- check the position based on the number said
4- put an npc there
5- add donation acceptances
6- add money withdrawal

//The Beer.txt NPC
1- check if the player touchs
2- Take some money from the player
3- Add it to a string


Finished script:

//The Main NPC
if (playerenters){
this.x={30,30,33,41,46,46};
this.y={17,21,24,24,21,17};
}
if (playerchats){
if (strequals(#g,Owner) || strequals(#g,GTManager) || strequals(#g,GTStaff)){
if (strequals(#g,Owner)){
if (strequals(#c,take donations)){
playerrupees+=strtofloat(#s(server.barrupees));
setstring server.barrupees,;
}
if (strequals(#c,see donations)){
message strtofloat(#s(server.barrupees)) rupees;
}
}
tokenize #c;
if (strequals(#t(0),Sell)){
this.put=strtofloat(#t(1))-1;
putnpc beer.gif,,this.x[this.put],this.y[this.put]
}
if (strequals(#t(0),Free)){
for (this.put=-1;this.put<arraylen(this.x);this.put++){
putnpc beer.gif,,this.x[this.put],this.y[this.put];
}
}
}
}
if (playerchats && startswith(donate,#c)){
tokenize #c;
if (playerrupees>=strtofloat(#t(1))){
setstring server.barrupees,#v(strtofloat(#s(server.barrupees ))+strtofloat(#t(1)));
}
}

//The Beer.txt
if (playertouchsme && playerrupees>=5){
playerhearts+=2;
playerrupees-=5;
setplayerprop #c,Ahhh... feels good!;
setstring server.barrupees,#v(strtofloat(#s(server.barrupees ))+5);
sleep .5;
putleaps 5,x+0.5,y+0;
destroy;
}

SlayerOfDarkness 11-15-2001 08:16 PM

thxs
 
thxs man

SlayerOfDarkness 11-16-2001 07:15 AM

doesnt work
 
doesnt work

entravial 11-16-2001 09:24 AM

~AlphaFlame~

Like I said, I didn't use Graal Editor for that script... so what's wrong with it? I think my computer can actually open a graal window now without crashing and burning >.<;

*checks* Yup.

Faheria_GP2 11-18-2001 09:43 AM

liquid ain't that good, he's like average...


All times are GMT +2. The time now is 01:35 PM.

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