jrc24 Posted June 27, 2004 Share Posted June 27, 2004 how must I write that ? I want return TRUE if I have an item AND an other item too and FALSE if not. exemple : I want return TRUE if I have Bacca sword AND Heavy blaster, FALSE if not. I know it begins by : int StartingConditional() other question : is there an index or some files where I can find some commands and "name of things" (exemple : K_STAR_MAP) thank you Link to comment Share on other sites More sharing options...
Darth333 Posted June 27, 2004 Share Posted June 27, 2004 here are two examples: int nStar = GetGlobalNumber("K_STAR_MAP"); int nResult = GetGlobalNumber("KOR_DANEL"); if ((nResult == 6) && (nStar==50)) int nResult = GetGlobalNumber("KOR_DANEL"); int nPlot = GetGlobalBoolean("K_SWG_DUSTIL1"); if ((nResult == 6) && (nPlot == FALSE)) MOst useful .nss file is nwscript.nss You may also find useful TK012's Global Variable Comparison tool. (Check the Guide for the Newbie sticky for special tools) Link to comment Share on other sites More sharing options...
jrc24 Posted June 27, 2004 Author Share Posted June 27, 2004 thank you for your explanation (if &&) where can I find a item name list please ? (not item name type g_x_xxxxxx) this type : K_STAR_MAP KOR_DANEL etc... thank you very much Link to comment Share on other sites More sharing options...
Darth333 Posted June 27, 2004 Share Posted June 27, 2004 Use the Global Variable Comparison tool Link to comment Share on other sites More sharing options...
jrc24 Posted June 27, 2004 Author Share Posted June 27, 2004 ok I took a look on Global Variable Comparison tool, i see it can be very usefull. but i would ask to you something can I do that ? int ? = GetObjectByTag("k35_itm_sithhpass"); int ? = GetObjectByTag("g_w_vbroswrd05"); if ((? == ?) && (? == ?)) if yes what must I put instead of ? thank you very much darth333 Link to comment Share on other sites More sharing options...
Darth333 Posted June 27, 2004 Share Posted June 27, 2004 I haven't tested this and it might not work but you could try: int StartingConditional() { object oPC = GetPCSpeaker(); object oSword = GetItemPossessedBy(oPC, "g_w_vbroswrd05"); object oPass = GetItemPossessedBy(oPC, "k35_itm_sithpass"); if ((GetIsObjectValid(oSword) == TRUE) && (GetIsObjectValid(oPass) == TRUE)) { return TRUE; } else { return FALSE; } } Link to comment Share on other sites More sharing options...
jrc24 Posted June 27, 2004 Author Share Posted June 27, 2004 I try that : I speak with Zaalbar, he has g_w_vbroswrd05 and g_i_belt012 int StartingConditional() { object oPC = GetPCSpeaker(); object oSword = GetItemPossessedBy(oPC, "g_w_vbroswrd05"); object oBelt = GetItemPossessedBy(oPC, "g_i_belt012"); if ((GetIsObjectValid(oSword) == TRUE) && (GetIsObjectValid(oBelt) == TRUE)) { return TRUE; } else { return FALSE; } } it doesn t work ---------------------- I try that too : int StartingConditional() { object oPC = GetPCSpeaker(); object oSword = GetItemPossessedBy(oPC, "g_w_vbroswrd05"); object oBelt = GetItemPossessedBy(oPC, "g_i_belt012"); if ((GetIsObjectValid(oSword) == TRUE) && (GetIsObjectValid(oBelt) == TRUE)) { return TRUE; } return FALSE; } it doesn t work ----------------------- if I write that : int StartingConditional() { int nStar = GetGlobalNumber("K_STAR_MAP"); int nResult = GetGlobalNumber("K_XOR_AMBUSH"); if ((nResult == 2) && (nStar==50)) { return TRUE; } return FALSE; } it works very well ------------------------ if you see what could be the problem thank you Link to comment Share on other sites More sharing options...
tk102 Posted June 27, 2004 Share Posted June 27, 2004 I've found it's less confusing to myself if I use the GetObjectByTag function for nearly everything. So instead of oPC=GetPCSpeaker(); , which is the same as GetFirstPC() in this case, try oPC=GetObjectByTag("Zaalbar"); Link to comment Share on other sites More sharing options...
jrc24 Posted June 27, 2004 Author Share Posted June 27, 2004 yeeeeeeeeees !! with oPC=GetObjectByTag("Zaalbar"); it works !! :D a last question, if I want that the script verify if I have some items but not on a NPC but everywhere : on NPC, on FirstPC and in Inventory. because for exemple, sith pass is not on NPC or FirstPC if you know thank you very much darth333 and tk102 Link to comment Share on other sites More sharing options...
tk102 Posted June 27, 2004 Share Posted June 27, 2004 I think this should work. int StartingConditional() { int nFound=FALSE; object oPC=GetFirstPC(); object oThisItem=GetFirstItemInInventory(oPC); while (GetIsObjectValid(oThisItem)) { if (GetTag(oThisItem)=="k35_itm_sithpass") { nFound=TRUE; break; } oThisItem=GetNextItemInInventory(oPC); } return nFound; } Link to comment Share on other sites More sharing options...
jrc24 Posted June 27, 2004 Author Share Posted June 27, 2004 ok I check your script in the game it works very well It seeks the item in inventory and it find it, but it never find the item if the item is in firstpc hand or other party member hand or head or arm (for mask and armband) what must I write if I want the script seeks in inventory and in equiped items of each party member and fisrtpc ? thank you Link to comment Share on other sites More sharing options...
tk102 Posted June 27, 2004 Share Posted June 27, 2004 int StartingConditional() { int nFound=FALSE; object oPC=GetFirstPC(); object oThisItem=GetFirstItemInInventory(oPC); while (GetIsObjectValid(oThisItem)) { if (GetTag(oThisItem)=="k35_itm_sithpass") { nFound=TRUE; break; } oThisItem=GetNextItemInInventory(oPC); } if (!nFound) { while (GetIsObjectValid(oPC)) { oThisItem=GetItemPossessedBy(oPC, "k35_itm_sithpass"); if (GetIsObjectValid(oThisItem)) { nFound=TRUE; break; } oPC=GetNextPC(); } } return nFound; } Bring it on jrc24! Link to comment Share on other sites More sharing options...
jrc24 Posted June 27, 2004 Author Share Posted June 27, 2004 really thank you, I learn many things today with your last script, I can do that I wanted when I posted this thread. but there is a thing : oPC=GetNextPC(); doesn t work the script seeks and finds items in firstpc inventory and in firstpc equipped items, but not in other party member equipped items I don t need but if you know why that is not working it is very interesting thank you Link to comment Share on other sites More sharing options...
tk102 Posted June 27, 2004 Share Posted June 27, 2004 Try inserting oPC=GetFirstPC(); in between if (!nFound) { and while (GetIsObjectValid(oPC)) { Maybe it needs to be reminded where it left off... Link to comment Share on other sites More sharing options...
jrc24 Posted June 27, 2004 Author Share Posted June 27, 2004 no, problem persists....... Link to comment Share on other sites More sharing options...
tk102 Posted June 28, 2004 Share Posted June 28, 2004 Not to be daunted: int StartingConditional() { int nFound=FALSE; int nIndex; object oPC=GetFirstPC(); object oThisItem=GetFirstItemInInventory(oPC); while (GetIsObjectValid(oThisItem)) { if (GetTag(oThisItem)=="k35_itm_sithpass") { nFound=TRUE; break; } oThisItem=GetNextItemInInventory(oPC); } if (!nFound) { for (nIndex=0; nIndex<10; nIndex++) { oPC=GetPartyMemberByIndex(nIndex); if (GetIsObjectValid(oPC)) { oThisItem=GetItemPossessedBy(oPC, "k35_itm_sithpass"); if (GetIsObjectValid(oThisItem)) { nFound=TRUE; break; } } } } return nFound; } Link to comment Share on other sites More sharing options...
jrc24 Posted June 28, 2004 Author Share Posted June 28, 2004 no darth333, tk102 give me the same lines a little higher this script continues to have the same behavior I think it is possible to get that we want by creating object for each party member and ask to script to seeks every possessed object of each party member but the script become longer and it is obvious that your system will be better if it will work. thanks Link to comment Share on other sites More sharing options...
tk102 Posted June 28, 2004 Share Posted June 28, 2004 Yes that is the next step. I think you can carry on from here... Link to comment Share on other sites More sharing options...
Darth333 Posted June 28, 2004 Share Posted June 28, 2004 I think you found the viable solution jrc24 Just an observation on what i noticed in Kotor: I've been looking at how the game deals with this. It is obvious that there are similar checks in some situations. Per example, the sith papers you need to get to lower taris or the Krayt Dragon Pearl that you may give to the Sand people. for the sith papers hte script is this one: int StartingConditional() { return(GetIsObjectValid(GetItemPossessedBy(GetFirstPC(),"ptar_sithpapers"))); } That is not a problem, since the sith papers are not equippable. For the pearl, it's this: int StartingConditional() { object oPC = GetPCSpeaker(); object oDragonPearl = GetItemPossessedBy(oPC, "tat18_dragonprl"); if (GetIsObjectValid(oDragonPearl) == TRUE) { return TRUE; } else { return FALSE; } } So basically the same thing. Now, if I recall, if you equip your lightsaber with that pearl before speaking to the sand people, they will continue to tell you to get the pearl... same thing with the gaffi stick: when the player has it, no problem but equip another npc with it and the conversation options simply don't appear. Now, there are some checks too to see if you have sith uniform equipped or the sand people robes per example. The scripts are different. Those "items" are actually disguises (look at k_ptat_sandper.nss and k_ptar_sitharm.nss and those two disguises appear in the spells.2da file. Link to comment Share on other sites More sharing options...
jrc24 Posted June 28, 2004 Author Share Posted June 28, 2004 THANK YOU VERY MUCH TK102 AND DARTH333 FOR ALL THIS VERY INTERESTING INFORMATIONS !!! :D :D :D :D :D Link to comment Share on other sites More sharing options...
Veldrin Posted December 26, 2004 Share Posted December 26, 2004 Ok I use this script but something is wrong. Maybe in dlg file. I wrote this script, and in dlg file in the Starting list in script line, wrote the name of script. But it doesen't work My script: int StartingConditional() { int nFound=FALSE; object oPC=GetFirstPC(); object oThisItem=GetFirstItemInInventory(oPC); while (GetIsObjectValid(oThisItem)) { if (GetTag(oThisItem)=="k35_itm_sithpass") { nFound=TRUE; break; } oThisItem=GetNextItemInInventory(oPC); } return nFound; } Everything is like this. Hepl pls!!! Link to comment Share on other sites More sharing options...
Darkkender Posted December 26, 2004 Share Posted December 26, 2004 Originally posted by Veldrin Ok I use this script but something is wrong. Maybe in dlg file. I wrote this script, and in dlg file in the Starting list in script line, wrote the name of script. But it doesen't work My script: int StartingConditional() { int nFound=FALSE; object oPC=GetFirstPC(); object oThisItem=GetFirstItemInInventory(oPC); while (GetIsObjectValid(oThisItem)) { if (GetTag(oThisItem)=="k35_itm_sithpass") { nFound=TRUE; break; } oThisItem=GetNextItemInInventory(oPC); } return nFound; } Everything is like this. Hepl pls!!! Well it looks like a key element of your script is missing would be part of the problem. When you use a while statement in a script or program it is set up similiar to a if (then) else statement. You need to tell the script what to do if your condition is not being met. when tk102 used this scriptabove int StartingConditional() { int nFound=FALSE; int nIndex; object oPC=GetFirstPC(); object oThisItem=GetFirstItemInInventory(oPC); while (GetIsObjectValid(oThisItem)) { if (GetTag(oThisItem)=="k35_itm_sithpass") { nFound=TRUE; break; } oThisItem=GetNextItemInInventory(oPC); } if (!nFound) { for (nIndex=0; nIndex<10; nIndex++) { oPC=GetPartyMemberByIndex(nIndex); if (GetIsObjectValid(oPC)) { oThisItem=GetItemPossessedBy(oPC, "k35_itm_sithpass"); if (GetIsObjectValid(oThisItem)) { nFound=TRUE; break; } } } } return nFound; } it established the extra switch in the if (!nFound) portion of the script. Even though it does not appear as part of the code for the while statement it is there for the rest of the time when the while does not apply. Link to comment Share on other sites More sharing options...
Veldrin Posted December 27, 2004 Share Posted December 27, 2004 This is link to my Test mod :http://members.lycos.co.uk/jabusan/test.MOD Please test it and find Bugs. PLS.!! What I must do? What like script? Wrote it pls!!! Link to comment Share on other sites More sharing options...
Guest waterhammer Posted December 27, 2004 Share Posted December 27, 2004 Veldrin, I looked at your dialog in GFF editor and I see your starting list has the condition script in the second node and no condition in the first node. This means that the first node will always get spoken and never the second node. You should put your condition first and then, if that fails, the other thing will be spoken. Also I looked at your .nss file but it does not have this final part: return nFound; In fact it seems to miss a } at the end too so it could not compile for me until I added it. If you don't have the return nFound part then it will always return false. Hope this helps. Link to comment Share on other sites More sharing options...
Veldrin Posted December 28, 2004 Share Posted December 28, 2004 Ok thx. I change the script to the first line and it works:D In fact I create new script: In Firts tree script is when we HAVE item, looks like that: int StartingConditional() { int nFound=FALSE; int nIndex; object oPC=GetFirstPC(); object oThisItem=GetFirstItemInInventory(oPC); while (GetIsObjectValid(oThisItem)) { if (GetTag(oThisItem)=="ITEMTAG") { nFound=TRUE; break; } oThisItem=GetNextItemInInventory(oPC); } if (!nFound) { for (nIndex=0; nIndex<10; nIndex++) { oPC=GetPartyMemberByIndex(nIndex); if (GetIsObjectValid(oPC)) { oThisItem=GetItemPossessedBy(oPC, "ITEMTAG"); if (GetIsObjectValid(oThisItem)) { nFound=TRUE; break; } } } } return nFound; } And in the Second Tree when we HAVEN'T item scirpt is like that: int StartingConditional() { int nFound=TRUE; int nIndex; object oPC=GetFirstPC(); object oThisItem=GetFirstItemInInventory(oPC); while (GetIsObjectValid(oThisItem)) { if (GetTag(oThisItem)=="ITEMTAG") { nFound=FALSE; break; } oThisItem=GetNextItemInInventory(oPC); } if (!nFound) { for (nIndex=0; nIndex<10; nIndex++) { oPC=GetPartyMemberByIndex(nIndex); if (GetIsObjectValid(oPC)) { oThisItem=GetItemPossessedBy(oPC, "ITEMTAG"); if (GetIsObjectValid(oThisItem)) { nFound=FALSE; break; } } } } return nFound; } Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.