Aller au contenu

Photo

Looking for a script to identify an item when put into a container.


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

#1
Lazarus Magni

Lazarus Magni
  • Members
  • 1 134 messages

Greetings,

Anyone have a script like this they would be willing to share? I am guessing it would need to check first if the item(s) is(are) identified, and if not ID it(them).

Laz



#2
Baaleos

Baaleos
  • Members
  • 1 330 messages
Everything nwnscript is event based.
So you have identified that the event / trigger you want is when an item is added to a container.

This event is specifically referred to as the OnDisturbed event of a container.
 
// put this OnDisturbed of a container.
void main()
{
     object oItem=GetInventoryDisturbItem();
     object oPC=GetLastDisturbed();
     int nType=GetInventoryDisturbType();
 
     switch (nType)
     {
     case INVENTORY_DISTURB_TYPE_ADDED:
            //Put your identify code here
            SetIdentified(oItem,TRUE);
           //End of Identify code
        break;
     case INVENTORY_DISTURB_TYPE_REMOVED:

        break;
     case INVENTORY_DISTURB_TYPE_STOLEN:
 
        
         break;
    }
}
So there is 3 main ways inventories can be disturbed.
items added, removed, or stolen.
I've assumed you wanted this to fire when items are added- as seen above.

Because identification is a single routine/function call, I wouldn't really worry about the checking to see if the item is identified already or not.
If its already identified, is it really so bad that we re-identify it?

http://www.nwnlexico...e=SetIdentified

nwnlexicon might be slightly out dated, but its still your friend.
I recommend it for reference.
Even people who are script guru's refer to it, as the nwnscript language is much to large for anyone person to remember it all.
  • Shadooow et WhiteTiger aiment ceci

#3
Lazarus Magni

Lazarus Magni
  • Members
  • 1 134 messages

Thank you very much Baaelos. I will give this a try.



#4
Lazarus Magni

Lazarus Magni
  • Members
  • 1 134 messages

This worked perfectly. TYVM Baaleos. I recommend to anyone using omega forges to add this to the ondisturbed event.



#5
Proleric

Proleric
  • Members
  • 2 361 messages
For a fee, obviously :devil:

#6
Lazarus Magni

Lazarus Magni
  • Members
  • 1 134 messages

Umm... what?

 

I asked the community to help with an issue, which I didn't elaborate on. Baaleos presented a solution which I verified as working, and I gave a heads up to anyone else using the system we found could benefit from this.

 

If you want my version of the script I would love to post it if these damn forums would allow me to paste (It's nothing special, I just added the code Baaleos provided to dm_forge_ondist).



#7
Lazarus Magni

Lazarus Magni
  • Members
  • 1 134 messages

P.S. how the hell do you paste things on these boards anyways? I tried more reply options, paste, paste simple text, paste from word. Nothing works...



#8
Baaleos

Baaleos
  • Members
  • 1 330 messages
If you mean the code tags it's
The words code inside square brackets

[ code]. And [/code ]

Hope that displayed correctly

#9
Proleric

Proleric
  • Members
  • 2 361 messages
Regarding the "fee", I simply meant that omega forge in-game normally requires the player to pay for the upgrade, so you'd expect them to pay extra for identification. No RL implication intended!

Regarding "paste", are you using IE? For a long time, I could't get the editor to work on this site (or neverwintervault.org, for that matter) without reverting to plain text and bbcode. Then I read that IE is massively incompatible with editors like Drupal. I've switched to Firefox, no more problems. I hear that just about any browser except IE will work.

#10
Proleric

Proleric
  • Members
  • 2 361 messages

P.S. Sometimes you have to use CTRL C / X  / V to copy / cut / paste these sites. Seems like a conspiracy to regress to the 1970s...  :rolleyes:  Scary for me, as CTRL C was also the code for crashing programs on many systems... :wacko:



#11
Lazarus Magni

Lazarus Magni
  • Members
  • 1 134 messages

#include "dm_forge_config"
void main()
{
    object oItemPlot = GetLastDisturbed();
    object oPC = GetLastUsedBy();

    if(!PLOT_UNFORGEABLE) return;

    if(GetPlotFlag(oItemPlot))
    {
        CopyItem(oItemPlot,oPC,TRUE);
        DestroyObject(oItemPlot,0.5);
        SendMessageToPC(oPC,"You cannot forge that item");
    }
//ID item
{
object oItem=GetInventoryDisturbItem();
     object oPC=GetLastDisturbed();
     int nType=GetInventoryDisturbType();

     switch (nType)
     {
     case INVENTORY_DISTURB_TYPE_ADDED:
            //Put your identify code here
            SetIdentified(oItem,TRUE);
           //End of Identify code
        break;
     case INVENTORY_DISTURB_TYPE_REMOVED:

        break;
     case INVENTORY_DISTURB_TYPE_STOLEN:

         break;
    }

}
}

 

 

I was using IE11. Firefox seems to handle it no problems. Thanks much. That's the code we used for the omega forge ondisturbed event.