TnZ Scripting Tricks FAQ

+
TnZ Scripting Tricks FAQ

Here you can find some scripting FAQ. If you want to know how to do something - just request here. I'll try to answer asap and post solution in this little FAQ.1. How to change NPC/Player appearance by script?
void main(){ object oTarget = GetObjectByTag("my_tag"); int iApearance = 1; SetCreatureAppearance(oTarger, iApearance);}
Note: creature will have only new appearance - not, for instance, new animation sets!2. Script that force Witcher to draw the sword:
void main(){ object oPC = GetFirstPC(); object oItem = GetItemInSlot(INVENTORY_SLOT_STEELSWORD, oPC); AssignCommand(oPC, ActionEquipItem(oItem, INVENTORY_SLOT_RIGHTHAND));}
Note: Of coursce you can use INVENTORY_SLOT_SILVERSWORD instead of *STEELSWORD.3. How to script CameraShake effect?
#include "inc_cameffects"void main(){ CameraShake(0.1, 0.07, 0.3);}
4. Is there possibility to force Witcher to move from point A to B?
void main(){ object oTarget = GetObjectByTag("my_npc_tag"); object oGoTo = GetObjectByTag("tag_of_destination_object"); AssignCommand(oTarger, ActionMoveToObject(oGoTo));}
5. Is there any delay function? Like sleep() in C++.No but you can use DelayCommand to achieve something simillar. For ex:
void My_delayed_function(){ // something here}void main(){ float fTime = 10.0; DelayCommand(fTime,My_delayed_function());}
 
This all looks very NWN script like. To what extent does NWN Aurora scripting carry over into D'Jinni? I mean, I know you're using some version of the Aurora engine underneath, but could one just copy and paste form NWN scripts into D'Jinni scripts and expect them to work, or has too much changed underneath?I have to confess I've been working on plot structure and locations for my new adventure and haven't really got down to play with D'Jinni very much yet - but if scripting and dialogue-trees work very similarly to NWN it will save me masses of time!
 
Firehawk, Add this :#include "inc_cameffects"void main(){ CameraShake(0.1, 0.01, 0.5);}for example as "On Enter" Trigger script and compile.
 

tnz

Senior user
SimonBrooke said:
This all looks very NWN script like. To what extent does NWN Aurora scripting carry over into D'Jinni? I mean, I know you're using some version of the Aurora engine underneath, but could one just copy and paste form NWN scripts into D'Jinni scripts and expect them to work, or has too much changed underneath?I have to confess I've been working on plot structure and locations for my new adventure and haven't really got down to play with D'Jinni very much yet - but if scripting and dialogue-trees work very similarly to NWN it will save me masses of time!
There are some changes - some functions are added and other have changed functionality. But yea, there should be no big problem with converting nvn scripts into the witcher ones.
 
Hallo, I need a script but I'm not a programmer. In a conversation with an NPC I have the chance to kill him or not. If I choose to kill him then the dialog end but nothing happens. Therefore I have to draw the sword and kill him. At this point (when I draw the sword) the NPC should to start runs away faster then me so, in fact, I cant kill him (it's humorous). In few words when I'm close to him with the sword equipped he runs away. But he must not change the attitude (neutral) so if I put away the sword I can speak with him again.Is it possible?Bye.I think probably it's not possible to write a "decent" script, because the NPC should run away at least for five seconds (On Heartbeat) but he is in a room and there are walls, etc...
 
Hey there, is this thread dead or what is it. No more questions and no answers. Whats wrong here?Here is a question then:The command "LoadAreaMap", it's description is in polish, can somebody please translate it to english or german?And is this needed to change from the normal village map (l24_0) to the smaller village map (l24_1) when Geralt passes the gates to the village?And when it is needed, ehem, can someone tell me if it must have a trigger or how does it work?
 
I need help with the circle of elementsplease could someone post an example .nss-script for the aard or igni Stone. The wiki is not very helpful with this thing.
 
i did not actually have to resort to a script to get my circles of elements working.I just placed my main stone and then set it to Active as the default state, then set the properties for Effect Name and On Usedexample: Ignimodel = ob_ignistone01Effect = fx_ignistone01Open state = Activatedon used = igni_on_usedthese are all part of the djinni and now my circles work ... perhaps not as fully as they couldalso, Yrden is usually abbreviated to yrdn in these files, except for On Used, then it is yrden_on_used
 
