View Single Post
  #1  
Old 09-27-2006, 01:50 PM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
Things that stop NPCs

Zodiac's inventory has a major bug.
It randomly stops. By stopping, I mean it doesn't carry out any functions or catch any events.
I have no idea what causes it. The only thing I can think of that stops an NPC like this is when a script exceeds the loop limit. The console log doesn't give a loop limit exceeded error.

I can't fully debug the problem, because I can't make the bug happen to myself. However, a majority of Zodiac has it. These bugged players all seem to have the Stealth skill, but I also have it and I'm not experiencing the bug.

PHP Code:
//Skill: Stealth
function onActionServerside() {
  if (
params[0] == "cast") {
    
player.TakeMP(25,"skill");
  }
}
//#CLIENTSIDE
function onCreated() {
  
join("systemfunctions");
  
join("mudfunctions");
  
this.spelltime .4;
  
this.spellpower 0;
  
this.manacost 25;
  
this.element "Dark";
  
this.description "Makes you invisible to|others for a while.";
  
this.castani "carrystill";
}

function 
onCast() {
  if (
clientr.stat.mp this.manacost) return;
  
setani("carrystill",NULL);
  
this.ftime .5;
  if (
clientr.cmp.shadowblanket 0this.ftime -= clientr.cmp.shadowblanket .1;
  
freezeplayer(this.ftime);
  
findweapon("+System").AddBuff(/*Params clipped*/);
  
sleep(this.ftime);
  
setani("y-animation-hidden",NULL);
  
player.chat " ";
  if (
clientr.element == "Dark") {
    
temp.stealthtime clientr.levels.Thief 1.5;
  }
  else if (
clientr.element == "Light") {
    
temp.stealthtime clientr.levels.Thief .5;
  }
  else {
    
temp.stealthtime clientr.levels.Thief 1.5;
  }
  
temp.modz clientr.mods;
  while (
temp.modz.index("stealthup") >= 0) {
    
temp.stealthtime += temp.modz[temp.modz.index("stealthup")+1];
    
temp.modz.delete(temp.modz.index("stealthup")+1);
    
temp.modz.delete(temp.modz.index("stealthup"));
  }
  
findweapon("+System").AddBuff(/*Params clipped*/);
  
triggerserver("gui",name,"cast");
}

public function 
CanCast() {
  if (
HasBuff("invisible")) return false;
  return 
true;

PHP Code:
//System: Stealth-related functions
public function AddBuff(/*Params clipped*/) {
  switch (
type) {
    case 
"invisible":
      
this.invisible.duration time;
      
replaceani("walk","y-animation-hidden");
      
replaceani("idle","y-animation-hidden");
      
player.attr[3] = "";
      
RemoveEffects();
      break;
  }
}

function 
RemoveEffects() {
  for (
728b++) {
    
player.attr[b] = "";
  }
}

function 
onTimeout() {
  for (
/*Buff stuff*/) {
    if (
a[3] == "invisible") {
      
this.invisible.duration -= .05;
      if (
player.ani != "y-animation-hidden") {
        
this.invisible.duration 0;
      }
      if (
this.invisible.duration <= 0) {
        
RemoveBuff("invisible");
      }
    }
  }
}

public function 
RemoveBuff(/*Params clipped*/) {
  
this.(@type).duration 0;

  switch (
type) {
    case 
"invisible":
      
replaceani("walk",client.gani.walk);
      
replaceani("idle",client.gani.idle);
      
replaceani("sit","sit");
      
this.updateicon 0;
      if (
player.ani == "y-animation-hidden"setani(client.gani.idle,player.attr[2]);
      
UpdateBuffs();
    break;
  }
}

function 
UpdateBuffs() {
  for (
728b++) {
    
player.attr[b] = "";
  }
  for (
/*Buff stuff*/) {
    
player.attr[7+a] = /*Buff effect var clipped*/;
  }

Clipped out not-so-important parts that people-shouldn't-be-seeing.
Reply With Quote