Thread: NPC Troubles :(
View Single Post
  #7  
Old 01-04-2005, 10:49 PM
Sildae Sildae is offline
Elven sorceress!
Sildae's Avatar
Join Date: Dec 2001
Location: Lothlòrien
Posts: 159
Sildae is on a distinguished road
I am not really good with gscript, and I have not used it for years, so I have a few questions. I have made a few changes to your code, could you explain to me why you did not write it that way?
Quote:
Originally Posted by Velox Cruentus
NPC Code:

//#CLIENTSIDE
if (created)
this.speed = 0.5;

if (weaponfired) {
timeout = 0.05 - timeout;
tokenize Off On;
setplayerprop #c,Boots #t(timeout * 20);
}

if (timeout) {
for (direction = 0; direction < 4; direction ++) {
playerx += keydown(direction) * vecx(direction) * this.speed;
playery += keydown(direction) * vecy(direction) * this.speed;
}
timeout = 0.05;
}

if (playerchats) {
if (startswith(/boots, #c)) {
newSpeed = strtofloat(#e(7,-1,#c));
if (newSpeed > 0) {
this.speed = newSpeed;
} else {
index = indexof(#e(7,-1,#c), off on);
if (index in {0, 4})
timeout = 0.05 * (index / 4);
}

}
}

__________________
"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man."
-- George Bernard Shaw
Reply With Quote