Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Shorten (https://forums.graalonline.com/forums/showthread.php?t=22256)

lordhelmut 01-27-2002 04:16 PM

Shorten
 
Anyone wanna help me shorten this?

// NPC made by Lord Helmut
//255x144 width=63 height=48

if(created){
this.hearts=5;
this.speed=.5;
this.x=x;
this.y=y;
setimgpart #f,0,0,63,48;
}
if(playerenters){
timeout=.05;
}
if(timeout){
i=random(0,20);
if(i<5){
swimleft();
}
if(i<10||>=5){
swimright();
}
if(i<15||>=10){
swimdown();
}
if(i=<20||>=15){
swimup();
}
timeout=3;
}
function swimleft() {
setgifpart b_piranah.png,63*2,48*1,63,48;
sleep .3;
setgifpart b_piranah.png,63*2,48*0,63,48;
sleep .3;
setgifpart b_piranah.png,63*2,48*2,63,48;
sleep .3;
setgifpart b_piranah.png,63*2,48*1,63,48;
sleep .3;
setgifpart b_piranah.png,63*2,48*0,63,48;
sleep .3;
setgifpart b_piranah.png,63*2,48*2,63,48;
sleep .3;
setgifpart b_piranah.png,63*2,48*1,63,48;
sleep .3;
setgifpart b_piranah.png,63*2,48*0,63,48;
sleep .3;
setgifpart b_piranah.png,63*2,48*2,63,48;
sleep .3;
}

function swimright() {
setgifpart b_piranah.png,63*3,48*1,63,48;
sleep .3;
setgifpart b_piranah.png,63*3,48*0,63,48;
sleep .3;
setgifpart b_piranah.png,63*3,48*2,63,48;
sleep .3;
setgifpart b_piranah.png,63*3,48*1,63,48;
sleep .3;
setgifpart b_piranah.png,63*3,48*0,63,48;
sleep .3;
setgifpart b_piranah.png,63*3,48*2,63,48;
sleep .3;
setgifpart b_piranah.png,63*3,48*1,63,48;
sleep .3;
setgifpart b_piranah.png,63*3,48*0,63,48;
sleep .3;
setgifpart b_piranah.png,63*3,48*2,63,48;
sleep .3;
}

function swimup() {
setgifpart b_piranah.png,63*0,48*1,63,48;
sleep .3;
setgifpart b_piranah.png,63*0,48*0,63,48;
sleep .3;
setgifpart b_piranah.png,63*0,48*2,63,48;
sleep .3;
setgifpart b_piranah.png,63*0,48*1,63,48;
sleep .3;
setgifpart b_piranah.png,63*0,48*0,63,48;
sleep .3;
setgifpart b_piranah.png,63*0,48*2,63,48;
sleep .3;
setgifpart b_piranah.png,63*0,48*1,63,48;
sleep .3;
setgifpart b_piranah.png,63*0,48*0,63,48;
sleep .3;
setgifpart b_piranah.png,63*0,48*2,63,48;
sleep .3;
}

function swimdown() {
setgifpart b_piranah.png,63*1,48*1,63,48;
sleep .3;
setgifpart b_piranah.png,63*1,48*0,63,48;
sleep .3;
setgifpart b_piranah.png,63*1,48*2,63,48;
sleep .3;
setgifpart b_piranah.png,63*1,48*1,63,48;
sleep .3;
setgifpart b_piranah.png,63*1,48*0,63,48;
sleep .3;
setgifpart b_piranah.png,63*1,48*2,63,48;
sleep .3;
setgifpart b_piranah.png,63*1,48*1,63,48;
sleep .3;
setgifpart b_piranah.png,63*1,48*0,63,48;
sleep .3;
setgifpart b_piranah.png,63*1,48*2,63,48;
sleep .3;
}

its my first try at anything bigger than a door script =(

lordhelmut 01-27-2002 04:31 PM

all i could think of was like a timeout to put the animation part in but i already use a timeout and I cant use 2. Maybe a while loop but i would need 4. 1 for each animation part =/

kittygirl765 01-27-2002 04:56 PM

Re: Shorten
 
try this, i just made it up right now, so mite be wrong in some places =D
NPC Code:
// NPC made by Lord Helmut
//255x144 width=63 height=48

if(created){
this.hearts=5;
this.speed=.5;
this.x=x;
this.y=y;
setimgpart #f,0,0,63,48;
}
if(playerenters){
timeout=.05;
}
if(timeout){
i=int(random(0,4));
for(a=0;a!=3;a++) {
setgifpart b_piranah.png,63*i,48*1,63,48;
sleep .3;
setgifpart b_piranah.png,63*i,48*0,63,48;
sleep .3;
setgifpart b_piranah.png,63*i,48*2,63,48;
sleep .3;
}
timeout=3;
}


lordhelmut 01-27-2002 05:01 PM

wtf ahhhhhh!

lordhelmut 01-27-2002 05:10 PM

wait that only works for 1 dir though... =/ damn how would i do all 4 dirs

TDO2000 01-27-2002 07:08 PM

u can save some bits if u use

for(a=0;a<4;a++)
;)

LiquidIce00 01-27-2002 10:55 PM

its funny
u always asking for help on the forums and you have ur own PW ..
I used to help you out but then your PW came out and I saw Dark Warlock's outside building (u use it outside of onlinestartlocal) and I asked about 30 times to take that down b/c Dark Warlock does not want his stolen building there. So dont expect any help towards your PW from me. and I do help other PW's .. im friends w/ Maximus (Delteria) , Brandon (Andor), and more ..
so if u want help dont be an ass when we ask of something from u

royce 01-27-2002 11:37 PM

Quote:

Originally posted by LiquidIce00
its funny
u always asking for help on the forums and you have ur own PW ..
I used to help you out but then your PW came out and I saw Dark Warlock's outside building (u use it outside of onlinestartlocal) and I asked about 30 times to take that down b/c Dark Warlock does not want his stolen building there. So dont expect any help towards your PW from me. and I do help other PW's .. im friends w/ Maximus (Delteria) , Brandon (Andor), and more ..
so if u want help dont be an ass when we ask of something from u

Friends with me?

LiquidIce00 01-27-2002 11:43 PM

Quote:

Originally posted by royce


Friends with me?

u ?
i dont even know you?

royce 01-27-2002 11:51 PM

Yes You do. Why in the hell where you just abusing your powers on andor to screw around with my life there? You would keep jailing me then you would not stop puttin my hearts to 0.

LiquidIce00 01-27-2002 11:52 PM

Quote:

Originally posted by royce
Yes You do. Why in the hell where you just abusing your powers on andor to screw around with my life there? You would keep jailing me then you would not stop puttin my hearts to 0.
LOLOL I have not been to andor for a month..
since the last "incident" of the staff's stupidity I havent been there and I just talk to Brandon thru AIM ..

lordhelmut 01-28-2002 12:16 AM

:confused:

i was just asking for help to shorten my script... :(

lordhelmut 01-28-2002 12:29 AM

Quote:

Originally posted by LiquidIce00
its funny
u always asking for help on the forums and you have ur own PW ..
I used to help you out but then your PW came out and I saw Dark Warlock's outside building (u use it outside of onlinestartlocal) and I asked about 30 times to take that down b/c Dark Warlock does not want his stolen building there. So dont expect any help towards your PW from me. and I do help other PW's .. im friends w/ Maximus (Delteria) , Brandon (Andor), and more ..
so if u want help dont be an ass when we ask of something from u

sorry bout that. I remember you saying that and I was really busy and forgot to take it down. I have changed it somewhat now. Its the same basic shape but not the same thing. If you would rather me change it more please say so.

LiquidIce00 01-28-2002 12:33 AM

Quote:

Originally posted by lordhelmut


sorry bout that. I remember you saying that and I was really busy and forgot to take it down. I have changed it somewhat now. Its the same basic shape but not the same thing. If you would rather me change it more please say so.

thats fine thnk u..
ur staff was giving me beef and being smart asses when I was talking to them a while ago .. so thats not cool

kyle0654 01-28-2002 12:37 AM

NPC Code:

// NPC made by Lord Helmut
// Shortened by Kyle0654
// 255x144 width=63 height=48

if (created) {
this.dirgo = {0,2,1,3};
this.hearts = 5;
this.speed = .5;
this.x = x;
this.y = y;
setimgpart #f,0,0,63,48;
}

if (playerenters||timeout) {
i = int(random(0,3.9));
swim();
timeout = 3;
}

function swim() {
for (this.z = 0; this.z < 9; this.z++) {
setimgpart b_piranah.png,63*(this.dirgo[i]),48*((10-this.z)%3),63,48;
sleep .3;
}
}


You'll of course need some code for actually moving it...and I'd suggest rearranging your sprite set to eliminate the need for the dirgo modifier.


All times are GMT +2. The time now is 09:18 AM.

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