Graal Forums  

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

 
 
Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 05-29-2001, 09:33 AM
Bravo_NPC-Admin1 Bravo_NPC-Admin1 is offline
Registered User
Join Date: May 2001
Location: Olympia, Washington USA
Posts: 25
Bravo_NPC-Admin1 is on a distinguished road
Send a message via AIM to Bravo_NPC-Admin1 Send a message via Yahoo to Bravo_NPC-Admin1
Cool

Ok. Also, I am having trouble with this.variables. In my person, this is his code:
// Graal2001 NPC by Stefan Knorr
if (created) {
// Initialize the attributes
showcharacter;
setcharprop #3,head0.gif;
setcharprop #C0,orange;
setcharprop #C1,white;
setcharprop #C2,blue;
setcharprop #C3,red;
setcharprop #C4,black;
setcharprop #n,Bug Collector;
setcharprop #2,shield1.gif;
shieldpower = 1;
dir = 2;
x+=0.5;
setcharani sit,;
}
if (playerchats && strequals(#c,sell bugs)) {
this.BugRemainderCount=client.BugCount%10; //How much bugs are left if uneven amount
this.BugGive=client.BugCount-this.BugRemainderCount;
this.BugMoney=int(this.BugGive/10); //How much bugs to give
this.BugLeft=10-client.BugCount; //How many bugs are left until jar full
if (client.BugCount>0) { //If has more than 1 bug
if (client.BugCount>=10) { //If has enough to get money
playerrupees+=this.BugMoney; //Give money
say2
You gave me #v(this.BugGive) bugs.#b
You still have #v(this.BugRemainderCount) bugs left.;
} else { //Else not enough to give money
say2
You only have #v(client.BugCount) bugs!#b
You still need #v(this.BugLeft) more bugs!;
}
} else {
say2
You don't have any bugs!;
}
}
if (playertouchsme) {
say2
Hi! I am collecting bugs. If#b
you catch any bugs, will you#b
sell them to me? I will pay#b
you 1 Gralat for every 10 bugs#b
you give me. Bees are special.#b
If you capture a bee, it will#b
count towards 2 bugs! I will#b
also sell you some supplies#b
to catch bugs. Just say,#b
"buy" then the itemname.;
}

In this script, the this.variables don't work right. The weird thing is, they don't even work in offline mode... I catch a bug, and it sets client.BugCount to 1. Notice this portion:
You only have #v(client.BugCount) bugs!#b
You still need #v(this.BugLeft) more bugs!;

this.BugLeft is set by:
this.BugLeft=10-client.BugCount;

In the debugger, this.BugLeft is equal to 9. But, in the textbox, it says:
You only have 1 bugs!
You still need 0 more bugs!

It should read:
You still need 9 more bugs!

Can you guys please explain to me what I am doing wrong? this.BugLeft is 9 in the debugger, but it display's zero in the sign...
__________________
-Boco
 


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 11:30 AM.


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