Aller au contenu

Photo

I need to destroy the item that gets auto deequiped when you first equip.


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

#1
JackFuzz

JackFuzz
  • Members
  • 408 messages
I need to destroy the item that gets auto deequiped when you first equip something.

Example:

1. You have ITEMTOBEDESTROYED Equipped ("hf_body_aca_test");
2. Now you equip Chainmail Chest Piece. 
* Now I want to destroy the ITEMTOBEDESTROYED piece  that was previously equipped.

Problem:

The following doesn't work!! wtf?! 

It seems like I simply have no access to the item automatically being de-equipped.

        case EVENT_TYPE_EQUIP:
        {
            bEventHandled = HandleEvent_Equip(ev);
           
            object oMorrigan = GetObjectByTag("gen00fl_morrigan");           
            object oMorriganChestSlot = GetItemInEquipSlot(INVENTORY_SLOT_CHEST, oMorrigan);

            RemoveItemsByTag(oMorrigan, "hf_body_aca_test");                   
            RemoveItemsByTag(GetHero(), "hf_body_aca_test");
            UT_RemoveItemFromInventory(R"hf_body_aca_test.uti",99);
                   
            break;
        }

 case EVENT_TYPE_UNEQUIP:

        {
            bEventHandled = HandleEvent_UnEquip(ev);

            object oMorrigan = GetObjectByTag("gen00fl_morrigan");           

            object oMorriganChestSlot = GetItemInEquipSlot(INVENTORY_SLOT_CHEST, oMorrigan);



            RemoveItemsByTag(oMorrigan, "hf_body_aca_test");                   

            RemoveItemsByTag(GetHero(), "hf_body_aca_test");
            UT_RemoveItemFromInventory(R"hf_body_aca_test.uti",99);

            break;
        }


Is there some kind of temporary container I don't know about where items get stored temporarily during the auto equip/deequip process?

Modifié par JackFuzz, 14 janvier 2010 - 05:07 .


#2
wyvern14

wyvern14
  • Members
  • 107 messages
object oMorriganChestSlot = GetItemInEquipSlot(INVENTORY_SLOT_CHEST, oMorrigan);

Safe_Destroy_Object(oMorriganChestSlot , 0);

#3
JackFuzz

JackFuzz
  • Members
  • 408 messages

wyvern14 wrote...

object oMorriganChestSlot = GetItemInEquipSlot(INVENTORY_SLOT_CHEST, oMorrigan);
Safe_Destroy_Object(oMorriganChestSlot , 0);


Thanks for this, it seems to work the same as removeitem .. But both methods get rid of the item which is good.

I have good news and bad news.. The good news is I figured out how to get the handle of the item that is being unequipped.

The bad news is when I Safedestroy or Removeitem the item still appears in the inventory even though it's not there. I know it's not there anymore because when I close the inventory window and open it up again the item is indeed gone.

The question is how do I refresh the inventory so it shows updated info?

