Aller au contenu

Photo

Only fires in TS?


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

#1
Alupinu

Alupinu
  • Members
  • 528 messages
Ok, here’s something that just mystifies me. I have this script that fires perfectly when I spot check it in the TS but when I try to use it “in game” it doesn’t fire. Any idea why?

//Created by Alupinu
//Altered by Morbane
// OnInventoryDisturbed
void main()
{
int iType = GetInventoryDisturbType();
object oItem = GetInventoryDisturbItem();
object oPC = GetLastUsedBy();
string sTemplate = GetLocalString(OBJECT_SELF, "sItem");
int nQuantity = GetLocalInt(OBJECT_SELF, "nQuantity");
if(GetLocalInt(OBJECT_SELF, GetTag(OBJECT_SELF)) == TRUE) return;
switch(iType)
{
case INVENTORY_DISTURB_TYPE_REMOVED:
{
if(oItem == GetObjectByTag("f_container_secret_comp")) // sItemTag is simply the tag of your junk item in quotes " "
{
SetLocalInt(OBJECT_SELF, GetTag(OBJECT_SELF), TRUE);
CreateItemOnObject(sTemplate, OBJECT_SELF, nQuantity);
ActionSpeakString("*SUCCESS* You found a secret compartment in the chest.");
}
else return;
}
}
}



#2
Morbane

Morbane
  • Members
  • 1 883 messages
Try this:

//Created by Alupinu
//Altered by Morbane
// OnInventoryDisturbed
void main()
{
int iType = GetInventoryDisturbType();
object oItem = GetInventoryDisturbItem();
object oPC = GetLastDisturbed(); // changed this **
string sTemplate = GetLocalString(OBJECT_SELF, "sItem");
int nQuantity = GetLocalInt(OBJECT_SELF, "nQuantity");
if(GetLocalInt(OBJECT_SELF, GetTag(OBJECT_SELF)) == TRUE) return;
switch(iType)
{
case INVENTORY_DISTURB_TYPE_REMOVED:// either 0 or 1 or 2 - REMOVED = 1
{
if(oItem == GetObjectByTag("f_container_secret_comp")) // sItemTag is simply the tag of your junk item in quotes " "
{
SetLocalInt(OBJECT_SELF, GetTag(OBJECT_SELF), TRUE);
CreateItemOnObject(sTemplate, OBJECT_SELF, nQuantity);
ActionSpeakString("*SUCCESS* You found a secret compartment in the chest.");
}
}
}
}

:happy:

Modifié par Morbane, 01 juin 2012 - 10:09 .


#3
Alupinu

Alupinu
  • Members
  • 528 messages
Hey Morbane,
The script seems to be working fine now, thank you again. Image IPB

#4
PJ156

PJ156
  • Members
  • 2 988 messages
Morbane,

For those of us further down the brain chain :)

What did you do?

PJ

#5
painofdungeoneternal

painofdungeoneternal
  • Members
  • 1 799 messages
look in his revision where he wrote "changed this **"

#6
Morbane

Morbane
  • Members
  • 1 883 messages
I dont know why in the original script for Alu I put GetLastUsedBy() rather than GetLastDisturbed()