TheGreenGoblin Posted July 27, 2006 Share Posted July 27, 2006 I'm trying to create a script to tell Carth to equip an armor I want, here's the script I made (I'm just using p_carth001 for testing), but it doesn't seem to be working. Am I totally off base here, or am I inputting something incorrectly. void main() { object oNPC=GetObjectByTag("p_carth001"); object oOldobject = GetItemInSlot(INVENTORY_SLOT_BODY,OBJECT_SELF); object oNewobject = CreateItemOnObject("g_a_class9001",OBJECT_SELF); if (GetIsObjectValid (oOldobject)) { DestroyObject(oOldobject); } AssignCommand(oNPC,ActionEquipItem(oNewobject,INVENTORY_SLOT_BODY,TRUE)); } Link to comment Share on other sites More sharing options...
Darth333 Posted July 27, 2006 Share Posted July 27, 2006 Hehe I seem to recognize this script... Where did you attached the script? It's either that or a problem with your .uti fileas the script seems ok (I've used it without problems). Edit: duh! It looks like the problem was with the resref of your object and the tag of the npc. hehe I didn't checked those, just the syntax. Note that the "Oldobject" will get destroyed with this script. If you simply want to unequip the oldobject use: AssignCommand(oNPC, ActionUnequipItem(oOldobject, TRUE)); But even then, I believe that you don't need this line and that if you equip a new item, the old one will be automatically unequipped. Link to comment Share on other sites More sharing options...
TheGreenGoblin Posted July 27, 2006 Author Share Posted July 27, 2006 Hehe I seem to recognize this script... Where did you attached the script? It's either that or a problem with your .uti fileas the script seems ok (I've used it without problems). Well, right now, I'm just trying to test it by having the script go off by attaching it to Trask's dialogue, specifically when he tells you to hurry up and grab your gear. I'm not any good with triggers, and using dialogue has worked for me in the past. But, the Carth that comes over the comm isn't changing no matter what I try. What I'm hoping to accomplish is having the Carth's on the Spire in Republic Officer's Uniform as well as the one during the celebration. I've already altered the armor line in the appeareance 2da, so I'm not sure why it isn't working. Link to comment Share on other sites More sharing options...
oldflash Posted July 27, 2006 Share Posted July 27, 2006 I lost 1 day to discover that part with objects is case sensitive. Just to be sure copy from .uti or .utc tag or xresref and paste into script. Link to comment Share on other sites More sharing options...
TheGreenGoblin Posted July 27, 2006 Author Share Posted July 27, 2006 I lost 1 day to discover that part with objects is case sensitive. Just to be sure copy from .uti or .utc tag or xresref and paste into script. What do you mean, as in if p_carth was written like P_Carth, or g_a_class9001, G_A_Class9001. If so I've already checked the names of those files and they're perfect. If not, would you mind elaborating? Link to comment Share on other sites More sharing options...
oldflash Posted July 27, 2006 Share Posted July 27, 2006 What do you mean, as in if p_carth was written like P_Carth, or g_a_class9001, G_A_Class9001. If so I've already checked the names of those files and they're perfect. If not, would you mind elaborating? Seems to be difference betwen g_a_class9001 and G_A_Class9001 at leat for scripts. If item tag is "g_a_class9001" script check for "G_A_Class9001" will return false. To be sure I don't any more problems I was using this function. // 61: Convert sString into lower case // * Return value on error: "" string GetStringLowerCase(string sString); Link to comment Share on other sites More sharing options...
EnderWiggin Posted July 27, 2006 Share Posted July 27, 2006 I see the problem! At least... I think I see it. Here you tell p_carth001 - the party member Carth to equip your item. Now, that's the problem. The comm Carth isn't p_carth001. It's another random Carth filename. Use TK102's FindRefs program or KT's search function to find all the utc files pointing to Carth. This one probably will be in the RIM files. Replace p_carth001 with the cutscene Carth *.utc tag and it should work like a charm. Hope this helps! Oops... sorry! _EW_ Link to comment Share on other sites More sharing options...
Tupac Amaru Posted July 27, 2006 Share Posted July 27, 2006 object oNPC=GetObjectByTag("p_carth001"); It looks like you used the name of the template file. This script function requires an object's tag, not its file name. Normally, the tag for the different Carths in the game is just 'Carth'. Link to comment Share on other sites More sharing options...
stoffe Posted July 27, 2006 Share Posted July 27, 2006 object oNPC=GetObjectByTag("p_carth001"); object oOldobject = GetItemInSlot(INVENTORY_SLOT_BODY,OBJECT_SELF); Another thing that may cause trouble: Depending on what object runs your script you may get a mismatch between who possesses the armor and who tries to equip it. You create the item on OBJECT_SELF (i.e. the object running the script), but tell Carth to equip it. If the script isn't running on the Carth object he doesn't have the armor to equip. Try something like this variant where you make sure you both create, destroy and equip on the same NPc: void CreateAndEquip() { object oArmor = CreateItemOnObject("g_a_class9001"); object oRemove = GetItemInSlot(INVENTORY_SLOT_BODY); if (GetIsObjectValid(oRemove)) DestroyObject(oRemove, 0.5); ActionEquipItem(oArmor, INVENTORY_SLOT_BODY, TRUE); } void main() { AssignCommand(GetObjectByTag("Carth"), CreateAndEquip()); } Link to comment Share on other sites More sharing options...
TheGreenGoblin Posted July 27, 2006 Author Share Posted July 27, 2006 Worked like a charm! Thanks so much everyone for the help! Link to comment Share on other sites More sharing options...
Princess Artemis Posted July 27, 2006 Share Posted July 27, 2006 Here you tell p_carth001 - the party member Carth to equip your item. Now, that's the problem. The comm Carth isn't p_carth001. It's another random Carth filename. Use TK102's FindRefs program or KT's search function to find all the utc files pointing to Carth. This one probably will be in the RIM files. Replace p_carth001 with the cutscene Carth *.utc tag and it should work like a charm. Just to clarify, since TheGreenGoblin has it working now, p_carth001.utc is the Endar Spire Carth (and about 10 other Carths). p_carth.utc is the party Carth and he only spawns on Taris. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.