View Single Post
  #23  
Old 11-10-2006, 05:32 AM
Tyhm Tyhm is offline
Psionic Youth
Tyhm's Avatar
Join Date: Mar 2001
Location: Babord, West Graal Deaths:1009 Kills:1
Posts: 5,635
Tyhm has a spectacular aura about
Attempted translation (someone else can figure out if it even works at all):

NPC Code:

function onCreated() {
showcharacter();
dontblock();
headimg = "frog.png";
setcharani("tyhm_frog_baddy_rustle",NULL);
setTimer(0.1);
}
function onTimeout() {
if (this.counter==1) {
setcharani ("tyhm_frog_baddy",NULL);
}else if (this.counter <3) {
this.vulnerable = 1;
this.attacking = 1;
} else if (this.counter < 4){
this.vulnerable = 0;
this.attacking = 0;
} else if (this.counter < 5){
hide();
} else {
this.counter = 0;
x+=random(-5,+5);
if (x>63) x=63;
else if (x<0) x=0;
y+=random(-5,+5);
if (y>63) y=63;
else if (y<0) y=0;
show();
}
this.counter+=0.05;
if (this.attacking > 0) {
//frankly, this part needs to be customized to each damage system anyway.
}
setTimer(0.05);
}

function onWa****(){
struck();
}
function onWasShot(){
struck();
}
function onExploded(){
struck();
}

function struck(){
if(this.vulnerable>0){
setcharani("baddydead",NULL);
sleep 1;//I know, I know, bad form but it's temporary.
temp.i=int(random(0,20));
if (temp.i<5) lay(greenrupee);
else if (temp.i<6) lay(bluerupee);
else if (temp.i<9) lay(heart);
setTimer(0);
this.revive=1;
hide();
}
}

function onPlayerEnters(){
if (this.revive>0){
setTimer(0.05);
this.revive=0;
this.counter=5;
}
}

__________________
"Whatever," said Bean, "I was just glad to get out of the toilet."

"Power does not corrupt. Fear corrupts, perhaps the fear of a loss of power."- John Steinbeck
"I'm only acting retarded, what's your excuse?" queried the Gord.
- My pet, the Levelup Gnome

http://forums.graalonline.com/forums...&postcount=233
Reply With Quote