I have a vague memory of reading somewhere of a function, triggerhack, or script that would tack on the contents of a text file to the end of the currently running NPC. I want to say it was “join” something?
I’ve searched the forums, newfeatures 200X, commands.rtf, and npcprogramming.doc and not found anything. I’ve also searched through the gserver’s config.cfg file for any appropriate looking triggerhacks. All of the above has brought up bupkis.
Anybody have any idea what I’m talking about and able to point me at a link with the right function name/params/triggerhack/whatever?
I don’t follow. Is it a function name that I can put into an npc? Or are you saying that it’s a text file that I should exec with the “exec” triggeraction hack?
Don’t put the file extension, it is automatically txt files. I use it for the bushes on Xialza. You put a script in the text file, then you use it on a certain NPC. Mainly for easy alteration I believe.
Ok, I understand what you’re saying now. I’m just surprised that it’s not documented anywhere. Also, I can’t seem to make it work. I made an offline level called “test.nw”. In it I have an npc with the following:
// NPC made by traddles
if (created) {
}
if (playerchats && strequals(#c,test2)) {
say2 you said test2;
}
join test;
In the same folder as test.nw I put a file test.txt with the following code:
if (playerchats && strequals(#c,test)) {
say2 you chatted 'test';
}
Upon saying “test2” I see the say2. But upon saying “test”, I see nothing. I also tried the above but with the “join test;” line inside of the “if (created)” block. Is there something inside my client config that needs to be turned on to make this work?
[QUOTE=hosler;66946]it might be that the join command can be the only command in the npc.[/QUOTE]
Tried that as well. Hmmm. Some more googleing around has given me a couple of ideas.
ViaXia, is this with gs2?
Another idea: does this only work in online mode and/or are you running an NPC-server? I saw some stuff from a few years back about how “the join command appends text to the npc but it does this on the server side”.
My test is just running in offline mode
Merged doublepost_______________
[QUOTE=Cadavre;66950]I believe join only works online as it is a gserver feature.[/QUOTE]
haha, you beat me to it. I’ll experiment with this in online mode later. Thanks for your help everyone. If I have troubles in online mode as well I’ll post them here so please leave this thread open till I can test this out.
Join is documented in readme.txt in the gserver download.
-------------------------------------
| Special Graal Reborn NPC commands |
-------------------------------------
The Graal Reborn gserver has a couple special NPC commands built in.
join somefile;
Much like official Graal's server-side join command, this command searches for somefile.txt and appends the contents to the end of the NPC script.
singleplayer
This command is like the sparringzone command. When placed by itself with no semi-colon inside an NPC, it signifies that the level is "singleplayer." (SEE: Singleplayer Levels).
Make sure your .txt file can be found! In RC, try: /find myfile.txt
If you can’t find it, it may be a foldersconfig.txt issue. Make sure it is in a proper path. The world/ folder should work fine.
[QUOTE=ViaXia;66931]Don’t put the file extension, it is automatically txt files. I use it for the bushes on Xialza. You put a script in the text file, then you use it on a certain NPC. Mainly for easy alteration I believe.[/QUOTE]
so i could use this join command to join isweapon.txt into NPC. in that txt i can have the wasfired flags and all that stuff that is in every weapon. the isweapon.txt will eventually call the weaponFired() function at some point, and that function can be in the NPC instead of the isweapon.txt. This would work, right? if it doesnt then wtf.
[QUOTE=hosler;67344]so i could use this join command to join isweapon.txt into NPC. in that txt i can have the wasfired flags and all that stuff that is in every weapon. the isweapon.txt will eventually call the weaponFired() function at some point, and that function can be in the NPC instead of the isweapon.txt. This would work, right? if it doesnt then wtf.[/QUOTE]
I was thinking something very similar to this. I was thinking of making a “draggableNpc.txt” file with the basic functions that all npcs need in order to be dragged around. Then, to make any npc “draggable” just do “if (created) join draggableNpc.txt”