TnZ Scripting Tricks FAQ

+
Simon, thanks but...you see those questionmarks around my head? ??? ??? ???I'm a beginner, even with scripting and it isn't as easy as in NWN. And I have no knowledge of using strings or variables correctly. I always have to look at given scripts and study them, to know how to make my own. And the most problem is that I could not open the ncs files and look into it, else I maybe would have found out how to script my own effect on the igni stone.Maybe you can tell me what command to use in such a trigger and I'm able to make an own nss script.
 
Note: I'm only fixing the stack overflow problem, I haven't given any thought to what your script actually does...
HexenmeisterRaven said:
Code:
#include "inc_dialog"void main(){	object oPC = GetFirstPC();	// create a new, unique magic marker, not used anywhere else	string marker = "myspecialmagicmarkerdifferentfromeveryother";		// if the magic marker isn't already set...	if (GetLocalInt( oPC, marker) != TRUE){		// set the magic marker		SetLocalInt( oPC, marker, TRUE);		// then do what you want to do		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);		// finally clear the magic marker		SetLocalInt( oPC, marker, FALSE);	}}
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. ???
 
Simon, you have the wrong script. Sorry, I should have made it more clearer. This script you changed actually is not the one with the stack overflow. (Btw, this one runs since an hour correctly)The script where I have this stack overflow is the other I mentioned in first post, the "est_lighton" and the "est_lightoff", those two are ncs scripts added to a trigger on ignistone in m1-module, I tried to make the same trigger around my stonecircle and because that are ncs I could not open and look into it. So I only typed them in the properties of my trigger. And they don't work, they don't do any effects when Geralt enters this trigger and they do those 'stack overflows issue'.What I need is an nss or own script to give my trigger such light effects when Geralt enters.Edit: But I copy this one you changed, who knows for what I can need it later. :)
 
HexenmeisterRaven said:
Simon, you have the wrong script. Sorry, I should have made it more clearer. This script you changed actually is not the one with the stack overflow. (Btw, this one runs since an hour correctly)
Well, send me the script you want fixed, and I'll fix it.
 
I need a script to destroy a blocker i. e. in a cave, to open a special area only by (or after) a Quest.I think I saw it somewhere here in the forum or in the wiki, but it's vanished :-[Please help me, cure my blindness
 
I believe you have used the wrong placeable there (i could be wrong), but there are objects which can be destroyed using aard. These are named as follows: ob_cryptaard01ob_cryptaard02ob_cryptaard03 and there are also arches like ob_ob_cryptakolum and ob_cryptapart that you may want to check out
 
gamewidow said:
I believe you have used the wrong placeable there (i could be wrong), but there are objects which can be destroyed using aard. These are named as follows: ob_cryptaard01ob_cryptaard02ob_cryptaard03 and there are also arches like ob_ob_cryptakolum and ob_cryptapart that you may want to check out
I am searching for a nss script that will open a blocked area by some tag set of by a trigger or Quest.Geralt should not enter this area by using aard. Only after a special point/tag in the storyline.
 
i see :) if i find anything, i'll be sure to post or add it to the wiki, or both ;)... but now I'm dying of curiosity to know how you plan to animate that, or do you ?
 
I don't want to do some animated things. Geralt should not be in that place, when the blocker will vanish. There was some script with a "destroyobject" Line. But where ?
 
Thingol, use search option...really.Nayava,You can change size from appearance.2da file by editing "scale" (if i remember).I don't know any comand, but I can ask someone here if needed.
 
endrek said:
Thingol, use search option...really.
I had, of course. I searched for different keywords, but the most results are part of the polish forum.Sorry, I dont speak polish.
 
@ThingolIs this what you are searching for?
void main(){}Your script should be between those brackets { }. Every line should end with “;”. If you want a script to refer to a player, you have to use function GetFirstPC(). For other objects you can use GetObjectByTag(“object_tag”) or GetNearestObjectByTag(). Another useful function is GetEnteringObject(). You can use it do define that the trigger should work only when a player enters it, eg:if(GetEnteringObject() == GetFirstPC()){DestroyObject(GetObjectByTag("big_stone"));EnableTrigger(GetObjectByTag("stone_trigger"), FALSE);}This function will destroy a big stone, blocking the way, when Geralt enters a specific trigger with this script added in a field “On Enter”. After that the script will disable this trigger (we want this event to happen only once).
 
Hallo, has anyone tried setting up a conversation with a door or any other "placeables"? The conversation starts, the camera doesn't switch from the door to Geralt but stays always on Geralt and on the second string of the dialog D'jinni crashes. I've tried with this script on the field "On Fail To Open" (because the door is locked):void main(){ object oPC = GetFirstPC(); object oDoor = GetObjectByTag("my_tag"); AssignCommand(oPC, ActionStartConversation(oDoor, ""));}then I've putted the dlg file in the field "Conversation" of the door properties.The Aurora log shows: DESIGN ERROR: Object my_tag[25e] [template: ] has no default behaviour!!! I'm setting IgnoreMe and IgnoreAll profiles and coward behaviour.WARNING: trying to set camera shot with (speaker == interlocutor) IS THIS YOUR INTENT?... no! It wasn't my intent! ;D And I can't find how to set behaviour for a door.Bye
 
Last things first, you won't set behaviours for a door, as the door is not a creature.Placeable conversations are known to behave strangely - mainly because D'jinni is trying to set cameras between speakers, and a placeable is not a 'creature' for which the engine could determine height, eye tracking, lipsync, etc. I wonder how it would work if someone created an invisible model (of the cm_*.mdl type) with just the special nodes and bones (it could be easily done with the skeleton taken from Deidre's model, I think) and a composite model (of the cr_*.mdb type) attaching standard animations to it. An invisible character, created this way, would be a perfect "dummy" to speak with, that could perhaps be instanced on demand to help with weird conversation scenarios.
 
Top Bottom