Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #11  
Old 11-02-2009, 05:30 AM
_Z3phyr_ _Z3phyr_ is offline
Banned
Join Date: Sep 2003
Location: Louisiane
Posts: 390
_Z3phyr_ is an unknown quantity at this point
unfortunately, i'm not able to edit my original post

so i'll just post the updated thing with the ap's edit:

PHP Code:
//#CLIENTSIDE
function onCreated() {
  
init_Attr();
}
function 
onPlayerenters() {
  
this.setTimer(random(0,3));
}
function 
onPlayertouchsme() {
  
this.setTimer(0);
  
move(0,0,0.05,0);
  
dir getdir(player.x-x,player.y-y);
  
temp.var = int(random(0,this.messages.size()));
  if (
temp.var==0) { say2(this.messages[1]); }
  else { 
say2(this.messages[temp.var]); }
  
this.setTimer(5);
}
function 
onTimeout() {
  
doMove();
  
this.setTimer(int(random(2,5)));
}
function 
init_Attr() {//in honor of ace2896
  
showcharacter();
  
//  use this part if its a regular npc
  
player.head "head0.png";
  
player.body "body.png";
  
player.shield "no-shield.png";
  
colors[0] = "orange"colors[1] = "white"colors[2] = "blue"colors[3] = "red"colors[4] = "black";
  
  
//use this part if its a custom gani npc person
  //setcharani("delt_suo-kccutie","kc_kara2.png");
  
dir int(random(0,3));
  
this.messages = {null,"Where have you set the" NL "cabbage this time, Myra!?","My armpits smell like butter.","I wish daddy would stop hitting" NL "mommy.","C-C-C-C-C-COOCAAAINE","MMMMMM CIGARETTES","Well Gertrude, I tend to be more" NL "liberal-centrist on the issue.","Ware da hood @","kekekekekekeke ^_^","I am going to stab your" NL "babies with a sharpened banana.","I once set the internet on fire."};
  
this.distX = {null,0,-7,0,7,0};
  
this.distY = {null,0,-7,0,7,0};
  
this.dispT = {null,.4,.5,.65,.75,1};
}
function 
doMove() {
  
temp.array = {int(random(1,5)),int(random(1,5)),int(random(1,5))};
  
move(this.distX[temp.array[0]]*this.dispT[temp.array[2]],this.distY[temp.array[1]]*this.dispT[temp.array[2]],this.dispT[temp.array[2]],20);
  if (
this.distX[temp.array[0]]==this.distY[temp.array[1]]==0) {
    
dir int(random(0,3));
    if (
this.ani != "idle") {
      
setcharani("idle",null);
    }
    
sleep(this.dispT[temp.array[2]]);
  }else{
    if (
this.ani != "walk") {
      
setcharani("walk",null);
    }
  }

i would have noticed thiat earlier but i've been banned from the forum for the past two years.
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 09:13 PM.


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