I am in need of a couple of scripts, if anyone feels like helping me out. ^_^
first off i need a script that, after i have had a conversation with a person, and have received an item, will make it so i can talk to that person again, and not receive that item again.
(or better yet i script that deleats a dialog string.) * or makes it so it can not run in game.*
I forgot what the other one was. . .
i'll edit this if i remember. :ears1:
THANKS!
~DR
Try this...
void main() {
// HH: Will check for boolean and exit if it hase been activated.
int nDlgString = GetGlobalBoolean("global_dr");
if (nDlgString) { return; }
// HH: Start the Dialog.
ActionStartConversation(GetFirstPC(),"dlg_dr");
// HH: Create the item.
// HH: You cam change nQuantity to the number of items.
int nQuantity = 1;
CreateItemOnObject("resref_dr", GetFirstPC(), nQuantity);
// HH: Will set the boolean.
SetGlobalBoolean("global_dr",TRUE);
}
I have added comments in red.
If it's used for ensuring that certain dialog nodes only fire once, but aren't otherwise related to some quest or story event that needs to be checked for elsewhere I'd recommend using Local Booleans set on the NPC you talk to instead, reducing needless global variable use.
Which game is this for? If it's for TSL there are ready-made standard scripts meant for use as condition/action scripts in dialog. On the dialog node you only wish to be reachable once, set the conditional script to c_local_notset and its P1 parameter to 40. Then on the same dialog node set the action script to a_local_set and its P1 parameter to 40.
This would ensure that the dialog node and any child nodes could only be picked (for replies) or triggered (for entries) once.
If you have several such branches in the DLG file for the same NPC, change the P1 parameter value to another unique value between 30 and 64. Make sure you set both the conditional and action script parameter to the same value.
My game is uninstalled and I can't check but on the same principle mentioned by stoffe, wasn't there also a standard script called k_act_talktrue (or a similar name in both K1 and K2) that will ensure that a dlg branch is fired only once?
In such case, just adding k_act_talktrue in the conditional field would ensure that the dialogue branch that is spoken the first time you meet with the npc is spoken only once....that is if I remember well...I am getting a bit rusty :p
DANG! i forgot to put down which game this was for. . . sorry.
i need this script for [K1]
here is what i've done so far.
for the janice droid shop, i have added custom dlg to janice.
at one part of the dlg she will give th PC a datapad.
i'm at odds as to how to make that particular dlg string not appeir in game after i have talked with her.
(so that i can not get more than one datapad, and so it looks a little bit more realistic.)
the second script i need is one that determins if a party memeber is with the PC at the time.
if so that script would enable a certain dlg string, and if not would not.
i'm kinda new to scripting, so i don't know what limetations there are or anything.(nooby) ^_^
thanks!
~DR
in the meen time i'll see if hangouts script works for what i want to do.
My game is uninstalled and I can't check but on the same principle mentioned by stoffe, wasn't there also a standard script called k_act_talktrue (or a similar name in both K1 and K2) that will ensure that a dlg branch is fired only once?
This may work if you have an entirely new NPC. If it's an existing one there is a fair chance it's already in use though, since I think Bioware uses this for making the "Welcome back..." type of dialog responses once you've spoken to an NPC once.
for the janice droid shop, i have added custom dlg to janice.
at one part of the dlg she will give th PC a datapad.
i'm at odds as to how to make that particular dlg string not appeir in game after i have talked with her.
For KotOR1 you'll need to make your own scripts, since it does not support script parameters sent from dialogs. You will need two fairly simple scripts:
The dialog conditional script (st_c_janpad.nss):
// ST: st_c_janpad.nss
int StartingConditional() {
return !GetLocalBoolean(OBJECT_SELF, 9);
}
The dialog action script (st_a_janpad.nss):
// ST: st_a_janpad.nss
void main() {
SetLocalBoolean(OBJECT_SELF, 9, TRUE);
}
Compile those two scripts into NCS files. Then in the dialog file, on the topmost new node you have added which holds the conversation path you only want to be available once, set the st_c_janpad script as conditional script ("Script that determines if node is available" in KotorTool) and the st_a_janpad script as action script ("Script to run for this node" in KotorTool).
This would make the dialog node only available once. After it has been picked it will be blocked out from appearing again.
the second script i need is one that determins if a party memeber is with the PC at the time.
if so that script would enable a certain dlg string, and if not would not.
That depends which party member it is you want to check for. There are a number of existing dialog conditional scripts that check if a party member is currently in the active party, so you won't have to make your own. Pick the script name from the list below and then put it as conditional script ("Script that determines if node is available" in KotorTool) for the node you want to be unique for that party member.
Party member/slot Script name
----------------- -----------
Bastila k_con_bastpm
Carth k_con_carthpm
Canderous k_con_canderpm
HK-47 k_con_hk47pm
Jolee k_con_joleepm
Juhani k_con_juhanipm
Mission k_con_missionpm
T3M4 (not a typo!) k_con_t3m3pm
Zaalbar k_con_zaalbarpm
YAY!!!
thanks stoffe! <(^_^)> <(^_^)J L(^_^)J (>^_^)> <(^_^<)
Edit: ACK!
new question! (sorry)
i'm trying to add a custom datapad to the game. i want the droid shop owner to give it to me, but when i go through all the dlg options, no datapad appeirs i the game. . .
could someone help?
i'm sure that i have the right names for everything. . .
i'm trying to add a custom datapad to the game. i want the droid shop owner to give it to me, but when i go through all the dlg options, no datapad appeirs i the game. . .
What script are you using to give the datapad during the dialog?
oh, sorry.
i'm using.
void main()
{
object oItem=CreateItemOnObject( "droid_data", GetFirstPC());
}
oh, sorry.
i'm using.
void main()
{
object oItem=CreateItemOnObject( "droid_data", GetFirstPC());
}
Nothing wrong with the script itself (though the object reference assignment is unnecessary since you never use it for anything), so the problem must lie in how you use it.
Make sure that the name of the NCS file isn't longer than 16 characters and only contain alphanumerical characters. Make sure you've spelled it properly in the "Script to run for this node" (Action) box in the DLG file, and that you've assigned it to the correct DLG node.
Also make sure you've compiled the script into an NCS file and put that either in the override folder or in the module where it should be used. The same goes for the droid_data.uti file.
thanks i figured out the problem.
my datapad was saved as a uct file instead of a uci...
god, i'm an idiot. XP
i do have one more question.
could you give me a script that will after an event,(such as the PC getting a data pad) will make a custom npc have a differents diolog option, and delete the old dialog.
for instance my npc right now will say.
npc: yes sir, i am ready to serve.
but i want that dialog option to cease working after i have the datapad, and i want it to be replaced by a new dialog string.
thanks for sticking with me!
~DR
could you give me a script that will after an event,(such as the PC getting a data pad) will make a custom npc have a differents diolog option, and delete the old dialog.
for instance my npc right now will say.
npc: yes sir, i am ready to serve.
but i want that dialog option to cease working after i have the datapad, and i want it to be replaced by a new dialog string.
For your alternate dialog paths, add two Entry nodes to your dialog file. Make sure the entry that should be used by the NPC when you have the datapad is listed above the one that should otherwise be used. Then add a conditional script ("Script that determines if node is available" in KotorTool) like the one below to the top node:
// st_c_haspad.nss
int StartingConditional() {
return GetIsObjectValid(GetItemPossessedBy(GetFirstPC(), "droid_data"));
}
This would make the top node only be used if the player has an item with the tag droid_data in their inventory. If your datapad has a different tag, change it in the script above to match what is set inside the UTI file.
Like this:
http://img65.imageshack.us/img65/2949/ktdlgexamplebx3.jpg)
ok, everything is working. as far as i can tell! Thanks stoffe!!!!!! ^_^
EDIT:
GAHH, sorry, but there IS one more thing.
i used the above scripts in the correct fashion, but then realized that the new dlg string should only play once as well, be fore moving on to a totally new dlg string.
i thought that maybe deleting the data pad from the PC's inventory would solve the problem, and at least bring me back to the original dlg string but it didn't work....
could you help me once again?
thanks
~DR
i used the above scripts in the correct fashion, but then realized that the new dlg string should only play once as well, be fore moving on to a totally new dlg string.
If I understand what you want to do correctly you could change the script checking for the datapad to also check a local variable to ensure it is only triggered once. If so, the script might look something like this, provided it's used on an Entry (NPC speak) node and not a Reply (player line) node:
// st_c_haspad1.nss
int StartingConditional() {
int bHasItem = GetIsObjectValid(GetItemPossessedBy(GetFirstPC(), "droid_data"));
int bDoneOnce = GetLocalBoolean(OBJECT_SELF, 8);
if (bHasItem && !bDoneOnce) {
SetLocalBoolean(OBJECT_SELF, 8, TRUE);
return TRUE;
}
return FALSE;
}
ok, thanks stoffe!!!
you are the ultimate scripting genius!
i don't think i'll have any more questions, but if i do i'll jusdt post 'em here again.
but my pc mod should be ready really soon!
thanks again
~DR