Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   I need NPC help (https://forums.graalonline.com/forums/showthread.php?t=22686)

kao3 02-01-2002 06:07 AM

I need NPC help
 
does anybody know how to make a NPC repeat its action? I want someone to tell me how to make a NPC repeadly shoot cannonballs.

Dustey 02-01-2002 06:11 AM

1 word
 
WHILE

Shard_IceFire 02-01-2002 06:47 AM

Here is an example =)
NPC Code:

if (playerenters||timeout) {
shootfireball up;
timeout=0.2;
}


nyghtGT 02-01-2002 10:24 AM

'for' loops are fun.

TDO2000 02-01-2002 06:49 PM

Some time ago I have seen a functions loop... but it only worked for the leader:

NPC Code:

if(playerenters){
loopit();
}

function loopit() {
x+=.05;
sleep .05;
loopit();
}



U shouldn't use it but it's possible too ;)

TDK_RC6 02-01-2002 07:39 PM

whats going to be new with the new engine??

TDO2000 02-01-2002 08:47 PM

Quote:

Originally posted by Kaimetsu


Ew, infinite recursion. Won't work when the new scripting engine is completed.

Just sid that it is possible at the moment not that it was a good ieda to use it or that it's possible to use it in the future

TDK_RC6 02-01-2002 09:53 PM

will you be able to send things to functions

like
fname(value1,value2)

zell12 02-01-2002 10:11 PM

arg, your mins are so much more complex then mine >.<

TDO2000 02-02-2002 02:18 AM

Quote:

Originally posted by Kaimetsu


I believe so.

Hmmm Stefan said that he won't add these params on functions because he would have to redo too many things... but I only think the only person who can say anything about this is mr. Bomber hisself ;)

TDK_RC6 02-02-2002 04:36 AM

o man


*tries to contain self*


this is going to be so great, i cant wait

nyghtGT 02-02-2002 04:41 AM

Stefan scares me ...
But these new engine stuff, sounds very nice, hopefully
there will be more easier ways for storing values on the server then server.strings ...

TDK_RC6 02-02-2002 05:07 AM

Quote:

Originally posted by nyghtGT
Stefan scares me ...
But these new engine stuff, sounds very nice, hopefully
there will be more easier ways for storing values on the server then server.strings ...

lets just hope so

Saga2001 02-02-2002 09:11 AM

Well,
Ipersonally think that its pretty retarded to send values thru functions, its trendy, and you could just use triggeractions. Also, that could screw up the scope, and like I personally hate non-global scope, like PHP. Its just pointless... Also this:
NPC Code:

func(10,10);
function func(i,j) {
ans = i*j;
return;
}


is to:
NPC Code:

i = 10;
j = 10;
func();
function func(i,j) {
ans = i*j;
return;
}


Mmmmmmmmmmmm....global scope.
Bootiful.

Saga2001 02-02-2002 09:16 AM

I want to be helpfula dn help people make the new scripting engine, but i can't seem to work my way to the top...:-/. O well i can reccommend here...

Saga2001 02-04-2002 11:56 AM

Quote:

Originally posted by Kaimetsu


It's pointless because you don't understand the point to it. It's more efficient, leads to fewer conflicts, makes the program more comprehensive etc. If you get into deeper programming than Graal then I hope you'll see the difference.

Ouch, burnt by the seering touch of the whip of Kaimetsu...
But I know that it is good in stuff like Standard C. I understand it is helpful, and there are good points to it, I was just pointing out that you can do it already. It does lead to fewer conflicts, and it is indeed more efficient, but what i was saying is that it can be done as is. I do see the difference and it is not fair to immediatly assume otherwise.

joseyisleet 02-04-2002 06:12 PM

-=Josey=-
That would own, you could shorten code by a lot!

function message(text,timeammount){
message text;
sleep timeammount;
message ;
}
if (playertouchsme){
message(hi there,10);
}

If this is how it's going to work, I'll be most delighted. ;D

Saga2001 02-05-2002 12:15 AM

Quote:

Originally posted by Kaimetsu


"message" will probably be a reserved word and you won't be able to deliver strings in that way, but yeah. I wonder if it'll use polymorphism...

Polymorphism!? Leet!!! man this is gonna own. I admit that the use of arguments is going to be helpful, but if it required re-writing parts of the scripting engine, that why waste the time...;)

Goboom 02-05-2002 05:32 AM

This sounds awsome you will be able to own in graal but im putting just about all of my money on this that all the good script commands that let you do anything neto will be DUN DUN DUN !!! P2P!!!!!!

nyghtGT 02-05-2002 03:58 PM

Quote:

Originally posted by Kaimetsu
Oops, I didn't even mean polymorphism. I meant the other thing whose name I've forgotten. Basically:

NPC Code:
function hi(i){
<code>
}
function hi(i,j){
<othercode>
}



Same function name, allowed because the params are different. Cookie to the guy who can remind me what it's called.

its called magik ...

Saga2001 02-06-2002 12:12 AM

Isn't that overloading?
NPC Code:

function hi(i) {}
function hi(i,j) {}



yes it is. :)

Saga2001 02-06-2002 06:43 AM

Quote:

Originally posted by Kaimetsu


Cookie!

yay! :p


All times are GMT +2. The time now is 02:51 PM.

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