TnZ Scripting Tricks FAQ

+
Not exactly on topic here, but of interest:I just finished adding about 800 or so documents to the djinni wiki .. one document per scripting function ... I may have missed a few, but the large part of them are all there. You can link to the top launch page herei only copied the text Simon dumped in there from the nss.api and a lot of it is still in Polish, so please, those of you know know how these functions work, please have a look and flesh out those entries to help others .. i can't do it alone :)
 
Thanks a lot for this work. The most fuktions are in the nwn-lexicon too. you could copy, paste...But there are some different fct. I like the examples in the nwn-lexicon.
 
Note that a vast majority of those doesn't really need redocumenting - they're the same functions that the NWN/NWN2 community has been using for the past few years. NWN Lexicon, has dozens of them documented quite extensively - oops, as Ralf stated in the meantime.
 
Ailinon said:
Note that a vast majority of those doesn't really need redocumenting - they're the same functions that the NWN/NWN2 community has been using for the past few years. NWN Lexicon, has dozens of them documented quite extensively - oops, as Ralf stated in the meantime.
It's true that a lot of the functions are the same as in earlier versions of Aurora. But surprisingly many aren't, and also the Witcher does many things differently from previous Aurora games. Also, some things which worked in earlier versions of Aurora may not work in The Witcher, so having our own documentation is no bad thing. I agree that doing something systematic to link to the NWNLexicon version of the documentation would be a good idea, I may even get round to doing something about it.But the Widow's but a huge amount of work in here - it's worth a 'thank you', I think, rather than a dismissive comment. If it doesn't help you it doesn't, but it will help lots of people.
 
By all means, more resources is a good thing, not a bad one! Never have I meant my comment to be dismissive, and Game Widow has my most sincere apologies if it came out wrong.What I meant, perhaps in a too much imprecise manner, was that most of those functions work just as other sites document them - AND if they work differently in The Witcher, that's what deserves the most attention. So, instead of just documenting or translating Polish documentation, I think the most focus from now on - now that the big-ass starting brick has been placed - should be the Witcher peculiarities. Like, SetName not working at all, or something.
 
.. bah!.. To check I've tried this script and it works.void main(){ object oPC = GetFirstPC(); if (!GetLocalInt(oPC,"ciop")) { PrintString("ciop"); SetLocalInt(oPC,"ciop",1); }}Futile things, anyway ;)bye
 
Where do you check? In a Trigger "OnEnter"?Edit:
@nandussoAnyway, in other scripts I've seen that Set/GetLocalInt works well with the PC ( GetFirstPC ) but with the NPC sometime works and sometime doesn't, as if the game forgot the int.
Exactement!
 
No, I've run the script manually while the game was running, to see the output in the aurora log.Anyway, in other scripts I've seen that Set/GetLocalInt works well with the PC ( GetFirstPC ) but with the NPC sometime works and sometime doesn't, as if the game forgot the int.bye
 
I never worked with the switch-command, but i want learn. I know its similar to the if-command.Set in the cow-Heartbeat the following script:void main(){int nRoll;object oAp = GetObjectByTag("wp_kuh1");nRoll = Random(4);switch (nRoll) { case 0: // Nothing happens case 1: ActionMoveToObject (oAp, TRUE); break; case 2: ActionRandomWalk(); break; case 3: ActionWait(20.0); break; }}The cow stand and is doing nothing.
 
Ralf ... serais-tu par chance français ? :)I pointed out your script to simon, maybe he has some ideas :wave:
 
Ralf1731 said:
I never worked with the switch-command, but i want learn. I know its similar to the if-command.Set in the cow-Heartbeat the following script:void main(){int nRoll;object oAp = GetObjectByTag("wp_kuh1");nRoll = Random(4);switch (nRoll) { case 0: // Nothing happens case 1: ActionMoveToObject (oAp, TRUE); break; case 2: ActionRandomWalk(); break; case 3: ActionWait(20.0); break; }}The cow stand and is doing nothing.
Note, I have not tested this. But in your case 0 there's no break, so it will just drop through to your case 1. I think what you meant is probably:
Code:
void main(){    int nRoll;    object oAp = GetObjectByTag("wp_kuh1");    nRoll = Random(4);    switch (nRoll) {      case 0:  		// Nothing happens 		break;          case 1:        ActionMoveToObject (oAp, TRUE); break;      case 2:  		ActionRandomWalk(); break;      case 3:  		ActionWait(20.0); break;     }}
Frankly I'd be inclined to rewrite that:
Code:
void main(){    object oAp = GetObjectByTag("wp_kuh1");    int nRoll = Random(4);    switch (nRoll) {      case 1:        ActionMoveToObject (oAp, TRUE); break;      case 2:  		ActionRandomWalk(); break;      case 3:  		ActionWait(20.0); break;       default:        /* nothing happens */    }}
The 'default' is technically redundant but does not harm. Finally, you're switching between actions but you're not actually assigning those actions to anyone. I suspect what you really want is:
Code:
void main(){    object oAp = GetObjectByTag("wp_kuh1");	object oPlayer = GetFirstPC();    int nRoll = Random(4);    switch (nRoll) {      case 1:        AssignCommand( oPlayer, ActionMoveToObject (oAp, TRUE)); break;      case 2:  		AssignCommand( oPlayer, ActionRandomWalk()); break;      case 3:  		AssignCommand( oPlayer, ActionWait(20.0)); break;       default:        /* nothing happens */    }}
 
Keywords are case-sensitive. Are you writing the 'if' lowercase or uppercase? Should be definitely lowercase...
 
On-Anything script hooks work only with script set "custom" - but then you don't have fighting capabilities, etc. For enhancing the default script set, you need the OnUserEvent hook.
 
Hi, can anyone please tell me why the following script isn't working at all?
Code:
#include "inc_dialog"void main(){TeleportPCAndTalk(GetObjectByTag("nasz_zygfryd"), "rozmowa_zygfryd");}
 
Top Bottom