TnZ Scripting Tricks FAQ

+
Yes! It was my second attempt, but I'm not able to make an invisible character. I've tried with "alpha_dummy" in the Appearance's field but in this way I have a black figure in front of the door... with the coloured circle around the feet. It should be invisible and not "clickable" (excuse my English) to work perfectly.Thanks for the explanation.
 
nandusso said:
Yes! It was my second attempt, but I'm not able to make an invisible character. I've tried with "alpha_dummy" in the Appearance's field but in this way I have a black figure in front of the door... with the coloured circle around the feet. It should be invisible and not "clickable" (excuse my English) to work perfectly.Thanks for the explanation.
Could you put the dummy just behind the door?
 
;D ... yes, the intention is to talk with someone behind the door... and I tried like you said, too. But it doesn't work.Thanks for the hint... :DI think the only way is to make a cutscene, but in that case you can't do any choice.
 
What about a trigger outside the door, and then utilizing "TeleportAndTalk" script? When walking on trigger, calls the script with TeleportAndTalk which causes the NPC behind door to begin a conversation with the player.
 
Hmm... but in that case would the NPC appear in front of Geralt? The situation is that the NPC is afraid of monsters outside but Geralt has slain them all and then ask to enter. There's a funny dialog among The NPC, his wife and the witcher, and then Geralt can enter. This is why the door should stay closed without seeing the NPCs, so it seems more "realistic". ... in the meantime I can try it.bye
 
You could change the appearance of the npc by script to one that does not exist, so the npc is invisible. Then just add a trigger that triggers a teleport pc and talk script, that let Geralt talk with this npc.
 
It doesn't work because the game loads the "placeholder", the conversation becomes slow and when the NPC talks there's an empty background. The same way as if you starts with the NPC with the wrong appearence already set. (setted?) Thanks.
 
I've reached a compromise using this script. Now when the door "talks" we are "in-game" and when Geralt talks the camera is facing him.void main(){ object oPC = GetFirstPC(); object oDoor = GetObjectByTag("talking_door"); if(GetDialogFlagValue("en_conv_door") == 1) // optional { if((GetIsDay() == 1) || (GetIsDusk() == 1)) // optional { SetCutsceneMode(oPC, TRUE); // to avoid the player walks around :) AssignCommand(oDoor, SpeakOneLinerConversation("conv_door")); DelayCommand(3.0, AssignCommand(oDoor, SpeakOneLinerConversation("conv_door1"))); DelayCommand(8.0, AssignCommand(oPC, ActionStartConversation(oDoor, "witcher_door"))); } }}The conv_door.dlg files have, obviously, only one entry dialogue. The "DelayCommand" is set according to the length of the sentence. The witcher_door.dlg file must have only, and no less than, two "levels" of dialogue lines (dialog-entry --> dialog-reply), otherwise the game crashes or stops because of the cutscene-mode-on. During this conversation the camera is always facing the witcher. If we want the witcher has the possibility to choose a reply we can add more dialog-reply on the second "level".To continue the conversation after the witcher's reply we can put a script on the Action Script's field of the "second level" dialogue line:void TalkingDoor(){ object oPC = GetFirstPC(); object oDoor = GetObjectByTag("talking_door"); SpeakOneLinerConversation("conv_door2"); DelayCommand(2.0, SpeakOneLinerConversation("conv_door3")); //ActionDoCommand(SetCutsceneMode(oPC, FALSE)); // if the conversation ends here (use also DelayCommand) DelayCommand(7.0, AssignCommand(oPC, ActionStartConversation(oDoor, "witcher_door1"))); // if we want another reply of the witcher}void main(){ object oPC = GetFirstPC(); object oDoor = GetObjectByTag("talking_door"); DelayCommand(0.5, SetCutsceneMode(oPC, TRUE)); DelayCommand(1.0, AssignCommand(oDoor, TalkingDoor()));}I did it so because in that manner the game has never crashed or "forgotten" to show the dialogue lines. Maybe we can use only two conversation files with all the dialogue entry and some global flags to enable-disable them.In my opinion the effect is good, but I would prefer if, instead of using DelayCommand, the game waits for the mouse left click after the "SpeakOneLinerConversation", as happens on the "witcher_door" dialogue.Does anyone know how do it?Bye.
 
