Modifié par Grani, 25 décembre 2012 - 08:10 .
Anti-pickpocket bag?
Débuté par
Grani
, déc. 25 2012 08:02
#1
Posté 25 décembre 2012 - 08:02
Is it possible to have a bag that cannot be stolen and such that everything inside it cannot be stolen as well? I believe I have seen such thing on some PW, but I have no idea which one and how this was done. I've tried searching the net for this but any pickpocket scripts are rare and nothing similar to this idea was found.
#2
Posté 25 décembre 2012 - 08:22
sure, such bag needs a unique power that will set all items inside undroppable(cursed) and second usage back
#3
Posté 25 décembre 2012 - 08:35
ShaDoOoW wrote...
sure, such bag needs a unique power that will set all items inside undroppable(cursed) and second usage back
But is it possible to make a script that would launch every time an item is put into or put out from such a bag? This would be the nicest option.
Modifié par Grani, 25 décembre 2012 - 08:36 .
#4
Posté 25 décembre 2012 - 09:25
Short answer. In vanilla NWN, this is not possible. With NWNX on a linux server, it is. Here's why, and how.
No event fires when an item is put into a bag. If you want, you could use nwnx's hooking of the pickpocket event to recode pickpocketing, adding a check to see if the item to be pickpocketed is in a particular container, using this function to get the container, and checking for a particular int set on it:
You could name the int NoPickpocket, for example, and if the bag has it on it, simply block the pickpocket attempt. Here's a very simple chunk of code from our pickpocket event, using the nwnx_events plugin (which is still linux-only, as far as I know). It merely sets a few cirumstances in which pickpocketing is blocked, as you want. You could easily add a very similar one using the container check above.
If you don't want to use NWNX, or aren't running linux, then you'll have to do as Shad suggests. It's probably worth remarking that items that are cursed within a container do not prevent the player from dropping the container itself.
Funky
No event fires when an item is put into a bag. If you want, you could use nwnx's hooking of the pickpocket event to recode pickpocketing, adding a check to see if the item to be pickpocketed is in a particular container, using this function to get the container, and checking for a particular int set on it:
object GetContainerOfItem (object oItem) {
object oPossessor = GetItemPossessor(oItem);
if (!GetIsObjectValid(oPossessor))
return OBJECT_INVALID;
object oContents, oCheck;
object oContainer = GetFirstItemInInventory(oPossessor);
while (GetIsObjectValid(oContainer)) {
if (GetItemIsContainer(oContainer)) {
oCheck = GetFirstItemInInventory(oContainer);
while (GetIsObjectValid(oCheck)) {
if (oCheck == oItem)
return oContainer;
oCheck = GetNextItemInInventory(oContainer);
}
}
oContainer = GetNextItemInInventory(oPossessor);
}
return OBJECT_INVALID;
}
You could name the int NoPickpocket, for example, and if the bag has it on it, simply block the pickpocket attempt. Here's a very simple chunk of code from our pickpocket event, using the nwnx_events plugin (which is still linux-only, as far as I know). It merely sets a few cirumstances in which pickpocketing is blocked, as you want. You could easily add a very similar one using the container check above.
case EVENT_TYPE_PICKPOCKET:
oTarget = GetEventTarget();
if (GetIsPC(OBJECT_SELF) && GetIsPC(oTarget)) {
if (GetLocalInt(GetArea(OBJECT_SELF), "nopp")) {
FloatingTextStringOnCreature("You cannot pickpocket other players!", OBJECT_SELF, FALSE);
BypassEvent();
}
if (abs(GetHitDice(oTarget) - GetHitDice(OBJECT_SELF)) > 6) {
FloatingTextStringOnCreature("You cannot pickpocket players more than 6 levels above or below you!", OBJECT_SELF, FALSE);
BypassEvent();
}
if (GetIsHardcore(OBJECT_SELF) || GetIsHardcore(oTarget)) {
FloatingTextStringOnCreature("Hardcore players cannot pickpocket or be pickpocketed by other players!", OBJECT_SELF, FALSE);
BypassEvent();
}
}
RemoveEffectsOfType(EFFECT_TYPE_ETHEREAL, OBJECT_SELF);
break;
If you don't want to use NWNX, or aren't running linux, then you'll have to do as Shad suggests. It's probably worth remarking that items that are cursed within a container do not prevent the player from dropping the container itself.
Funky
Modifié par FunkySwerve, 25 décembre 2012 - 09:27 .
#5
Posté 25 décembre 2012 - 09:58
I see. Thanks a lot for the answers! Unfortunately, I don't have linux, so I guess what ShaDoOoW said is my best bet.
Modifié par Grani, 25 décembre 2012 - 09:59 .
#6
Posté 26 décembre 2012 - 12:27





Retour en haut







