![]() |
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 =( |
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 =/
|
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 |
wtf ahhhhhh!
|
wait that only works for 1 dir though... =/ damn how would i do all 4 dirs
|
u can save some bits if u use
for(a=0;a<4;a++) ;) |
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 |
Quote:
|
Quote:
i dont even know you? |
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.
|
Quote:
since the last "incident" of the staff's stupidity I havent been there and I just talk to Brandon thru AIM .. |
:confused:
i was just asking for help to shorten my script... :( |
Quote:
|
Quote:
ur staff was giving me beef and being smart asses when I was talking to them a while ago .. so thats not cool |
NPC Code: 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. |
i completely started over.
// NPC made by Lord Helmut //255x144 width=63 height=48 if(created){ this.hearts=5; this.speed=.1; this.fdir=0; this.fsprite=0; this.fswimsprite=0; setimgpart #f,0,0,63,48; } if(playerenters){ timeout=.05; } if(timeout){ if (random(1,40)<3) this.fdir=int(random(0,4)); if (this.fdir==0 && !onwall(x+2,y-.1)) y-=this.speed; if (this.fdir==1 && !onwall(x-.5,y+1.5)) x-=this.speed; if (this.fdir==2 && !onwall(x+2,y+3.1)) y+=this.speed; if (this.fdir==3 && !onwall(x+4.1,y+1.5)) x+=this.speed; if (this.fswimsprite==0) this.fsprite=0; if (this.fswimsprite==1) this.fsprite=0; if (this.fswimsprite==2) this.fsprite=1; if (this.fswimsprite==3) this.fsprite=1; if (this.fswimsprite==4) this.fsprite=0; if (this.fswimsprite==5) this.fsprite=0; if (this.fswimsprite==6) this.fsprite=2; if (this.fswimsprite==7) this.fsprite=2; this.fswimsprite++; if (this.fswimsprite>=8) this.fswimsprite=0; timeout=.05; } if (onwater(x+2,y+1.3)) { if (this.fdir==2) {setgifpart b_piranah.png,63*1,48*0,63,48;} if (this.fdir==0) {setgifpart b_piranah.png,63*0,48*0,63,48;} if (this.fdir==1) {setgifpart b_piranah.png,63*3,48*0,63,48;} if (this.fdir==3) {setgifpart b_piranah.png,63*2,48*0,63,48;} } it works fine accept...the fish sometimes swims onto land and for some reason it doesnt display fish sprites =( it should the fish swimming around really fast but it wont show the sprites of the tail moving |
Quote:
We all got inmature asses for staff but I gotta deal with it because everyone willing to be GP or FAQ (97% of population) are *****s |
:megaeek: *laughs hysterically* You had a script from kyle0654 and you out of the blue decided to start over. !@# you freak.
Kyle! don't bother helping anybody! they are ungrateful and Your better off working on NW scripts!. |
Kyle's shortened version was nice and compact but won't work when turning that script into a baddy or whatever it will be because it has sleep in the for loop. :(
|
Quote:
|
At least try to learn something from the techneques that you can plainly see in most good scripts.
|
how do you make NPCs work with multiple players in a level?
|
players[index].variable
for some of my baddies, I do a for-loop to find the closest player, and set him to "this.chase"...then I have the baddie chase after players[this.chase].x and players[this.chase].y |
Quote:
Not sure if this will work, since i havn't tested it... :P Gohan *edit* I didn't see that last part, but you can also add: NPC Code:if(!onwater(x,y)) { x=this.startx; y=this.starty; } or better yet, make it go to the closest place where there is water. Ex: water is to the south: NPC Code: Not sure...but just trying... |
because im testing to see if its on a wall? I want it to be in water. Thanks Soul. That helped =D
|
Quote:
|
Quote:
i've been in a rather good mood for level making ... |
Quote:
|
er...redo your timeout setup and set the animation every timeout (.3) and do the rest every 10 timeouts.
|
will somoeone shorten this please
if (created) { destroy; } |
Quote:
NPC Code: bah doesn't anyone know how to shorten a script besides kyle... |
~AlphaFlame~
Yea, I know how you can shorten it. Use a gun... oh!! You mean the script? Uhhh I know I know!! Learn to script you newbie!! :megaeek: :megaeek: :megaeek: :megaeek: :megaeek: |
Quote:
NPC Code: Created will be the first flag called on the npc, and it will run past destroy;, which needs no flags to run, just something to trigger the npc, and it will destroy it. |
This is why Kyle ownz. ;)
|
All times are GMT +2. The time now is 10:49 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.