Nice, a talking door.... I remember the talking bookstand in NWN, with the ghost behind.... :)Can somebody tell me how to make a character lay down on ground during a dialog with Geralt?My wounded lady every time stands up when Geralt talks to her, but she shall lay down the whole time during the conversation. (Like the wounded Triss in game's first act).So I'm in need of a script I can add to her template or dialog or where ever this should be put in. ???
 
Hallo Hexenmeister, if you haven't already found it (... :)) I've seen in the npcactions.2da file the action entry "w_h_sleep_triss". It has the field "ForceInDialog" setted to 1. Maybe this can help you.bye
 
Uh, yes, it helped me a bit... well, the character is flying in the air (above the grass) and does not longer look wounded, but she's lying down during the dialog.It seems, that I have to make my own entry into this file. I'll try it tomorrow with my "sickness" action... and hope to get it to work. Thanks so far. :)
 
Indeed, the npcactions.2da deserves a few custom entries :)So far I needed those:
Code:
212	w_h_fixing_hi     	w_h_man_fixing1  	5     	w_h_man_fixing_post	****     	****   	w_h_man_fixing_pre	10  	****	w_h_hammer  	****     	****  	****     	****       	****       	****    	1         	****     	****    	0   	****    	0    	****	****    213	w_h_fixing_lo     	w_h_man_fixing2  	5     	w_h_man_fixing_post	****     	****   	w_h_man_fixing_pre	10  	****	w_h_hammer  	****     	****  	****     	****       	****       	****    	1         	****     	****    	0   	****    	0    	****	****    214	w_h_man_fixing_stand 	w_h_man_swordforge 	5     	gest_tired3    	****     	****   	****       	10  	****	w_h_hammerbig 	****		****    	****     	****       	****       	****    	1       	****	 	****      0   	****    	0    	****	****    215	w_h_kneel      	w_h_kneel      	1     	w_h_kneel_post  	****     	****   	w_h_kneel_pre  	**** 	****	****     	****     	****  	****     	****       	****       	****    	****       	****     	****    	0   	****    	0    	****	****
These are: 'fixing' only standing (the regular fixing is random standing/kneeling, not always wanted), only kneeling, working with a hammer forge-style (banging on the table, not on the wall like fixing and without a sword), and stay-kneeling.
 
Could someone tell me what is the command to "delete" a placeable (so that it is invisible and does not block) and what command undo this?
 
DestroyObject(object oTrash, float fDelay=0.0f);Destroys the oTrash object, optionally after a fDelay seconds' delay.There is no undoing this - you'd need to re-create the object, using CreateObject.
 
I like to avoid the player from running away from enemies when he should fight. So I like to know if someone could make a script for an invisible placeable that blocks the players way during the fight and allow the player to pass it when the fight is over.
 
I'm fairly sure there are invisible obstacles in the Price of Neutrality (check the perimeter of the valley) ...so you could use those, then destroy them after the fight as Ailinon suggested
 
I will try finding this obstacle. But I hope there is another way then just destroying them. I want Geralt to fight in the same area twice without the option to run away. Maybe when the appearance of the placeable is changed to a cave door. They are invisible too and you can walk through them. But I do not know how to change the appearance of a placeable by script.
 
You shouldn't have any problem with creating the object when it's needed with CreateObject and destroying it when it's supposed to be gone. Just place a waypoint there and script creation/destruction basing on its location.
 
Then I have to create an own script for every situation? Or how could I solve this in one script? A trigger in front of every of this waypoints that activates a script that creates this placeble on every of this waypoints when GetIsInCombat(OPC)== 1 and destroy every placeable with the tag of the invisible wall when GetIsInCombat(OPC)== 0? But would not that create crashes when a invisible wall spawns in a invisible wall or a the placeable that should be destroyed is already destroyed?
 
Easily verifiable with setting a variable in the waypoint object.
Code:
object oWaypoint = GetObjectByTag("wp_inviswall01");object oPC = GetFirstPC();if (GetIsInCombat(oPC) && !GetLocalInt(oWaypoint,"IS_BLOCKED")) { CreateObject(OBJECT_TYPE_PLACEABLE,"template",GetLocation(oWaypoint),FALSE,"ob_inviswall01"); SetLocalInt(oWaypoint,"IS_BLOCKED",1);}if (!GetIsInCombat(oPC) && GetLocalInt(oWaypoint,"IS_BLOCKED")) { DestroyObject(GetObjectByTag("ob_inviswall01")); DeleteLocalInt(oWaypoint,"IS_BLOCKED");}
Dry code, warning.
 
Top Bottom