Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 06-25-2002, 11:19 AM
Torankusu Torankusu is offline
Elite Member
Torankusu's Avatar
Join Date: Jun 2001
Posts: 10,065
Torankusu is a jewel in the roughTorankusu is a jewel in the rough
This might help.

NPC Code:
//Get the bar money, etc.
if (playerchats) {
allow=false;
{
if (strequals(#a,Account) || strequals(#g,Bar Tender)) allow=true; //Allows this guild/account to withdraw the money.
barmoney=strtofloat(#s(this.barmoney));
}
if (strequals(#c,show money)) setcharprop #c,The bar has collected #v(barmoney) rupees.;
if (startswith(collect,#c)) { //Checks player's text to see if it starts with "collect."
if (allow==false) setcharprop #c,You can't collect any money.; //Self Explainatory.
else {
total=strtofloat(#e(8,-1,#c)); //#e = carries the eight characters (collect,) , -1, I forget, #c, withdraws the character's # amount.
if (total>0&&total<=barmoney) {
barmoney-=total; //Subtracts the money from the bar total.
playerrupees+=total; //Adds the money to the bar total.
setcharprop #c, } else { //If the bar doesn't have that much money--
if (total<0) setcharprop #c,You must say a number greater then 0!;
else setcharprop #c,The bar doesn't have that much money!;
}
}
}
setstring this.barmoney,#v(barmoney);
}



And... I'd do this with the beer...
NPC Code:

//NPC made by Torankusu
if (playerenters) {
hide;}
if (playerchats && strequals(#c,buy beer 1)) {
playerrupees-=5;
setstring this.barmoney,#v(strtofloat(#s(this.barmoney))+5); //Adds to the bar money.
show;}
if (playertouchsme) {
playerhearts+=2;
putleaps 5,playerx,playery;
hide;
}



I suggest you put the bar collect stuff in a separate NPC.
__________________
Quote:
Originally posted by Spark910
Think befreo you type.
Reply With Quote
 


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 04:44 AM.


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