gamewidow said:
i did not actually have to resort to a script to get my circles of elements working.I just placed my main stone and then set it to Active as the default state, then set the properties for Effect Name and On Usedexample: Ignimodel = ob_ignistone01Effect = fx_ignistone01Open state = Activatedon used = igni_on_usedthese are all part of the djinni and now my circles work ... perhaps not as fully as they couldalso, Yrden is usually abbreviated to yrdn in these files, except for On Used, then it is yrden_on_used
No script? Please explain the Line on used = igni_on_used. Ich think this has to be a nss. script. The wiki discription is a bit short: http://djinni.wikia.com/wiki/Basic_scripts I have to give Geralt the ability igni (i.e.) with the Line "AddAbility("igni1", oPC);" but there must be a bit more... ???
 
OK ... what I should have said was that i never had to resort to writing my own script. Poor choice of words on my part, sorry! :)i can't explain the script to you as i do know have any scripting experience, What i can tell you is that this script already exists and that you can use it. Also, i never had to give Geralt any special abilityhope that clears things up.
 
sorry, not reallyWhere you got this "igni_on_used" thing. is it in one of the unpacked(unbifed) folders?in my case the "on used" row is empty. I have to search for the "igni_on_used(should be .nss) File. There is only a compiled .ncs. (I can not take this)
 
I inspected the Price of Neutrality module to see what they had done. This is all they had in their properties, so i simply typed in the same string (i didn't try to "find" the script file at all by browsing). Just type in those strings into those property fields, save and test ... i'll bet you anything your circles work after that.I know this is not terribly satisfactory since it is a "black box" method, but it works.
 
yes, this is an ncs script, can be found under all the unbiffed stuff. Push the ncs-script to the module.I've done it in too. And you can make a trigger around those stones and in trigger properties you can add:eek:nEnter: est_lightononExit: est_lightoffThese are the light effects (its also on the Aardstone), I think they can be used for all those circles.Someone an idea on this damned map thing? Must be a trigger, there are some scripts for the map l24_1, but .ncs. I can't decompile them to read what they do.
 
HexenmeisterRaven said:
Someone an idea on this damned map thing? Must be a trigger, there are some scripts for the map l24_1, but .ncs. I can't decompile them to read what they do.
You want to change the map between near and far by leaving the close village area, right?First you have to place the the special waypoints (near and far) for the smaller map. They called ...near_1 and far_1. You have either to rename the others to ..._0. Now you have 4 wp.Place a big triggerfield around the village for the area of the small map. Write two nss-scripts, like map0.nss and map1.nss. For map0:void main(){
 
Thanks, I waited weeks now to get an answer for this, I'll try out when I leave the arena tonight :DMaybe someone can solve this too:In the m1-module is a trigger round the igni stone, and in its properties are the ncs scripts "est_lighton" and "est_lightoff", but that does do nothing when I went into the trigger with Geralt, no effects.All that happened is that Aurora says:
Script est_lighton, OID: 80000290, Tag: trig_igni_01, ERROR: STACK OVERFLOW, Last Command Id: 76
they used it in m1-module and there it works, does anybody know the trick for this? ???And can someone please tell me, whats wrong in this script:
#include "inc_dialog"void main(){ object oPC = GetFirstPC(); if (GetLocalInt(oPC, "startet")!=1) DestroyObject(GetItemPossessedBy(oPC, "it_witcharm_001")); CreateItemOnObject("it_witcharm_007", oPC, 1); CreateItemOnObject("m0_it_grease03", oPC, 1); CreateItemOnObject("m0_it_potion02", oPC, 3); CreateItemOnObject("m0_it_potion03", oPC, 3); CreateItemOnObject("m0_it_potion05", oPC, 1); CreateItemOnObject("m0_it_other07", oPC, 3); AssignCommand(oPC, ActionEquipItem(CreateItemOnObject("it_stlswd_rrr", oPC, 1), INVENTORY_SLOT_STEELSWORD)); AddAbility("HeroStartingAbility", oPC); AddAbility("AutoJump", oPC); //AddAbility("AttackFromBehind", oPC); //AddAbility("Strength1", oPC); //AddAbility("Dexterity1", oPC); //AddAbility("Intelligence1", oPC); AddAbility("Aard1", oPC); AddAbility("Aard2", oPC); AddAbility("Quen1", oPC); AddAbility("Yrden1", oPC); //SetXP(oPC, 50000, TRUE); GiveGoldToCreature(oPC, 300); // Spawnsets EnableSpawnPhase("spawn_echin01", TRUE); EnableSpawnPhase("spawn_wraith01", TRUE);}
All needed items and the script itself are added to module, and it runs yesterday. I changed some things and it no longer works..but I don't know why. ???
 
usually stack overflows are caused by recursive looping ... is it possible that whatever you changed now calls the same script ?
 
They made the same trigger in the m1-module... I made it totally the same. And I have not done the ncs "est_lighton" or "...off" in the module, so it should call it from the bifs ???
 
Top Bottom