Aller au contenu

Photo

Unequipping/equipping items during a conversation


  • Veuillez vous connecter pour répondre
6 réponses à ce sujet

#1
sea-

sea-
  • Members
  • 264 messages
I have a particular conversation which calls a script, designed to cause
the characters in the conversation to change their clothes during the
conversation.  The script looks fine to me, but it doesn't seem to want
to run during the conversation.

I'm not sure what it is I'm doing
wrong, but I haven't found much information on running scripts during
conversations, so it might be something extremely simple.  Any help is
appreciated!

#include "plt_rivian"
#include "wrappers_h"
#include "utility_h"

void main()
{  
    //gets Rivian and thugs
    object oRivian = GetObjectByTag("rivian_battle_2");
    object oThug1 = GetObjectByTag("rivian_thug_1_2");
    object oThug2 = GetObjectByTag("rivian_thug_2_2");   
   
    //gets all their equipped items
    object oRivianArmour = GetItemInEquipSlot(INVENTORY_SLOT_CHEST, oRivian);
    object oRivianWeapon = GetItemInEquipSlot(INVENTORY_SLOT_MAIN, oRivian);
    object oRivianShield = GetItemInEquipSlot(INVENTORY_SLOT_OFFHAND, oRivian);
    object oRivianBoots = GetItemInEquipSlot(INVENTORY_SLOT_BOOTS, oRivian);
    object oRivianGloves = GetItemInEquipSlot(INVENTORY_SLOT_GLOVES, oRivian);

    object oThug1Armour = GetItemInEquipSlot(INVENTORY_SLOT_CHEST, oThug1);
    object oThug1Weapon = GetItemInEquipSlot(INVENTORY_SLOT_MAIN, oThug1);
    object oThug1Shield = GetItemInEquipSlot(INVENTORY_SLOT_OFFHAND, oThug1);
    object oThug1Boots = GetItemInEquipSlot(INVENTORY_SLOT_BOOTS, oThug1);
    object oThug1Gloves = GetItemInEquipSlot(INVENTORY_SLOT_GLOVES, oThug1);   

    object oThug2Armour = GetItemInEquipSlot(INVENTORY_SLOT_CHEST, oThug2);
    object oThug2Weapon = GetItemInEquipSlot(INVENTORY_SLOT_MAIN, oThug2);
    object oThug2Boots = GetItemInEquipSlot(INVENTORY_SLOT_BOOTS, oThug2);
    object oThug2Gloves = GetItemInEquipSlot(INVENTORY_SLOT_GLOVES, oThug2);

    //gets Rivian & co.'s clothes
    object oRivianClothes = GetObjectByTag("gen_im_cth_com_c03");
    object oThug1Clothes = GetObjectByTag("gen_im_cth_com_a01");
    object oThug2Clothes = GetObjectByTag("gen_im_cth_com_b02");   
   
    //Unequips all items from Rivian and friends
    UnequipItem(oRivian, oRivianArmour);
    UnequipItem(oRivian, oRivianWeapon);
    UnequipItem(oRivian, oRivianShield);
    UnequipItem(oRivian, oRivianBoots);
    UnequipItem(oRivian, oRivianGloves);   
   
    UnequipItem(oThug1, oThug1Armour);
    UnequipItem(oThug1, oThug1Weapon);
    UnequipItem(oThug1, oThug1Shield);
    UnequipItem(oThug1, oThug1Boots);
    UnequipItem(oThug1, oThug1Gloves);
   
    UnequipItem(oThug2, oThug2Armour);
    UnequipItem(oThug2, oThug2Weapon);
    UnequipItem(oThug2, oThug2Boots);
    UnequipItem(oThug2, oThug2Gloves);   
    
    //equips their clothes because I don't like shame :(
    EquipItem(oRivian, oRivianClothes);
    EquipItem(oThug1, oThug1Clothes);
    EquipItem(oThug2, oThug2Clothes);
}

Modifié par sea-, 08 avril 2011 - 04:39 .


#2
Apolyon6k

Apolyon6k
  • Members
  • 175 messages
Scripts are run after the conversation as far as I know. That is why you can't see the player char during the first conversation with Ben in my mod.

A possible workaround would be to change parts of the conversation into cut-scenes and change the equipment there for visibility and per script at the end of the cut-scene to make the changes permanent. You would have to start the conversation again in the same script. Not sure who much work that would be.

The script looks ok so far, by the way.

#3
sea-

sea-
  • Members
  • 264 messages
Ah, okay, I figured it would be something like that (the characters are set to disappear after the conversation, I probably should have stopped to remove that).

The thing that confuses me is that certain tasks, like disabling objects, seem to be performed during conversations. I suppose that only specific things can trigger within a conversation?

#4
Proleric

Proleric
  • Members
  • 2 346 messages
I've successfully changed clothing during conversation.

In the OP script, I suspect EquipItem won't work unless the items are already in the NPC inventories. I'd use GetItemPossessedBy rather than GetObjectByTag.

As a point of finesse, equipping the clothing automatically unequips the armour.

Incidentally, here's a general-purpose function.

I find it's better not to show the change of clothes on camera, since (modesty aside) the engine doesn't always render it smoothly. So, I point the camera elsewhere (or do it in the final script of the conversation, if that works dramatically).

An alternative which works smoothly is to have two versions of the NPC (with only one active at any given time).

On the bigger question of when scripts execute during conversation, I'd welcome definitive information.

My impression is that scripts execute immediately, but AI is suspended.

So, changing data (e.g. plot flags) is fine, appearance changes usually work, but scripted animation or movement don't.

#5
Apolyon6k

Apolyon6k
  • Members
  • 175 messages
In my mod I was unable to change the players equipment during a dialogue so I had to use the default stage camera that only shows the conversation owner otherwise the player model would be without clothing despite the fact that the first line states that said clothes are put on.

#6
Proleric

Proleric
  • Members
  • 2 346 messages
Correction - taking a closer look at what I did, in effect I "pause" the conversation for the clothing change.

The first conversation ends with the script

BeginConversation... // Begin second conversation
zzzMoveInventory... // Change clothes


Of course, the second conversation could be the same as the first, using a condition to restart at the appropriate line.

#7
sea-

sea-
  • Members
  • 264 messages
I'm running into a minor issue where my cutscene animations aren't playing during a conversation (this might be a limitation of using cutscene -> conversation conversion), but other than that everything works great. I went with a plot flag and a conversation re-launch. The upside of this solution is that it actually leads to yet another choice the player can make afterwards, which is nice as well. Thanks for the tip on using GetItemPossessedBy as well, even if its use here is academic it will theoretically help reduce any potential errors.