shockix Posted March 15, 2008 Share Posted March 15, 2008 Hi. I created a script to unequip npc's items : void UnEquip(int iSlot,object oNpc ) { object oItem = GetItemInSlot( iSlot, oNpc); AssignCommand(oNpc, ActionUnequipItem(oItem)); } void main() { object oNpc = GetObjectByTag(GetScriptStringParameter()); UnEquip( INVENTORY_SLOT_HEAD, oNpc); UnEquip( INVENTORY_SLOT_BODY, oNpc); UnEquip( INVENTORY_SLOT_HANDS, oNpc); UnEquip( INVENTORY_SLOT_RIGHTWEAPON, oNpc); UnEquip( INVENTORY_SLOT_LEFTWEAPON, oNpc); UnEquip( INVENTORY_SLOT_LEFTARM, oNpc); UnEquip( INVENTORY_SLOT_RIGHTARM, oNpc); UnEquip( INVENTORY_SLOT_IMPLANT, oNpc); UnEquip( INVENTORY_SLOT_BELT, oNpc); UnEquip( INVENTORY_SLOT_RIGHTWEAPON2, oNpc); UnEquip( INVENTORY_SLOT_LEFTWEAPON2, oNpc); } This script is attached to an end node (in a dlg file) and is supposed to unequip all the items of the Npc I was talking to. But it doesn't work. In fact, items remain equipped. But if I click on the npc and make him the new party leader, all his items are unequipped. Any idea ? Link to comment Share on other sites More sharing options...
stoffe Posted March 15, 2008 Share Posted March 15, 2008 I created a script to unequip npc's items : This script is attached to an end node (in a dlg file) and is supposed to unequip all the items of the Npc I was talking to. But it doesn't work. In fact, items remain equipped. But if I click on the npc and make him the new party leader, all his items are unequipped. Might be that the game does something with characters when exiting dialog mode. You could try delaying the unequipping a little and clear their action queue and see if that makes a difference. Like: void UnEquip(); int GetNextEquipSlot(int iCurrent); [color=PaleGreen]// ST: Main function [/color] void main() { object oNPC = GetObjectByTag( GetScriptStringParameter() ); DelayCommand(1.0, AssignCommand(oNPC, UnEquip())); } [color=PaleGreen]// ST: Support function - unequip everything in all non-monster item slots[/color] void UnEquip() { int i; ClearAllActions(); for (i = INVENTORY_SLOT_HEAD; i <= INVENTORY_SLOT_LEFTWEAPON2; i = GetNextEquipSlot(i)) { if (GetIsObjectValid(GetItemInSlot(i))) { ActionUnequipItem( GetItemInSlot(i), TRUE); } } } [color=PaleGreen]// ST: Utility function - get the next non-monster item slot in sequence[/color] int GetNextEquipSlot(int iCurrent) { switch (iCurrent) { case INVENTORY_SLOT_HEAD : return INVENTORY_SLOT_BODY; case INVENTORY_SLOT_BODY : return INVENTORY_SLOT_HANDS; case INVENTORY_SLOT_HANDS : return INVENTORY_SLOT_RIGHTWEAPON; case INVENTORY_SLOT_RIGHTWEAPON : return INVENTORY_SLOT_LEFTWEAPON; case INVENTORY_SLOT_LEFTWEAPON : return INVENTORY_SLOT_LEFTARM; case INVENTORY_SLOT_LEFTARM : return INVENTORY_SLOT_RIGHTARM; case INVENTORY_SLOT_RIGHTARM : return INVENTORY_SLOT_IMPLANT; case INVENTORY_SLOT_IMPLANT : return INVENTORY_SLOT_BELT; case INVENTORY_SLOT_BELT : return INVENTORY_SLOT_RIGHTWEAPON2; case INVENTORY_SLOT_RIGHTWEAPON2: return INVENTORY_SLOT_LEFTWEAPON2; case INVENTORY_SLOT_LEFTWEAPON2 : return 999; } return 999; } Link to comment Share on other sites More sharing options...
shockix Posted March 15, 2008 Author Share Posted March 15, 2008 Thanks for your answer. I usually tried to delay the command. It was my first idea. I thought that the dialog had to be over for the unequip command to works. Unfortunately, this didn't work. I already have to click on the npc for him to be unequipped. I know there is a way. When you fight with Handmaiden in the Ebon Hawk, all her items are unequipped without you taking her control. I tryed Dencs to decompile the script that seems to unequip her but it failed. Link to comment Share on other sites More sharing options...
stoffe Posted March 15, 2008 Share Posted March 15, 2008 I know there is a way. When you fight with Handmaiden in the Ebon Hawk, all her items are unequipped without you taking her control. I tryed Dencs to decompile the script that seems to unequip her but it failed. You mean this script, or another? a_hand_fight: // ST: a_hand_fight.nss (003EBO_s.rim) #include "k_inc_hawk" // --------------------------------------------------------------- // ST: Function prototypes // --------------------------------------------------------------- void AttackPlayer(object oAttacker); // --------------------------------------------------------------- // ST: Main Function - run from Handmaiden's dialog. // --------------------------------------------------------------- void main() { object oPC = GetFirstPC(); object oMaiden; object oSomething; int nParam = GetScriptParameter(1); oMaiden = GetObjectByTag("Handmaiden"); SetLocalBoolean(oMaiden, 26, FALSE); SetLocalBoolean(oMaiden, 27, FALSE); SetLocalBoolean(oMaiden, 29, FALSE); SetLocalBoolean(oMaiden, 28, TRUE); int i = 0; SetMinOneHP(oPC, TRUE); switch (nParam) { case 0: { SetGlobalFadeOut(); SetGlobalFadeIn(0.5, 2.0); object oDoor = GetObjectByTag("CargoDoor"); AssignCommand(oDoor, ActionCloseDoor(oDoor)); SetLocked(oDoor, TRUE); for (i = 0; i < 12; i++) { ChangeToStandardFaction(GetObjectByTag(GetNPCTag(i)), STANDARD_FACTION_NEUTRAL); } AssignCommand(oPC, ActionJumpToObject(GetObjectByTag("WP_HANDFIGHT_PC"))); AssignCommand(oPC, ClearAllEffects()); GiveItem(GetItemInSlot(INVENTORY_SLOT_LEFTWEAPON, oPC), oPC); GiveItem(GetItemInSlot(INVENTORY_SLOT_RIGHTWEAPON, oPC), oPC); GiveItem(GetItemInSlot(INVENTORY_SLOT_BODY, oPC), oPC); AurPostString("a_hand_fight: disarming handmaiden..", 6, 6, 3.0); object oHand = GetObjectByTag("Handmaiden"); AssignCommand(oHand, ActionJumpToObject(GetObjectByTag("WP_HANDFIGHT_HAND"))); AssignCommand(oHand, ClearAllEffects()); GiveItem(GetItemInSlot(INVENTORY_SLOT_LEFTWEAPON, oHand), oPC); GiveItem(GetItemInSlot(INVENTORY_SLOT_RIGHTWEAPON, oHand), oPC); GiveItem(GetItemInSlot(INVENTORY_SLOT_BODY, oHand), oHand); DelayCommand(1.9, AttackPlayer(oMaiden)); } break; } } // --------------------------------------------------------------- // ST: Go hostile and attack player in a rather peculiar way... // --------------------------------------------------------------- void AttackPlayer(object oAttacker) { DelayCommand(0.5, AssignCommand(oAttacker, ActionAttack(GetFirstPC()))); DelayCommand(0.5, ChangeToStandardFaction(oAttacker, STANDARD_FACTION_HOSTILE_1)); DelayCommand(0.6, GN_DetermineCombatRound()); SetMinOneHP(oAttacker, TRUE); } Link to comment Share on other sites More sharing options...
shockix Posted March 15, 2008 Author Share Posted March 15, 2008 Thanks. This is the script I had in mind. I'll try to understand it. Link to comment Share on other sites More sharing options...
stoffe Posted March 15, 2008 Share Posted March 15, 2008 Thanks. This is the script I had in mind. I'll try to understand it. Looks like they unequip items using the GiveItem() function to give the equipped item to the character who already possess it . Link to comment Share on other sites More sharing options...
shockix Posted March 15, 2008 Author Share Posted March 15, 2008 Precisely. The GiveItem command is to put an specific object into pc's inventory. When this specific object is equipped, the only way is to unequip it. And the game does. I modified my first script : void UnEquip(int iSlot,object oNpc ) { object oItem = GetItemInSlot( iSlot, oNpc); //AssignCommand(oNpc, ActionUnequipItem(oItem)); Previous command GiveItem( oItem, GetFirstPC() ); // New one } It now works as intended. Thanks a lot for your help. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.