Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Future Improvements (https://forums.graalonline.com/forums/forumdisplay.php?f=10)
-   -   Way to make inter-NPC communication better (https://forums.graalonline.com/forums/showthread.php?t=19825)

jeff335 12-29-2001 12:43 AM

Way to make inter-NPC communication better
 
NPCs could communicate much better between each other if they could call each other easier (without callnpc or clunky ol' triggeraction). Graal seems object-oriented enough that the following additions would do well...

A textbox in the editor would set the "true name" by which all other NPCs can call the NPC.


goto truename,condition;
Calls the specified conditional trigger in the NPC with the specified true name. This should be able to call only NPCs within the NPC's level. Theoretically it should be able to work clientside.

applied:

if(this.hearts<3){
//if the boss's hearts are less than 3
goto henchman1,attackplayer;
//triggers condition attackplayer in npc henchman1
goto henchman2,attackplayer;
//triggers condition attackplayer in npc henchman2
}




goto2 level,truename,condition;

This'd be a serverside version of goto that would allow calling remote NPCs.


applied:

if(playertouchsme){
goto2 level13.graal,antagostatue,explode;
//calls explode in NPC antagostatue, residing in level13.graal
}




EDIT: Oops, forgot last part about var calling.


At this point, npc.var could refer to another NPC's variables, where npc is the true name of an NPC and var is a variable within said NPC

Falcor 12-29-2001 08:23 AM

Cool. Dont forget params though ^^;

jeff335 12-29-2001 09:27 AM

Okay then, that'd be:

goto truename,condition(1,var,string,array,sarray);

Just as in the first post, except that commas can be used to separate params in the parentheses, which can be numbers, vars, strings, and so on. These params specify what string or var or whatever param1, param2, param3, param4, param5, param6, and so on represent.

LilNiglet 12-29-2001 09:51 AM

What if two NPC's are named the same thing? I suggest a simple command:

settruename name;

and if it is not used, it simply does not have a name =)

and any duplicates (within the level or two levels used, of course) woukld simply not work, therfore making it that much easier.

Basiclly, make it so it ONLY calls to the level it names to use.

[edit]This command would make hard npc's now SO much easier! Add it stefan![/edit]

Slaktmaster 12-29-2001 07:00 PM

I just love that idea. :)

Admins 12-29-2001 09:49 PM

Yes sounds good
On the npcserver the database npcs already
have a name and can be accessed with
with (getnpc(Ship1)) ... but it would be much better
if you could access them with simple do
Ship1.x or Ship1.moveforward() or so.
Non-Database-npcs could be named with
a command setname or so.
I am making a concept for a new/better scripting
engine, which will be compatible but make things
more easy (using setstring and strtofloat gets annoying
after some time)

Slaktmaster 12-29-2001 10:16 PM

woot!

Is it possible to add setfocusx/setfocusy for making movies and the like as well? :(

jeff335 12-30-2001 11:12 AM

Goto would make stuff easier for Tyhm and all the other people working on free servers...right now you have to find exact indices or use for(i=0;i<npcscount;i++;){callnpc i,attackplayer;} to trigger something in another NPC, unless you know the npc's exact location for triggeraction. If there were a way to determine if something is a string or var (dim as in Visual Basic if it comes to it) string=text could be interpreted as "setstring string,text" and string-- (and such) as "setstring string,#v(strtofloat(string)-1)"

Faheria_GP2 12-30-2001 01:37 PM

Quote:

Originally posted by Stefan
Yes sounds good
On the npcserver the database npcs already
have a name and can be accessed with
with (getnpc(Ship1)) ... but it would be much better
if you could access them with simple do
Ship1.x or Ship1.moveforward() or so.
Non-Database-npcs could be named with
a command setname or so.
I am making a concept for a new/better scripting
engine, which will be compatible but make things
more easy (using setstring and strtofloat gets annoying
after some time)

dont forget the function parameters!

BocoC 12-30-2001 02:25 PM

Quote:

Originally posted by Slaktmaster
woot!

Is it possible to add setfocusx/setfocusy for making movies and the like as well? :(

I believe you are talking about setfocus x,y; and resetfocus; Stefan said he would enable the command to work around 2 Graal versions ago. Maybe if we bug him......


All times are GMT +2. The time now is 10:07 PM.

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