redrob41 Posted November 3, 2010 Share Posted November 3, 2010 This is for TSL (for the RoR mod). I need some help with scripts. Specifically, I want a script that will fire either on heartbeat or in a dialog, and create a custom item on the player character's hidden item slot. The tricky part, is that I want to have several different custom items, and I want the script to place the correct one based on the player character's line of the appearance.2da file. I have several different alien species, and I want to place a species specific dummy feat on the character (similar to my K1 mod, with how it was accomplished explained in this thread). The problem with that K1 mod, is that during the dialog you are asked what species you are, and you can tell the truth, or lie. I want to avoid that by having the script determine which line of the appearance.2da you are using. I realize that in order for that to work, the appearance.2da has to be set in stone, so that the row numbers don't change (We're ok with that on RoR, because the mod is too huge to add it to an existing modded override folder - the patcher bogs down). For example, if I pick a Zeltron (row 735, 736, 737, 808, 809 & 810 of appearance.2da) during character creation, when I start the game, I want a script to put a file called "PC_HIDE_RR41_ZEL.uti" into the player's hidden item slot. Or, if I pick a Chiss (row 707, 708, 709, 786, 787, 788), it will place "PC_HIDE_RR41_CHS.uti" etcetera. These items will link to a dummy feat that explains the history of the species, as well as acting as a new check for dialog options. I'm guessing that part of the script will probably look something like (courtesy of Stoffe): void main() { object oPC = GetFirstPC(); AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_ZEL", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } but I don't know how to work in the row of the 2da file. If anyone has any insight they can bestow upon me, I would be very greatful Link to comment Share on other sites More sharing options...
Darth Elessar Posted November 3, 2010 Share Posted November 3, 2010 I'm not a modder, but found a couple threads that might help (depending if you want a conditional script or a regular script: Conditional script Regular script Hope you find them useful. Link to comment Share on other sites More sharing options...
Qui-Gon Glenn Posted November 3, 2010 Share Posted November 3, 2010 Interesting... and I am most hopeful that you can find a resolution to this, as I have had a similar issue in the past that has frustrated me... specifically, not knowing how to look thru different .2das in-game. I looked around the intrawebz, and saw Darkkender over at the BioWare forums (NWN subforum) talking about this somewhat, although not exactly on your point. Looking thru the lexicon, I found this and was then struck by the likelihood that that function set was stripped from the KotOR version of the engine. The logic and script to make it all happen is easy, and mostly done as you have posted half of it! The other idea I had was if a boolean could be set through the character creation process. If that could be the case, then there is no need to look through the app.2da, you could just have a large switch statement, and a boolean made with values corresponding to each of your racial types. Anyways, hope that others can provide more helpful assistance... I am hoping there is a solution for your sake and my own!! Link to comment Share on other sites More sharing options...
redrob41 Posted November 3, 2010 Author Share Posted November 3, 2010 I just downloaded a copy of nwscript.nss to look through at work. I did a quick search for "appearance" and found a few strings: // 463: Create a Disguise effect. // - * nDisguiseAppearance: DISGUISE_TYPE_*s effect EffectDisguise(int nDisguiseAppearance); // 500: void DuplicateHeadAppearance(object oidCreatureToChange, object oidCreatureToMatch); // 524: Returns the appearance type of oCreature (0 if creature doesn't exist) // - oCreature int GetAppearanceType(object oCreature); // 850 // ChangeObjectAppearance // oObjectToChange = Object to change appearance of // nAppearance = appearance to change to (from appearance.2da) void ChangeObjectAppearance( object oObjectToChange, int nAppearance ); I'm thinking that //524 might be useful Conditional script Regular script Thanks. I found the second thread (talks about //850) while searching around, but I must have missed that first one (talks about //524). The other idea I had was if a boolean could be set through the character creation process. If that could be the case, then there is no need to look through the app.2da, you could just have a large switch statement, and a boolean made with values corresponding to each of your racial types. you lost me at boolean Looks like I'll have to learn even more than I bargained for. Edit: I'm doing a search for "GetAppearanceType" and I'm finding some interesting threads, like this one (stoffe has the answers once again ). Edit 2: I also found this thread, which pretty much looks like an answer to my own problem. I'll have to experiament with it tonight. Link to comment Share on other sites More sharing options...
zbyl2 Posted November 3, 2010 Share Posted November 3, 2010 I recall doing something similar once (though I don't remember what it was for. Nevermind), a script would look like this: if(GetAppearanceType(GetFirstPC()) == X) {// replace "X" with line's number from appearance.2da file //Spawn items and do any other stuff you need here } else if(GetAppearanceType(GetFirstPC()) == X) //and redo it however many times you need for each appearance Hope that helps And tell me if something isn't clear enough. Link to comment Share on other sites More sharing options...
logan23 Posted November 4, 2010 Share Posted November 4, 2010 @zbyl2 I was able to compile the script. void main () { object oPC = GetFirstPC(); if(GetAppearanceType(GetFirstPC()) == 88) { // replace "X" with line's number from appearance.2da file //Spawn items and do any other stuff you need here AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_ZEL", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } if(GetAppearanceType(GetFirstPC()) == 87){ AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_ZEL", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); //and redo it however many times you need for each appearance } if(GetAppearanceType(GetFirstPC()) == 85){ AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_ZEL", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); //and redo it however many times you need for each appearance } } Have you ever tested yours? I will test this this week or weekend. I plan to place this into the first dlg conversation. If this works then we will be able to have NPCs recognize the PC, fingers crossed:thmbup1: thanks! Logan Link to comment Share on other sites More sharing options...
redrob41 Posted November 4, 2010 Author Share Posted November 4, 2010 Have you ever tested yours? I will test this this week or weekend. I plan to place this into the first dlg conversation. If this works then we will be able to have NPCs recognize the PC, fingers crossed:thmbup1: thanks! Logan I haven't tested it yet, but this is what I've come up with: // File name is SpeciesHideItem.nss void main () { object oPC = GetFirstPC(); int nAppearance = GetAppearanceType(oPC); int nStack = 1; if (nAppearance == 685) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_HUM", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 686) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_HUM", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 687) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_HUM", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 688) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_HUM", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 689) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_HUM", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 690) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_HUM", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 691) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_HUM", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 692) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_HUM", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 693) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_HUM", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 694) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_HUM", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 695) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_HUM", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 696) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_HUM", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 697) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_HUM", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 698) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_HUM", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 699) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_HUM", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 700) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_HUM", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 701) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_ARK", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 702) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_ARK", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 703) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_ARK", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 704) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_OFF", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 705) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_OFF", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 706) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_OFF", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 707) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_CHS", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 708) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_CHS", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 709) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_CHS", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 710) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_ECH", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 711) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_ECH", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 712) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_ECH", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 713) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_KAZ", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 714) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_KAZ", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 715) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_KAZ", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 716) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_KIF", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 717) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_KIF", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 718) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_KIF", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 719) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_MRK", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 720) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_MRK", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 721) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_MRK", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 722) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_MRL", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 723) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_MRL", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 724) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_MRL", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 725) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_RAT", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 726) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_RAT", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 727) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_RAT", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 728) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_RAT", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 729) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_RAT", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 730) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_RAT", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 731) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_RAT", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 732) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_RAT", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 733) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_RAT", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 734) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_RAT", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 735) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_ZEL", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 736) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_ZEL", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 737) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_ZEL", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 738) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 739) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 740) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 741) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 742) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 743) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 744) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 745) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 746) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 747) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 748) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 749) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 750) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 751) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 752) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 753) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 754) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 755) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 756) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 757) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 758) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 759) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 760) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 761) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 762) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_DEV", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 763) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_DEV", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 764) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_DEV", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 765) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_HUM", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 766) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_HUM", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 767) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_HUM", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 768) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_HUM", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 769) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_HUM", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 770) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_HUM", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 771) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_HUM", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 772) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_HUM", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 773) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_HUM", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 774) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_HUM", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 775) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_HUM", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 776) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_HUM", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 777) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_HUM", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 778) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_HUM", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 779) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_HUM", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 780) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_ARK", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 781) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_ARK", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 782) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_ARK", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 783) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_OFF", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 784) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_OFF", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 785) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_OFF", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 786) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_CHS", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 787) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_CHS", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 788) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_CHS", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 789) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_ECH", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 790) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_ECH", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 791) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_ECH", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 792) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_KAZ", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 793) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_KAZ", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 794) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_KAZ", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 795) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_KIF", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 796) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_KIF", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 797) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_KIF", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 798) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_MRK", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 799) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_MRK", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 800) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_MRK", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 801) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_MRL", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 802) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_MRL", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 803) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_MRL", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 804) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_RAT", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 805) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_RAT", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 806) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_RAT", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 807) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_RAT", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 808) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_ZEL", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 809) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_ZEL", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 810) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_ZEL", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 811) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 812) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 813) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 814) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 815) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 816) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 817) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 818) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 819) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 820) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 821) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 822) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 823) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 824) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 825) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 826) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 827) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 828) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 829) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 830) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 831) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 832) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 833) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 834) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } } I was able to compile it with Kotor Tool. Question: should the last one say "else if (nAppear..." or should it just say "else (nAppear..."? Link to comment Share on other sites More sharing options...
TimBob12 Posted November 4, 2010 Share Posted November 4, 2010 no it needs to say "else if" Otherwise it won't work. Else is used when none of the if statements you have written are fulfilled so it is often used in normal programming for error messages. Link to comment Share on other sites More sharing options...
ForeverNight Posted November 4, 2010 Share Posted November 4, 2010 maybe add this to the end? else{ SendMessageToPC(GetFirstPC(),"Something in here didn't work right, go back and check it out")); } check the feedback log after the conversation and see if this showed up. For more debugging add a line like that and the end of each else if that describes what happened or something unique to it and then after the script fires check to see that it fired right through the feedback message. Link to comment Share on other sites More sharing options...
zbyl2 Posted November 4, 2010 Share Posted November 4, 2010 Looking at Redrob's script, I see you've got lot of "if" statements spawning the same item. Just a suggestion, it would be cleaner and probably easier to do that way: if (nAppearance == 685 || nAppearance == 686 || nAppearance == 687 || nAppearance == 688 || nAppearance == 689 || nAppearance == 690 || nAppearance == 691 || nAppearance == 692 || nAppearance == 693 || nAppearance == 694 || nAppearance == 695 || nAppearance == 696 || nAppearance == 697 || nAppearance == 698 || nAppearance == 699 || nAppearance == 700) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_HUM", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if(...)//again Link to comment Share on other sites More sharing options...
redrob41 Posted November 4, 2010 Author Share Posted November 4, 2010 Looking at Redrob's script, I see you've got lot of "if" statements spawning the same item. Just a suggestion, it would be cleaner and probably easier to do that way: Thanks, so , you mean something like this: // File name is SpeciesHideItem.nss void main () { object oPC = GetFirstPC(); int nAppearance = GetAppearanceType(oPC); int nStack = 1; if (nAppearance == 685 || nAppearance == 686 || nAppearance == 687 || nAppearance == 688 || nAppearance == 689 || nAppearance == 690 || nAppearance == 691 || nAppearance == 692 || nAppearance == 693 || nAppearance == 694 || nAppearance == 695 || nAppearance == 696 || nAppearance == 697 || nAppearance == 698 || nAppearance == 699 || nAppearance == 700 || nAppearance == 765 || nAppearance == 766 || nAppearance == 767 || nAppearance == 768 || nAppearance == 769 || nAppearance == 770 || nAppearance == 771 || nAppearance == 772 || nAppearance == 773 || nAppearance == 774 || nAppearance == 775 || nAppearance == 776 || nAppearance == 777 || nAppearance == 778 || nAppearance == 779) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_HUM", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 701 || nAppearance == 702 || nAppearance == 703 || nAppearance == 780 || nAppearance == 781 || nAppearance == 782) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_ARK", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 704 || nAppearance == 705 || nAppearance == 706 || nAppearance == 783 || nAppearance == 784 || nAppearance == 785) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_OFF", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 707 || nAppearance == 708 || nAppearance == 709 || nAppearance == 786 || nAppearance == 787 || nAppearance == 788) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_CHS", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 710 || nAppearance == 711 || nAppearance == 712 || nAppearance == 789 || nAppearance == 790 || nAppearance == 791) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_ECH", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 713 || nAppearance == 714 || nAppearance == 715 || nAppearance == 792 || nAppearance == 793 || nAppearance == 794) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_KAZ", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 716 || nAppearance == 717 || nAppearance == 718 || nAppearance == 795 || nAppearance == 796 || nAppearance == 797) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_KIF", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 719 || nAppearance == 720 || nAppearance == 721 || nAppearance == 798 || nAppearance == 799 || nAppearance == 800) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_MRK", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 722 || nAppearance == 723 || nAppearance == 724 || nAppearance == 801 || nAppearance == 802 || nAppearance == 803) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_MRL", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 725 || nAppearance == 726 || nAppearance == 727 || nAppearance == 728 || nAppearance == 729 || nAppearance == 730 || nAppearance == 731 || nAppearance == 732 || nAppearance == 733 || nAppearance == 734 || nAppearance == 804 || nAppearance == 805 || nAppearance == 806 || nAppearance == 807) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_RAT", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 735 || nAppearance == 736 || nAppearance == 737 || nAppearance == 808 || nAppearance == 809 || nAppearance == 810) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_ZEL", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 738 || nAppearance == 739 || nAppearance == 740 || nAppearance == 741 || nAppearance == 742 || nAppearance == 743 || nAppearance == 744 || nAppearance == 745 || nAppearance == 746 || nAppearance == 747 || nAppearance == 748 || nAppearance == 749 || nAppearance == 750 || nAppearance == 751 || nAppearance == 752 || nAppearance == 753 || nAppearance == 754 || nAppearance == 755 || nAppearance == 756 || nAppearance == 757 || nAppearance == 758 || nAppearance == 759 || nAppearance == 760 || nAppearance == 761 || nAppearance == 811 || nAppearance == 812 || nAppearance == 813 || nAppearance == 814 || nAppearance == 815 || nAppearance == 816 || nAppearance == 817 || nAppearance == 818 || nAppearance == 819 || nAppearance == 820 || nAppearance == 821 || nAppearance == 822 || nAppearance == 823 || nAppearance == 824 || nAppearance == 825 || nAppearance == 826 || nAppearance == 827 || nAppearance == 828 || nAppearance == 829 || nAppearance == 830 || nAppearance == 831 || nAppearance == 832 || nAppearance == 833 || nAppearance == 834) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 762 || nAppearance == 763 || nAppearance == 764) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_DEV", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } } Or could I also do this? I only just learned that the two vertical pipes || is a "logical OR". I'm just not sure that if I put them on seperate lines, if I need to put the brackets around the "nAppearance == 685"? If that is how it should be done, it makes it easier to see if I've got all the row numbers correct. // File name is SpeciesHideItem.nss void main () { object oPC = GetFirstPC(); int nAppearance = GetAppearanceType(oPC); int nStack = 1; if (nAppearance == 685) || (nAppearance == 686) || (nAppearance == 687) || (nAppearance == 688) || (nAppearance == 689) || (nAppearance == 690) || (nAppearance == 691) || (nAppearance == 692) || (nAppearance == 693) || (nAppearance == 694) || (nAppearance == 695) || (nAppearance == 696) || (nAppearance == 697) || (nAppearance == 698) || (nAppearance == 699) || (nAppearance == 700) || (nAppearance == 765) || (nAppearance == 766) || (nAppearance == 767) || (nAppearance == 768) || (nAppearance == 769) || (nAppearance == 770) || (nAppearance == 771) || (nAppearance == 772) || (nAppearance == 773) || (nAppearance == 774) || (nAppearance == 775) || (nAppearance == 776) || (nAppearance == 777) || (nAppearance == 778) || (nAppearance == 779) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_HUM", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 701) || (nAppearance == 702) || (nAppearance == 703) || (nAppearance == 780) || (nAppearance == 781) || (nAppearance == 782) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_ARK", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 704) || (nAppearance == 705) || (nAppearance == 706) || (nAppearance == 783) || (nAppearance == 784) || (nAppearance == 785) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_OFF", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 707) || (nAppearance == 708) || (nAppearance == 709) || (nAppearance == 786) || (nAppearance == 787) || (nAppearance == 788) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_CHS", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 710) || (nAppearance == 711) || (nAppearance == 712) || (nAppearance == 789) || (nAppearance == 790) || (nAppearance == 791) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_ECH", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 713) || (nAppearance == 714) || (nAppearance == 715) || (nAppearance == 792) || (nAppearance == 793) || (nAppearance == 794) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_KAZ", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 716) || (nAppearance == 717) || (nAppearance == 718) || (nAppearance == 795) || (nAppearance == 796) || (nAppearance == 797) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_KIF", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 719) || (nAppearance == 720) || (nAppearance == 721) || (nAppearance == 798) || (nAppearance == 799) || (nAppearance == 800) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_MRK", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 722) || (nAppearance == 723) || (nAppearance == 724) || (nAppearance == 801) || (nAppearance == 802) || (nAppearance == 803) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_MRL", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 725) || (nAppearance == 726) || (nAppearance == 727) || (nAppearance == 728) || (nAppearance == 729) || (nAppearance == 730) || (nAppearance == 731) || (nAppearance == 732) || (nAppearance == 733) || (nAppearance == 734) || (nAppearance == 804) || (nAppearance == 805) || (nAppearance == 806) || (nAppearance == 807) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_RAT", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 735) || (nAppearance == 736) || (nAppearance == 737) || (nAppearance == 808) || (nAppearance == 809) || (nAppearance == 810) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_ZEL", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 738) || (nAppearance == 739) || (nAppearance == 740) || (nAppearance == 741) || (nAppearance == 742) || (nAppearance == 743) || (nAppearance == 744) || (nAppearance == 745) || (nAppearance == 746) || (nAppearance == 747) || (nAppearance == 748) || (nAppearance == 749) || (nAppearance == 750) || (nAppearance == 751) || (nAppearance == 752) || (nAppearance == 753) || (nAppearance == 754) || (nAppearance == 755) || (nAppearance == 756) || (nAppearance == 757) || (nAppearance == 758) || (nAppearance == 759) || (nAppearance == 760) || (nAppearance == 761) || (nAppearance == 811) || (nAppearance == 812) || (nAppearance == 813) || (nAppearance == 814) || (nAppearance == 815) || (nAppearance == 816) || (nAppearance == 817) || (nAppearance == 818) || (nAppearance == 819) || (nAppearance == 820) || (nAppearance == 821) || (nAppearance == 822) || (nAppearance == 823) || (nAppearance == 824) || (nAppearance == 825) || (nAppearance == 826) || (nAppearance == 827) || (nAppearance == 828) || (nAppearance == 829) || (nAppearance == 830) || (nAppearance == 831) || (nAppearance == 832) || (nAppearance == 833) || (nAppearance == 834) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_TWI", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } else if (nAppearance == 762) || (nAppearance == 763) || (nAppearance == 764) { AssignCommand(oPC, ActionEquipItem( CreateItemOnObject("PC_HIDE_RR41_DEV", oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } } For more debugging add a line like that and the end of each else if that describes what happened or something unique to it and then after the script fires check to see that it fired right through the feedback message. Good Idea. I'll have to add in the strings of text for testing purposes later. Link to comment Share on other sites More sharing options...
VarsityPuppet Posted November 4, 2010 Share Posted November 4, 2010 Or something like this: Show spoiler (hidden content - requires Javascript to show) // File name is SpeciesHideItem.nss void main () { object oPC = GetFirstPC(); int nAppearance = GetAppearanceType(oPC); int nStack = 1; string sFeat; //HUMANS if (nAppearance >= 685 && nAppearance <= 700) { sFeat = "PC_HIDE_RR41_HUM"; } else if (nAppearance >= 685 && nAppearance <= 779) { sFeat = "PC_HIDE_RR41_HUM"; } //ARKANIANS else if (nAppearance >= 701 && nAppearance <= 703) { sFeat = "PC_HIDE_RR41_ARK"; } else if (nAppearance >= 780 && nAppearance <= 782) { sFeat = "PC_HIDE_RR41_ARK"; } //ARKANIAN OFFSHOOT else if (nAppearance >= 704 && nAppearance <= 706) { sFeat = "PC_HIDE_RR41_OFF"; } else if (nAppearance >= 783 && nAppearance <= 784) { sFeat = "PC_HIDE_RR41_OFF"; } //CHISS else if (nAppearance >= 707 && nAppearance <= 709) { sFeat = "PC_HIDE_RR41_CHS"; } else if (nAppearance >= 786 && nAppearance <= 788) { sFeat = "PC_HIDE_RR41_CHS"; } //ECHANI else if (nAppearance >= 710 && nAppearance <= 712) { sFeat = "PC_HIDE_RR41_ECH"; } else if (nAppearance >= 789 && nAppearance <= 791) { sFeat = "PC_HIDE_RR41_ECH"; } //KAZ WHATEVER else if (nAppearance >= 713 && nAppearance <= 715) { sFeat = "PC_HIDE_RR41_KAZ"; } else if (nAppearance >= 792 && nAppearance <= 794) { sFeat = "PC_HIDE_RR41_KAZ"; } //KIFFAR else if (nAppearance >= 716 && nAppearance <= 718) { sFeat = "PC_HIDE_RR41_KIF"; } else if (nAppearance >= 795 && nAppearance <= 797) { sFeat = "PC_HIDE_RR41_KIF"; } //MRK else if (nAppearance >= 719 && nAppearance <= 721) { sFeat = "PC_HIDE_RR41_MRK"; } else if (nAppearance >= 798 && nAppearance <= 800) { sFeat = "PC_HIDE_RR41_MRK"; } //MIRALUKAS? else if (nAppearance >= 722 && nAppearance <= 724) { sFeat = "PC_HIDE_RR41_MRL"; } else if (nAppearance >= 801 && nAppearance <= 803) { sFeat = "PC_HIDE_RR41_MRL"; } //RATTATAKI else if (nAppearance >= 724 && nAppearance <= 734) { sFeat = "PC_HIDE_RR41_RAT"; } else if (nAppearance >= 804 && nAppearance <= 807) { sFeat = "PC_HIDE_RR41_RAT"; } //ZELTRON else if (nAppearance >= 735 && nAppearance <= 737) { sFeat = "PC_HIDE_RR41_ZEL"; } else if (nAppearance >= 808 && nAppearance <= 810) { sFeat = "PC_HIDE_RR41_ZEL"; } //TWILEKS else if (nAppearance >= 738 && nAppearance <= 761) { sFeat = "PC_HIDE_RR41_TWI"; } else if (nAppearance >= 811 && nAppearance <= 834) { sFeat = "PC_HIDE_RR41_TWI"; } //DEVARONIANS else if (nAppearance >= 762 && nAppearance <= 764) { sFeat = "PC_HIDE_RR41_DEV"; } AssignCommand(oPC, ActionEquipItem( CreateItemOnObject(sFeat, oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } Link to comment Share on other sites More sharing options...
Qui-Gon Glenn Posted November 4, 2010 Share Posted November 4, 2010 @VP - the most clear coding so far... nicely laid out so its readable!!! I wish everyone were so thoughtful The else if's seem a little overused here.... couldn't this be accomplished a little more simply with a case/switch? Link to comment Share on other sites More sharing options...
redrob41 Posted November 4, 2010 Author Share Posted November 4, 2010 Or something like this: This cat is getting skinned six ways to Sunday Thanks VP, that does look a lot tidier. I had to go through it, and edit a few typo numbers, so it looks like this now: // File name is SpeciesHideItem.nss void main () { object oPC = GetFirstPC(); int nAppearance = GetAppearanceType(oPC); int nStack = 1; string sFeat; //HUMANS if (nAppearance >= 685 && nAppearance <= 700) { sFeat = "PC_HIDE_RR41_HUM"; } else if (nAppearance >= 765 && nAppearance <= 779) { sFeat = "PC_HIDE_RR41_HUM"; } //ARKANIANS else if (nAppearance >= 701 && nAppearance <= 703) { sFeat = "PC_HIDE_RR41_ARK"; } else if (nAppearance >= 780 && nAppearance <= 782) { sFeat = "PC_HIDE_RR41_ARK"; } //ARKANIAN OFFSHOOT else if (nAppearance >= 704 && nAppearance <= 706) { sFeat = "PC_HIDE_RR41_OFF"; } else if (nAppearance >= 783 && nAppearance <= 785) { sFeat = "PC_HIDE_RR41_OFF"; } //CHISS else if (nAppearance >= 707 && nAppearance <= 709) { sFeat = "PC_HIDE_RR41_CHS"; } else if (nAppearance >= 786 && nAppearance <= 788) { sFeat = "PC_HIDE_RR41_CHS"; } //ECHANI else if (nAppearance >= 710 && nAppearance <= 712) { sFeat = "PC_HIDE_RR41_ECH"; } else if (nAppearance >= 789 && nAppearance <= 791) { sFeat = "PC_HIDE_RR41_ECH"; } //KALZERIAN else if (nAppearance >= 713 && nAppearance <= 715) { sFeat = "PC_HIDE_RR41_KAZ"; } else if (nAppearance >= 792 && nAppearance <= 794) { sFeat = "PC_HIDE_RR41_KAZ"; } //KIFFAR else if (nAppearance >= 716 && nAppearance <= 718) { sFeat = "PC_HIDE_RR41_KIF"; } else if (nAppearance >= 795 && nAppearance <= 797) { sFeat = "PC_HIDE_RR41_KIF"; } //MIRALUKA else if (nAppearance >= 719 && nAppearance <= 721) { sFeat = "PC_HIDE_RR41_MRK"; } else if (nAppearance >= 798 && nAppearance <= 800) { sFeat = "PC_HIDE_RR41_MRK"; } //MIRIALAN else if (nAppearance >= 722 && nAppearance <= 724) { sFeat = "PC_HIDE_RR41_MRL"; } else if (nAppearance >= 801 && nAppearance <= 803) { sFeat = "PC_HIDE_RR41_MRL"; } //RATTATAKI else if (nAppearance >= 725 && nAppearance <= 734) { sFeat = "PC_HIDE_RR41_RAT"; } else if (nAppearance >= 804 && nAppearance <= 807) { sFeat = "PC_HIDE_RR41_RAT"; } //ZELTRON else if (nAppearance >= 735 && nAppearance <= 737) { sFeat = "PC_HIDE_RR41_ZEL"; } else if (nAppearance >= 808 && nAppearance <= 810) { sFeat = "PC_HIDE_RR41_ZEL"; } //TWILEKS else if (nAppearance >= 738 && nAppearance <= 761) { sFeat = "PC_HIDE_RR41_TWI"; } else if (nAppearance >= 811 && nAppearance <= 834) { sFeat = "PC_HIDE_RR41_TWI"; } //DEVARONIANS else if (nAppearance >= 762 && nAppearance <= 764) { sFeat = "PC_HIDE_RR41_DEV"; } AssignCommand(oPC, ActionEquipItem( CreateItemOnObject(sFeat, oPC), INVENTORY_SLOT_CARMOUR, TRUE )); } Link to comment Share on other sites More sharing options...
VarsityPuppet Posted November 4, 2010 Share Posted November 4, 2010 @VP - the most clear coding so far... nicely laid out so its readable!!! I wish everyone were so thoughtful The else if's seem a little overused here.... couldn't this be accomplished a little more simply with a case/switch? I would have just left them all as If statements. As it goes down the list, there's only one statement that will hold true for it, so don't need an endless list of 'elses'. A switch wouldn't have worked as well, because you'd need to put in each individual number for each case. It'd be about as efficient as the script redrob just posted a few posts up. Link to comment Share on other sites More sharing options...
Qui-Gon Glenn Posted November 5, 2010 Share Posted November 5, 2010 A switch wouldn't have worked as well, because you'd need to put in each individual number for each case. Fair enough. I need to read through the linked threads a little closer... Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.