Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   ?Tile>Fish<Random? (https://forums.graalonline.com/forums/showthread.php?t=19734)

royce 12-27-2001 04:12 PM

?Tile>Fish<Random?
 
Ok the subject gives ya a clue on what I need help on. I am trying to make a fish for Eternal Destiny just randmize around on a certain tile. Can somebody even tell me where I begin!?

entravial 12-27-2001 05:05 PM

~AlphaFlame~

Just a guess, but wouldn't you need to do something like

if (timeout){
Check();
showimg 0,0,fish.gif,this.x,this.y;
timeout=1;
}
function Check(){
this.x=int(random(0,64));
this.y=int(random(0,64));
if (!tiles[this.x,this.y]=tile)Check();
}

Eh, maybe?

royce 12-28-2001 10:28 AM

gah that helps alot! thanx, i've never done a script that runs on random and on a certain tile so i didnt know what to do.

dragoonvenganc 12-28-2001 10:56 AM

i dont thinkthat is right
 
first Let me saywhat the crap is this

if (timeout){
Check();
showimg 0,0,fish.gif,this.x,this.y;
timeout=1;
}
function Check(){
this.x=int(random(0,64));
this.y=int(random(0,64));
if (!tiles[this.x,this.y]=tile) Error... no ;

Check(); YOUR redoing the function within the function......
}


Ok i wil explain
ok have it so that it replaces the fish in a diffeent spot every couple seconds... right..
and lets not use functions..since.. it might confuse u.. no offense



if (timeout||created){ // does the stuff below when
// first created or when timer runs out
this.done=0;
while (!this.done=1){ // keeps doing the below until it finds a tile
//that is what ever the tile u are looking for is
this.x=int(random(0,64)); // gets a random number between 0&64
this.y=int(random(0,64));
if (tiles[this.x,this.y]=***){this.done=1;}
}

showimg 0,0,fish.gif,this.x,this.y; // shows fish at this.x and this.y
timeout=1;
} // ends statment



Where the ***'s are at put in the number tile for the water.. or what ever.. i dont know what it is

this should work i have not checked..
Hope that helps

Dragoon Vengance
Owner of Pangea Relics of Time

royce 12-28-2001 02:07 PM

gah too hard **** XD! I am mainly into levels and gfx but scripting isnt too bad but crap like this is confusing. I have alot of stuff to script so I need some practice. No it doesnt work.

dragoonvenganc 12-29-2001 11:25 AM

let me test it and fix it for u then

dragoonvenganc 12-29-2001 11:58 AM

Sorry im so stupid .. i dont know why i dint think of using on water

if (timeout||created){
this.done=0;
while (!this.done=1){
this.x=int(random(0,64));
this.y=int(random(0,64));
if (onwater(this.x,this.y)){this.done=1;}
showimg 1,appletree1.gif,this.x,this.y;
}
timeout =1;}

replace appletree1.gif with the fish

royce 12-29-2001 12:57 PM

1 Attachment(s)
omg! me too...damn water and tiles...lol...btw it only puts the picture in 1 spot around everywhere! I wanted the fish to roam around without warping places! heres the pic

Poogle 12-29-2001 01:00 PM

ive been doing this for water spashes should work for fish too
if (playerenters) {
timeout = 0.1;
}
while (timeout) {
setani FISHANI,;
x = random(water end left,water end right);
y = random(water end up,water end down);
sleep 0.2;
}
the water end DIR is the X and Y needed

entravial 12-29-2001 06:06 PM

~AlphaFlame~

Oh my god... Poogle... why the hell are you using while (timeout)?!

And besides, recalling a function within a function could be used in conjunction with strings if you needed to do... say... a wall-crawling spider and a water-roaming fish in the same NPC. Or if you needed to recall the function someplace else in the script. Trada. I win.

entravial 12-29-2001 06:09 PM

~AlphaFlame~

Oh my god... XD the forum agreed with me! I WIN!!

entravial 12-29-2001 06:11 PM

1 Attachment(s)
~AlphaFlame~

Err screenshot... wtf is up with the attacher...

LiquidIce00 12-30-2001 04:52 AM

dont ask ;P
NPC Code:

timereverywhere;
dontblock;
drawunderplayer;

if (playerenters) {
this.dir=0;
timeout=.1;
}

if (timeout) {
if (onwater(x+vecx(this.dir),y+vecy(this.dir))) {
x+=vecx(this.dir);
y+=vecy(this.dir);
}
else {
this.dir=(this.dir+2)%4;
x+=vecx(this.dir);
y+=vecy(this.dir);
}
timeout=.1;
}


royce 12-30-2001 06:50 AM

ok liquid that is still wrong...God made me not to be a scripter so please dont critisize. It just bouces off the walls and sides liquid. I want it to setimg when x is - then change when x is +....not like a ping pong ball that keeps boucing back in fourth....

Too hard XD

dragoonvenganc 12-30-2001 08:57 AM

ok.. i thought u wanted it to randomly appear sorry

so u want it to move just right till it hits a wall then left.. or what.. give me more detail and if i feel like it i will

this is easy i just miss understood u

Poogle 12-30-2001 11:29 AM

Quote:

Originally posted by entravial
~AlphaFlame~

Oh my god... Poogle... why the hell are you using while (timeout)?!

And besides, recalling a function within a function could be used in conjunction with strings if you needed to do... say... a wall-crawling spider and a water-roaming fish in the same NPC. Or if you needed to recall the function someplace else in the script. Trada. I win.

Dude I made it where it stays in a certian place Tada you suck

Poogle 12-30-2001 11:31 AM

Quote:

Originally posted by entravial
~AlphaFlame~

Err screenshot... wtf is up with the attacher...

You can tell thats fake stupid

royce 12-30-2001 11:51 AM

Quote:

Originally posted by Poogle
You can tell thats fake stupid
It was a total joke jackass!

LiquidIce00 12-30-2001 01:37 PM

i dont get what u mean.

royce 12-31-2001 02:20 AM

Quote:

Originally posted by LiquidIce00
i dont get what u mean.
Grr. Ok this is what I mean. A fish that swims around using the two directions, left and right. Not make it hop out of the water. I want the fish to swim around. Not swim back and fourth, swima round randomly!

LordMatt 12-31-2001 05:53 PM

I have a script already perfectly for my servers fishing works fine and all, but wont give it out :-\ I might of helped chik but I quit/got fired from ed

fuzie 01-01-2002 02:13 AM

Quote:

Originally posted by LordMatt
I have a script already perfectly for my servers fishing works fine and all, but wont give it out :-\ I might of helped chik but I quit/got fired from ed
fired? quit? Your still in. Geeze, ya never talk to me nemore so you assume this?

fuzie 01-01-2002 02:14 AM

this also has nothing to do with jobs.....it is just something that will be swimming around.

Poogle 01-01-2002 07:17 AM

Quote:

Originally posted by royce


It was a total joke jackass!

I know but you can make it more realistic

fuzie 01-01-2002 07:25 AM

it was good enough for a 5 minute thing. Now back to what I was saying.

entravial 01-01-2002 03:03 PM

~AlphaFlame~

Hey poogle... I'll say this, 56k modem. The only edit I did to that picture was adding the n for win.

OMG LIKE THAT N IS A WHOLE ATOM OFF!!! OMG FAAAAAAKEEEEEEEE!!!!!!!!!!!!

Poogle... do me (and probably more people) a biiiiiig favor... tie a rock around your neck with a frayed rope, then put the rock on a pier. Jump over the edge so that you're hanging over shark-infested waters, and so crows and ravens and seagulls can eat your eyes out. Then, the rope breaks and you fall in, promptly getting eaten by sharks. And the peasants rejoice.

<Peasants> *Rejoice*

fuzie 01-01-2002 06:47 PM

Quote:

Originally posted by entravial
~AlphaFlame~

Hey poogle... I'll say this, 56k modem. The only edit I did to that picture was adding the n for win.

OMG LIKE THAT N IS A WHOLE ATOM OFF!!! OMG FAAAAAAKEEEEEEEE!!!!!!!!!!!!

Poogle... do me (and probably more people) a biiiiiig favor... tie a rock around your neck with a frayed rope, then put the rock on a pier. Jump over the edge so that you're hanging over shark-infested waters, and so crows and ravens and seagulls can eat your eyes out. Then, the rope breaks and you fall in, promptly getting eaten by sharks. And the peasants rejoice.

<Peasants> *Rejoice*

ouch that was harsh, poogle is always annoying me so ohh well.:D .

entravial 01-01-2002 09:18 PM

~AlphaFlame~

Can you tell I don't like Poogle?

Anyway, left/right fish? Try this... and yes, I have been up for uh... 14 hours now, so it might not exactly work 100%...


if (playerenters || created){timeout=.05;timereverywhere;}
if (timeout){
if (x in |left x,right x){x+=vecx(this.dir)/4;} else {
if (x<left x)this.dir=3; else this.dir=1;
}
timeout=.5;
}

Change the speed by modifying this: x+=vecx(this.dir)/4;
Just change the 4... right now, it moves .25 left/right. And make sure to edit the parts in bold.

[edit] Notice, Poogle, If (timeout) [/edit]

dragoonvenganc 01-02-2002 12:17 PM

so u want x and y movement totally randomized..

fuzie 01-03-2002 08:24 AM

thanx....yes a random moving fish.

entravial 01-03-2002 04:30 PM

~AlphaFlame~

*ker-try*

if (playerenters || created){timeout=.05;timereverywhere;}
if (timeout){
this.dircng+=random(.01,.3);
if (this.dircng>1){
this.dircng-=1;
this.dir=int(random(0,5));
}
if (!onwall(x+vecx(this.dir),y+vecy(this.dir))){
x+=vecx(this.dir);
y+=vecy(this.dir);
} else {
this.dircng=1;
}
timeout=.5;
}

Another 4:30 a.m. script, brought to you by... *snoooore*

Mrmicro 01-04-2002 04:04 AM

It goes on grass

fuzie 01-04-2002 04:16 AM

Quote:

Originally posted by Mrmicro
It goes on grass
So, you like to take scripts off the forums then put all of them together then make a pw called "Scriptopia"? I heard about this a while ago, I just want to know if it was true.

Saga2001 01-05-2002 05:55 AM

i made a cool fish
 
i made a cool fish that wandered around in all directions and did stuff like that, but than i kinda realized i scripted it bad and it would hit the wall, and freeze after a while, so i quit graal.

Mrmicro 01-06-2002 12:50 AM

How did you guess that!? Man dont tell out my secret.. I have a ubber leet server comming out.. Its called "Stuff I take from forums" and then I just got done scripting this npc that says hi... took me 3 days

its like

//Npc made by Mrmicro
if (playerenters)
message hi!;

DONT STEAL THAT SCRIPT I DID IT AND IT TOOK ME 3 DAYS!

If you beleive that then your an idiot... I was simply testing to see if the fish went on grass or not..! Dont flip out

BeZeRkEr 01-06-2002 01:10 AM

better not use my graphics mr chik

Mrmicro 01-06-2002 02:05 AM

Note: He is using the graphics you sent him

BeZeRkEr 01-06-2002 04:55 AM

you know
he never told me that the graphics i give him belong to the server
i signed no contract so your agreement is void
never told me about it nor did i agree to it
those graphics belong to me
and if you use them you are stealing graphics
and i will tell stefan

fuzie 01-06-2002 05:44 AM

Quote:

Originally posted by BeZeRkEr
you know
he never told me that the graphics i give him belong to the server
i signed no contract so your agreement is void
never told me about it nor did i agree to it
those graphics belong to me
and if you use them you are stealing graphics
and i will tell stefan

You game them to me. When you say here ya go and send them over Direct Connect then I think that means you gave them to me.

mikepg 01-06-2002 06:06 AM

umm
 
why dont you try this:

NPC Code:

if (playerenters||created) {timeout = .1;
}

if (timeout) {
this.movex=random(-1,1.1);
this.movey=random(-1,1.1);
if (this.movex>=0) {this.dir=3;
}
if (this.movex<0) {this.dir=1;
}
if (this.dir=1) {setimg <fishleft>;
}
if (this.dir=3) {setimg <fishright>;
}
if (onwater(x+this.movex,y+this.movey)) {
move this.movex,this.movey,1,4;
sleep 1;
}
timeout = .1;
}



that will make your fish wonder around aimlessly on the water.
not a whole lot to it. this thread didnt need to be 3 pages long.


All times are GMT +2. The time now is 08:20 PM.

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