I tried using openinventory but that is way too annoying.

 case EVENT_TYPE_UNEQUIP:
        {
            bEventHandled = HandleEvent_UnEquip(ev);

            //handle of item being unequipped           
            object oTestGet = GetEventCreator(ev);
         
            //This works
            Safe_Destroy_Object(oTestGet);   

            //PROBLEM: The removed item stills appears in inventory even if it's not there!

Modifié par JackFuzz, 14 janvier 2010 - 05:24 .


#4
wyvern14

wyvern14
  • Members
  • 107 messages
Try passing a nDelay to it:



 case EVENT_TYPE_UNEQUIP:
        {
            bEventHandled = HandleEvent_UnEquip(ev);

            //handle of item being unequipped           
            object oTestGet = GetEventCreator(ev);
         
            //This works
            Safe_Destroy_Object(oTestGet, 0);   


I had issues in the past where not putting in a delay, even though it said immediate if nothing was entered, wasn't cutting it. Might also depend when and where that case is handled, some are "pulsing", others are on the ball for this.

#5
JackFuzz

JackFuzz
  • Members
  • 408 messages

wyvern14 wrote...

Try passing a nDelay to it:



 case EVENT_TYPE_UNEQUIP:
        {
            bEventHandled = HandleEvent_UnEquip(ev);

            //handle of item being unequipped           
            object oTestGet = GetEventCreator(ev);
         
            //This works
            Safe_Destroy_Object(oTestGet, 0);   


I had issues in the past where not putting in a delay, even though it said immediate if nothing was entered, wasn't cutting it. Might also depend when and where that case is handled, some are "pulsing", others are on the ball for this.


Good thinking, but it still doesn't work.

When you drag the item from the chest into the inventory it does get destroyed but you still see the item sitting there in your inventory. Once you close the inventory and open it then it's gone.

#6
wyvern14

wyvern14
  • Members
  • 107 messages
Doh, sorry, can't seem to find a way to force an inventory refresh :(

#7
JackFuzz

JackFuzz
  • Members
  • 408 messages

wyvern14 wrote...

Doh, sorry, can't seem to find a way to force an inventory refresh :(


No prob. I'll keep looking if I find a way i'll post it.

But it looks like there is no way around this one.

#8
wyvern14

wyvern14
  • Members
  • 107 messages
Arf, worst case, now that you can handle where the item is, try doing a Move Item to something else's inventory (outside the party roster), or even a container somewhere, see if you get the same "inventory lag". Add a PrintToLog to track if it actually goes there. It might just be because it's inventory roster related that it causes this.



If that works, a workaround would be to move the item somewhere, then destroy it.

#9
JackFuzz

JackFuzz
  • Members
  • 408 messages

wyvern14 wrote...

Arf, worst case, now that you can handle where the item is, try doing a Move Item to something else's inventory (outside the party roster), or even a container somewhere, see if you get the same "inventory lag". Add a PrintToLog to track if it actually goes there. It might just be because it's inventory roster related that it causes this.

If that works, a workaround would be to move the item somewhere, then destroy it.


I bet you anything it would move it, but still appear in your inventory until you close it :P

#10
wyvern14

wyvern14
  • Members
  • 107 messages
Yeah perhaps, in what contest are you intercepting the event equip? There might be a different way of doing this without this annoying inventory thing.

#11
JackFuzz

JackFuzz
  • Members
  • 408 messages

wyvern14 wrote...

Yeah perhaps, in what contest are you intercepting the event equip? There might be a different way of doing this without this annoying inventory thing.


Script: player_core

There is an event section they added for modders.

I tried other places but no luck.  Although I may of missed somewhere. 

case EVENT_TYPE_UNEQUIP:
        {
            bEventHandled = HandleEvent_UnEquip(ev);
            // item being unequipped           
            object oTestGet = GetEventCreator(ev);

 case EVENT_TYPE_EQUIP:
        {
            bEventHandled = HandleEvent_Equip(ev);

            //object being equipped to, example morrigan or player ... Yes I know this is different than in unequip
            object oTestGet = GetEventCreator(ev);

#12
wyvern14

wyvern14
  • Members
  • 107 messages
So you want to override it every time it happens and not just for special cases?

#13
JackFuzz

JackFuzz
  • Members
  • 408 messages

wyvern14 wrote...

So you want to override it every time it happens and not just for special cases?


That was just test code.

It will be for special cases that don't happen too often.

Modifié par JackFuzz, 14 janvier 2010 - 07:06 .


#14
wyvern14

wyvern14
  • Members
  • 107 messages
Don't override the equip/unequip events then if it's only for special occasions, treat it on a case by case using a plot or area load, it will be immediate, especially if the plog flag is set during a conversation or during area load. I just tested an item destruction using plot and I'm not getting the inventory stuff you described, since it's isolated. Using a broad, general event is perhaps was causes the lag.



Mind you, I'm working from hypothesis only.

#15
JackFuzz

JackFuzz
  • Members
  • 408 messages

wyvern14 wrote...

Don't override the equip/unequip events then if it's only for special occasions, treat it on a case by case using a plot or area load, it will be immediate, especially if the plog flag is set during a conversation or during area load. I just tested an item destruction using plot and I'm not getting the inventory stuff you described, since it's isolated. Using a broad, general event is perhaps was causes the lag.

Mind you, I'm working from hypothesis only.


One of the unavoidable conditions is that the inventory has to be open.  Are you saying you can remove an item from the inventory while the inventory is open and have the item go away?

#16
EJ42

EJ42
  • Members
  • 723 messages
Why do you not simply destroy the item instead of unequipping it? Destroy the item in place, then equip the new item after.

RemoveItem(GetItemInEquipSlot(blah blah), blah)...then equip the new item.

#17
EJ42

EJ42
  • Members
  • 723 messages
Oh wait...I just remembered what you were trying to do. Yeah, I can see why you would want to do that. The player is the one causing the item to unequip. I suppose that could be trickier.

Modifié par EJ42, 14 janvier 2010 - 07:51 .